git-catch 0.1.3 → 0.1.4
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/.git-catch.yaml +4 -0
- data/bin/git-catch +1 -0
- data/lib/git/catch/version.rb +1 -1
- data/lib/git/catch.rb +45 -1
- metadata +3 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: acfe4df3b3c7627d8693978e4504b1127ffeb8bf
         | 
| 4 | 
            +
              data.tar.gz: 8d2cab43d97f941b44071fe3dd8bdf013321832b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8f6732cf83f70c5d929e77de6061c5a93e1be6f3a2ff5892b7db3cd6d86ab1d9a4ef9c56b4f0b5f0bf524144c347bea9f181df9ab138025c7e2eeb31026f21c4
         | 
| 7 | 
            +
              data.tar.gz: 4865fba333a36ce0bf48791387a15d36d822c664f5861841c32ce4b3fa02a214f7823871a684b1d8372fc269106d14b1dda31a1a663922bbcb1e728c17df0b00
         | 
    
        data/.git-catch.yaml
    ADDED
    
    
    
        data/bin/git-catch
    CHANGED
    
    
    
        data/lib/git/catch/version.rb
    CHANGED
    
    
    
        data/lib/git/catch.rb
    CHANGED
    
    | @@ -1,7 +1,51 @@ | |
| 1 | 
            +
            require "yaml"
         | 
| 2 | 
            +
            require "fileutils"
         | 
| 3 | 
            +
             | 
| 1 4 | 
             
            require "git/catch/version"
         | 
| 2 5 |  | 
| 6 | 
            +
             | 
| 3 7 | 
             
            module Git
         | 
| 4 8 | 
             
              module Catch
         | 
| 5 | 
            -
                 | 
| 9 | 
            +
                class Runner
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                  def init
         | 
| 12 | 
            +
                    hooks = [
         | 
| 13 | 
            +
                      "applypatch-msg",
         | 
| 14 | 
            +
                      "commit-msg",
         | 
| 15 | 
            +
                      "post-update",
         | 
| 16 | 
            +
                      "pre-applypatch",
         | 
| 17 | 
            +
                      "pre-commit",
         | 
| 18 | 
            +
                      "pre-push",
         | 
| 19 | 
            +
                      "pre-rebase",
         | 
| 20 | 
            +
                      "prepare-commit-msg",
         | 
| 21 | 
            +
                      "update",
         | 
| 22 | 
            +
                    ]
         | 
| 23 | 
            +
                    config = YAML.load_file("./.git-catch.yaml")
         | 
| 24 | 
            +
                    config.each do |name, files|
         | 
| 25 | 
            +
                      if !hooks.include? name
         | 
| 26 | 
            +
                        puts "==> Hook #{name} is not known"
         | 
| 27 | 
            +
                        next
         | 
| 28 | 
            +
                      end
         | 
| 29 | 
            +
                      build name, files
         | 
| 30 | 
            +
                    end
         | 
| 31 | 
            +
                  end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  private
         | 
| 34 | 
            +
                  def build(name, files)
         | 
| 35 | 
            +
                    file = ".git/hooks/#{name}"
         | 
| 36 | 
            +
                    content = <<~EOS
         | 
| 37 | 
            +
                      #!/usr/bin/env bash
         | 
| 38 | 
            +
                      set -eu
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                    EOS
         | 
| 41 | 
            +
                    files.each do |file|
         | 
| 42 | 
            +
                      content << "#{file}\n"
         | 
| 43 | 
            +
                    end
         | 
| 44 | 
            +
                    File.write file, content
         | 
| 45 | 
            +
                    FileUtils.chmod "+x", file
         | 
| 46 | 
            +
                    puts "==> File #{file} written"
         | 
| 47 | 
            +
                  end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                end
         | 
| 6 50 | 
             
              end
         | 
| 7 51 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: git-catch
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Pedro Barbosa
         | 
| @@ -60,6 +60,7 @@ executables: | |
| 60 60 | 
             
            extensions: []
         | 
| 61 61 | 
             
            extra_rdoc_files: []
         | 
| 62 62 | 
             
            files:
         | 
| 63 | 
            +
            - ".git-catch.yaml"
         | 
| 63 64 | 
             
            - ".gitignore"
         | 
| 64 65 | 
             
            - ".travis.yml"
         | 
| 65 66 | 
             
            - Gemfile
         | 
| @@ -90,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 90 91 | 
             
                  version: '0'
         | 
| 91 92 | 
             
            requirements: []
         | 
| 92 93 | 
             
            rubyforge_project: 
         | 
| 93 | 
            -
            rubygems_version: 2. | 
| 94 | 
            +
            rubygems_version: 2.5.2.1
         | 
| 94 95 | 
             
            signing_key: 
         | 
| 95 96 | 
             
            specification_version: 4
         | 
| 96 97 | 
             
            summary: Hooks up your git hooks
         |