bard 0.51.1 → 0.52.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/install_files/specified_ruby.rb +5 -1
- data/lib/bard/ci/github_actions.rb +55 -2
- data/lib/bard/ci.rb +1 -1
- data/lib/bard/version.rb +1 -1
- data/lib/bard.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ab90b5029209584ea96d267fe90cee5a47840e66c7b4120b7b29a7d518c1b1f
|
4
|
+
data.tar.gz: 218539e104b1c65cb46831c6768fbdd846b2f6e2145e7292d792b1af423cef18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6049732d522d95c9e803f3ae0ecb01f1a830fde0951efa22cdeba621acdd29013bce9717b49ca83b8e58049abb0e106d6dea23cf989515fc9ccb0ab1360cd232
|
7
|
+
data.tar.gz: 944edde30fa1234c62813a769c6e1d849ab30b7bd5c16a945ab608f55411fb70c86821600274ee5010b65ff13da3ea9821283c62c7a00b969aa7510095045f1f
|
@@ -49,7 +49,11 @@ module SpecifiedRuby
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def restart
|
52
|
-
|
52
|
+
command = "rvm-exec #{$0}"
|
53
|
+
unless %w[staging production].include?(ENV["RAILS_ENV"])
|
54
|
+
command += " && rvm-exec $SHELL"
|
55
|
+
end
|
56
|
+
exec command
|
53
57
|
end
|
54
58
|
end
|
55
59
|
|
@@ -7,7 +7,6 @@ class Bard::CLI < Thor
|
|
7
7
|
class CI
|
8
8
|
class GithubActions < Struct.new(:project_name, :branch, :sha)
|
9
9
|
def run
|
10
|
-
api = API.new(project_name)
|
11
10
|
last_time_elapsed = api.last_successful_run&.time_elapsed
|
12
11
|
@run = api.create_run!(branch)
|
13
12
|
|
@@ -33,7 +32,33 @@ class Bard::CLI < Thor
|
|
33
32
|
def last_response
|
34
33
|
end
|
35
34
|
|
35
|
+
def status
|
36
|
+
last_run = api.last_run
|
37
|
+
if last_run.building?
|
38
|
+
puts "Building..."
|
39
|
+
elsif last_run.success?
|
40
|
+
puts "Succeeded!"
|
41
|
+
elsif last_run.failure?
|
42
|
+
puts "Failed!\n\n#{last_run.console}"
|
43
|
+
else
|
44
|
+
raise "Unknown job status: #{last_run.inspect}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def api
|
51
|
+
@api ||= API.new(project_name)
|
52
|
+
end
|
53
|
+
|
36
54
|
class API < Struct.new(:project_name)
|
55
|
+
def last_run
|
56
|
+
response = client.get("runs", event: "workflow_dispatch", per_page: 1)
|
57
|
+
if json = response["workflow_runs"][0]
|
58
|
+
Run.new(self, json)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
37
62
|
def last_successful_run
|
38
63
|
successful_runs = client.get("runs", event: "workflow_dispatch", status: "success", per_page: 1)
|
39
64
|
if json = successful_runs["workflow_runs"][0]
|
@@ -92,7 +117,11 @@ class Bard::CLI < Thor
|
|
92
117
|
end
|
93
118
|
|
94
119
|
def success?
|
95
|
-
|
120
|
+
status == "completed" && conclusion == "success"
|
121
|
+
end
|
122
|
+
|
123
|
+
def failure?
|
124
|
+
conclusion == "failure"
|
96
125
|
end
|
97
126
|
|
98
127
|
def job
|
@@ -102,6 +131,30 @@ class Bard::CLI < Thor
|
|
102
131
|
def console
|
103
132
|
job.logs
|
104
133
|
end
|
134
|
+
|
135
|
+
def branch
|
136
|
+
json["head_branch"]
|
137
|
+
end
|
138
|
+
|
139
|
+
def sha
|
140
|
+
json["head_sha"]
|
141
|
+
end
|
142
|
+
|
143
|
+
def status
|
144
|
+
json["status"]
|
145
|
+
end
|
146
|
+
|
147
|
+
def conclusion
|
148
|
+
json["conclusion"]
|
149
|
+
end
|
150
|
+
|
151
|
+
def started_at
|
152
|
+
Time.parse(json["run_started_at"])
|
153
|
+
end
|
154
|
+
|
155
|
+
def updated_at
|
156
|
+
Time.parse(json["updated_at"])
|
157
|
+
end
|
105
158
|
end
|
106
159
|
|
107
160
|
class Job < Struct.new(:api, :json)
|
data/lib/bard/ci.rb
CHANGED
data/lib/bard/version.rb
CHANGED
data/lib/bard.rb
CHANGED
@@ -84,11 +84,13 @@ class Bard::CLI < Thor
|
|
84
84
|
ping to
|
85
85
|
end
|
86
86
|
|
87
|
-
method_options %w[verbose -v] => :boolean, %w[local-ci -l] => :boolean
|
87
|
+
method_options %w[verbose -v] => :boolean, %w[local-ci -l] => :boolean, %w[status -s] => :boolean
|
88
88
|
desc "ci [BRANCH=HEAD]", "runs ci against BRANCH"
|
89
89
|
def ci branch=Git.current_branch
|
90
90
|
ci = CI.new(project_name, branch, local: options["local-ci"])
|
91
91
|
if ci.exists?
|
92
|
+
return puts ci.status if options["status"]
|
93
|
+
|
92
94
|
puts "Continuous integration: starting build on #{branch}..."
|
93
95
|
|
94
96
|
success = ci.run do |elapsed_time, last_time|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.52.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Micah Geisel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -179,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
requirements: []
|
182
|
-
rubygems_version: 3.
|
182
|
+
rubygems_version: 3.2.32
|
183
183
|
signing_key:
|
184
184
|
specification_version: 4
|
185
185
|
summary: CLI to automate common development tasks.
|