pennyworth-tool 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS +6 -0
- data/README.md +2 -1
- data/Rakefile +23 -0
- data/lib/pennyworth/constants.rb +19 -0
- data/lib/pennyworth/version.rb +1 -1
- data/pennyworth.gemspec +6 -5
- data/tools/release.rb +107 -0
- data/tools/release_checks.rb +35 -0
- metadata +23 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a540a31b068d26b1deebf691d65d60f94dcc343a
|
4
|
+
data.tar.gz: da36dd75b9c759acec70e477bafce396ebe5982a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44914ae8d8bc9d39451349fa82df0f59e64bc59bef3ad3a3ff384707423362ff5923fdaed46c8720d25abd45baa33cce5396b2c7ab72794528a1cc81906b85c2
|
7
|
+
data.tar.gz: 95a678007e0dd64a1957faeb4a62aea969569ed31810255ae6d3120101d376007d02f0912b70476767b550db0663c9a44c8a88c6f515e1cce419621fa057d754
|
data/NEWS
ADDED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# Pennyworth
|
2
2
|
|
3
3
|
[![Code Climate](https://codeclimate.com/github/SUSE/pennyworth/badges/gpa.svg)](https://codeclimate.com/github/SUSE/pennyworth)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/pennyworth-tool.svg)](http://badge.fury.io/rb/pennyworth-tool)
|
4
5
|
|
5
6
|
Pennyworth is a tool for running integration tests inside a network of virtual
|
6
7
|
machines. It allows the user to define virtual machines, build them as Vagrant
|
@@ -27,7 +28,7 @@ the environment of the integration tests.
|
|
27
28
|
|
28
29
|
## Installation
|
29
30
|
|
30
|
-
Pennyworth is tested on [openSUSE 13.2](https://en.opensuse.org/Portal:13.2)
|
31
|
+
Pennyworth is tested on [openSUSE 13.2](https://en.opensuse.org/Portal:13.2)
|
31
32
|
and [SUSE Linux Enterprise Server 12](https://www.suse.com/products/server/).
|
32
33
|
It may not work with other openSUSE versions, Linux distributions, or
|
33
34
|
operating systems.
|
data/Rakefile
CHANGED
@@ -15,7 +15,12 @@
|
|
15
15
|
# To contact SUSE about this file by physical or electronic mail,
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
|
+
require_relative "lib/pennyworth/constants"
|
19
|
+
require_relative "lib/pennyworth/version"
|
20
|
+
require_relative "tools/release"
|
18
21
|
require "rspec/core/rake_task"
|
22
|
+
require "cheetah"
|
23
|
+
require "packaging"
|
19
24
|
|
20
25
|
RSpec::Core::RakeTask.new
|
21
26
|
|
@@ -31,3 +36,21 @@ namespace :gem do
|
|
31
36
|
system "gem build pennyworth.gemspec"
|
32
37
|
end
|
33
38
|
end
|
39
|
+
|
40
|
+
desc "Release a new version ('type' is either 'major', 'minor 'or 'patch')"
|
41
|
+
task :release, [:type] do |task, args|
|
42
|
+
unless ["major", "minor", "patch"].include?(args[:type])
|
43
|
+
puts "Please specify a valid release type (major, minor or patch)."
|
44
|
+
exit 1
|
45
|
+
end
|
46
|
+
|
47
|
+
new_version = Release.generate_release_version(args[:type])
|
48
|
+
release = Release.new(version: new_version)
|
49
|
+
|
50
|
+
# Check syntax, git and CI state
|
51
|
+
Rake::Task['check:committed'].invoke
|
52
|
+
Rake::Task['check:syntax'].invoke
|
53
|
+
release.check
|
54
|
+
|
55
|
+
release.publish
|
56
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of version 3 of the GNU General Public License as
|
5
|
+
# published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This program is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
+
# GNU General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU General Public License
|
13
|
+
# along with this program; if not, contact SUSE LLC.
|
14
|
+
#
|
15
|
+
# To contact SUSE about this file by physical or electronic mail,
|
16
|
+
# you may find current contact information at www.suse.com
|
17
|
+
module Pennyworth
|
18
|
+
ROOT = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."))
|
19
|
+
end
|
data/lib/pennyworth/version.rb
CHANGED
data/pennyworth.gemspec
CHANGED
@@ -37,14 +37,15 @@ Gem::Specification.new do |s|
|
|
37
37
|
helpers are provided.
|
38
38
|
EOT
|
39
39
|
|
40
|
+
s.required_ruby_version = ">= 2.0.0"
|
40
41
|
s.required_rubygems_version = ">= 1.3.6"
|
41
42
|
s.rubyforge_project = "pennyworth"
|
42
43
|
|
43
|
-
s.add_dependency "gli", "~> 2.11
|
44
|
-
s.add_dependency "cheetah"
|
45
|
-
s.add_dependency "colorize"
|
46
|
-
s.add_dependency "nokogiri"
|
47
|
-
s.add_dependency "ruby-libvirt", "~> 0.4
|
44
|
+
s.add_dependency "gli", "~> 2.11"
|
45
|
+
s.add_dependency "cheetah", "~> 0.4"
|
46
|
+
s.add_dependency "colorize", "~> 0.7"
|
47
|
+
s.add_dependency "nokogiri", "~> 1.6"
|
48
|
+
s.add_dependency "ruby-libvirt", "~> 0.4"
|
48
49
|
|
49
50
|
s.files = `git ls-files`.split("\n")
|
50
51
|
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
|
data/tools/release.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# encoding:utf-8
|
2
|
+
|
3
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
4
|
+
#
|
5
|
+
# This program is free software; you can redistribute it and/or
|
6
|
+
# modify it under the terms of version 3 of the GNU General Public License as
|
7
|
+
# published by the Free Software Foundation.
|
8
|
+
#
|
9
|
+
# This program is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
12
|
+
# GNU General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU General Public License
|
15
|
+
# along with this program; if not, contact SUSE LLC.
|
16
|
+
#
|
17
|
+
# To contact SUSE about this file by physical or electronic mail,
|
18
|
+
# you may find current contact information at www.suse.com
|
19
|
+
require_relative "release_checks"
|
20
|
+
class Release
|
21
|
+
include ReleaseChecks
|
22
|
+
|
23
|
+
def initialize(opts = {})
|
24
|
+
@options = {
|
25
|
+
version: generate_development_version
|
26
|
+
}.merge(opts)
|
27
|
+
@release_version = @options[:version]
|
28
|
+
@tag = "v#{@release_version}"
|
29
|
+
@release_time = Time.now.strftime("%a %b %d %H:%M:%S %Z %Y")
|
30
|
+
@mail = Cheetah.run(["git", "config", "user.email"], stdout: :capture).chomp
|
31
|
+
@gemspec = Gem::Specification.load("pennyworth.gemspec")
|
32
|
+
end
|
33
|
+
|
34
|
+
# Commit version changes, tag release and push changes upstream.
|
35
|
+
def publish
|
36
|
+
set_version
|
37
|
+
finalize_news_file
|
38
|
+
|
39
|
+
commit
|
40
|
+
end
|
41
|
+
|
42
|
+
# Calculates the next version number according to the release type (:major, :minor or :patch)
|
43
|
+
def self.generate_release_version(release_type)
|
44
|
+
current_version = Pennyworth::VERSION
|
45
|
+
major, minor, patch = current_version.scan(/(\d+)\.(\d+)\.(\d+)/).first.map(&:to_i)
|
46
|
+
|
47
|
+
case release_type
|
48
|
+
when "patch"
|
49
|
+
patch += 1
|
50
|
+
when "minor"
|
51
|
+
patch = 0
|
52
|
+
minor += 1
|
53
|
+
when "major"
|
54
|
+
patch = 0
|
55
|
+
minor = 0
|
56
|
+
major += 1
|
57
|
+
end
|
58
|
+
|
59
|
+
"#{major}.#{minor}.#{patch}"
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def set_version
|
65
|
+
Dir.chdir(Pennyworth::ROOT) do
|
66
|
+
command = [
|
67
|
+
"sed",
|
68
|
+
"-i",
|
69
|
+
"s/VERSION.*=.*/VERSION = \"#{@release_version}\"/",
|
70
|
+
"lib/pennyworth/version.rb"
|
71
|
+
]
|
72
|
+
Cheetah.run command
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def finalize_news_file
|
77
|
+
file = File.join(Pennyworth::ROOT, "NEWS")
|
78
|
+
content = File.read(file)
|
79
|
+
# All changes for the next release are directly added below the headline
|
80
|
+
# by the developers without adding a version line.
|
81
|
+
# Since the version line is automatically added during release by this
|
82
|
+
# method we can check for new bullet points since the last release.
|
83
|
+
if content.scan(/# Pennyworth .*$\n+## Version /).empty?
|
84
|
+
header = "\n\n\n## Version #{@release_version} - #{@release_time} - #{@mail}\n\n"
|
85
|
+
content = content.sub(/\n+/, header)
|
86
|
+
File.write(file, content)
|
87
|
+
else
|
88
|
+
fail("No new changelog items for this version")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def commit
|
93
|
+
Cheetah.run "git", "commit", "-a", "-m", "package #{@release_version}"
|
94
|
+
Cheetah.run "git", "tag", "-a", @tag, "-m", "Tag version #{@release_version}"
|
95
|
+
Cheetah.run "git", "push"
|
96
|
+
Cheetah.run "git", "push", "--tags"
|
97
|
+
end
|
98
|
+
|
99
|
+
def generate_development_version
|
100
|
+
# The development version RPMs have the following version number scheme:
|
101
|
+
# <base version>.<timestamp><os>git<short git hash>
|
102
|
+
timestamp = Time.now.strftime("%Y%m%dT%H%M%SZ")
|
103
|
+
commit_id = Cheetah.run("git", "rev-parse", "--short", "HEAD", stdout: :capture).chomp
|
104
|
+
|
105
|
+
"#{Pennyworth::VERSION}.#{timestamp}git#{commit_id}"
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Copyright (c) 2013-2015 SUSE LLC
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of version 3 of the GNU General Public License as
|
5
|
+
# published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This program is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
10
|
+
# GNU General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU General Public License
|
13
|
+
# along with this program; if not, contact SUSE LLC.
|
14
|
+
#
|
15
|
+
# To contact SUSE about this file by physical or electronic mail,
|
16
|
+
# you may find current contact information at www.suse.com
|
17
|
+
module ReleaseChecks
|
18
|
+
def check
|
19
|
+
check_tag
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def fail(msg)
|
25
|
+
puts msg
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
29
|
+
def check_tag
|
30
|
+
Cheetah.run("git", "fetch", "--tags")
|
31
|
+
existing_tag = Cheetah.run("git", "tag", "-l", @tag, stdout: :capture)
|
32
|
+
|
33
|
+
fail "Tag #{@tag} already exists. Abort." unless existing_tag.empty?
|
34
|
+
end
|
35
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pennyworth-tool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SUSE
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.11
|
19
|
+
version: '2.11'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.11
|
26
|
+
version: '2.11'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: cheetah
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '0.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '0.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: colorize
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '0.7'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '0.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: nokogiri
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1.6'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1.6'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: ruby-libvirt
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.4
|
75
|
+
version: '0.4'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.4
|
82
|
+
version: '0.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: ronn
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -127,6 +127,7 @@ files:
|
|
127
127
|
- CONTRIBUTING.md
|
128
128
|
- COPYING
|
129
129
|
- Gemfile
|
130
|
+
- NEWS
|
130
131
|
- README.md
|
131
132
|
- Rakefile
|
132
133
|
- bin/pennyworth
|
@@ -156,6 +157,7 @@ files:
|
|
156
157
|
- lib/pennyworth/commands/shutdown_command.rb
|
157
158
|
- lib/pennyworth/commands/status_command.rb
|
158
159
|
- lib/pennyworth/commands/up_command.rb
|
160
|
+
- lib/pennyworth/constants.rb
|
159
161
|
- lib/pennyworth/exceptions.rb
|
160
162
|
- lib/pennyworth/helper.rb
|
161
163
|
- lib/pennyworth/host_config.rb
|
@@ -230,6 +232,8 @@ files:
|
|
230
232
|
- spec/vagrant_runner_spec.rb
|
231
233
|
- spec/vagrant_spec.rb
|
232
234
|
- spec/vm_spec.rb
|
235
|
+
- tools/release.rb
|
236
|
+
- tools/release_checks.rb
|
233
237
|
homepage: https://github.com/SUSE/pennyworth
|
234
238
|
licenses:
|
235
239
|
- GPL-3.0
|
@@ -242,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
242
246
|
requirements:
|
243
247
|
- - ">="
|
244
248
|
- !ruby/object:Gem::Version
|
245
|
-
version:
|
249
|
+
version: 2.0.0
|
246
250
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
247
251
|
requirements:
|
248
252
|
- - ">="
|