whitespace 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/bin/whitespace +10 -4
  2. metadata +6 -6
data/bin/whitespace CHANGED
@@ -29,10 +29,16 @@ class WhitespaceProcessor
29
29
  end
30
30
  end
31
31
 
32
- puts "* Stripping whitespace from modified files."
33
- `git status`.split("\n").each do |line|
34
- next unless line =~ /^#\tmodified:/
35
- line = line.split(':').last.strip
32
+ if ARGV.include?('--all')
33
+ files = `find . -type file | grep -v .git | grep -v ./vendor | grep -v ./tmp | egrep ".(rb|js|haml|html|css|sass)"`.split(/\n/)
34
+ puts "* Stripping whitespace from all project files"
35
+ else
36
+ files = `git status | egrep ".(rb|js|haml|html|css|sass)"`.split("\n").select { |file| file =~ /^#\t(modified|new file|renamed):/ }
37
+ puts "* Stripping whitespace from modified files."
38
+ end
39
+
40
+ files.each do |line|
41
+ line = line.split(/[\t\s]+/).last
36
42
  puts " processing #{line}..."
37
43
  code = File.read(line)
38
44
  File.open(line, 'w+') { |f| f << (WhitespaceProcessor.process(code)) }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whitespace
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
- - 1
7
+ - 2
8
8
  - 0
9
9
  - 0
10
- version: 1.0.0
10
+ version: 2.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pat Nakajima
@@ -16,13 +16,13 @@ bindir: bin
16
16
  cert_chain: []
17
17
 
18
18
  date: 2011-01-19 00:00:00 -05:00
19
- default_executable:
19
+ default_executable: whitespace
20
20
  dependencies: []
21
21
 
22
22
  description:
23
23
  email: patnakajima@gmail.com
24
- executables: []
25
-
24
+ executables:
25
+ - whitespace
26
26
  extensions: []
27
27
 
28
28
  extra_rdoc_files: []