vanish 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f304ebe82898bc94bbedaf0fe0444f575152d80c
4
- data.tar.gz: 12aa222c6548c9a553cb8f933a8e63d34412b1b7
3
+ metadata.gz: 8318d22120c21010fef9fdc718080ba0a930d7d3
4
+ data.tar.gz: f3390d13d295cb08ca22216d9858daa55da672c7
5
5
  SHA512:
6
- metadata.gz: e54361d6032a233943c780fe2b821ea2fc7abf19222bbfaaec833105366c9b0e3102a6702148674904cae11d65bec3808d6d61f6ec614c4db91acea5e061161d
7
- data.tar.gz: 730a78edc28699edf0c1bbd347a6440e8f451372756002807d06d5dd437e63eec8d5a6dea5c5f54653cbbd1d3fa69e79513755c4512e4fc0fc2c1b89d68ed5dd
6
+ metadata.gz: eb5c0ab2b4d1d07df7dc0e28b0e4e0cf1dac5d2956bb7a84576d17aba095138146f8ca72c6d69a07766150cd45c8e20a6c64e4aedc78390a1ec850578fc865a1
7
+ data.tar.gz: 5d81a5480dc4281b12c74a900f54b23613066e7b9929bb548350e6dfa2e12630cb5f72efa75e28e833f2c42a72a223769e3376f45890988d52cefecabcbaec68
@@ -6,9 +6,9 @@ rvm:
6
6
  - 2.2.7
7
7
  - 2.3.4
8
8
  - 2.4.1
9
- - head
9
+ - ruby-head
10
10
  before_install: gem install bundler -v 1.14.6
11
11
 
12
12
  matrix:
13
13
  allow_failures:
14
- - rvm: head
14
+ - rvm: ruby-head
@@ -1,3 +1,7 @@
1
+ ## 0.2.0
2
+
3
+ - If you omit the path, target the current directory.
4
+
1
5
  ## 0.1.0
2
6
 
3
7
  - The first release. `vanish` removes the useless white space in the text file.
data/README.md CHANGED
@@ -1,23 +1,9 @@
1
- # vanish
1
+ # vanish [![Build Status](https://travis-ci.org/koic/vanish.svg)](https://travis-ci.org/koic/vanish) [![Gem Version](https://badge.fury.io/rb/vanish.svg)](http://badge.fury.io/rb/vanish) [![git.legal](https://git.legal/projects/3962/badge.svg "Number of libraries approved")](https://git.legal/projects/3962)
2
2
 
3
3
  `vanish` removes the useless white space in the text file.
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'vanish'
11
- ```
12
-
13
- And then execute:
14
-
15
- ```sh
16
- % bundle
17
- ```
18
-
19
- Or install it yourself as:
20
-
21
7
  ```sh
22
8
  % gem install vanish
23
9
  ```
@@ -27,19 +13,19 @@ Or install it yourself as:
27
13
  Display the contents to apply vanish command on standard output.
28
14
 
29
15
  ```sh
30
- % vanish .
16
+ % vanish
31
17
  ```
32
18
 
33
19
  It corrects automatically by vanish command.
34
20
 
35
21
  ```sh
36
- % vanish -a .
22
+ % vanish -a
37
23
  ```
38
24
 
39
25
  or
40
26
 
41
27
  ```sh
42
- % vanish --auto-correct .
28
+ % vanish --auto-correct
43
29
  ```
44
30
 
45
31
  As a result, remove blank lines at the top and bottom of the file and a white space at the end of line.
data/exe/vanish CHANGED
@@ -8,21 +8,21 @@ Version = VanishingVision::VERSION
8
8
 
9
9
  options = {}
10
10
 
11
- opt = OptionParser.new('usage: vanish [-a] path ...')
11
+ opt = OptionParser.new('usage: vanish [-a] [path ...]')
12
12
  opt.on('-a', '--auto-correct', 'auto correct (default is just to display)') {|v| options[:auto_correct] = true }
13
13
  opt.on('-v', '--version', 'version') {|v| options[:version] = true } # overwrite
14
14
 
15
15
  begin
16
16
  opt.permute!(ARGV)
17
17
 
18
- raise if options.empty? && ARGV.empty?
19
-
20
18
  if options[:version]
21
19
  puts "vanish #{VanishingVision::VERSION}"
22
20
  exit
23
21
  end
24
22
 
25
- ARGV.each do |path|
23
+ paths = ARGV.empty? ? ['.'] : ARGV
24
+
25
+ paths.each do |path|
26
26
  VanishingVision.vanish(path, options)
27
27
  end
28
28
  rescue
@@ -4,6 +4,8 @@ Diffy::Diff.default_format = :color
4
4
 
5
5
  module VanishingVision
6
6
  class Engine
7
+ SKIP_ENCODINGS = [NKF::BINARY, NKF::UNKNOWN]
8
+
7
9
  def initialize(path)
8
10
  @path = path
9
11
  end
@@ -11,7 +13,7 @@ module VanishingVision
11
13
  def run(auto_correct)
12
14
  source = File.read(@path)
13
15
 
14
- return if NKF.guess(source) == Encoding::ASCII_8BIT
16
+ return if SKIP_ENCODINGS.include?(NKF.guess(source))
15
17
 
16
18
  core = Core.new(source)
17
19
 
@@ -1,3 +1,3 @@
1
1
  module VanishingVision
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi ITO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-02 00:00:00.000000000 Z
11
+ date: 2017-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy