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 +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +4 -0
- data/README.md +4 -18
- data/exe/vanish +4 -4
- data/lib/vanishing_vision/engine.rb +3 -1
- data/lib/vanishing_vision/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 8318d22120c21010fef9fdc718080ba0a930d7d3
         | 
| 4 | 
            +
              data.tar.gz: f3390d13d295cb08ca22216d9858daa55da672c7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: eb5c0ab2b4d1d07df7dc0e28b0e4e0cf1dac5d2956bb7a84576d17aba095138146f8ca72c6d69a07766150cd45c8e20a6c64e4aedc78390a1ec850578fc865a1
         | 
| 7 | 
            +
              data.tar.gz: 5d81a5480dc4281b12c74a900f54b23613066e7b9929bb548350e6dfa2e12630cb5f72efa75e28e833f2c42a72a223769e3376f45890988d52cefecabcbaec68
         | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CHANGELOG.md
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,23 +1,9 @@ | |
| 1 | 
            -
            # vanish
         | 
| 1 | 
            +
            # vanish [](https://travis-ci.org/koic/vanish) [](http://badge.fury.io/rb/vanish) [](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. | 
| 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) | 
| 16 | 
            +
                  return if SKIP_ENCODINGS.include?(NKF.guess(source))
         | 
| 15 17 |  | 
| 16 18 | 
             
                  core = Core.new(source)
         | 
| 17 19 |  | 
    
        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. | 
| 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- | 
| 11 | 
            +
            date: 2017-08-26 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: diffy
         |