groundskeeper-bitcore 0.3.6 → 0.3.7
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/.travis.yml +3 -1
- data/README.md +0 -8
- data/groundskeeper.gemspec +1 -1
- data/lib/groundskeeper.rb +0 -1
- data/lib/groundskeeper/commands.rb +2 -25
- data/lib/groundskeeper/executable.rb +4 -0
- data/lib/groundskeeper/git.rb +11 -0
- data/lib/groundskeeper/project.rb +7 -19
- data/lib/groundskeeper/version.rb +1 -1
- metadata +6 -6
- data/lib/groundskeeper/git_hub.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 809d12859add61d5a82c2e9f55d773b9ed88e42aa7440a4e8b95bc42758b32cc
|
4
|
+
data.tar.gz: ca191ff7c1db6a185ead9b4c1e643627437d150286f9f0f71c013c31752e8a32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fca0e0631f1a3db3f0117acd1b274a01c68ed2a36cdf9f63bc472133b9d09c65e79d077fb14c64b2ca95291aa097ca4f2ac1279ac4e63883263a98ea70fbb84e
|
7
|
+
data.tar.gz: 2911246a9f12b19160946351a03c4ed28882c6b79546200e5f16cdbd67ef7287e8fa865ae673d6b74efef48717398e821966e1837a6ba7bea83e629c50a18d74
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -23,14 +23,6 @@ export JIRA_PASSWORD="my-password"
|
|
23
23
|
export JIRA_SITE="https://cbit123.atlassian.net"
|
24
24
|
```
|
25
25
|
|
26
|
-
You also need to add a GitHub API Token with `repo` scope to your `bash_profile`.
|
27
|
-
You can create one [here](https://github.com/settings/tokens) if you don't have
|
28
|
-
one already.
|
29
|
-
|
30
|
-
```bash
|
31
|
-
export GITHUB_API_TOKEN="my-github-api-token"
|
32
|
-
```
|
33
|
-
|
34
26
|
For integration with Sentry, find or create your auth token
|
35
27
|
[from here](https://sentry.io/settings/account/api/auth-tokens/) with the scopes `event:admin, event:read, member:read, org:read, project:read, project:releases, team:read`:
|
36
28
|
|
data/groundskeeper.gemspec
CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = "ground"
|
32
32
|
spec.require_paths = %w[lib config]
|
33
33
|
|
34
|
-
spec.add_dependency "jira-ruby", "~> 1.
|
34
|
+
spec.add_dependency "jira-ruby", "~> 1.6"
|
35
35
|
spec.add_dependency "mina", "~> 1.2"
|
36
36
|
spec.add_dependency "mina-whenever", "~> 1.0.1"
|
37
37
|
spec.add_dependency "thor", "~> 0.19"
|
data/lib/groundskeeper.rb
CHANGED
@@ -6,7 +6,6 @@ require "groundskeeper/commands"
|
|
6
6
|
require "groundskeeper/document"
|
7
7
|
require "groundskeeper/executable"
|
8
8
|
require "groundskeeper/git"
|
9
|
-
require "groundskeeper/git_hub"
|
10
9
|
require "groundskeeper/jira"
|
11
10
|
require "groundskeeper/project"
|
12
11
|
require "groundskeeper/rails_version"
|
@@ -25,10 +25,6 @@ module Groundskeeper
|
|
25
25
|
project = Project.build(repository.name)
|
26
26
|
deploy_url = "https://#{project.full_dns(stage)}"
|
27
27
|
website = Website.new(deploy_url)
|
28
|
-
git_hub = GitHub.build(
|
29
|
-
username: project.source_control_username,
|
30
|
-
repository_name: repository.name
|
31
|
-
)
|
32
28
|
sentry = Sentry.build(
|
33
29
|
project_name: project.sentry_project,
|
34
30
|
version_prefix: repository.name
|
@@ -38,7 +34,6 @@ module Groundskeeper
|
|
38
34
|
changelog: Changelog.build,
|
39
35
|
console: console,
|
40
36
|
git: Git.build,
|
41
|
-
git_hub: git_hub,
|
42
37
|
jira: Jira.build(project.jira_prefix),
|
43
38
|
project: project,
|
44
39
|
repository: repository,
|
@@ -59,7 +54,6 @@ module Groundskeeper
|
|
59
54
|
changelog: nil,
|
60
55
|
console:,
|
61
56
|
git: nil,
|
62
|
-
git_hub: nil,
|
63
57
|
jira: nil,
|
64
58
|
project: nil,
|
65
59
|
repository: nil,
|
@@ -71,7 +65,6 @@ module Groundskeeper
|
|
71
65
|
@changelog = changelog
|
72
66
|
@console = console
|
73
67
|
@git = git
|
74
|
-
@git_hub = git_hub
|
75
68
|
@jira = jira
|
76
69
|
@project = project
|
77
70
|
@repository = repository
|
@@ -107,12 +100,10 @@ module Groundskeeper
|
|
107
100
|
# rubocop:enable Metrics/AbcSize
|
108
101
|
|
109
102
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
110
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
111
103
|
def release(options = {})
|
112
104
|
is_initial_release = !version_file.exists?
|
113
105
|
|
114
106
|
return missing_jira_credentials unless jira.credentials?
|
115
|
-
return missing_github_credentials unless git_hub.credentials?
|
116
107
|
return unless check_groundskeeper_version
|
117
108
|
return unrecognized_version unless version_file.rails?
|
118
109
|
|
@@ -129,10 +120,9 @@ module Groundskeeper
|
|
129
120
|
ask_create_jira_version
|
130
121
|
ask_push_with_tags
|
131
122
|
ask_add_version_to_jira_issues unless is_initial_release
|
132
|
-
open_pull_request_page
|
133
123
|
end
|
134
124
|
# rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity
|
135
|
-
# rubocop:enable Metrics/MethodLength
|
125
|
+
# rubocop:enable Metrics/MethodLength
|
136
126
|
|
137
127
|
# :nocov:
|
138
128
|
def predeploy(options = {})
|
@@ -171,7 +161,7 @@ module Groundskeeper
|
|
171
161
|
private
|
172
162
|
|
173
163
|
# collaborators
|
174
|
-
attr_reader :changelog, :console, :git, :
|
164
|
+
attr_reader :changelog, :console, :git, :jira, :project,
|
175
165
|
:repository, :rubygems, :sentry, :version_file, :website
|
176
166
|
# state
|
177
167
|
attr_reader :current_step, :did_checkout_branch, :did_push_to_remote,
|
@@ -344,19 +334,6 @@ module Groundskeeper
|
|
344
334
|
)
|
345
335
|
end
|
346
336
|
|
347
|
-
def missing_github_credentials
|
348
|
-
console.say(
|
349
|
-
"Please configure your GitHub environment variables.",
|
350
|
-
:red
|
351
|
-
)
|
352
|
-
end
|
353
|
-
|
354
|
-
def open_pull_request_page
|
355
|
-
return unless did_checkout_branch && did_push_to_remote
|
356
|
-
|
357
|
-
git_hub.open_pull_request_page(new_branch_name)
|
358
|
-
end
|
359
|
-
|
360
337
|
def new_branch_name
|
361
338
|
"v#{next_version}"
|
362
339
|
end
|
data/lib/groundskeeper/git.rb
CHANGED
@@ -9,6 +9,7 @@ module Groundskeeper
|
|
9
9
|
FETCH_WITH_TAGS = "fetch --tags"
|
10
10
|
VERSION = "--version"
|
11
11
|
TAGS_ASC = "tag -l --sort=v:refname"
|
12
|
+
TAGS_DESC = "tag -l --sort=-v:refname"
|
12
13
|
LATEST_TAG_COMMIT = "#{COMMAND} rev-list --tags --max-count=1"
|
13
14
|
LATEST_TAG_NAME =
|
14
15
|
format("describe --tags $(%<commit>s)", commit: LATEST_TAG_COMMIT)
|
@@ -23,6 +24,7 @@ module Groundskeeper
|
|
23
24
|
PUSH_HEAD_WITH_TAGS = "push origin head --tags"
|
24
25
|
PULL = "-C #{Dir.home}/%s pull"
|
25
26
|
REMOTE_URL = "-C #{Dir.home}/%s config --get remote.origin.url"
|
27
|
+
ORIGIN_URL = "config --get remote.origin.url"
|
26
28
|
|
27
29
|
attr_reader :git
|
28
30
|
|
@@ -52,6 +54,11 @@ module Groundskeeper
|
|
52
54
|
git.execute(TAGS_ASC)
|
53
55
|
end
|
54
56
|
|
57
|
+
def fetch_and_list_tags
|
58
|
+
git.execute(FETCH_WITH_TAGS)
|
59
|
+
git.execute(TAGS_DESC).split("\n")
|
60
|
+
end
|
61
|
+
|
55
62
|
def latest_tag_name_across_branches
|
56
63
|
git.execute(LATEST_TAG_NAME).chop
|
57
64
|
end
|
@@ -97,5 +104,9 @@ module Groundskeeper
|
|
97
104
|
def remote_url(name)
|
98
105
|
git.execute(format(REMOTE_URL, name))
|
99
106
|
end
|
107
|
+
|
108
|
+
def origin_url
|
109
|
+
git.execute(ORIGIN_URL).strip
|
110
|
+
end
|
100
111
|
end
|
101
112
|
end
|
@@ -6,13 +6,12 @@ require "json"
|
|
6
6
|
module Groundskeeper
|
7
7
|
# Accesses project details stored in the home directory.
|
8
8
|
class Project
|
9
|
-
attr_reader :details, :servers, :repo_name
|
9
|
+
attr_reader :details, :servers, :repo_name, :git
|
10
10
|
|
11
11
|
DETAILS_PATH = "~/.project_details/projects.yml"
|
12
12
|
SERVERS_PATH = "~/.project_details/servers.yml"
|
13
13
|
JIRA_PREFIX_KEY = "jira_prefix"
|
14
14
|
PROJECT_NAME_KEY = "name"
|
15
|
-
SOURCE_CONTROL_USERNAME_KEY = "scm_username"
|
16
15
|
FULL_DNS_KEY = "full_dns"
|
17
16
|
RVM_RUBY_VERSION_KEY = "ruby_version"
|
18
17
|
DB_ENV_VARIABLES_KEY = "db_env_variables"
|
@@ -27,7 +26,8 @@ module Groundskeeper
|
|
27
26
|
new(
|
28
27
|
projects_yaml: Document.new(DETAILS_PATH).read,
|
29
28
|
servers_yaml: Document.new(SERVERS_PATH).read,
|
30
|
-
repository_name: repository_name
|
29
|
+
repository_name: repository_name,
|
30
|
+
git: Git.build
|
31
31
|
)
|
32
32
|
end
|
33
33
|
|
@@ -39,11 +39,12 @@ module Groundskeeper
|
|
39
39
|
end
|
40
40
|
# :nocov:
|
41
41
|
|
42
|
-
def initialize(projects_yaml:, servers_yaml:, repository_name:)
|
42
|
+
def initialize(projects_yaml:, servers_yaml:, repository_name:, git: nil)
|
43
43
|
projects = YAML.safe_load(projects_yaml) || {}
|
44
44
|
@details = projects[repository_name] || {}
|
45
45
|
@servers = YAML.safe_load(servers_yaml) || {}
|
46
46
|
@repo_name = repository_name
|
47
|
+
@git = git
|
47
48
|
end
|
48
49
|
|
49
50
|
def project_name
|
@@ -54,10 +55,6 @@ module Groundskeeper
|
|
54
55
|
details[JIRA_PREFIX_KEY] || ""
|
55
56
|
end
|
56
57
|
|
57
|
-
def source_control_username
|
58
|
-
details[SOURCE_CONTROL_USERNAME_KEY] || ""
|
59
|
-
end
|
60
|
-
|
61
58
|
def full_dns(stage)
|
62
59
|
details.dig(FULL_DNS_KEY, stage.to_s) || ""
|
63
60
|
end
|
@@ -116,7 +113,7 @@ module Groundskeeper
|
|
116
113
|
|
117
114
|
# :nocov:
|
118
115
|
def repo_url
|
119
|
-
|
116
|
+
git.origin_url
|
120
117
|
end
|
121
118
|
# :nocov:
|
122
119
|
|
@@ -128,16 +125,7 @@ module Groundskeeper
|
|
128
125
|
|
129
126
|
# :nocov:
|
130
127
|
def tags
|
131
|
-
|
132
|
-
"#{source_control_username}/#{repo_name}/tags"
|
133
|
-
authorization_header = "Authorization: token #{ENV['GITHUB_API_TOKEN']}"
|
134
|
-
response = JSON.parse(`curl -s -H "#{authorization_header}" #{api_url}`)
|
135
|
-
unless response.is_a?(Array)
|
136
|
-
message = response["message"]
|
137
|
-
puts "Failed to obtain response: #{message}"
|
138
|
-
return []
|
139
|
-
end
|
140
|
-
response.map { |h| h["name"] }
|
128
|
+
git.fetch_and_list_tags
|
141
129
|
end
|
142
130
|
# :nocov:
|
143
131
|
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.3.
|
4
|
+
version: 0.3.7
|
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-
|
12
|
+
date: 2019-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jira-ruby
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '1.
|
20
|
+
version: '1.6'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '1.
|
27
|
+
version: '1.6'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: mina
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,7 +175,6 @@ files:
|
|
175
175
|
- lib/groundskeeper/document.rb
|
176
176
|
- lib/groundskeeper/executable.rb
|
177
177
|
- lib/groundskeeper/git.rb
|
178
|
-
- lib/groundskeeper/git_hub.rb
|
179
178
|
- lib/groundskeeper/jira.rb
|
180
179
|
- lib/groundskeeper/project.rb
|
181
180
|
- lib/groundskeeper/rails_version.rb
|
@@ -207,7 +206,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
206
|
- !ruby/object:Gem::Version
|
208
207
|
version: '0'
|
209
208
|
requirements: []
|
210
|
-
|
209
|
+
rubyforge_project:
|
210
|
+
rubygems_version: 2.7.7
|
211
211
|
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: A gem for managing releases and deployments.
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Groundskeeper
|
4
|
-
# Wraps an interface to GitHub.
|
5
|
-
class GitHub
|
6
|
-
attr_reader :opener, :username, :repository_name
|
7
|
-
|
8
|
-
GITHUB_API_TOKEN = "GITHUB_API_TOKEN"
|
9
|
-
COMMAND = "open"
|
10
|
-
URL_BASE = "https://github.com/"
|
11
|
-
|
12
|
-
def self.build(username:, repository_name:)
|
13
|
-
new(
|
14
|
-
opener: Executable.new(COMMAND),
|
15
|
-
username: username,
|
16
|
-
repository_name: repository_name
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
def initialize(opener:, username:, repository_name:)
|
21
|
-
@opener = opener
|
22
|
-
@username = username
|
23
|
-
@repository_name = repository_name
|
24
|
-
end
|
25
|
-
|
26
|
-
def open_pull_request_page(branch_name)
|
27
|
-
url = "#{URL_BASE}#{username}/#{repository_name}/compare/" \
|
28
|
-
"#{branch_name}?expand=1"
|
29
|
-
|
30
|
-
opener.execute(url)
|
31
|
-
end
|
32
|
-
|
33
|
-
def credentials?
|
34
|
-
ENV[GITHUB_API_TOKEN].present?
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|