zapwhite 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 677ac315bf9fc59519513f0bd2ca5342d65ad8e2
4
- data.tar.gz: 530f4202a1219f64804591ac586fbc421c97de08
3
+ metadata.gz: 0fb0eada69b01c2b889300dec91a617488d6b4a6
4
+ data.tar.gz: c8ef49b445687b197fdfaafda74b5c02bbec23e1
5
5
  SHA512:
6
- metadata.gz: ca3ba0ad1a9c1464ebb8af02db54074d3bfbe07897b9bcea18933cc1eb58c5e6fe44978c97ec940ae0b7d0935ef269a8a0e8d03a302098b05581d7977ab6949e
7
- data.tar.gz: 199e6210ff898f3ac64019b57984a24bedd40d06de00dd1d513065ee1f3ace7fb6b60429f23fc6a6b9459a8ff1a29e88231b81b5f80af1594ca50e5933c17891
6
+ metadata.gz: b2954ff2cc652657e0311b57a6a452ade7225b1837ba60bc880d958cbf69d0b2e333e232e492c558d77b42f915944d0324c68d2904e0bd3940250b08b52a09c9
7
+ data.tar.gz: 7d1beea31dc78a152408ac33371369c88fd3de8b6bac349185c6d0e57602a8814d47fda980903a35703ee15b9f5bd87ae3d07cfc7d0b4d1b2822de5ea1820a09
data/README.md CHANGED
@@ -6,7 +6,7 @@ A simple tool to normalize whitespace in git repositories. The tool:
6
6
 
7
7
  * removes trailing whitespace from each line
8
8
  * ensures files end with a new line
9
- * ensure files are in UTF-8 format with no invalid UTF sequences
9
+ * ensure files are in ASCII format with no invalid UTF sequences
10
10
  * ensures dos files use dos line endings and all other files do not.
11
11
 
12
12
  Files that are part of the repository are candidates for normalization.
@@ -15,8 +15,13 @@ patterns supplied either in the command line or in the `.gitattributes`
15
15
  file associated with the repository.
16
16
 
17
17
  The tool will ensure files annotated with `text` will be processed and
18
- files with the `crlf` flag as true will be treated as dos files. If the
18
+ files with the `eol=crlf` attribute will be treated as dos files. If the
19
19
  file has an `encoding` attribute, the tool will not try to convert to
20
- UTF-8. The tool will also scan and remove duplicate new lines if any file
20
+ ASCII. The tool will also scan and remove duplicate new lines if any file
21
21
  has a attribute `-dupnl`. The tool will not enforce end of file new
22
22
  lines if attribute `-eofnl` is set.
23
+
24
+ ## TODO
25
+
26
+ * Next version should generate `.gitattributes` based on scanning project
27
+ and then follow up with normal zapwhite process.
@@ -19,7 +19,7 @@ module Reality
19
19
 
20
20
  def initialize(base_directory)
21
21
  @base_directory = base_directory
22
- @attributes = Reality::GitAttributes.new(@base_directory)
22
+ @attributes = Reality::Git::Attributes.parse(@base_directory)
23
23
  @exclude_patterns = %w(vendor/.* node_modules/.*)
24
24
  @check_only = false
25
25
  end
@@ -85,7 +85,7 @@ module Reality
85
85
  attr = @attributes.attributes(f)
86
86
  if attr['text']
87
87
  files[f] = {
88
- :dos => (!!attr['crlf']),
88
+ :dos => (attr['eol'] == 'crlf'),
89
89
  :encoding => attr['encoding'],
90
90
  :nodupnl => attr['dupnl'].nil? ? false : !attr['dupnl'],
91
91
  :eofnl => attr['eofnl'].nil? ? true : !!attr['eofnl']
@@ -31,7 +31,7 @@ TEXT
31
31
  def test_fixing_trailing_whitespace_not_crlf_specified
32
32
  dir = create_git_repo do
33
33
  write_gitattributes_file(<<TEXT)
34
- *.md text -crlf
34
+ *.md text eol=lf
35
35
  TEXT
36
36
  write_file('README.md', "Hello \n")
37
37
  end
@@ -59,7 +59,7 @@ TEXT
59
59
  def test_dos_eol
60
60
  dir = create_git_repo do
61
61
  write_gitattributes_file(<<TEXT)
62
- *.bat text crlf
62
+ *.bat text eol=crlf
63
63
  TEXT
64
64
  write_file('run.bat', "echo hi\n")
65
65
  end
data/zapwhite.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{zapwhite}
5
- s.version = '1.0.0'
5
+ s.version = '2.0.0'
6
6
  s.platform = Gem::Platform::RUBY
7
7
 
8
8
  s.authors = ['Peter Donald']
9
9
  s.email = %q{peter@realityforge.org}
10
10
 
11
11
  s.homepage = %q{https://github.com/realityforge/zapwhite}
12
- s.summary = %q{A simple tool to normalize whitespace.}
13
- s.description = %q{A simple tool to normalize whitespace.}
12
+ s.summary = %q{A simple tool to normalize whitespace in git repositories.}
13
+ s.description = %q{A simple tool to normalize whitespace in git repositories.}
14
14
 
15
15
  s.files = `git ls-files`.split("\n")
16
16
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
@@ -19,9 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = %w(lib)
20
20
 
21
21
  s.has_rdoc = false
22
- s.rdoc_options = %w(--line-numbers --inline-source --title gitattributes)
22
+ s.rdoc_options = %w(--line-numbers --inline-source --title zapwhite)
23
23
 
24
- s.add_dependency 'gitattributes', '= 1.1.0'
24
+ s.add_dependency 'gitattributes', '= 2.0.0'
25
25
 
26
26
  s.add_development_dependency(%q<minitest>, ['= 5.9.1'])
27
27
  s.add_development_dependency(%q<test-unit>, ['= 3.1.5'])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zapwhite
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Donald
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-29 00:00:00.000000000 Z
11
+ date: 2017-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitattributes
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.1.0
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 1.1.0
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minitest
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.1.5
55
- description: A simple tool to normalize whitespace.
55
+ description: A simple tool to normalize whitespace in git repositories.
56
56
  email: peter@realityforge.org
57
57
  executables:
58
58
  - zapwhite
@@ -81,7 +81,7 @@ rdoc_options:
81
81
  - "--line-numbers"
82
82
  - "--inline-source"
83
83
  - "--title"
84
- - gitattributes
84
+ - zapwhite
85
85
  require_paths:
86
86
  - lib
87
87
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -99,5 +99,5 @@ rubyforge_project:
99
99
  rubygems_version: 2.5.1
100
100
  signing_key:
101
101
  specification_version: 4
102
- summary: A simple tool to normalize whitespace.
102
+ summary: A simple tool to normalize whitespace in git repositories.
103
103
  test_files: []