whitespace 2.0.4 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/bin/whitespace +8 -10
  3. metadata +18 -39
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5f93ee66dd122d27e888c9a4b7cdeefc000c7f01
4
+ data.tar.gz: 7be39effeb3f2bef6415a0a1cf259ae292f206dd
5
+ SHA512:
6
+ metadata.gz: 93f5a3e2d035a13a91b7199bc939ae2f2f39f4b73cc8d64b24d9bd4d730a8f6c52cea526f904008eceeca0f41b97e856f227797c462b8fb9962f44ccc9396f5e
7
+ data.tar.gz: 45ab9cc45ecb4677b2635f3a96cbcc2b3c1dee80516395ae3ed5dcfa7affdc531fd3e4935b9066efb821d61443f139d32796bee0066c2eb59aed340dc4de07f9
@@ -6,7 +6,7 @@
6
6
  # Also:
7
7
  # - converts tabs to spaces
8
8
  # - ensures a single newline at the end
9
- FILE_TYPES = "rb|js|haml|html|css|sass|coffee"
9
+ FILE_TYPES = "rb|js|haml|html|css|sass|erb|coffee|m|h"
10
10
 
11
11
  class WhitespaceProcessor
12
12
  def self.process(code)
@@ -31,23 +31,21 @@ class WhitespaceProcessor
31
31
  end
32
32
  end
33
33
 
34
+ regex = "(#{FILE_TYPES})"
35
+
34
36
  if ARGV.include?('--all')
35
- files = `find . -type file | grep -v .git | grep -v ./vendor | grep -v ./tmp | egrep ".(#{FILE_TYPES})"`.split(/\n/)
37
+ files = `find . -type file | grep -v .git | grep -v ./vendor | grep -v ./tmp | egrep "#{regex}"`.split(/\n/)
36
38
  puts "* Stripping whitespace from all project files"
37
39
  else
38
- files = `git status | egrep ".(#{FILE_TYPES})"`.split("\n").select { |file| file =~ /^#\t(modified|new file|renamed):/ }
40
+ files = `git status`.split("\n").select { |file| file =~ /^#?\t(modified|new file|renamed):/ }
39
41
  puts "* Stripping whitespace from modified files."
40
42
  end
41
43
 
42
44
  files.each do |line|
43
45
  line = line.split(":").last.strip
46
+ next unless line =~ Regexp.new(regex)
44
47
  puts " processing #{line}..."
45
- begin
46
- code = File.read(line)
47
- File.open(line, 'w+') { |f| f << (WhitespaceProcessor.process(code)) }
48
- rescue Errno::ENOENT
49
- puts " WARNING: #{line} not found"
50
- end
48
+ code = File.read(line)
49
+ File.open(line, 'w+') { |f| f << (WhitespaceProcessor.process(code)) }
51
50
  end
52
-
53
51
  puts "* DONE"
metadata CHANGED
@@ -1,66 +1,45 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: whitespace
3
- version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease:
6
- segments:
7
- - 2
8
- - 0
9
- - 4
10
- version: 2.0.4
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.1.3
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Pat Nakajima
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2011-01-19 00:00:00 Z
11
+ date: 2011-01-19 00:00:00.000000000 Z
19
12
  dependencies: []
20
-
21
13
  description:
22
14
  email: patnakajima@gmail.com
23
- executables:
15
+ executables:
24
16
  - whitespace
25
17
  extensions: []
26
-
27
18
  extra_rdoc_files: []
28
-
29
- files:
19
+ files:
30
20
  - README
31
21
  - bin/whitespace
32
22
  homepage: https://github.com/nakajima/whitespace
33
23
  licenses: []
34
-
24
+ metadata: {}
35
25
  post_install_message:
36
26
  rdoc_options: []
37
-
38
- require_paths:
27
+ require_paths:
39
28
  - lib
40
- required_ruby_version: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
43
31
  - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
49
- required_rubygems_version: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
52
36
  - - ">="
53
- - !ruby/object:Gem::Version
54
- hash: 3
55
- segments:
56
- - 0
57
- version: "0"
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
58
39
  requirements: []
59
-
60
40
  rubyforge_project:
61
- rubygems_version: 1.8.11
41
+ rubygems_version: 2.2.2
62
42
  signing_key:
63
43
  specification_version: 3
64
44
  summary: Strips whitespace from files modified by git
65
45
  test_files: []
66
-