Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

use `$HOME/.tidyall.ini` if not found `tidyall.ini` #5

Open
wants to merge 4 commits into from

3 participants

@aanoaa

first, sorry i have very poor english skills.
so i don't have to write documentation for details.

Test

$HOME/.tidyall.ini

[PerlTidy]
select = **/*.{pl,pm,t}
argv = -noll -it=2

[PerlCritic]
select = lib/**/*.pm
ignore = lib/UtterHack.pm
argv = -severity 3

then, go to some where perl project without tidyall.ini

$ tidyall -a

@jonswar
Owner
@aanoaa

tidyall needs to know the "root directory" of your project

current working directory will use to root_dir.

+    $params{root_dir} = cwd() if $conf_file eq "$ENV{HOME}/.tidyall.ini";

and this patch is working till now at me. :)

@oalders

I suppose you could also just keep the .ini file in your home dir and then symlink to it from your individual projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 11, 2012
  1. @aanoaa

    use `$HOME/.tidyall.ini` if not found `tidyall.ini`

    aanoaa authored
    in working directories.
    closes [#4]
  2. @aanoaa

    oops missing `;`

    aanoaa authored
  3. @aanoaa
  4. @aanoaa
This page is out of date. Refresh to see the latest.
View
1  bin/tidyall
@@ -54,6 +54,7 @@ if ( ( $all_files || $svn_files || $git_files ) ) {
die "cannot use filename(s) with -a/--all, -s/--svn, or -g/--git"
if @ARGV;
$conf_file ||= $tidyall_class->find_conf_file( cwd() );
+ $params{root_dir} = cwd() if $conf_file eq "$ENV{HOME}/.tidyall.ini";
my $ct = $tidyall_class->new_from_conf_file( $conf_file, %params );
my @files;
View
3  lib/Code/TidyAll.pm
@@ -320,7 +320,8 @@ sub find_conf_file {
my $path1 = rel2abs($start_dir);
my $path2 = realpath($start_dir);
my $conf_file = $class->_find_conf_file_upward($path1)
- || $class->_find_conf_file_upward($path2);
+ || $class->_find_conf_file_upward($path2)
+ || "$ENV{HOME}/.tidyall.ini";
unless ( defined $conf_file ) {
die sprintf( "could not find $ini_name upwards from %s",
( $path1 eq $path2 ) ? "'$path1'" : "'$path1' or '$path2'" );
View
10 lib/Code/TidyAll/Git/Precommit.pm
@@ -30,7 +30,15 @@ sub check {
my $root_dir = capturex( $self->git_path, "rev-parse", "--show-toplevel" );
chomp($root_dir);
my $conf_file = join( "/", $root_dir, $self->conf_file );
- die "could not find conf file '$conf_file'" unless -f $conf_file;
+ my $global_conf_file = "$ENV{HOME}/.tidyall.ini";
+ unless ( -f $conf_file ) {
+ unless ( -f $global_conf_file ) {
+ die "could not find conf file '$conf_file', '$global_conf_file'";
+ }
+ else {
+ $conf_file = $global_conf_file;
+ }
+ }
# Store the stash, and restore it upon exiting this scope
unless ( $self->no_stash ) {
Something went wrong with that request. Please try again.