pre-commit 0.28.0 → 0.29.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/lib/pre-commit/template.rb +12 -12
- data/templates/gem/{<%= gem_name %>.gemspec → GEM_NAME.gemspec} +0 -0
- data/templates/gem/lib/plugins/pre_commit/checks/{<%= name %>.rb → PLUGIN_NAME.rb} +0 -0
- data/templates/gem/lib/pre-commit/{<%= name %> → PLUGIN_NAME}/version.rb +0 -0
- data/templates/gem/test/plugins/pre_commit/checks/{<%= name %>_test.rb → PLUGIN_NAME_test.rb} +0 -0
- data/templates/hooks/default +1 -0
- metadata +7 -7
- data/templates/hooks/default +0 -40
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6e3d660e5cb5d67fbf8bc342a007439fb19ad013
         | 
| 4 | 
            +
              data.tar.gz: d3d6ceb36c3bf46e2faaaf2d20c52d548938debc
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 0a1c9bca0529a85f7d564da55a87222e23763682d0910bf9d26ceb95bf51b6f3e81d4058b344795160d6865885b61d84d8188b795ee72fe3d2165896d468bfbe
         | 
| 7 | 
            +
              data.tar.gz: 304f6aa0fdccd9be6d30721395a10d3a8df778ecb62a52ac262040d0f1ad6966c553ae20c83d06e7bfc2400cfbde05674d0d74780cb2b213457c16fc14855b1d
         | 
    
        data/lib/pre-commit/template.rb
    CHANGED
    
    | @@ -28,6 +28,18 @@ Next steps: | |
| 28 28 | 
             
            STEPS
         | 
| 29 29 | 
             
                end
         | 
| 30 30 |  | 
| 31 | 
            +
                def all_files
         | 
| 32 | 
            +
                  Dir.glob("#{TEMPLATE_DIR}/**/*", File::FNM_DOTMATCH)
         | 
| 33 | 
            +
                    .reject { |path| File.directory?(path) }
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                def target_path(file)
         | 
| 37 | 
            +
                  file
         | 
| 38 | 
            +
                    .sub(TEMPLATE_DIR, gem_name)
         | 
| 39 | 
            +
                    .sub("GEM_NAME", gem_name)
         | 
| 40 | 
            +
                    .sub("PLUGIN_NAME", name)
         | 
| 41 | 
            +
                end
         | 
| 42 | 
            +
             | 
| 31 43 | 
             
              private
         | 
| 32 44 |  | 
| 33 45 | 
             
                def validate_params
         | 
| @@ -38,10 +50,6 @@ STEPS | |
| 38 50 | 
             
                  raise ArgumentError, "#{gem_name} already exists" if File.directory?(gem_name)
         | 
| 39 51 | 
             
                end
         | 
| 40 52 |  | 
| 41 | 
            -
                def all_files
         | 
| 42 | 
            -
                  Dir.glob("#{TEMPLATE_DIR}/**/*", File::FNM_DOTMATCH).reject{|path| File.directory?(path) }.sort
         | 
| 43 | 
            -
                end
         | 
| 44 | 
            -
             | 
| 45 53 | 
             
                def parse_and_save(file)
         | 
| 46 54 | 
             
                  save_file(
         | 
| 47 55 | 
             
                    target_path(file),
         | 
| @@ -49,14 +57,6 @@ STEPS | |
| 49 57 | 
             
                  )
         | 
| 50 58 | 
             
                end
         | 
| 51 59 |  | 
| 52 | 
            -
                def target_path(file)
         | 
| 53 | 
            -
                  ERB.new(
         | 
| 54 | 
            -
                    file.sub(TEMPLATE_DIR, gem_name)
         | 
| 55 | 
            -
                  ).result(
         | 
| 56 | 
            -
                    binding
         | 
| 57 | 
            -
                  )
         | 
| 58 | 
            -
                end
         | 
| 59 | 
            -
             | 
| 60 60 | 
             
                def save_file(path, content)
         | 
| 61 61 | 
             
                  FileUtils.mkdir_p(File.expand_path("..", path))
         | 
| 62 62 | 
             
                  File.write(path, content, 0, mode: "w")
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
| 
            File without changes
         | 
    
        data/templates/gem/test/plugins/pre_commit/checks/{<%= name %>_test.rb → PLUGIN_NAME_test.rb}
    RENAMED
    
    | 
            File without changes
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            automatic
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: pre-commit
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.29.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Shajith Chacko, Josh Lubaway
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2016- | 
| 11 | 
            +
            date: 2016-10-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: pluginator
         | 
| @@ -149,15 +149,15 @@ files: | |
| 149 149 | 
             
            - lib/pre-commit/template.rb
         | 
| 150 150 | 
             
            - lib/pre-commit/utils/git_conversions.rb
         | 
| 151 151 | 
             
            - lib/pre-commit/utils/staged_files.rb
         | 
| 152 | 
            -
            - templates/gem | 
| 152 | 
            +
            - templates/gem/GEM_NAME.gemspec
         | 
| 153 153 | 
             
            - templates/gem/Gemfile
         | 
| 154 154 | 
             
            - templates/gem/LICENSE
         | 
| 155 155 | 
             
            - templates/gem/README.md
         | 
| 156 156 | 
             
            - templates/gem/Rakefile
         | 
| 157 | 
            -
            - templates/gem/lib/plugins/pre_commit/checks | 
| 158 | 
            -
            - templates/gem/lib/pre-commit | 
| 157 | 
            +
            - templates/gem/lib/plugins/pre_commit/checks/PLUGIN_NAME.rb
         | 
| 158 | 
            +
            - templates/gem/lib/pre-commit/PLUGIN_NAME/version.rb
         | 
| 159 159 | 
             
            - templates/gem/test/minitest_helper.rb
         | 
| 160 | 
            -
            - templates/gem/test/plugins/pre_commit/checks | 
| 160 | 
            +
            - templates/gem/test/plugins/pre_commit/checks/PLUGIN_NAME_test.rb
         | 
| 161 161 | 
             
            - templates/hooks/automatic
         | 
| 162 162 | 
             
            - templates/hooks/default
         | 
| 163 163 | 
             
            - templates/hooks/manual
         | 
| @@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 183 183 | 
             
                  version: '0'
         | 
| 184 184 | 
             
            requirements: []
         | 
| 185 185 | 
             
            rubyforge_project: 
         | 
| 186 | 
            -
            rubygems_version: 2. | 
| 186 | 
            +
            rubygems_version: 2.5.1
         | 
| 187 187 | 
             
            signing_key: 
         | 
| 188 188 | 
             
            specification_version: 3
         | 
| 189 189 | 
             
            summary: A slightly better git pre-commit hook
         | 
    
        data/templates/hooks/default
    DELETED
    
    | @@ -1,40 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env sh
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            # This hook has a focus on portability.
         | 
| 4 | 
            -
            # This hook will attempt to setup your environment before running checks.
         | 
| 5 | 
            -
            #
         | 
| 6 | 
            -
            # If you would like `pre-commit` to get out of your way and you are comfortable
         | 
| 7 | 
            -
            # setting up your own environment, you can install the manual hook using:
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            #     pre-commit install --manual
         | 
| 10 | 
            -
            #
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            # This is a work-around to get GitHub for Mac to be able to run `node` commands
         | 
| 13 | 
            -
            # https://stackoverflow.com/questions/12881975/git-pre-commit-hook-failing-in-github-for-mac-works-on-command-line
         | 
| 14 | 
            -
            PATH=$PATH:/usr/local/bin:/usr/local/sbin
         | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
            cmd=`git config pre-commit.ruby 2>/dev/null`
         | 
| 18 | 
            -
            if   test -n "${cmd}"
         | 
| 19 | 
            -
            then true
         | 
| 20 | 
            -
            elif which rvm   >/dev/null 2>/dev/null
         | 
| 21 | 
            -
            then cmd="rvm default do ruby"
         | 
| 22 | 
            -
            elif which rbenv >/dev/null 2>/dev/null
         | 
| 23 | 
            -
            then cmd="rbenv exec ruby"
         | 
| 24 | 
            -
            else cmd="ruby"
         | 
| 25 | 
            -
            fi
         | 
| 26 | 
            -
             | 
| 27 | 
            -
            export rvm_silence_path_mismatch_check_flag=1
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            ${cmd} -rrubygems -e '
         | 
| 30 | 
            -
              begin
         | 
| 31 | 
            -
                require "pre-commit"
         | 
| 32 | 
            -
                true
         | 
| 33 | 
            -
              rescue LoadError => e
         | 
| 34 | 
            -
                $stderr.puts <<-MESSAGE
         | 
| 35 | 
            -
            pre-commit: WARNING: Skipping checks because: #{e}
         | 
| 36 | 
            -
            pre-commit: Did you set your Ruby version?
         | 
| 37 | 
            -
            MESSAGE
         | 
| 38 | 
            -
                false
         | 
| 39 | 
            -
              end and PreCommit.run
         | 
| 40 | 
            -
            '
         |