groundskeeper-bitcore 0.8.0 → 0.9.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
  SHA256:
3
- metadata.gz: c42acd881127bee131fdf1527a0d2bfc514d63fb664f26302c3716d2cba974c0
4
- data.tar.gz: bc2927f60462a8b649de263a5ecc575afaf13d41424560a1963e7b28dbc2b980
3
+ metadata.gz: a313973fae89b7f987fe0b7b066866b60e4e0ec54bb0d2e8d31cbf008868bfb9
4
+ data.tar.gz: a6d2f72b2e810b91f7e1ba0b6121afc5ff3795601b428e5819c970e48931561f
5
5
  SHA512:
6
- metadata.gz: f45c5e3555520d9f9212a99145c8b568c119312c18dee4eadfd08d1837338cea7f459de29bfd4d9391af407889006313ce81203a2721bb628ad0001b6097ff7c
7
- data.tar.gz: ee6eeaf2d42a1fb2d02b703e621ede7a68d1679344bb3dceb38a1a44c7ef8957d0c84ec80ddc8da62328d528f24bac7ad2cbdd707f223bbb184ab9c6b25e1f9c
6
+ metadata.gz: e5b84247121dfe9e4383ec835f8396508983da48afdc454792c64a8df5837dbad9d69f9a23f5f30b88cd9d04042c722d7afefe900beb64773a7ccfd6942e7575
7
+ data.tar.gz: 349a4fb05d2be8b770f68f9e0e4f5ef31e666b03776615b16bd03134e326af9e1d8668b2442667e1a9074485b53c0db5a7e526defcf0990a4890b756d3a04c9c
@@ -9,33 +9,33 @@ AllCops:
9
9
  - bin/**/*
10
10
  TargetRubyVersion: 2.4
11
11
 
12
- AbcSize:
12
+ Metrics/AbcSize:
13
13
  Exclude:
14
14
  - test/**/*
15
15
 
16
- BlockLength:
16
+ Metrics/BlockLength:
17
17
  Exclude:
18
18
  - groundskeeper.gemspec
19
19
 
20
- ClassLength:
20
+ Metrics/ClassLength:
21
21
  Exclude:
22
22
  - test/**/*
23
23
 
24
- EmptyLineBetweenDefs:
24
+ Layout/EmptyLineBetweenDefs:
25
25
  Exclude:
26
26
  - test/**/*
27
27
 
28
- MethodLength:
28
+ Metrics/MethodLength:
29
29
  Exclude:
30
30
  - test/**/*
31
31
 
32
- NestedMethodDefinition:
32
+ Lint/NestedMethodDefinition:
33
33
  Exclude:
34
34
  - test/**/*
35
35
 
36
- SingleLineMethods:
36
+ Style/SingleLineMethods:
37
37
  Exclude:
38
38
  - test/**/*
39
39
 
40
- StringLiterals:
40
+ Style/StringLiterals:
41
41
  EnforcedStyle: double_quotes
@@ -1 +1 @@
1
- 2.4.1
1
+ 2.6.2
@@ -1,4 +1,4 @@
1
- image: 'isgmhradd/rails-ruby24:2019-04-02'
1
+ image: 'isgmhradd/rails-ruby26:2019-10-07'
2
2
 
3
3
  pipelines:
4
4
  default:
@@ -13,23 +13,6 @@ def load_project
13
13
  invoke :before_run unless fetch(:project)
14
14
  end
15
15
 
16
- # Basic settings:
17
- # domain - The hostname to SSH to.
18
- # deploy_to - Path to deploy into.
19
- # repository - Git repo to clone from. (needed by mina/git)
20
- # branch - Branch name to deploy. (needed by mina/git)
21
-
22
- # set :application_name, 'foobar'
23
- # set :domain, 'foobar.com'
24
- # set :deploy_to, '/var/www/foobar.com'
25
- # set :repository, 'git://...'
26
- # set :branch, 'master'
27
-
28
- # Optional settings:
29
- # set :user, 'foobar' # Username in the server to SSH to.
30
- # set :port, '30000' # SSH port number.
31
- # set :forward_agent, true # SSH forward_agent.
32
-
33
16
  # Shared dirs and files will be symlinked into the app-folder by the
34
17
  # 'deploy:link_shared_paths' step. Some plugins already add folders to
35
18
  # shared_dirs like `mina/rails` add `public/assets`, `vendor/bundle` and many
@@ -41,6 +24,7 @@ set :shared_dirs, fetch(:shared_dirs, []).push(
41
24
  "tmp/cache",
42
25
  "tmp/sockets",
43
26
  "bundle",
27
+ "public/packs",
44
28
  "public/system",
45
29
  "storage"
46
30
  )
@@ -51,6 +35,10 @@ set :shared_files, fetch(:shared_files, []).push(
51
35
  "config/master.key"
52
36
  )
53
37
 
38
+ # Each deploy, these directories will be checked for changes. If changes are
39
+ # detected, assets will be precompiled. Otherwise that step will be skipped.
40
+ set :asset_dirs, ["app/javascript/"]
41
+
54
42
  # This task is the environment that is loaded for all remote run commands, such
55
43
  # as `mina deploy` or `mina rake`.
56
44
  task :environment do
@@ -13,6 +13,7 @@ require "groundskeeper/repository"
13
13
  require "groundskeeper/rubygems"
14
14
  require "groundskeeper/semantic_version"
15
15
  require "groundskeeper/sentry"
16
+ require "groundskeeper/ssh"
16
17
  require "groundskeeper/string_utils"
17
18
  require "groundskeeper/version"
18
19
  require "groundskeeper/website"
@@ -22,7 +22,7 @@ module Groundskeeper
22
22
  @date = date
23
23
  end
24
24
 
25
- # rubocop:disable Performance/RedundantMatch
25
+ # rubocop:disable Performance/RedundantMatch,Performance/RegexpMatch
26
26
  def update_file(version, changes)
27
27
  unless document.match(/(#{TITLE_EXPRESSION})/)
28
28
  document.prepend_file("#{TITLE_EXPRESSION}\n\n")
@@ -31,7 +31,7 @@ module Groundskeeper
31
31
  document
32
32
  .append_to_file(TITLE_EXPRESSION, version_template(version, changes))
33
33
  end
34
- # rubocop:enable Performance/RedundantMatch
34
+ # rubocop:enable Performance/RedundantMatch,Performance/RegexpMatch
35
35
 
36
36
  private
37
37
 
@@ -18,6 +18,7 @@ module Groundskeeper
18
18
  DEFAULT_STAGE = STAGING
19
19
  TAG = "tag"
20
20
  INITIAL_VERSION = "0.0.1"
21
+ SSH_USERNAME = "deploy"
21
22
 
22
23
  # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
23
24
  def self.build(console)
@@ -29,6 +30,7 @@ module Groundskeeper
29
30
  project_name: project.sentry_project,
30
31
  version_prefix: repository.name
31
32
  )
33
+ ssh = Ssh.build(SSH_USERNAME, project.full_dns(stage))
32
34
 
33
35
  new(
34
36
  changelog: Changelog.build,
@@ -39,6 +41,7 @@ module Groundskeeper
39
41
  repository: repository,
40
42
  rubygems: Rubygems,
41
43
  sentry: sentry,
44
+ ssh: ssh,
42
45
  version_file: RailsVersion.build,
43
46
  website: website
44
47
  )
@@ -59,6 +62,7 @@ module Groundskeeper
59
62
  repository: nil,
60
63
  rubygems: nil,
61
64
  sentry: nil,
65
+ ssh: nil,
62
66
  website: nil,
63
67
  version_file:
64
68
  )
@@ -70,6 +74,7 @@ module Groundskeeper
70
74
  @repository = repository
71
75
  @rubygems = rubygems
72
76
  @sentry = sentry
77
+ @ssh = ssh
73
78
  @website = website
74
79
  @version_file = version_file
75
80
  @did_push_to_remote = false
@@ -111,14 +116,14 @@ module Groundskeeper
111
116
  pull_project_details
112
117
 
113
118
  summarize_recent_commits unless is_initial_release
114
- ask_next_version(is_initial_release)
119
+ say_next_version(is_initial_release)
115
120
  checkout_new_branch
116
121
  update_version_file
117
122
  update_changelog
118
123
  commit_changes_and_tag(is_initial_release)
119
- ask_create_jira_version
120
- ask_push
121
- ask_add_version_to_jira_issues unless is_initial_release
124
+ create_jira_version
125
+ push
126
+ add_version_to_jira_issues unless is_initial_release
122
127
  end
123
128
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
124
129
  # rubocop:enable Metrics/MethodLength
@@ -143,6 +148,7 @@ module Groundskeeper
143
148
  return missing_jira_credentials unless jira.credentials?
144
149
  return missing_sentry_credentials unless sentry.credentials?
145
150
  return unless check_groundskeeper_version
151
+ return unable_to_ssh unless ssh.can_connect?
146
152
 
147
153
  Executable.verbose = options[:verbose]
148
154
  pull_project_details
@@ -161,7 +167,7 @@ module Groundskeeper
161
167
 
162
168
  # collaborators
163
169
  attr_reader :changelog, :console, :git, :jira, :project,
164
- :repository, :rubygems, :sentry, :version_file, :website
170
+ :repository, :rubygems, :sentry, :ssh, :version_file, :website
165
171
  # state
166
172
  attr_reader :current_step, :did_push_to_remote, :next_version,
167
173
  :recent_commits
@@ -219,13 +225,11 @@ module Groundskeeper
219
225
  console.say("")
220
226
  end
221
227
 
222
- def ask_next_version(is_initial_release)
228
+ def say_next_version(is_initial_release)
223
229
  if is_initial_release
224
230
  @next_version = INITIAL_VERSION
225
231
  else
226
- type = console.ask("Major, minor, or patch release?",
227
- :cyan,
228
- limited_to: %w[M m p])
232
+ type = "m"
229
233
  @next_version = repository.bumped_semantic_version(type)
230
234
  end
231
235
 
@@ -252,33 +256,19 @@ module Groundskeeper
252
256
  console.say("# committed changes", :green)
253
257
  end
254
258
 
255
- def ask_create_jira_version
256
- create_jira_version =
257
- console.yes?("Create version #{next_version} in Jira? [y, n]", :cyan)
258
- jira.create_remote_version(next_jira_version_name) if create_jira_version
259
+ def create_jira_version
260
+ jira.create_remote_version(next_jira_version_name)
259
261
  end
260
262
 
261
- def ask_push
262
- @did_push_to_remote = console.yes?(
263
- "Push to remote with tags? [y, n]",
264
- :cyan
265
- )
266
- git.push && console.say("# pushed") if @did_push_to_remote
263
+ def push
264
+ @did_push_to_remote = true
265
+ git.push && console.say("# pushed to version control")
267
266
  end
268
267
 
269
- def ask_add_version_to_jira_issues
268
+ def add_version_to_jira_issues
270
269
  issue_ids = jira.included_issues(recent_commits)
271
- add_version_to_jira_issues = console.yes?(
272
- "Add #{next_jira_version_name} to #{issue_ids}? [y, n]",
273
- :cyan
274
- )
275
-
276
- return unless add_version_to_jira_issues
277
-
278
- # :nocov:
279
270
  jira.add_version_to_remote_issues(next_jira_version_name, issue_ids)
280
- console.say("# added version to Jira issues", :green)
281
- # :nocov:
271
+ console.say("# added version to Jira issues #{issue_ids}", :green)
282
272
  end
283
273
 
284
274
  def next_jira_version_name
@@ -325,6 +315,13 @@ module Groundskeeper
325
315
  )
326
316
  end
327
317
 
318
+ def unable_to_ssh
319
+ console.say(
320
+ "Unable to SSH to the server, are you signed into VPN?",
321
+ :red
322
+ )
323
+ end
324
+
328
325
  def new_branch_name
329
326
  "release/#{next_version}"
330
327
  end
@@ -342,6 +339,7 @@ module Groundskeeper
342
339
  end
343
340
  end
344
341
 
342
+ # rubocop:disable Metrics/MethodLength
345
343
  def update_deployed_issues
346
344
  announce_step(
347
345
  "Check deployed version at #{website.uri}/#{Website::VERSION_PATH}"
@@ -353,10 +351,15 @@ module Groundskeeper
353
351
  transition_remote_issues deployed_version
354
352
  else
355
353
  # :nocov:
356
- console.say("something went wrong", :red)
354
+ console.say(
355
+ "something went wrong: expected version #{ENV[TAG]}, " \
356
+ "found version #{deployed_version} instead",
357
+ :red
358
+ )
357
359
  # :nocov:
358
360
  end
359
361
  end
362
+ # rubocop:enable Metrics/MethodLength
360
363
 
361
364
  # :nocov:
362
365
  def release_version
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Groundskeeper
4
+ # Wraps ssh executable.
5
+ class Ssh
6
+ COMMAND = "ssh"
7
+ DEFAULT_CONNECT_TIMEOUT_IN_S = 5
8
+ # ssh arguments
9
+ CONNECT_WITH_TIMEOUT = "-o ConnectTimeout=#{DEFAULT_CONNECT_TIMEOUT_IN_S}"
10
+ REMOTE_ECHO =
11
+ "%<options>s %<username>s@%<domain_name>s \"echo 'groundskeeper'\""
12
+
13
+ attr_reader :domain_name, :ssh, :username
14
+
15
+ def self.build(username, domain_name)
16
+ new Executable.new(COMMAND), username, domain_name
17
+ end
18
+
19
+ def initialize(ssh, username, domain_name)
20
+ @ssh = ssh
21
+ @username = username
22
+ @domain_name = domain_name
23
+ end
24
+
25
+ def can_connect?
26
+ ssh.execute(format(REMOTE_ECHO,
27
+ options: CONNECT_WITH_TIMEOUT,
28
+ username: username,
29
+ domain_name: domain_name)).strip == "groundskeeper"
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Groundskeeper
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
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.8.0
4
+ version: 0.9.0
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: 2019-06-10 00:00:00.000000000 Z
12
+ date: 2019-11-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jira-ruby
@@ -196,6 +196,7 @@ files:
196
196
  - lib/groundskeeper/rubygems.rb
197
197
  - lib/groundskeeper/semantic_version.rb
198
198
  - lib/groundskeeper/sentry.rb
199
+ - lib/groundskeeper/ssh.rb
199
200
  - lib/groundskeeper/string_utils.rb
200
201
  - lib/groundskeeper/version.rb
201
202
  - lib/groundskeeper/website.rb
@@ -220,7 +221,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
221
  - !ruby/object:Gem::Version
221
222
  version: '0'
222
223
  requirements: []
223
- rubygems_version: 3.0.2
224
+ rubygems_version: 3.0.6
224
225
  signing_key:
225
226
  specification_version: 4
226
227
  summary: A gem for managing releases and deployments.