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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7a38b12c557de98e6ea36e0f82cb9f65e44a5bf
|
4
|
+
data.tar.gz: 478894aeceac04cc8027ba88bf78578e65b649d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0956fb1a9f67912b750729dc6132fe1dcd8784d23da178878e808eb167f37947772d65d21fa46f1a98bf2ba26129718a5e95ee3e8e5ba7624c3e785ac4affd85
|
7
|
+
data.tar.gz: 349837d22c00fb3c2decdda42dc37ea29cd6a85ed86937caa1c89b0bac346c7af55e1da6eefa3897588e92e976f0e09ad7b70ecc174cdcd7f5f08fe86be3d5c0
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
# Change log of yes_ship_it
|
2
2
|
|
3
|
+
## Version 0.0.6
|
4
|
+
|
5
|
+
* Add support for local assertion plugins. `yes_ship_it plugin generate` creates
|
6
|
+
the scaffold for a new plugin. `yes_ship_it plugin list` shows all available
|
7
|
+
local plugins.
|
8
|
+
* Support reading versions from C/C++ header files
|
9
|
+
* Don't overwrite existing config with `yes_ship_it init` (bug #5)
|
10
|
+
* Implement detection of ruby and generic projects in `yes_ship_it init`
|
11
|
+
* Support `obs_project` parameter in `submitted_rpm` assertion
|
12
|
+
|
3
13
|
## Version 0.0.5
|
4
14
|
|
5
15
|
* Handle missing credentials for Rubygems, when pushing gems
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
2
|
+
of this software and associated documentation files (the "Software"), to deal
|
3
|
+
in the Software without restriction, including without limitation the rights
|
4
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
5
|
+
copies of the Software, and to permit persons to whom the Software is
|
6
|
+
furnished to do so, subject to the following conditions:
|
7
|
+
|
8
|
+
The above copyright notice and this permission notice shall be included in
|
9
|
+
all copies or substantial portions of the Software.
|
10
|
+
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
12
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
13
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
14
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
15
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
16
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
17
|
+
THE SOFTWARE.
|
data/assertions/built_gem.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module YSI
|
2
2
|
class BuiltGem < Assertion
|
3
|
-
def display_name
|
3
|
+
def self.display_name
|
4
4
|
"built gem"
|
5
5
|
end
|
6
6
|
|
@@ -14,8 +14,7 @@ module YSI
|
|
14
14
|
|
15
15
|
def check
|
16
16
|
if !File.exist?(gemspec_file)
|
17
|
-
|
18
|
-
return nil
|
17
|
+
raise AssertionError.new("I need a gemspec: #{gemspec_file}")
|
19
18
|
end
|
20
19
|
|
21
20
|
if !File.exist?(gem_file)
|
@@ -25,13 +24,8 @@ module YSI
|
|
25
24
|
gem_file
|
26
25
|
end
|
27
26
|
|
28
|
-
def assert(
|
29
|
-
|
30
|
-
`gem build #{gemspec_file}`
|
31
|
-
if $?.to_i != 0
|
32
|
-
return nil
|
33
|
-
end
|
34
|
-
end
|
27
|
+
def assert(executor)
|
28
|
+
executor.run_command(["gem", "build", gemspec_file])
|
35
29
|
gem_file
|
36
30
|
end
|
37
31
|
end
|
data/assertions/change_log.rb
CHANGED
@@ -2,32 +2,26 @@ module YSI
|
|
2
2
|
class ChangeLog < Assertion
|
3
3
|
needs "version"
|
4
4
|
|
5
|
-
def display_name
|
5
|
+
def self.display_name
|
6
6
|
"change log"
|
7
7
|
end
|
8
8
|
|
9
9
|
def check
|
10
10
|
if !File.exist?("CHANGELOG.md")
|
11
|
-
|
12
|
-
return nil
|
11
|
+
raise AssertionError.new("Expected change log in CHANGELOG.md")
|
13
12
|
end
|
14
13
|
|
15
|
-
|
16
|
-
if @error
|
17
|
-
return nil
|
18
|
-
end
|
14
|
+
check_content(File.read("CHANGELOG.md"))
|
19
15
|
|
20
16
|
"CHANGELOG.md"
|
21
17
|
end
|
22
18
|
|
23
|
-
def assert(
|
19
|
+
def assert(_executor)
|
24
20
|
end
|
25
21
|
|
26
22
|
def check_content(content)
|
27
|
-
if content
|
28
|
-
|
29
|
-
else
|
30
|
-
return "Can't find version #{engine.version} in change log"
|
23
|
+
if content !~ /#{engine.version}/
|
24
|
+
raise AssertionError.new("Can't find version #{engine.version} in change log")
|
31
25
|
end
|
32
26
|
end
|
33
27
|
end
|
data/assertions/published_gem.rb
CHANGED
@@ -2,7 +2,7 @@ module YSI
|
|
2
2
|
class PublishedGem < Assertion
|
3
3
|
needs "built_gem"
|
4
4
|
|
5
|
-
def display_name
|
5
|
+
def self.display_name
|
6
6
|
"published gem"
|
7
7
|
end
|
8
8
|
|
@@ -25,19 +25,13 @@ module YSI
|
|
25
25
|
nil
|
26
26
|
end
|
27
27
|
|
28
|
-
def assert(
|
29
|
-
if !
|
30
|
-
|
31
|
-
if !File.exist?(File.expand_path("~/.gem/credentials"))
|
32
|
-
@error = "You need to log in to Rubygems first by running `gem push #{gem_file}` manually"
|
33
|
-
return nil
|
34
|
-
end
|
35
|
-
Cheetah.run(["gem", "push", gem_file])
|
36
|
-
rescue Cheetah::ExecutionFailed => e
|
37
|
-
@error = e.message
|
38
|
-
return nil
|
39
|
-
end
|
28
|
+
def assert(executor)
|
29
|
+
if !File.exist?(File.expand_path("~/.gem/credentials"))
|
30
|
+
raise AssertionError.new("You need to log in to Rubygems first by running `gem push #{gem_file}` manually")
|
40
31
|
end
|
32
|
+
|
33
|
+
executor.run_command(["gem", "push", gem_file])
|
34
|
+
|
41
35
|
gem_file
|
42
36
|
end
|
43
37
|
end
|
data/assertions/pushed_code.rb
CHANGED
@@ -2,22 +2,20 @@ module YSI
|
|
2
2
|
class PushedCode < Assertion
|
3
3
|
needs "release_branch"
|
4
4
|
|
5
|
-
def display_name
|
5
|
+
def self.display_name
|
6
6
|
"pushed code"
|
7
7
|
end
|
8
8
|
|
9
9
|
def check
|
10
|
-
if Git.new.needs_push?
|
10
|
+
if Git.new(Executor.new).needs_push?
|
11
11
|
return nil
|
12
12
|
else
|
13
13
|
return "up-to-date"
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
def assert(
|
18
|
-
|
19
|
-
Git.new.push
|
20
|
-
end
|
17
|
+
def assert(executor)
|
18
|
+
Git.new(executor).push
|
21
19
|
return "pushed"
|
22
20
|
end
|
23
21
|
end
|
data/assertions/pushed_tag.rb
CHANGED
@@ -2,7 +2,7 @@ module YSI
|
|
2
2
|
class PushedTag < Assertion
|
3
3
|
needs "tag"
|
4
4
|
|
5
|
-
def display_name
|
5
|
+
def self.display_name
|
6
6
|
"pushed tag"
|
7
7
|
end
|
8
8
|
|
@@ -11,7 +11,7 @@ module YSI
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def check
|
14
|
-
response =
|
14
|
+
response = Executor.new.run_command(["git", "ls-remote", "--tags", "origin", tag])
|
15
15
|
if response.include?(tag)
|
16
16
|
return response
|
17
17
|
end
|
@@ -19,10 +19,8 @@ module YSI
|
|
19
19
|
nil
|
20
20
|
end
|
21
21
|
|
22
|
-
def assert(
|
23
|
-
|
24
|
-
`git push --tags`
|
25
|
-
end
|
22
|
+
def assert(executor)
|
23
|
+
executor.run_command(["git", "push", "--tags"])
|
26
24
|
tag
|
27
25
|
end
|
28
26
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module YSI
|
2
2
|
class ReleaseArchive < Assertion
|
3
|
-
def display_name
|
3
|
+
def self.display_name
|
4
4
|
"release archive"
|
5
5
|
end
|
6
6
|
|
@@ -25,19 +25,14 @@ module YSI
|
|
25
25
|
nil
|
26
26
|
end
|
27
27
|
|
28
|
-
def assert(
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
exclude_options = excludes.map { |e| "--exclude '#{e}'" }.join(" ")
|
37
|
-
if !system("cd #{tmp_dir}; tar czf #{release_archive} #{exclude_options} #{archive_dir}")
|
38
|
-
return nil
|
39
|
-
end
|
40
|
-
end
|
28
|
+
def assert(executor)
|
29
|
+
Dir.mktmpdir do |tmp_dir|
|
30
|
+
archive_dir = "#{engine.project_name}-#{engine.version}"
|
31
|
+
executor.run_command(["git", "clone", Dir.pwd, File.join(tmp_dir, archive_dir)])
|
32
|
+
FileUtils.mkdir_p(File.dirname(release_archive))
|
33
|
+
excludes = [".git", ".gitignore", "yes_ship_it.conf"]
|
34
|
+
exclude_options = excludes.map { |e| ["--exclude", e] }.flatten
|
35
|
+
executor.run_command(["tar", "czf", release_archive] + exclude_options + [archive_dir], working_directory: tmp_dir)
|
41
36
|
end
|
42
37
|
filename
|
43
38
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module YSI
|
2
2
|
class ReleaseBranch < Assertion
|
3
|
-
def display_name
|
3
|
+
def self.display_name
|
4
4
|
"release branch"
|
5
5
|
end
|
6
6
|
|
@@ -23,14 +23,13 @@ module YSI
|
|
23
23
|
|
24
24
|
def check
|
25
25
|
if current_branch != branch
|
26
|
-
|
27
|
-
return nil
|
26
|
+
raise AssertionError.new("Not on release branch '#{branch}'")
|
28
27
|
else
|
29
28
|
return branch
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
33
|
-
def assert(
|
32
|
+
def assert(_executor)
|
34
33
|
branch
|
35
34
|
end
|
36
35
|
end
|
data/assertions/submitted_rpm.rb
CHANGED
@@ -5,7 +5,7 @@ module YSI
|
|
5
5
|
attr_reader :obs_user, :obs_password
|
6
6
|
attr_reader :obs_package_files
|
7
7
|
|
8
|
-
def display_name
|
8
|
+
def self.display_name
|
9
9
|
"submitted RPM"
|
10
10
|
end
|
11
11
|
|
@@ -46,34 +46,34 @@ module YSI
|
|
46
46
|
erb.result(RpmSpecHelpers.new(engine).get_binding)
|
47
47
|
end
|
48
48
|
|
49
|
+
def base_url
|
50
|
+
"https://#{obs_user}:#{obs_password}@api.opensuse.org/source/#{obs_project}/#{engine.project_name}"
|
51
|
+
end
|
52
|
+
|
49
53
|
def check
|
50
54
|
if !obs_project
|
51
|
-
|
52
|
-
return nil
|
55
|
+
raise AssertionError.new("OBS project is not set")
|
53
56
|
end
|
54
57
|
if !engine.release_archive
|
55
|
-
|
56
|
-
return nil
|
58
|
+
raise AssertionError.new("Release archive is not set. Assert release_archive before submitted_rpm")
|
57
59
|
end
|
58
60
|
|
59
61
|
read_obs_credentials(File.expand_path("~/.oscrc"))
|
60
62
|
|
63
|
+
@obs_package_files = []
|
64
|
+
|
61
65
|
begin
|
62
|
-
|
63
|
-
xml = RestClient.get(url)
|
66
|
+
xml = RestClient.get(base_url)
|
64
67
|
rescue RestClient::Exception => e
|
65
68
|
if e.is_a?(RestClient::ResourceNotFound)
|
66
69
|
return nil
|
67
70
|
elsif e.is_a?(RestClient::Unauthorized)
|
68
|
-
|
69
|
-
return nil
|
71
|
+
raise AssertionError.new("No credentials set for OBS. Use osc to do this.")
|
70
72
|
else
|
71
|
-
|
72
|
-
return nil
|
73
|
+
raise AssertionError.new(e.to_s)
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
76
|
-
@obs_package_files = []
|
77
77
|
doc = REXML::Document.new(xml)
|
78
78
|
doc.elements.each("directory/entry") do |element|
|
79
79
|
file_name = element.attributes["name"]
|
@@ -85,7 +85,7 @@ module YSI
|
|
85
85
|
nil
|
86
86
|
end
|
87
87
|
|
88
|
-
def assert(
|
88
|
+
def assert(executor)
|
89
89
|
engine.out.puts "..."
|
90
90
|
|
91
91
|
old_files = []
|
@@ -96,34 +96,20 @@ module YSI
|
|
96
96
|
end
|
97
97
|
|
98
98
|
engine.out.puts " Uploading release archive '#{archive_file_name}'"
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
begin
|
103
|
-
RestClient.put(url, file, content_type: "application/x-gzip")
|
104
|
-
rescue RestClient::Exception => e
|
105
|
-
STDERR.puts e.inspect
|
106
|
-
end
|
107
|
-
end
|
99
|
+
url = "#{base_url}/#{archive_file_name}"
|
100
|
+
file = File.new(engine.release_archive, "rb")
|
101
|
+
executor.http_put(url, file, content_type: "application/x-gzip")
|
108
102
|
|
109
103
|
spec_file = engine.project_name + ".spec"
|
110
104
|
engine.out.puts " Uploading spec file '#{spec_file}'"
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
begin
|
115
|
-
RestClient.put(url, content, content_type: "text/plain")
|
116
|
-
rescue RestClient::Exception => e
|
117
|
-
STDERR.puts e.inspect
|
118
|
-
end
|
119
|
-
end
|
105
|
+
url = "#{base_url}/#{spec_file}"
|
106
|
+
content = create_spec_file("rpm/#{spec_file}.erb")
|
107
|
+
executor.http_put(url, content, content_type: "text/plain")
|
120
108
|
|
121
109
|
old_files.each do |file|
|
122
110
|
engine.out.puts " Removing '#{file}'"
|
123
|
-
|
124
|
-
|
125
|
-
RestClient.delete(url)
|
126
|
-
end
|
111
|
+
url = "#{base_url}/#{file}"
|
112
|
+
executor.http_delete(url)
|
127
113
|
end
|
128
114
|
|
129
115
|
engine.out.print "... "
|
data/assertions/tag.rb
CHANGED
@@ -2,7 +2,7 @@ module YSI
|
|
2
2
|
class Tag < Assertion
|
3
3
|
needs "version"
|
4
4
|
|
5
|
-
def display_name
|
5
|
+
def self.display_name
|
6
6
|
"tag"
|
7
7
|
end
|
8
8
|
|
@@ -11,9 +11,9 @@ module YSI
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def check
|
14
|
-
|
14
|
+
Executor.new.run_command(["git", "tag"]).each_line do |line|
|
15
15
|
if line.chomp == tag
|
16
|
-
|
16
|
+
Executor.new.run_command(["git", "show", tag]).each_line do |show_line|
|
17
17
|
if show_line =~ /Date:\s+(.*)/
|
18
18
|
@engine.tag_date = $1
|
19
19
|
end
|
@@ -24,10 +24,8 @@ module YSI
|
|
24
24
|
return nil
|
25
25
|
end
|
26
26
|
|
27
|
-
def assert(
|
28
|
-
|
29
|
-
`git tag -a #{tag} -m "Version #{@engine.version}"`
|
30
|
-
end
|
27
|
+
def assert(executor)
|
28
|
+
executor.run_command(["git", "tag", "-a", tag, "-m", engine.version])
|
31
29
|
tag
|
32
30
|
end
|
33
31
|
end
|
data/assertions/version.rb
CHANGED
@@ -2,14 +2,13 @@ module YSI
|
|
2
2
|
class Version < Assertion
|
3
3
|
parameter :version_file, "lib/version.rb"
|
4
4
|
|
5
|
-
def display_name
|
5
|
+
def self.display_name
|
6
6
|
"version number"
|
7
7
|
end
|
8
8
|
|
9
9
|
def check
|
10
10
|
if !File.exist?(version_file)
|
11
|
-
|
12
|
-
return nil
|
11
|
+
raise AssertionError.new("Expected version in #{version_file}")
|
13
12
|
end
|
14
13
|
|
15
14
|
version = parse_version(version_file)
|
@@ -17,11 +16,10 @@ module YSI
|
|
17
16
|
@engine.version = version
|
18
17
|
return @engine.version
|
19
18
|
end
|
20
|
-
|
21
|
-
nil
|
19
|
+
raise AssertionError.new("Couldn't find version in #{version_file}")
|
22
20
|
end
|
23
21
|
|
24
|
-
def assert(
|
22
|
+
def assert(_executor)
|
25
23
|
end
|
26
24
|
|
27
25
|
def parse_version(file_name)
|
@@ -37,6 +35,12 @@ module YSI
|
|
37
35
|
return $1
|
38
36
|
end
|
39
37
|
end
|
38
|
+
elsif file_name =~ /\.h$/
|
39
|
+
File.read(file_name).each_line do |line|
|
40
|
+
if line =~ /#define .*_VERSION "(.*)"/
|
41
|
+
return $1
|
42
|
+
end
|
43
|
+
end
|
40
44
|
end
|
41
45
|
nil
|
42
46
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module YSI
|
2
2
|
class WorkingDirectory < Assertion
|
3
|
-
def display_name
|
3
|
+
def self.display_name
|
4
4
|
"working directory"
|
5
5
|
end
|
6
6
|
|
@@ -30,12 +30,11 @@ module YSI
|
|
30
30
|
if status == "clean"
|
31
31
|
return status
|
32
32
|
else
|
33
|
-
|
34
|
-
return nil
|
33
|
+
raise AssertionError.new(status)
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
38
|
-
def assert(
|
37
|
+
def assert(_executor)
|
39
38
|
"clean"
|
40
39
|
end
|
41
40
|
end
|
@@ -2,7 +2,7 @@ module YSI
|
|
2
2
|
class YesItShipped < Assertion
|
3
3
|
needs "tag"
|
4
4
|
|
5
|
-
def display_name
|
5
|
+
def self.display_name
|
6
6
|
"pushed to yes-it-shipped"
|
7
7
|
end
|
8
8
|
|
@@ -15,17 +15,11 @@ module YSI
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
-
def assert(
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
release_date_time: engine.tag_date, project_url: engine.project_url,
|
24
|
-
release_url: engine.release_url, ysi_config_url: engine.config_url)
|
25
|
-
rescue RestClient::Exception
|
26
|
-
return nil
|
27
|
-
end
|
28
|
-
end
|
18
|
+
def assert(executor)
|
19
|
+
executor.http_post("https://yes-it-shipped.herokuapp.com/releases",
|
20
|
+
project: engine.project_name, version: engine.version,
|
21
|
+
release_date_time: engine.tag_date, project_url: engine.project_url,
|
22
|
+
release_url: engine.release_url, ysi_config_url: engine.config_url)
|
29
23
|
"#{engine.project_name}-#{engine.version}"
|
30
24
|
end
|
31
25
|
end
|
data/bin/yes_ship_it
CHANGED
@@ -37,19 +37,30 @@ if ARGV == ["changelog"]
|
|
37
37
|
system("git log #{tag}..HEAD")
|
38
38
|
exit 0
|
39
39
|
elsif ARGV == ["init"]
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
YSI::Init.new(Dir.pwd).setup_config
|
41
|
+
elsif ARGV[0] == "plugin"
|
42
|
+
plugin = YSI::Plugin.new(Dir.pwd)
|
43
|
+
if ARGV[1] == "list"
|
44
|
+
plugin.list
|
45
|
+
elsif ARGV[1] == "generate"
|
46
|
+
if !ARGV[2].is_a?(String) && !ARGV[3].is_a?(String)
|
47
|
+
STDERR.puts "Parameters are missing. Use for example"
|
48
|
+
STDERR.puts
|
49
|
+
STDERR.puts " yes_ship_it plugin generate my_plugin \"My plugin\""
|
50
|
+
STDERR.puts
|
51
|
+
STDERR.puts "to generate a plugin `my_plugin` with a display name of \"My plugin\"."
|
52
|
+
exit 1
|
53
|
+
end
|
54
|
+
plugin.generate(ARGV[2], ARGV[3])
|
55
|
+
else
|
56
|
+
STDERR.puts "Invalid command"
|
57
|
+
STDERR.puts
|
58
|
+
STDERR.puts option_parser
|
59
|
+
exit 1
|
44
60
|
end
|
45
|
-
puts "Initialized directory for shipping."
|
46
|
-
puts
|
47
|
-
puts "Check the file `yes_ship_it.conf` and adapt it to your needs."
|
48
|
-
puts
|
49
|
-
puts "Happy shipping!"
|
50
61
|
elsif ARGV.empty?
|
51
62
|
if !File.exist?(config_file)
|
52
|
-
STDERR.puts
|
63
|
+
STDERR.puts "Unable to find file `yes_ship_it.conf`. I need it."
|
53
64
|
exit 1
|
54
65
|
end
|
55
66
|
|
@@ -61,6 +72,8 @@ elsif ARGV.empty?
|
|
61
72
|
engine.data_dir = options[:data_dir] if options[:data_dir]
|
62
73
|
|
63
74
|
begin
|
75
|
+
YSI::Plugin.new(Dir.pwd).load
|
76
|
+
|
64
77
|
engine.read(config_file)
|
65
78
|
|
66
79
|
exit engine.run
|
data/lib/version.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
module YSI
|
2
2
|
class Assertion
|
3
|
-
attr_reader :error
|
4
3
|
attr_accessor :engine
|
5
4
|
|
5
|
+
def self.class_name(name)
|
6
|
+
name.split("_").map { |n| n.capitalize }.join
|
7
|
+
end
|
8
|
+
|
6
9
|
def self.class_for_name(name)
|
7
|
-
class_name = name.split("_").map { |n| n.capitalize }.join
|
8
10
|
begin
|
9
|
-
Object.const_get("YSI::" + class_name)
|
11
|
+
Object.const_get("YSI::" + class_name(name))
|
10
12
|
rescue NameError
|
11
13
|
raise YSI::Error.new("Error: Unknown assertion '#{name}'")
|
12
14
|
end
|
@@ -53,6 +55,10 @@ module YSI
|
|
53
55
|
@parameter_defaults = {}
|
54
56
|
end
|
55
57
|
|
58
|
+
def display_name
|
59
|
+
self.class.display_name
|
60
|
+
end
|
61
|
+
|
56
62
|
def needs
|
57
63
|
@dependencies ||= self.class.dependency_names.map do |d|
|
58
64
|
Assertion.class_for_name(d)
|