code-cleaner 0.8 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,17 +21,17 @@ Of course you don't want to remove spaces from other files like PDF documents, i
21
21
 
22
22
  Default behaviour is to ignore everything from vendor and gems directories and from other directories just files ending with .rb, .rake, .task and .thor are normalized.
23
23
 
24
- You can change this behaviour by setting environment variables @BLACKLIST@ and @WHITELIST@. What you pass to these variables will be treated as a regular expression. The default behaviour respond to @BLACKLIST='/(vendor|gems)/'@ and @WHITELIST='\.(rb|rake|task|thor)$'@. Here's an example how you can use it:
24
+ You can change this behaviour by setting environment variables @BLACKLIST@ and @WHITELIST@. What you pass to these variables will be treated as a regular expression. The default behaviour respond to @BLACKLIST='/(vendor|gems)/'@ and @WHITELIST='(^bin/[^/]+|Rakefile|Thorfile|Gemfile$)|(^.+\.(rb|rake|nake|thor|task|gemspec)$)'@. Here's an example how you can use it:
25
25
 
26
26
  <pre>
27
- WHITELIST=''^(Rakefile|Thorfile|.+\.(rb|rake|nake|thor|task|gemspec))$'' BLACKLIST='/(vendor|gems)/' code-cleaner .
27
+ WHITELIST=''^(Rakefile|Thorfile|Gemfile|.+\.(rb|rake|nake|thor|task|gemspec))$'' BLACKLIST='/(vendor|gems)/' code-cleaner .
28
28
  </pre>
29
29
 
30
30
  Note that these rules aren't applied for explicit arguments, so if you run @code-cleaner README.textile@, your readme actually will be normalized. It's because blacklisting and whitelisting rules are applied just on directories, so if you run @code-cleaner .@, your readme will stay untouched. Because of this reason @code-cleaner .@ and @code-cleaner *@ will be different.
31
31
 
32
32
  If you want to force blacklisting resp. whitelisting even for explicitly specified files, use @--apply-rules@ switch. If you want just try it, use @--try-apply-rules@ which will tell you which files will be skipped and exit without any editing. If some files left in ARGV, the exit status will be 0, otherwise it will be 1.
33
33
 
34
- In your Ruby projects, you might add all files in your @bin@ and @script@ directories into whitelist: @WHITELIST='(bin/[^/]+|.+\.(rb|rake|nake|thor|task))$'@
34
+ In your Ruby projects, you might add all files in your @bin@ and @script@ directories into whitelist: @WHITELIST='(^bin/[^/]+|Rakefile|Thorfile|Gemfile$)|(^.+\.(rb|rake|nake|thor|task|gemspec)$)'@
35
35
 
36
36
  h2. Exit statuses
37
37
 
@@ -81,7 +81,7 @@ Also, if you project run in bundled environment, make sure you have your @bin@ o
81
81
  Nake::Task["hooks:whitespace:install"].tap do |task|
82
82
  task.config[:path] = "bin"
83
83
  task.config[:encoding] = "utf-8"
84
- task.config[:whitelist] = '(bin/[^/]+|.+\.(rb|rake|nake|thor|task))$'
84
+ task.config[:whitelist] = '(^bin/[^/]+|Rakefile|Thorfile|Gemfile$)|(^.+\.(rb|rake|nake|thor|task|gemspec)$)'
85
85
  #task.config[:blacklist]
86
86
  end
87
87
  </pre>
@@ -0,0 +1 @@
1
+ - the problem definitelly can't be solved with sleep, I was trying and it just doesn't work
@@ -24,7 +24,7 @@ require "find"
24
24
 
25
25
  $-i = "" # Windows compatibility
26
26
 
27
- WHITELIST = Regexp.new(ENV["WHITELIST"] || '^(Rakefile|Thorfile|.+\.(rb|rake|nake|thor|task|gemspec))$')
27
+ WHITELIST = Regexp.new(ENV["WHITELIST"] || '^(Rakefile|Thorfile|Gemfile|.+\.(rb|rake|nake|thor|task|gemspec))$')
28
28
  BLACKLIST = Regexp.new(ENV["BLACKLIST"] || '/(vendor|gems)/')
29
29
 
30
30
  def permitted?(file)
@@ -52,10 +52,10 @@ if ARGV.include?("-h") or ARGV.include?("--help")
52
52
  "\n"\
53
53
  "[\e[32mTricks\e[0m]\n"\
54
54
  "If you want to add files from your bin or script directory into \n"\
55
- "whitelist, use WHITELIST='(bin/[^/]+|.+\.(rb|rake|nake|thor|task))$'"
55
+ "whitelist, use WHITELIST='(^bin/[^/]+|Rakefile|Thorfile|Gemfile$)|(^.+\.(rb|rake|nake|thor|task|gemspec)$)'"
56
56
  "\n"\
57
57
  "[\e[32mExamples\e[0m]\n"\
58
- "WHITELIST='(bin/[^/]+|.+\.(rb|rake|nake|thor|task))$'"
58
+ "WHITELIST='(^bin/[^/]+|Rakefile|Thorfile|Gemfile$)|(^.+\.(rb|rake|nake|thor|task|gemspec)$)'"
59
59
  end
60
60
 
61
61
  def apply_rules
Binary file
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "code-cleaner"
6
- s.version = "0.8"
6
+ s.version = "0.8.1"
7
7
  s.authors = ["Jakub Šťastný aka Botanicus"]
8
8
  s.homepage = "http://github.com/botanicus/code-cleaner"
9
9
  s.summary = "Remove trailing whitespace, append missing \\n and replace tabs by two spaces"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-cleaner
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.8"
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jakub \xC5\xA0\xC5\xA5astn\xC3\xBD aka Botanicus"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
- date: 2010-01-08 00:00:00 +01:00
11
+ date: 2010-01-10 00:00:00 +01:00
12
12
  default_executable: code-cleaner
13
13
  dependencies: []
14
14
 
@@ -22,6 +22,7 @@ extra_rdoc_files: []
22
22
 
23
23
  files:
24
24
  - bin/code-cleaner
25
+ - code-cleaner-0.8.gem
25
26
  - code-cleaner.gemspec
26
27
  - LICENSE
27
28
  - README.textile
@@ -30,6 +31,7 @@ files:
30
31
  - tasks/code-cleaner.rake
31
32
  - tasks/code-cleaner.thor
32
33
  - tasks.rb
34
+ - TODO.txt
33
35
  has_rdoc: true
34
36
  homepage: http://github.com/botanicus/code-cleaner
35
37
  licenses: []