git-newline-at-eof 0.1.6 → 0.1.7

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
- SHA1:
3
- metadata.gz: d2fe432548d95d15b23a35c313a5d24fff2067bc
4
- data.tar.gz: a31cb2e1bea2cd767c0b4c2ffd2e422bc6c86477
2
+ SHA256:
3
+ metadata.gz: 795c971d93be97744ff688da9bff22cd220e053563f3ade643744e49940ad89f
4
+ data.tar.gz: 2deb923126a8933f1282eb1023f2e4d5826cf2b2c9501891a980e561b0c12218
5
5
  SHA512:
6
- metadata.gz: 0d53162265a23e6d9e87910e8136f58e2eec1bbf629262b452fa86ae2ff9bdc47e3ebede0f587af850dd64512bb9cf85786f8e1db8408fc68aa632a4902529ed
7
- data.tar.gz: 110cea051d5fc90cf88cf8d241152bc7acf586a79a177abf071c2d84cf9a70b995c06685a6a3561015b1889e21103725d035048a3be5b26865538153921e78a2
6
+ metadata.gz: 0f03cb5c24f8794fa4041659d2db1d9660aaf0900469f6f619f28400817fe619171e96aa26f8a5fdbcdc7f32012ef2c8c420d70ae3ac0d459cd26d51a93cfcda
7
+ data.tar.gz: b9888ed76d6acdc20bba0f5bb154f72139a413caeadacbe63b6c17390fa5ea929d0b0915950523ad319a4c3f914f5a9bd9c4172a6d3c728b0f61403e5bab251e
@@ -0,0 +1 @@
1
+ compat.version=2.3
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3.3
5
- - 2.4.0
6
- - jruby-9.1.7.0
4
+ - 2.3.4
5
+ - 2.4.1
6
+ - jruby-9.1.12.0
7
7
  script: bundle exec rake test
data/README.md CHANGED
@@ -158,7 +158,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
158
158
 
159
159
  Bug reports and pull requests are welcome on GitHub at https://github.com/aycabta/git-newline-at-eof.
160
160
 
161
-
162
161
  ## License
163
162
 
164
163
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -11,3 +11,5 @@ environment:
11
11
  matrix:
12
12
  - ruby_version: "23"
13
13
  - ruby_version: "23-x64"
14
+ - ruby_version: "24"
15
+ - ruby_version: "24-x64"
@@ -89,7 +89,12 @@ module GitNewlineAtEof
89
89
  else
90
90
  @files = files
91
91
  if @options[:check_all]
92
- check_all
92
+ case check_all
93
+ when :clean
94
+ 0
95
+ when :warning
96
+ 1
97
+ end
93
98
  elsif @options[:treat_all]
94
99
  treat_all
95
100
  0
@@ -131,9 +136,9 @@ module GitNewlineAtEof
131
136
  end
132
137
  end
133
138
  if exist_warning
134
- 1
139
+ :warning
135
140
  else
136
- 0
141
+ :clean
137
142
  end
138
143
  end
139
144
 
@@ -163,15 +168,14 @@ module GitNewlineAtEof
163
168
  end
164
169
  end
165
170
 
166
- def feed_last_line(filename)
171
+ private def feed_last_line(filename)
167
172
  filepath = current_dir(filename)
168
173
  File.open(filepath, 'at') do |f|
169
174
  f.write("\n")
170
175
  end
171
176
  end
172
- private :feed_last_line
173
177
 
174
- def discard_last_newline(filename, discard_num)
178
+ private def discard_last_newline(filename, discard_num)
175
179
  filepath = current_dir(filename)
176
180
  lines = nil
177
181
  File.open(filepath, 'rt') do |f|
@@ -183,9 +187,8 @@ module GitNewlineAtEof
183
187
  end
184
188
  end
185
189
  end
186
- private :discard_last_newline
187
190
 
188
- def no_newline?(last_newlines_num)
191
+ private def no_newline?(last_newlines_num)
189
192
  if last_newlines_num.nil?
190
193
  false
191
194
  elsif last_newlines_num == 0
@@ -194,9 +197,8 @@ module GitNewlineAtEof
194
197
  false
195
198
  end
196
199
  end
197
- private :no_newline?
198
200
 
199
- def discarded_newline?(last_newlines_num)
201
+ private def discarded_newline?(last_newlines_num)
200
202
  if last_newlines_num.nil?
201
203
  false
202
204
  elsif last_newlines_num > 1
@@ -205,9 +207,8 @@ module GitNewlineAtEof
205
207
  false
206
208
  end
207
209
  end
208
- private :discarded_newline?
209
210
 
210
- def files
211
+ private def files
211
212
  `git ls-files`.split("\n").select{ |filename|
212
213
  # check text file
213
214
  `git grep -I --name-only --untracked -e . -- #{Shellwords.shellescape(filename)}`
@@ -226,9 +227,8 @@ module GitNewlineAtEof
226
227
  }
227
228
  }
228
229
  end
229
- private :files
230
230
 
231
- def count_last_newlines(f)
231
+ private def count_last_newlines(f)
232
232
  if f.size == 0
233
233
  nil
234
234
  else
@@ -252,16 +252,13 @@ module GitNewlineAtEof
252
252
  count
253
253
  end
254
254
  end
255
- private :count_last_newlines
256
255
 
257
- def repository_toplevel_dir
256
+ private def repository_toplevel_dir
258
257
  `git rev-parse --show-toplevel`.chomp
259
258
  end
260
- private :repository_toplevel_dir
261
259
 
262
- def current_dir(filename)
260
+ private def current_dir(filename)
263
261
  File.join(repository_toplevel_dir, `git rev-parse --show-prefix`.chomp, filename)
264
262
  end
265
- private :current_dir
266
263
  end
267
264
  end
@@ -1,3 +1,3 @@
1
1
  module GitNewlineAtEof
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
metadata CHANGED
@@ -1,52 +1,52 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-newline-at-eof
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Ass
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-04 00:00:00.000000000 Z
11
+ date: 2017-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
18
  version: '0'
20
- type: :development
19
+ name: bundler
21
20
  prerelease: false
21
+ type: :development
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
32
  version: '0'
34
- type: :development
33
+ name: rake
35
34
  prerelease: false
35
+ type: :development
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: test-unit
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
44
  - - ">="
46
45
  - !ruby/object:Gem::Version
47
46
  version: '0'
48
- type: :development
47
+ name: test-unit
49
48
  prerelease: false
49
+ type: :development
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  description: 'Check and fix newline at end of file in Git respository.
56
56
 
57
- '
57
+ '
58
58
  email:
59
59
  - aycabta@gmail.com
60
60
  executables:
@@ -63,6 +63,7 @@ extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
65
  - ".gitignore"
66
+ - ".jrubyrc"
66
67
  - ".travis.yml"
67
68
  - Gemfile
68
69
  - LICENSE.txt
@@ -79,7 +80,7 @@ homepage: https://github.com/aycabta/git-newline-at-eof
79
80
  licenses:
80
81
  - MIT
81
82
  metadata: {}
82
- post_install_message:
83
+ post_install_message:
83
84
  rdoc_options: []
84
85
  require_paths:
85
86
  - lib
@@ -94,9 +95,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  - !ruby/object:Gem::Version
95
96
  version: '0'
96
97
  requirements: []
97
- rubyforge_project:
98
- rubygems_version: 2.6.8
99
- signing_key:
98
+ rubyforge_project:
99
+ rubygems_version: 2.6.11
100
+ signing_key:
100
101
  specification_version: 4
101
102
  summary: Check and fix newline at end of file in Git respository.
102
103
  test_files: []