cookbook-release 1.1.4 → 1.1.5
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 +8 -8
 - data/cookbook-release.gemspec +2 -1
 - data/lib/cookbook-release/git-utilities.rb +15 -24
 - data/spec/git_spec.rb +22 -0
 - metadata +16 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                NTI4MmYxOTQ2MTZkMTBjYzZkMDlhMGNiNzk2NGFlZmU4Y2NmMWY2NQ==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                MTRkNTc4MmIyMWRjN2VmM2U2M2I3ZGJlNWVhZGI0MWYwNjZjYjhmMw==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                YzVkNzZmZjNmYjdjNDg2Y2M1ZjFmNDU4ODJlMTliM2ZkOGE4MTIxMTM1NzNm
         
     | 
| 
      
 10 
     | 
    
         
            +
                MGJmZTU4NmFiMTRiNWJjNjhkOWFjNTI0MDFjMmMyZGNmM2VlNjU0MTFlMDg0
         
     | 
| 
      
 11 
     | 
    
         
            +
                ZDEyNDBhY2JkMmIyNGRkZDU4Yjk2NzJmMjZhMjhmMzQxOTRkMDI=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                YzhiODZlYzc4OTllZmNhYzk3NTAyYWZkMzg3YzJiYzlkNWRjMjk2ZTExMzk5
         
     | 
| 
      
 14 
     | 
    
         
            +
                YWUxMDA3OTJmZmZmMzAyNjhmMzE5MzUzNjI4OWM5NmI2MTFiMGRiNDYwNDk3
         
     | 
| 
      
 15 
     | 
    
         
            +
                NGFkMDRhNWZkODUxMzY2Y2Q2OWFjNzY4MmY5ZDIxNGE4ZThlMzg=
         
     | 
    
        data/cookbook-release.gemspec
    CHANGED
    
    | 
         @@ -6,7 +6,7 @@ require 'English' 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            Gem::Specification.new do |spec|
         
     | 
| 
       8 
8 
     | 
    
         
             
              spec.name          = 'cookbook-release'
         
     | 
| 
       9 
     | 
    
         
            -
              spec.version       = '1.1. 
     | 
| 
      
 9 
     | 
    
         
            +
              spec.version       = '1.1.5'
         
     | 
| 
       10 
10 
     | 
    
         
             
              spec.authors       = ['Grégoire Seux']
         
     | 
| 
       11 
11 
     | 
    
         
             
              spec.email         = 'g.seux@criteo.com'
         
     | 
| 
       12 
12 
     | 
    
         
             
              spec.summary       = 'Provide primitives (and rake tasks) to release a cookbook'
         
     | 
| 
         @@ -23,6 +23,7 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       23 
23 
     | 
    
         
             
              spec.add_dependency 'highline'
         
     | 
| 
       24 
24 
     | 
    
         
             
              spec.add_dependency 'mixlib-shellout'
         
     | 
| 
       25 
25 
     | 
    
         
             
              spec.add_dependency 'chef'
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_dependency 'git'
         
     | 
| 
       26 
27 
     | 
    
         | 
| 
       27 
28 
     | 
    
         | 
| 
       28 
29 
     | 
    
         
             
              spec.add_development_dependency 'rspec'
         
     | 
| 
         @@ -2,6 +2,7 @@ require 'semantic' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'semantic/core_ext'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'mixlib/shellout'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'highline/import'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'git'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            module CookbookRelease
         
     | 
| 
       7 
8 
     | 
    
         
             
              class GitUtilities
         
     | 
| 
         @@ -10,13 +11,15 @@ module CookbookRelease 
     | 
|
| 
       10 
11 
     | 
    
         | 
| 
       11 
12 
     | 
    
         
             
                def initialize(options={})
         
     | 
| 
       12 
13 
     | 
    
         
             
                  @tag_prefix = options[:tag_prefix] || ''
         
     | 
| 
      
 14 
     | 
    
         
            +
                  cwd = options[:cwd] || Dir.pwd
         
     | 
| 
       13 
15 
     | 
    
         
             
                  @shellout_opts = {
         
     | 
| 
       14 
     | 
    
         
            -
                    cwd:  
     | 
| 
      
 16 
     | 
    
         
            +
                    cwd: cwd
         
     | 
| 
       15 
17 
     | 
    
         
             
                  }
         
     | 
| 
      
 18 
     | 
    
         
            +
                  @g = Git.open(cwd)
         
     | 
| 
       16 
19 
     | 
    
         
             
                end
         
     | 
| 
       17 
20 
     | 
    
         | 
| 
       18 
21 
     | 
    
         
             
                def self.git?(dir)
         
     | 
| 
       19 
     | 
    
         
            -
                   
     | 
| 
      
 22 
     | 
    
         
            +
                  @g.index.readable?
         
     | 
| 
       20 
23 
     | 
    
         
             
                end
         
     | 
| 
       21 
24 
     | 
    
         | 
| 
       22 
25 
     | 
    
         
             
                def reset_command(new_version)
         
     | 
| 
         @@ -59,32 +62,20 @@ module CookbookRelease 
     | 
|
| 
       59 
62 
     | 
    
         
             
                  last.to_version
         
     | 
| 
       60 
63 
     | 
    
         
             
                end
         
     | 
| 
       61 
64 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
                # These string are used to split git commit summary
         
     | 
| 
       63 
     | 
    
         
            -
                # it just needs to be unlikely in a commit message
         
     | 
| 
       64 
     | 
    
         
            -
                MAGIC_SEP        = '@+-+@+-+@+-+@'
         
     | 
| 
       65 
     | 
    
         
            -
                MAGIC_COMMIT_SEP = '@===@===@===@'
         
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
65 
     | 
    
         
             
                def compute_changelog(since)
         
     | 
| 
       68 
     | 
    
         
            -
                   
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
                     
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
                      subject: subject,
         
     | 
| 
       78 
     | 
    
         
            -
                      hash: hash,
         
     | 
| 
       79 
     | 
    
         
            -
                      body: body
         
     | 
| 
       80 
     | 
    
         
            -
                    })
         
     | 
| 
       81 
     | 
    
         
            -
                  end.compact.reject { |commit| commit[:subject] =~ /^Merge branch (.*) into/i }
         
     | 
| 
      
 66 
     | 
    
         
            +
                  commits = @g.log.between(since, 'HEAD').map do |commit|
         
     | 
| 
      
 67 
     | 
    
         
            +
                    message = commit.message.lines.map(&:chomp).compact.delete_if(&:empty?)
         
     | 
| 
      
 68 
     | 
    
         
            +
                    Commit.new(
         
     | 
| 
      
 69 
     | 
    
         
            +
                      author: commit.author.name,
         
     | 
| 
      
 70 
     | 
    
         
            +
                      subject: message.delete_at(0),
         
     | 
| 
      
 71 
     | 
    
         
            +
                      hash: commit.sha,
         
     | 
| 
      
 72 
     | 
    
         
            +
                      body: message.empty? ? nil : message.join('\n')
         
     | 
| 
      
 73 
     | 
    
         
            +
                    )
         
     | 
| 
      
 74 
     | 
    
         
            +
                  end.reject { |commit| commit[:subject] =~ /^Merge branch (.*) into/i }
         
     | 
| 
       82 
75 
     | 
    
         
             
                end
         
     | 
| 
       83 
76 
     | 
    
         | 
| 
       84 
77 
     | 
    
         
             
                def tag(version)
         
     | 
| 
       85 
     | 
    
         
            -
                   
     | 
| 
       86 
     | 
    
         
            -
                  cmd.run_command
         
     | 
| 
       87 
     | 
    
         
            -
                  cmd.error!
         
     | 
| 
      
 78 
     | 
    
         
            +
                  @g.add_tag("#{@tag_prefix}#{version}")
         
     | 
| 
       88 
79 
     | 
    
         
             
                end
         
     | 
| 
       89 
80 
     | 
    
         | 
| 
       90 
81 
     | 
    
         
             
                def choose_remote
         
     | 
    
        data/spec/git_spec.rb
    CHANGED
    
    | 
         @@ -106,5 +106,27 @@ describe CookbookRelease::GitUtilities do 
     | 
|
| 
       106 
106 
     | 
    
         
             
                  expect(changelog.size).to eq(3)
         
     | 
| 
       107 
107 
     | 
    
         
             
                  expect(changelog.map {|c| c[:subject]}).to contain_exactly('A commit', 'Another commit', 'A third one')
         
     | 
| 
       108 
108 
     | 
    
         
             
                end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
      
 110 
     | 
    
         
            +
                it 'parse correctly commits' do
         
     | 
| 
      
 111 
     | 
    
         
            +
                  cmds = <<-EOH
         
     | 
| 
      
 112 
     | 
    
         
            +
                  touch toto
         
     | 
| 
      
 113 
     | 
    
         
            +
                  git add toto
         
     | 
| 
      
 114 
     | 
    
         
            +
                  git commit -m'none'
         
     | 
| 
      
 115 
     | 
    
         
            +
                  git tag 1.0.0
         
     | 
| 
      
 116 
     | 
    
         
            +
                  git commit --allow-empty -m "subject" -m "body"
         
     | 
| 
      
 117 
     | 
    
         
            +
                  git commit --allow-empty -m "without body"
         
     | 
| 
      
 118 
     | 
    
         
            +
                  EOH
         
     | 
| 
      
 119 
     | 
    
         
            +
                  cmds.split("\n").each do |cmd|
         
     | 
| 
      
 120 
     | 
    
         
            +
                    cmd = Mixlib::ShellOut.new(cmd)
         
     | 
| 
      
 121 
     | 
    
         
            +
                    cmd.run_command
         
     | 
| 
      
 122 
     | 
    
         
            +
                    cmd.error!
         
     | 
| 
      
 123 
     | 
    
         
            +
                  end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
                  changelog = git.compute_changelog('1.0.0')
         
     | 
| 
      
 126 
     | 
    
         
            +
                  expect(changelog.size).to eq(2)
         
     | 
| 
      
 127 
     | 
    
         
            +
                  expect(changelog[1][:subject]).to eq('subject')
         
     | 
| 
      
 128 
     | 
    
         
            +
                  expect(changelog[1][:body]).to eq('body')
         
     | 
| 
      
 129 
     | 
    
         
            +
                  expect(changelog[0][:body]).to be_nil
         
     | 
| 
      
 130 
     | 
    
         
            +
                end
         
     | 
| 
       109 
131 
     | 
    
         
             
              end
         
     | 
| 
       110 
132 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: cookbook-release
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Grégoire Seux
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-10- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-10-18 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: semantic
         
     | 
| 
         @@ -66,6 +66,20 @@ dependencies: 
     | 
|
| 
       66 
66 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
68 
     | 
    
         
             
                    version: '0'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: git
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       69 
83 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
84 
     | 
    
         
             
              name: rspec
         
     | 
| 
       71 
85 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |