release_manager 0.6.0 → 0.7.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: 03f488ec3c5ca203a22ebc5fdc6c3f35659fc3ab
4
- data.tar.gz: e0d8bc478030066ccaf0aea96a548bcda45461c1
3
+ metadata.gz: 0056b26bafb18d0a01df0610acfc187b5b894416
4
+ data.tar.gz: bd8a438f19dbee1ebb1ca73c277eac99b14222c9
5
5
  SHA512:
6
- metadata.gz: bdf95bd7a453b7ae03e108d23808dfce2194e50dfd3a27680d0219ddb32ad05ed45534e282af17f12f3bb8a39e653f905cdc9786b899e6268865a8b5f0a964db
7
- data.tar.gz: b9af8ec32da6a2743e822e3451b198d3663062d3866519f6fb19bbf1bab3c0703c66925f824c94d4cf8202b5cdeef677a41cd731d76575bbb4a79a774d1a3788
6
+ metadata.gz: 548c678ef78f0a13b3d2c9c6e40e1b97b12a64590cb5eb5c71595d3547e711e8bdbe98d7d88ddd3e61d305d0fb7d9715056fb47c9b923c392c12ef5ebcb1e5f1
7
+ data.tar.gz: fd8faf85ad2d821365a10d122c70683a4575db9769aaf9b54c765e07a8c59865229581c9863ba47a5a22f89d5bb8abcdddcb71b6f42b58014b17646970cf8f66
data/CHANGELOG.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # Release Manager
2
2
 
3
3
  ## Unreleased
4
-
4
+ * Fixes #3 - release-mod fails when trying to sort tags
5
+ * Fixes #8 - files disappear from change set
6
+ * Fixes #1 - deploy-mod creates commit everytime
5
7
  ## 0.6.0
6
8
  * Adds the ability to release-mod to dump a specific SemVer release level
7
9
  * Fixes issue with changelog file not existing
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- release_manager (0.6.0)
4
+ release_manager (0.7.0)
5
5
  gitlab (~> 4.2.0)
6
6
  highline (~> 1.7)
7
7
  rugged (~> 0.26)
data/README.md CHANGED
@@ -47,7 +47,7 @@ This gem provides workflow automations around releasing and deploying puppet mod
47
47
  6. Must have a r10k-control repo (name can vary)
48
48
  7. Must have a Gitlab API Access token (per user)
49
49
  8. Must have the libssh-dev library package installed
50
-
50
+ 9. Must tag code with version tags ie. `v1.2.3`
51
51
  ## Installation
52
52
 
53
53
  Add this line to your application's Gemfile:
@@ -315,8 +315,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
315
315
 
316
316
  ## Develpment Environment Setup
317
317
  ### Setting up your Gitlab Instance
318
- 1. Ensure you have docker installed
319
- 2. `docker-compose up`
318
+ 1. Ensure you have docker and docker-compose installed
319
+ 2. run `docker-compose up` to start all the services
320
320
  3. Visit http://localhost:8000/
321
321
  4. Create a password (password123)
322
322
  5. Login (root/password123)
@@ -14,4 +14,5 @@ class InvalidSshkey < Exception; end
14
14
  class InvalidBranchName < Exception; end
15
15
  class PatchError < Exception; end
16
16
  class AlreadyReleased < Exception; end
17
+ class AlreadyDeployed < Exception; end
17
18
  class TagExists < Exception; end
@@ -225,7 +225,7 @@ module ReleaseManager
225
225
  return add_all if file == '.'
226
226
  index = repo.index
227
227
  file.slice!(repo.workdir)
228
- index.add(:path => file, :oid => Rugged::Blob.from_workdir(repo, file), :mode => 0100644)
228
+ index.add(:path => file, :oid => Rugged::Blob.from_workdir(repo, file), :mode => 0100644, valid: false)
229
229
  end
230
230
 
231
231
  # @param [String] file - the path to the patch file you want to apply
@@ -276,10 +276,6 @@ module ReleaseManager
276
276
  index.remove(file)
277
277
  end
278
278
 
279
- def update_cli_index
280
- `#{git_command} update-index --really-refresh`
281
- end
282
-
283
279
  # @param [String] message - the message you want in the commit
284
280
  def create_commit(message)
285
281
  unless author_name and author_email
@@ -288,14 +284,14 @@ module ReleaseManager
288
284
  # get the index for this repository
289
285
  repo.status { |file, status_data| logger.debug "#{file} has status: #{status_data.inspect}" }
290
286
  index = repo.index
291
- index.write
292
287
  options = {}
293
288
  options[:author] = author
294
289
  options[:message] = message
295
290
  options[:committer] = author
296
- options[:parents] = repo.empty? ? [] : [repo.head.target_id].compact
291
+ options[:parents] = repo.empty? ? [] : [repo.head.target].compact
297
292
  options[:update_ref] = 'HEAD'
298
293
  options[:tree] = index.write_tree
294
+ index.write
299
295
  oid = Rugged::Commit.create(repo, options)
300
296
  if oid
301
297
  logger.info("Created commit #{message}")
@@ -303,7 +299,6 @@ module ReleaseManager
303
299
  else
304
300
  logger.warn("Something went wrong with the commit")
305
301
  end
306
- update_cli_index # for some reason the command line doesn't refresh the index after committing.
307
302
  oid
308
303
  end
309
304
 
@@ -68,7 +68,11 @@ class ModuleDeployer
68
68
  else
69
69
  puppetfile.write_version(puppet_module.name, latest_version)
70
70
  puppetfile.write_source(puppet_module.name, puppet_module.source)
71
- puppetfile.write_to_file
71
+ updated = puppetfile.write_to_file
72
+ unless updated
73
+ logger.warn "Module #{puppet_module.name} with version #{latest_version} has already been deployed, skipping deployment"
74
+ return
75
+ end
72
76
  logger.info "Updated module #{puppet_module.name} in Puppetfile to version: #{latest_version}"
73
77
  if options[:commit]
74
78
  puppetfile.commit("bump #{puppet_module.name} to version #{latest_version}")
@@ -84,8 +84,14 @@ class PuppetModule < WorkflowAction
84
84
  parts.join '.'
85
85
  end
86
86
 
87
+ # @return [Array<String>] - returns a array of version strings with the v in the name
88
+ def version_tags
89
+ tags.find_all {|tag| tag =~ /\Av\d/ }
90
+ end
91
+
92
+ # @return [String] - the latest tag in a series of versioned tags
87
93
  def latest_tag
88
- v = tags.sort do |a,b|
94
+ v = version_tags.sort do |a,b|
89
95
  Gem::Version.new(a.tr('v', '')) <=> Gem::Version.new(b.tr('v', ''))
90
96
  end
91
97
  v.last
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  require_relative 'control_mod'
3
3
  require_relative 'errors'
4
+ require 'fileutils'
4
5
  require 'json'
5
6
  require 'release_manager/puppet_module'
6
7
 
@@ -139,7 +140,17 @@ class Puppetfile
139
140
  end
140
141
  end
141
142
 
143
+ def diff(a,b)
144
+ FileUtils.compare_stream(a,b)
145
+ end
146
+
147
+ # @return [Boolean] - true if writing to file occurred, false otherwise
142
148
  def write_to_file
149
+ contents = to_s
150
+ a = StringIO.new(contents)
151
+ b = File.new(puppetfile)
152
+ # do not write to the file if nothing changed
153
+ return false if FileUtils.compare_stream(a,b)
143
154
  File.write(puppetfile, to_s)
144
155
  end
145
156
 
@@ -250,17 +250,3 @@ module ReleaseManager
250
250
  end
251
251
  end
252
252
  end
253
-
254
- #class Gitlab::Client
255
- # monkey patch correct api method until next version is released
256
- # module Commits
257
- # def create_commit(project, branch, message, actions, options={})
258
- # payload = {
259
- # branch: branch,
260
- # commit_message: message,
261
- # actions: actions,
262
- # }.merge(options)
263
- # post("/projects/#{url_encode project}/repository/commits", body: payload)
264
- # end
265
- # end
266
- #end
@@ -1,3 +1,3 @@
1
1
  module ReleaseManager
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: release_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Osman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-03 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gitlab