yes_ship_it 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/assertions/yes_it_shipped.rb +30 -0
- data/configs/ruby_gem.conf +1 -0
- data/lib/version.rb +1 -1
- data/lib/yes_ship_it/engine.rb +20 -0
- data/lib/yes_ship_it/git.rb +11 -0
- data/lib/yes_ship_it.rb +1 -0
- data/spec/integration/cli_spec.rb +1 -0
- data/spec/integration/spec_helper.rb +1 -8
- data/spec/spec_helper.rb +9 -0
- data/spec/unit/assertions/yes_it_shipped_spec.rb +73 -0
- data/spec/unit/engine_spec.rb +31 -0
- data/spec/unit/git_spec.rb +13 -0
- data/spec/unit/spec_helper.rb +3 -2
- data/yes_ship_it.gemspec +1 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 166ad586d456c70e04254032cacb88b08137af90
|
4
|
+
data.tar.gz: 0b544b73f9391fa9eabe47e4d9ab1c86e934e7a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 937111a8dbbfcfae794dbd7b49db9520d5fe16923cff77628bfeb16de21f8a48201245b4167b36241de8b4031918e29a93ddb050fd03328e7a075f8b44276338
|
7
|
+
data.tar.gz: 1247311f1d7fb9465b8a6a34ae841feb28e8ebe90216466eafa149ac4febcb3023f66743dec4289be37d8dd8aec29e9c2dcd33e65fbcc663da198ee8aba29a4d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# Change log of yes_ship_it
|
2
2
|
|
3
|
+
## Version 0.0.4
|
4
|
+
|
5
|
+
* Add yes_it_shipped assertion
|
6
|
+
|
7
|
+
This assertion publishes the release on a central server we have set up for
|
8
|
+
the yes_ship_it project. It currently runs at
|
9
|
+
https://yes-it-shipped.herokuapp.com.
|
10
|
+
|
11
|
+
The assertion is used, if you either explicitly put it in your configuration
|
12
|
+
or if you include the `rubygems` template.
|
13
|
+
|
3
14
|
## Version 0.0.3
|
4
15
|
|
5
16
|
* Implement minimal version of `yes_ship_it init`. The init command is supposed
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module YSI
|
2
|
+
class YesItShipped < Assertion
|
3
|
+
def display_name
|
4
|
+
"pushed to yes-it-shipped"
|
5
|
+
end
|
6
|
+
|
7
|
+
def check
|
8
|
+
begin
|
9
|
+
json = RestClient.get("https://yes-it-shipped.herokuapp.com/releases/#{engine.project_name}/#{engine.version}")
|
10
|
+
return "#{engine.project_name}-#{engine.version}"
|
11
|
+
rescue RestClient::ResourceNotFound
|
12
|
+
return nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def assert(dry_run: false)
|
17
|
+
if !dry_run
|
18
|
+
begin
|
19
|
+
RestClient.post("https://yes-it-shipped.herokuapp.com/releases",
|
20
|
+
project: engine.project_name, version: engine.version,
|
21
|
+
release_date_time: Time.now, project_url: engine.project_url,
|
22
|
+
release_url: engine.release_url, ysi_config_url: engine.config_url)
|
23
|
+
rescue RestClient::Exception
|
24
|
+
return nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
"#{engine.project_name}-#{engine.version}"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/configs/ruby_gem.conf
CHANGED
data/lib/version.rb
CHANGED
data/lib/yes_ship_it/engine.rb
CHANGED
@@ -59,6 +59,26 @@ module YSI
|
|
59
59
|
File.basename(Dir.pwd)
|
60
60
|
end
|
61
61
|
|
62
|
+
def github_project_name
|
63
|
+
if !@github_project_name
|
64
|
+
origin = Git.new.origin
|
65
|
+
@github_project_name = origin.match("git@github.com:(.*)")[1]
|
66
|
+
end
|
67
|
+
@github_project_name
|
68
|
+
end
|
69
|
+
|
70
|
+
def project_url
|
71
|
+
"https://github.com/#{github_project_name}"
|
72
|
+
end
|
73
|
+
|
74
|
+
def release_url
|
75
|
+
"https://github.com/#{github_project_name}/releases/tag/#{tag}"
|
76
|
+
end
|
77
|
+
|
78
|
+
def config_url
|
79
|
+
"https://raw.githubusercontent.com/#{github_project_name}/master/yes_ship_it.conf"
|
80
|
+
end
|
81
|
+
|
62
82
|
def tag
|
63
83
|
"v#{version}"
|
64
84
|
end
|
data/lib/yes_ship_it.rb
CHANGED
@@ -8,6 +8,7 @@ require "erb"
|
|
8
8
|
require_relative "yes_ship_it/assertion.rb"
|
9
9
|
require_relative "yes_ship_it/engine.rb"
|
10
10
|
require_relative "yes_ship_it/exceptions.rb"
|
11
|
+
require_relative "yes_ship_it/git.rb"
|
11
12
|
|
12
13
|
assertions_dir = File.expand_path("../../assertions", __FILE__)
|
13
14
|
Dir[File.join(assertions_dir, "*.rb")].each { |f| require(f) }
|
@@ -164,6 +164,7 @@ Checking built gem: error
|
|
164
164
|
I need a gemspec: test_project.gemspec
|
165
165
|
Checking published gem: skip (because dependency errored)
|
166
166
|
Checking pushed tag: skip (because dependency errored)
|
167
|
+
Checking pushed to yes-it-shipped: fail
|
167
168
|
|
168
169
|
Couldn't ship test_project. Help me.
|
169
170
|
EOT
|
@@ -1,10 +1,3 @@
|
|
1
1
|
require "cli_tester"
|
2
|
-
require "given_filesystem/spec_helpers"
|
3
2
|
|
4
|
-
|
5
|
-
tarball = "spec/data/red_herring-#{version}.tar.gz"
|
6
|
-
tarball_path = File.expand_path(tarball)
|
7
|
-
if !system("cd #{dir}; tar xzf #{tarball_path}")
|
8
|
-
raise "Unable to extract tarball #{tarball}"
|
9
|
-
end
|
10
|
-
end
|
3
|
+
require_relative "../spec_helper"
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require "given_filesystem/spec_helpers"
|
2
|
+
|
3
|
+
def setup_test_git_repo(version, dir)
|
4
|
+
tarball = "spec/data/red_herring-#{version}.tar.gz"
|
5
|
+
tarball_path = File.expand_path(tarball)
|
6
|
+
if !system("cd #{dir}; tar xzf #{tarball_path}")
|
7
|
+
raise "Unable to extract tarball #{tarball}"
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require_relative "../spec_helper"
|
2
|
+
|
3
|
+
describe YSI::YesItShipped do
|
4
|
+
describe "#check" do
|
5
|
+
it "succeeds when release is there" do
|
6
|
+
body = <<-EOT
|
7
|
+
{
|
8
|
+
"id": 2,
|
9
|
+
"project": "dummy",
|
10
|
+
"project_url": "http://example.com/dummy",
|
11
|
+
"version": "1.0.0",
|
12
|
+
"release_date_time": "2015-12-07T17:56:00.000Z",
|
13
|
+
"release_url": "http://example.com/dummy/v0.1.0",
|
14
|
+
"ysi_config_url": "http://example.com/dummy/yes_ship_it.conf",
|
15
|
+
"created_at": "2015-12-08T11:37:33.884Z",
|
16
|
+
"updated_at": "2015-12-08T11:37:33.884Z"
|
17
|
+
}
|
18
|
+
EOT
|
19
|
+
stub_request(:get, "https://yes-it-shipped.herokuapp.com/releases/dummy/1.0.0").
|
20
|
+
with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
|
21
|
+
to_return(:status => 200, :body => body, :headers => {})
|
22
|
+
|
23
|
+
engine = YSI::Engine.new
|
24
|
+
allow(engine).to receive(:project_name).and_return("dummy")
|
25
|
+
engine.version = "1.0.0"
|
26
|
+
assertion = YSI::YesItShipped.new(engine)
|
27
|
+
expect(assertion.check).to eq("dummy-1.0.0")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "fails when release is not there" do
|
31
|
+
stub_request(:get, "https://yes-it-shipped.herokuapp.com/releases/dummy/2.0.0").
|
32
|
+
with(:headers => {'Accept'=>'*/*; q=0.5, application/xml', 'Accept-Encoding'=>'gzip, deflate', 'User-Agent'=>'Ruby'}).
|
33
|
+
to_return(:status => 404, :body => "", :headers => {})
|
34
|
+
|
35
|
+
engine = YSI::Engine.new
|
36
|
+
allow(engine).to receive(:project_name).and_return("dummy")
|
37
|
+
engine.version = "2.0.0"
|
38
|
+
assertion = YSI::YesItShipped.new(engine)
|
39
|
+
expect(assertion.check).to be_nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#assert" do
|
44
|
+
it "pushes release" do
|
45
|
+
allow(Time).to receive(:now).and_return(Time.parse("20151208T141655+0100"))
|
46
|
+
stub_request(:post, "https://yes-it-shipped.herokuapp.com/releases").
|
47
|
+
with(
|
48
|
+
:body => {
|
49
|
+
"project"=>"dummy",
|
50
|
+
"project_url"=>"https://github.com/cornelius/yes_ship_it",
|
51
|
+
"release_date_time"=>"2015-12-08 14:16:55 +0100",
|
52
|
+
"release_url"=>"https://github.com/cornelius/yes_ship_it/releases/tag/v1.1.1",
|
53
|
+
"version"=>"1.1.1",
|
54
|
+
"ysi_config_url"=>"https://raw.githubusercontent.com/cornelius/yes_ship_it/master/yes_ship_it.conf"
|
55
|
+
},
|
56
|
+
:headers => {
|
57
|
+
'Accept'=>'*/*; q=0.5, application/xml',
|
58
|
+
'Accept-Encoding'=>'gzip, deflate',
|
59
|
+
'Content-Length'=>'342',
|
60
|
+
'Content-Type'=>'application/x-www-form-urlencoded',
|
61
|
+
'User-Agent'=>'Ruby'
|
62
|
+
}).to_return(:status => 200, :body => "", :headers => {})
|
63
|
+
|
64
|
+
engine = YSI::Engine.new
|
65
|
+
allow(engine).to receive(:project_name).and_return("dummy")
|
66
|
+
engine.version = "1.1.1"
|
67
|
+
|
68
|
+
assertion = YSI::YesItShipped.new(engine)
|
69
|
+
|
70
|
+
expect(assertion.assert).to eq("dummy-1.1.1")
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/spec/unit/engine_spec.rb
CHANGED
@@ -118,4 +118,35 @@ EOT
|
|
118
118
|
expect(engine.dependency_errored?(assertion, errored_assertions)).to be(true)
|
119
119
|
end
|
120
120
|
end
|
121
|
+
|
122
|
+
describe "release attributes" do
|
123
|
+
before(:each) do
|
124
|
+
@checkout_dir = given_directory
|
125
|
+
setup_test_git_repo("005", @checkout_dir)
|
126
|
+
@pwd = Dir.pwd
|
127
|
+
Dir.chdir(File.join(@checkout_dir, "red_herring"))
|
128
|
+
@engine = YSI::Engine.new
|
129
|
+
@engine.version = "1.0.0"
|
130
|
+
end
|
131
|
+
|
132
|
+
after(:each) do
|
133
|
+
Dir.chdir(@pwd)
|
134
|
+
end
|
135
|
+
|
136
|
+
it "#project_name" do
|
137
|
+
expect(@engine.project_name).to eq("red_herring")
|
138
|
+
end
|
139
|
+
|
140
|
+
it "#project_url" do
|
141
|
+
expect(@engine.project_url).to eq("https://github.com/cornelius/red_herring")
|
142
|
+
end
|
143
|
+
|
144
|
+
it "#release_url" do
|
145
|
+
expect(@engine.release_url).to eq("https://github.com/cornelius/red_herring/releases/tag/v1.0.0")
|
146
|
+
end
|
147
|
+
|
148
|
+
it "#config_url" do
|
149
|
+
expect(@engine.config_url).to eq("https://raw.githubusercontent.com/cornelius/red_herring/master/yes_ship_it.conf")
|
150
|
+
end
|
151
|
+
end
|
121
152
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
describe YSI::Git do
|
4
|
+
it "#origin" do
|
5
|
+
allow(subject).to receive(:run_git).with("remote -v").and_return(<<EOT
|
6
|
+
origin git@github.com:cornelius/red_herring (fetch)
|
7
|
+
origin git@github.com:cornelius/red_herring (push)
|
8
|
+
EOT
|
9
|
+
)
|
10
|
+
|
11
|
+
expect(subject.origin).to eq("git@github.com:cornelius/red_herring")
|
12
|
+
end
|
13
|
+
end
|
data/spec/unit/spec_helper.rb
CHANGED
data/yes_ship_it.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.add_development_dependency "given_filesystem"
|
23
23
|
s.add_development_dependency "cli_tester", ">= 0.0.2"
|
24
24
|
s.add_development_dependency "httpotemkin"
|
25
|
+
s.add_development_dependency "webmock"
|
25
26
|
|
26
27
|
s.files = `git ls-files`.split("\n")
|
27
28
|
s.require_path = 'lib'
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cornelius Schumacher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inifile
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webmock
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description: Whenever the answer is 'Yes, ship it!' you will need yes_ship_it. It
|
98
112
|
is the ultimate helper in releasing software..
|
99
113
|
email:
|
@@ -119,6 +133,7 @@ files:
|
|
119
133
|
- assertions/tag.rb
|
120
134
|
- assertions/version.rb
|
121
135
|
- assertions/working_directory.rb
|
136
|
+
- assertions/yes_it_shipped.rb
|
122
137
|
- bin/yes_ship_it
|
123
138
|
- configs/ruby_gem.conf
|
124
139
|
- lib/version.rb
|
@@ -126,6 +141,7 @@ files:
|
|
126
141
|
- lib/yes_ship_it/assertion.rb
|
127
142
|
- lib/yes_ship_it/engine.rb
|
128
143
|
- lib/yes_ship_it/exceptions.rb
|
144
|
+
- lib/yes_ship_it/git.rb
|
129
145
|
- spec/data/obs/mycroft.spec.erb
|
130
146
|
- spec/data/obs/oscrc
|
131
147
|
- spec/data/red_herring-000.tar.gz
|
@@ -142,6 +158,7 @@ files:
|
|
142
158
|
- spec/data/yes_ship_it.unknown.conf
|
143
159
|
- spec/integration/cli_spec.rb
|
144
160
|
- spec/integration/spec_helper.rb
|
161
|
+
- spec/spec_helper.rb
|
145
162
|
- spec/system/data/red_herring-checkout-build.tar.gz
|
146
163
|
- spec/system/data/red_herring-checkout-not-push.tar.gz
|
147
164
|
- spec/system/data/red_herring-checkout-push.tar.gz
|
@@ -156,8 +173,10 @@ files:
|
|
156
173
|
- spec/unit/assertions/submitted_rpm_spec.rb
|
157
174
|
- spec/unit/assertions/version_spec.rb
|
158
175
|
- spec/unit/assertions/working_directory_spec.rb
|
176
|
+
- spec/unit/assertions/yes_it_shipped_spec.rb
|
159
177
|
- spec/unit/assertions_spec.rb
|
160
178
|
- spec/unit/engine_spec.rb
|
179
|
+
- spec/unit/git_spec.rb
|
161
180
|
- spec/unit/spec_helper.rb
|
162
181
|
- spec/unit/support/assertion_examples.rb
|
163
182
|
- yes_ship_it-0.0.1.gem
|