yes_ship_it 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/MIT-LICENSE +17 -0
- data/assertions/built_gem.rb +4 -10
- data/assertions/change_log.rb +6 -12
- data/assertions/published_gem.rb +7 -13
- data/assertions/pushed_code.rb +4 -6
- data/assertions/pushed_tag.rb +4 -6
- data/assertions/release_archive.rb +9 -14
- data/assertions/release_branch.rb +3 -4
- data/assertions/submitted_rpm.rb +21 -35
- data/assertions/tag.rb +5 -7
- data/assertions/version.rb +10 -6
- data/assertions/working_directory.rb +3 -4
- data/assertions/yes_it_shipped.rb +6 -12
- data/bin/yes_ship_it +23 -10
- data/lib/version.rb +1 -1
- data/lib/yes_ship_it/assertion.rb +9 -3
- data/lib/yes_ship_it/dry_executor.rb +15 -0
- data/lib/yes_ship_it/engine.rb +30 -18
- data/lib/yes_ship_it/exceptions.rb +3 -0
- data/lib/yes_ship_it/executor.rb +37 -0
- data/lib/yes_ship_it/git.rb +8 -7
- data/lib/yes_ship_it/init.rb +50 -0
- data/lib/yes_ship_it/plugin.rb +76 -0
- data/lib/yes_ship_it.rb +4 -0
- data/spec/data/init/ruby/lib/version.rb +3 -0
- data/spec/data/plugins/my_other_plugin.rb +14 -0
- data/spec/data/plugins/my_plugin.rb +14 -0
- data/spec/data/version/polkaversion.h +1 -0
- data/spec/data/yes_ship_it.plugins.conf +4 -0
- data/spec/integration/cli_spec.rb +155 -3
- data/spec/spec_helper.rb +2 -0
- data/spec/system/data/red_herring-checkout-dry-run.tar.gz +0 -0
- data/spec/system/data/red_herring-checkout-rpm.tar.gz +0 -0
- data/spec/system/dry_run_spec.rb +59 -0
- data/spec/system/rpm_spec.rb +62 -0
- data/spec/system/ruby_gem_spec.rb +2 -3
- data/spec/unit/assertion_spec.rb +11 -1
- data/spec/unit/assertions/change_log_spec.rb +6 -2
- data/spec/unit/assertions/published_gem_spec.rb +6 -4
- data/spec/unit/assertions/pushed_code_spec.rb +1 -1
- data/spec/unit/assertions/version_spec.rb +5 -0
- data/spec/unit/assertions/yes_it_shipped_spec.rb +1 -1
- data/spec/unit/dry_executor_spec.rb +5 -0
- data/spec/unit/engine_spec.rb +16 -0
- data/spec/unit/executor_spec.rb +26 -0
- data/spec/unit/git_spec.rb +5 -4
- data/spec/unit/init_spec.rb +49 -0
- data/spec/unit/plugin_spec.rb +18 -0
- data/spec/unit/support/assertion_examples.rb +4 -4
- data/spec/unit/support/executor_examples.rb +17 -0
- metadata +23 -3
@@ -117,8 +117,6 @@ EOT
|
|
117
117
|
it "tells how to login" do
|
118
118
|
@client.execute(["yes_ship_it.ruby2.1"], working_directory: "red_herring")
|
119
119
|
|
120
|
-
expect(@client.exit_code).to eq(1)
|
121
|
-
|
122
120
|
expected_output = <<EOT
|
123
121
|
Shipping...
|
124
122
|
|
@@ -134,8 +132,9 @@ Asserting published gem: error
|
|
134
132
|
|
135
133
|
Ran into an error. Stopping shipping.
|
136
134
|
EOT
|
135
|
+
expect(@client.err).to eq("")
|
137
136
|
expect(@client.out).to eq(expected_output)
|
138
|
-
expect(@client.
|
137
|
+
expect(@client.exit_code).to eq(1)
|
139
138
|
end
|
140
139
|
end
|
141
140
|
end
|
data/spec/unit/assertion_spec.rb
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
require_relative "spec_helper"
|
2
2
|
|
3
3
|
describe YSI::Assertion do
|
4
|
+
describe ".class_name" do
|
5
|
+
it "converts simple name" do
|
6
|
+
expect(YSI::Assertion.class_name("simple")).to eq ("Simple")
|
7
|
+
end
|
8
|
+
|
9
|
+
it "converts multi-word name" do
|
10
|
+
expect(YSI::Assertion.class_name("multi_word")).to eq ("MultiWord")
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
4
14
|
describe ".class_for_name" do
|
5
15
|
it "creates VersionNumber class" do
|
6
16
|
expect(YSI::Assertion.class_for_name("version")).
|
@@ -18,7 +28,7 @@ describe YSI::Assertion do
|
|
18
28
|
parameter :some_thing
|
19
29
|
parameter :some_other_thing, "default_hello"
|
20
30
|
|
21
|
-
def display_name
|
31
|
+
def self.display_name
|
22
32
|
"My Assertion"
|
23
33
|
end
|
24
34
|
|
@@ -6,7 +6,9 @@ describe YSI::ChangeLog do
|
|
6
6
|
engine = YSI::Engine.new
|
7
7
|
engine.version = "1.2.3"
|
8
8
|
a = YSI::ChangeLog.new(engine)
|
9
|
-
expect
|
9
|
+
expect {
|
10
|
+
a.check_content("")
|
11
|
+
}.to raise_error("Can't find version 1.2.3 in change log")
|
10
12
|
end
|
11
13
|
|
12
14
|
it "when no version" do
|
@@ -20,7 +22,9 @@ describe YSI::ChangeLog do
|
|
20
22
|
|
21
23
|
* Some changes
|
22
24
|
EOT
|
23
|
-
expect
|
25
|
+
expect {
|
26
|
+
a.check_content(content)
|
27
|
+
}.to raise_error("Can't find version 1.2.3 in change log")
|
24
28
|
end
|
25
29
|
|
26
30
|
it "when all info is there" do
|
@@ -2,13 +2,15 @@ require_relative "../spec_helper.rb"
|
|
2
2
|
|
3
3
|
describe YSI::PublishedGem do
|
4
4
|
describe "#assert" do
|
5
|
-
it "
|
6
|
-
engine = YSI::Engine
|
5
|
+
it "raises AssertionError if there is an error" do
|
6
|
+
engine = YSI::Engine.new
|
7
7
|
allow(engine).to receive(:project_name).and_return("IdontExist")
|
8
8
|
allow(engine).to receive(:version).and_return("0.0")
|
9
|
-
assertion = YSI::PublishedGem.new(
|
9
|
+
assertion = YSI::PublishedGem.new(engine)
|
10
10
|
|
11
|
-
expect
|
11
|
+
expect {
|
12
|
+
assertion.assert(engine.executor)
|
13
|
+
}.to raise_error(YSI::AssertionError)
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -14,7 +14,7 @@ describe YSI::PushedCode do
|
|
14
14
|
assertion = YSI::PushedCode.new(engine)
|
15
15
|
Dir.chdir(File.join(dir, "red_herring")) do
|
16
16
|
expect(assertion.check).to be(nil)
|
17
|
-
expect(assertion.assert).to eq "pushed"
|
17
|
+
expect(assertion.assert(engine.executor)).to eq "pushed"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/spec/unit/engine_spec.rb
CHANGED
@@ -149,4 +149,20 @@ EOT
|
|
149
149
|
expect(@engine.config_url).to eq("https://raw.githubusercontent.com/cornelius/red_herring/master/yes_ship_it.conf")
|
150
150
|
end
|
151
151
|
end
|
152
|
+
|
153
|
+
describe "dry run" do
|
154
|
+
it "creates real executor by default" do
|
155
|
+
expect(subject.executor.class).to be(YSI::Executor)
|
156
|
+
end
|
157
|
+
|
158
|
+
it "sets dry run" do
|
159
|
+
subject.dry_run = true
|
160
|
+
expect(subject.executor.class).to be(YSI::DryExecutor)
|
161
|
+
end
|
162
|
+
|
163
|
+
it "unsets dry run" do
|
164
|
+
subject.dry_run = false
|
165
|
+
expect(subject.executor.class).to be(YSI::Executor)
|
166
|
+
end
|
167
|
+
end
|
152
168
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
describe YSI::Executor do
|
4
|
+
it_behaves_like "an executor"
|
5
|
+
|
6
|
+
describe "working directory" do
|
7
|
+
it "runs in the given working directory" do
|
8
|
+
working_directory = subject.run_command(["pwd"], working_directory: "/tmp")
|
9
|
+
expect(working_directory).to eq("/tmp\n")
|
10
|
+
end
|
11
|
+
|
12
|
+
it "sets back the working directory to the original value" do
|
13
|
+
current_working_directory = Dir.pwd
|
14
|
+
subject.run_command(["ls"], working_directory: "/tmp")
|
15
|
+
expect(Dir.pwd).to eq(current_working_directory)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "sets back the working directory to the original value when there is an error" do
|
19
|
+
current_working_directory = Dir.pwd
|
20
|
+
expect {
|
21
|
+
subject.run_command(["ls /IMNOTTHERE"], working_directory: "/tmp")
|
22
|
+
}.to raise_error(YSI::AssertionError)
|
23
|
+
expect(Dir.pwd).to eq(current_working_directory)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/spec/unit/git_spec.rb
CHANGED
@@ -4,9 +4,10 @@ include GivenFilesystemSpecHelpers
|
|
4
4
|
|
5
5
|
describe YSI::Git do
|
6
6
|
describe "#origin" do
|
7
|
+
subject { YSI::Git.new(YSI::Executor.new) }
|
7
8
|
|
8
9
|
it "grabs the url without the extension" do
|
9
|
-
allow(subject).to receive(:run_git).with("remote
|
10
|
+
allow(subject).to receive(:run_git).with(["remote","-v"]).and_return(<<EOT
|
10
11
|
origin git@github.com:cornelius/red_herring (fetch)
|
11
12
|
origin git@github.com:cornelius/red_herring (push)
|
12
13
|
EOT
|
@@ -15,7 +16,7 @@ EOT
|
|
15
16
|
end
|
16
17
|
|
17
18
|
it "grabs the url with the extension" do
|
18
|
-
allow(subject).to receive(:run_git).with("remote
|
19
|
+
allow(subject).to receive(:run_git).with(["remote","-v"]).and_return(<<EOT
|
19
20
|
origin git@github.com:cornelius/red_herring.git (fetch)
|
20
21
|
origin git@github.com:cornelius/red_herring.git (push)
|
21
22
|
EOT
|
@@ -30,7 +31,7 @@ EOT
|
|
30
31
|
it "returns true if local changes are not in remote branch" do
|
31
32
|
dir = given_directory
|
32
33
|
setup_test_git_repo("007", dir)
|
33
|
-
git = YSI::Git.new(File.join(dir, "red_herring"))
|
34
|
+
git = YSI::Git.new(YSI::Executor.new, File.join(dir, "red_herring"))
|
34
35
|
|
35
36
|
expect(git.needs_push?).to be(true)
|
36
37
|
end
|
@@ -38,7 +39,7 @@ EOT
|
|
38
39
|
it "returns false if local changes are in remote branch" do
|
39
40
|
dir = given_directory
|
40
41
|
setup_test_git_repo("008", dir)
|
41
|
-
git = YSI::Git.new(File.join(dir, "red_herring"))
|
42
|
+
git = YSI::Git.new(YSI::Executor.new, File.join(dir, "red_herring"))
|
42
43
|
|
43
44
|
expect(git.needs_push?).to be(false)
|
44
45
|
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
describe YSI::Init do
|
4
|
+
use_given_filesystem
|
5
|
+
|
6
|
+
it "falls back to generic project if it can not detect type" do
|
7
|
+
path = given_directory
|
8
|
+
|
9
|
+
init = YSI::Init.new(path)
|
10
|
+
out = double
|
11
|
+
allow(out).to receive(:puts)
|
12
|
+
init.out = out
|
13
|
+
init.setup_config
|
14
|
+
|
15
|
+
expected_config = <<-EOT
|
16
|
+
# Experimental release automation. See https://github.com/cornelius/yes_ship_it.
|
17
|
+
assertions:
|
18
|
+
- release_branch
|
19
|
+
- working_directory
|
20
|
+
- version
|
21
|
+
- change_log
|
22
|
+
- tag
|
23
|
+
- pushed_tag
|
24
|
+
- pushed_code
|
25
|
+
- yes_it_shipped
|
26
|
+
EOT
|
27
|
+
expect(File.read(File.join(path, "yes_ship_it.conf"))).to eq(expected_config)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "detects ruby" do
|
31
|
+
path = nil
|
32
|
+
given_directory("init") do
|
33
|
+
path = given_directory_from_data("ruby", from: "init/ruby" )
|
34
|
+
end
|
35
|
+
|
36
|
+
init = YSI::Init.new(path)
|
37
|
+
out = double
|
38
|
+
allow(out).to receive(:puts)
|
39
|
+
init.out = out
|
40
|
+
init.setup_config
|
41
|
+
|
42
|
+
expected_config = <<-EOT
|
43
|
+
# Experimental release automation. See https://github.com/cornelius/yes_ship_it.
|
44
|
+
include:
|
45
|
+
ruby_gem
|
46
|
+
EOT
|
47
|
+
expect(File.read(File.join(path, "yes_ship_it.conf"))).to eq(expected_config)
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
describe YSI::Plugin do
|
4
|
+
use_given_filesystem
|
5
|
+
|
6
|
+
it "loads plugins" do
|
7
|
+
dir = given_directory do
|
8
|
+
given_directory "yes_ship_it" do
|
9
|
+
given_directory_from_data "assertions", from: "plugins"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
expect(YSI::Plugin.new(dir).load).to eq({
|
14
|
+
"my_other_plugin" => YSI::MyOtherPlugin,
|
15
|
+
"my_plugin" => YSI::MyPlugin
|
16
|
+
})
|
17
|
+
end
|
18
|
+
end
|
@@ -7,6 +7,10 @@ shared_examples "an assertion" do
|
|
7
7
|
expect(assertion.display_name).to be_a(String)
|
8
8
|
end
|
9
9
|
|
10
|
+
it "has a display name as class method" do
|
11
|
+
expect(assertion.class.display_name).to be_a(String)
|
12
|
+
end
|
13
|
+
|
10
14
|
it "checks" do
|
11
15
|
expect(assertion).to respond_to(:check)
|
12
16
|
end
|
@@ -14,8 +18,4 @@ shared_examples "an assertion" do
|
|
14
18
|
it "asserts" do
|
15
19
|
expect(assertion).to respond_to(:assert)
|
16
20
|
end
|
17
|
-
|
18
|
-
it "reports errors" do
|
19
|
-
expect(assertion).to respond_to(:error)
|
20
|
-
end
|
21
21
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
shared_examples "an executor" do
|
2
|
+
it "runs command" do
|
3
|
+
expect(subject).to respond_to(:run_command)
|
4
|
+
end
|
5
|
+
|
6
|
+
it "posts http" do
|
7
|
+
expect(subject).to respond_to(:http_post)
|
8
|
+
end
|
9
|
+
|
10
|
+
it "puts http" do
|
11
|
+
expect(subject).to respond_to(:http_put)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "deletes http" do
|
15
|
+
expect(subject).to respond_to(:http_delete)
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yes_ship_it
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cornelius Schumacher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inifile
|
@@ -135,6 +135,7 @@ files:
|
|
135
135
|
- ".rspec"
|
136
136
|
- CHANGELOG.md
|
137
137
|
- Gemfile
|
138
|
+
- MIT-LICENSE
|
138
139
|
- README.md
|
139
140
|
- USERS.md
|
140
141
|
- assertions/built_gem.rb
|
@@ -154,11 +155,18 @@ files:
|
|
154
155
|
- lib/version.rb
|
155
156
|
- lib/yes_ship_it.rb
|
156
157
|
- lib/yes_ship_it/assertion.rb
|
158
|
+
- lib/yes_ship_it/dry_executor.rb
|
157
159
|
- lib/yes_ship_it/engine.rb
|
158
160
|
- lib/yes_ship_it/exceptions.rb
|
161
|
+
- lib/yes_ship_it/executor.rb
|
159
162
|
- lib/yes_ship_it/git.rb
|
163
|
+
- lib/yes_ship_it/init.rb
|
164
|
+
- lib/yes_ship_it/plugin.rb
|
165
|
+
- spec/data/init/ruby/lib/version.rb
|
160
166
|
- spec/data/obs/mycroft.spec.erb
|
161
167
|
- spec/data/obs/oscrc
|
168
|
+
- spec/data/plugins/my_other_plugin.rb
|
169
|
+
- spec/data/plugins/my_plugin.rb
|
162
170
|
- spec/data/red_herring-000.tar.gz
|
163
171
|
- spec/data/red_herring-001.tar.gz
|
164
172
|
- spec/data/red_herring-002.tar.gz
|
@@ -168,18 +176,24 @@ files:
|
|
168
176
|
- spec/data/red_herring-006.tar.gz
|
169
177
|
- spec/data/red_herring-007.tar.gz
|
170
178
|
- spec/data/red_herring-008.tar.gz
|
179
|
+
- spec/data/version/polkaversion.h
|
171
180
|
- spec/data/version/version.go
|
172
181
|
- spec/data/version/version.rb
|
173
182
|
- spec/data/yes_ship_it.conf
|
174
183
|
- spec/data/yes_ship_it.include.conf
|
184
|
+
- spec/data/yes_ship_it.plugins.conf
|
175
185
|
- spec/data/yes_ship_it.unknown.conf
|
176
186
|
- spec/integration/cli_spec.rb
|
177
187
|
- spec/integration/spec_helper.rb
|
178
188
|
- spec/spec_helper.rb
|
179
189
|
- spec/system/data/red_herring-checkout-build.tar.gz
|
190
|
+
- spec/system/data/red_herring-checkout-dry-run.tar.gz
|
180
191
|
- spec/system/data/red_herring-checkout-not-push.tar.gz
|
181
192
|
- spec/system/data/red_herring-checkout-push.tar.gz
|
193
|
+
- spec/system/data/red_herring-checkout-rpm.tar.gz
|
182
194
|
- spec/system/data/red_herring-remote.tar.gz
|
195
|
+
- spec/system/dry_run_spec.rb
|
196
|
+
- spec/system/rpm_spec.rb
|
183
197
|
- spec/system/ruby_gem_spec.rb
|
184
198
|
- spec/system/spec_helper.rb
|
185
199
|
- spec/unit/assertion_spec.rb
|
@@ -194,10 +208,15 @@ files:
|
|
194
208
|
- spec/unit/assertions/working_directory_spec.rb
|
195
209
|
- spec/unit/assertions/yes_it_shipped_spec.rb
|
196
210
|
- spec/unit/assertions_spec.rb
|
211
|
+
- spec/unit/dry_executor_spec.rb
|
197
212
|
- spec/unit/engine_spec.rb
|
213
|
+
- spec/unit/executor_spec.rb
|
198
214
|
- spec/unit/git_spec.rb
|
215
|
+
- spec/unit/init_spec.rb
|
216
|
+
- spec/unit/plugin_spec.rb
|
199
217
|
- spec/unit/spec_helper.rb
|
200
218
|
- spec/unit/support/assertion_examples.rb
|
219
|
+
- spec/unit/support/executor_examples.rb
|
201
220
|
- yes_ship_it-0.0.1.gem
|
202
221
|
- yes_ship_it.conf
|
203
222
|
- yes_ship_it.gemspec
|
@@ -221,8 +240,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
221
240
|
version: 1.3.6
|
222
241
|
requirements: []
|
223
242
|
rubyforge_project: yes_ship_it
|
224
|
-
rubygems_version: 2.
|
243
|
+
rubygems_version: 2.2.2
|
225
244
|
signing_key:
|
226
245
|
specification_version: 4
|
227
246
|
summary: The ultimate release script
|
228
247
|
test_files: []
|
248
|
+
has_rdoc:
|