groundskeeper-bitcore 0.3.2 → 0.3.3

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: 1a6720f0999695735f6151edd0cb2cfa7ee92d7b
4
- data.tar.gz: a954fe744717b6e1217cb23ab23cff635b604e97
3
+ metadata.gz: 79fab46f840dcb22b53fc55e4cdc362e77f393e3
4
+ data.tar.gz: bf56a82bf703d2148ec68ba65e45fad8a69f0a9d
5
5
  SHA512:
6
- metadata.gz: 1858a09df13187ccbc4056426e8bc62978bacdb27ec3f4b4f4550a29b1bdb702f2074627249396a136c51cb958ea8f652d4e135a469520d7a070d51b85ca23bf
7
- data.tar.gz: 52e5565e52a32663117d4fe68227fc8e2822168d0c3987a7aaa5fae48dbb1fd82260676b130559e1feafd3c66ce2c0fe84517fb846602c85d1226d23044bae36
6
+ metadata.gz: c1d1fe310cef1e8f3df71cc2c93af055c9e490456ef43eac0a322a47f384e3c04fbc435910fd8c5d8e72bdebb4ae219e0686eeb79180333c2b51b5225c034730
7
+ data.tar.gz: 012d6f338c90a6fed4ed6f0a8abb9ad1ddf8171c3a40d88e69169fe5b4c0ef73130da7c86163e4eee47cf8c7543bfedd1e204dfdc8a7739abe1c9b97e6fc9164
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  /tmp/
10
10
  groundskeeper-*.gem
11
11
  .byebug_history
12
+ .DS_Store
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.3 - 2018-11-16
4
+
5
+ * GROUN-17 should mark versions released in Jira after deploying to production (#83)
6
+ * GROUN-14 Add verbose flag (#82)
7
+ * GROUN-6 fix: fail elegantly if no tag is specified (#81)
8
+
3
9
  ## 0.3.2 - 2018-11-14
4
10
 
5
11
  * GROUN-2 create the initial release of a Rails application (#80)
@@ -8,7 +8,8 @@ module Groundskeeper
8
8
  attr_reader :commands
9
9
 
10
10
  class_option :simulate, desc: "Simulate mina"
11
- class_option :verbose, desc: "Run mina verbosely"
11
+ class_option :verbose, desc: "Run groundskeeper verbosely", aliases: :v,
12
+ type: :boolean
12
13
 
13
14
  def initialize(args = [], local_options = {}, config = {})
14
15
  @commands = Commands.build(self)
@@ -17,19 +18,19 @@ module Groundskeeper
17
18
 
18
19
  desc "info", "Display revision info"
19
20
  def info
20
- commands.info
21
+ commands.info options
21
22
  end
22
23
 
23
24
  desc "release", "create a new release"
24
25
  def release
25
- commands.info
26
- commands.release
26
+ commands.info options
27
+ commands.release options
27
28
  end
28
29
 
29
30
  # :nocov:
30
31
  desc "predeploy", "create configuration files for the project"
31
32
  def predeploy
32
- commands.info
33
+ commands.info options
33
34
  commands.predeploy options
34
35
  end
35
36
  # :nocov:
@@ -37,7 +38,7 @@ module Groundskeeper
37
38
  # :nocov:
38
39
  desc "deploy", "deploy the latest release"
39
40
  def deploy
40
- commands.info
41
+ commands.info options
41
42
  commands.deploy options
42
43
  end
43
44
  # :nocov:
@@ -86,9 +86,10 @@ module Groundskeeper
86
86
  # rubocop:enable Metrics/MethodLength,Metrics/ParameterLists
87
87
 
88
88
  # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
89
- def info
89
+ def info(options = {})
90
90
  return unrecognized_version unless version_file.exists?
91
91
  return unless check_groundskeeper_version
92
+ Executable.verbose = options[:verbose]
92
93
  pull_project_details
93
94
 
94
95
  announce_latest_tag
@@ -105,13 +106,14 @@ module Groundskeeper
105
106
  # rubocop:enable Metrics/AbcSize
106
107
 
107
108
  # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity
108
- def release
109
+ def release(options = {})
109
110
  is_initial_release = !version_file.exists?
110
111
 
111
112
  return missing_jira_credentials unless jira.credentials?
112
113
  return unless check_groundskeeper_version
113
114
  return unrecognized_version unless version_file.rails?
114
115
  version_file.create_initial_version! unless version_file.exists?
116
+ Executable.verbose = options[:verbose]
115
117
  pull_project_details
116
118
 
117
119
  summarize_recent_commits unless is_initial_release
@@ -129,31 +131,35 @@ module Groundskeeper
129
131
  # rubocop:enable Metrics/MethodLength
130
132
 
131
133
  # :nocov:
132
- def predeploy(options)
134
+ def predeploy(options = {})
133
135
  return unrecognized_version unless version_file.exists?
134
136
  return unless check_groundskeeper_version
137
+ Executable.verbose = options[:verbose]
135
138
  pull_project_details
136
139
 
137
140
  mina "predeploy", options
138
141
  end
139
142
  # :nocov:
140
143
 
141
- # rubocop:disable Metrics/AbcSize
142
- def deploy(options)
144
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
145
+ # rubocop:disable Metrics/MethodLength
146
+ def deploy(options = {})
143
147
  return unrecognized_version unless version_file.exists?
144
148
  return unrecognized_tag unless tag_present_in_git?(ENV[TAG])
145
149
  return missing_jira_credentials unless jira.credentials?
146
150
  return unless check_groundskeeper_version
151
+ Executable.verbose = options[:verbose]
147
152
  pull_project_details
148
-
149
153
  ENV["whenever"] = "1" if project.uses_whenever?
150
154
 
151
155
  mina "deploy", options
152
156
  announce_step "Wait for deployed application to restart"
153
157
  update_deployed_issues
158
+ release_version if self.class.stage == PRODUCTION
154
159
  add_version_to_sentry
155
160
  end
156
- # rubocop:enable Metrics/AbcSize
161
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
162
+ # rubocop:enable Metrics/MethodLength
157
163
 
158
164
  private
159
165
 
@@ -300,7 +306,7 @@ module Groundskeeper
300
306
  end
301
307
 
302
308
  def tag_present_in_git?(tag)
303
- git.list_tags.include? tag
309
+ tag.nil? ? false : git.list_tags.include?(tag)
304
310
  end
305
311
 
306
312
  def unrecognized_tag
@@ -363,6 +369,11 @@ module Groundskeeper
363
369
  end
364
370
  end
365
371
 
372
+ def release_version
373
+ jira.release_version(project, website.version)
374
+ console.say("#{project.repo_name} #{website.version} released", :green)
375
+ end
376
+
366
377
  def transition_remote_issues(version)
367
378
  version_name = "#{repository.name} #{version}"
368
379
  deployed_issues = jira.fetch_issues_by_fix_version(version_name)
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Groundskeeper
4
+ # Class to execute commands for other classes
5
+ class Executable
6
+ attr_reader :command
7
+
8
+ @verbose = false
9
+
10
+ class << self
11
+ attr_writer :verbose
12
+ end
13
+
14
+ class << self
15
+ attr_reader :verbose
16
+ end
17
+
18
+ def initialize(command)
19
+ @command = command
20
+ end
21
+
22
+ def execute(arguments)
23
+ puts "#{command} #{arguments}" if self.class.verbose
24
+ `#{command} #{arguments}`
25
+ end
26
+ end
27
+ end
@@ -24,15 +24,8 @@ module Groundskeeper
24
24
 
25
25
  attr_reader :git
26
26
 
27
- # Wraps the "git" shell command.
28
- class Executable
29
- def execute(arguments)
30
- `#{COMMAND} #{arguments}`
31
- end
32
- end
33
-
34
27
  def self.build
35
- new Executable.new
28
+ new Executable.new(COMMAND)
36
29
  end
37
30
 
38
31
  def initialize(git)
@@ -8,16 +8,9 @@ module Groundskeeper
8
8
  COMMAND = "open"
9
9
  URL_BASE = "https://github.com/"
10
10
 
11
- # Wraps the "open" shell command.
12
- class Executable
13
- def execute(arguments)
14
- `#{COMMAND} #{arguments}`
15
- end
16
- end
17
-
18
11
  def self.build(username:, repository_name:)
19
12
  new(
20
- opener: Executable.new,
13
+ opener: Executable.new(COMMAND),
21
14
  username: username,
22
15
  repository_name: repository_name
23
16
  )
@@ -71,6 +71,17 @@ module Groundskeeper
71
71
  JSON.parse(response)["issues"].map { |issue| issue["key"] }
72
72
  end
73
73
  # :nocov:
74
+
75
+ # :nocov:
76
+ def release_version(project:, version:)
77
+ version_name = "#{project.repo_name} #{version}"
78
+ client.Project
79
+ .find(project.jira_prefix)
80
+ .versions
81
+ .find { |element| element.name == version_name }
82
+ .save(released: true)
83
+ end
84
+ # :nocov:
74
85
  end
75
86
 
76
87
  def self.build(prefix)
@@ -126,5 +137,9 @@ module Groundskeeper
126
137
  client.fetch_issues_by_fix_version(version: version)
127
138
  end
128
139
  # :nocov:
140
+
141
+ def release_version(project, version)
142
+ client.release_version(project: project, version: version)
143
+ end
129
144
  end
130
145
  end
@@ -11,16 +11,9 @@ module Groundskeeper
11
11
 
12
12
  attr_reader :sentry, :project_name, :version_prefix
13
13
 
14
- # Wraps the "sentry-cli" shell command.
15
- class Executable
16
- def execute(arguments)
17
- `#{COMMAND} #{arguments}`
18
- end
19
- end
20
-
21
14
  def self.build(project_name:, version_prefix:)
22
15
  new(
23
- sentry: Executable.new,
16
+ sentry: Executable.new(COMMAND),
24
17
  project_name: project_name,
25
18
  version_prefix: version_prefix
26
19
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Groundskeeper
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
data/lib/groundskeeper.rb CHANGED
@@ -4,6 +4,7 @@ require "groundskeeper/application"
4
4
  require "groundskeeper/changelog"
5
5
  require "groundskeeper/commands"
6
6
  require "groundskeeper/document"
7
+ require "groundskeeper/executable"
7
8
  require "groundskeeper/git"
8
9
  require "groundskeeper/git_hub"
9
10
  require "groundskeeper/jira"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groundskeeper-bitcore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - BIT Core
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain:
11
11
  - certs/ericcf.pem
12
- date: 2018-11-14 00:00:00.000000000 Z
12
+ date: 2018-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jira-ruby
@@ -173,6 +173,7 @@ files:
173
173
  - lib/groundskeeper/changelog.rb
174
174
  - lib/groundskeeper/commands.rb
175
175
  - lib/groundskeeper/document.rb
176
+ - lib/groundskeeper/executable.rb
176
177
  - lib/groundskeeper/git.rb
177
178
  - lib/groundskeeper/git_hub.rb
178
179
  - lib/groundskeeper/jira.rb