builderator 0.3.15 → 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +9 -0
- data/Gemfile.lock +440 -0
- data/README.md +72 -18
- data/Rakefile +1 -2
- data/VERSION +1 -1
- data/bin/build-clean +102 -0
- data/bin/build-data +45 -0
- data/builderator.gemspec +7 -4
- data/docs/configuration.md +154 -0
- data/docs/configuration/cookbook.md +19 -0
- data/docs/configuration/profile.md +71 -0
- data/docs/versioning.md +65 -0
- data/lib/builderator.rb +3 -0
- data/lib/builderator/config.rb +93 -0
- data/lib/builderator/config/attributes.rb +287 -0
- data/lib/builderator/config/defaults.rb +163 -0
- data/lib/builderator/config/file.rb +336 -0
- data/lib/builderator/config/rash.rb +80 -0
- data/lib/builderator/control/cleaner.rb +138 -0
- data/lib/builderator/control/cookbook.rb +16 -0
- data/lib/builderator/control/data.rb +16 -0
- data/lib/builderator/control/data/image.rb +98 -0
- data/lib/builderator/control/version.rb +128 -0
- data/lib/builderator/control/version/auto.rb +48 -0
- data/lib/builderator/control/version/bump.rb +82 -0
- data/lib/builderator/control/version/comparable.rb +77 -0
- data/lib/builderator/control/version/git.rb +45 -0
- data/lib/builderator/control/version/scm.rb +92 -0
- data/lib/builderator/interface.rb +67 -0
- data/lib/builderator/interface/berkshelf.rb +38 -0
- data/lib/builderator/interface/packer.rb +75 -0
- data/lib/builderator/interface/vagrant.rb +31 -0
- data/lib/builderator/metadata.rb +5 -3
- data/lib/builderator/model/cleaner.rb +49 -0
- data/lib/builderator/model/cleaner/images.rb +93 -0
- data/lib/builderator/model/cleaner/instances.rb +58 -0
- data/lib/builderator/model/cleaner/launch_configs.rb +47 -0
- data/lib/builderator/model/cleaner/scaling_groups.rb +45 -0
- data/lib/builderator/model/cleaner/snapshots.rb +50 -0
- data/lib/builderator/model/cleaner/volumes.rb +48 -0
- data/lib/builderator/patch/berkshelf.rb +18 -0
- data/lib/builderator/patch/thor-actions.rb +47 -0
- data/lib/builderator/tasks.rb +127 -17
- data/lib/builderator/tasks/berkshelf.rb +63 -0
- data/lib/builderator/tasks/packer.rb +17 -56
- data/lib/builderator/tasks/vagrant.rb +111 -42
- data/lib/builderator/tasks/vendor.rb +94 -0
- data/lib/builderator/tasks/version.rb +58 -0
- data/lib/builderator/util.rb +37 -11
- data/lib/builderator/util/aws_exception.rb +1 -1
- data/lib/builderator/util/limit_exception.rb +12 -11
- data/lib/builderator/util/task_exception.rb +0 -2
- data/mkmf.log +4 -0
- data/spec/config_spec.rb +30 -0
- data/spec/data/Berksfile +6 -0
- data/spec/data/Buildfile +0 -0
- data/spec/data/Vagrantfile +0 -0
- data/spec/data/history.json +483 -0
- data/spec/data/packer.json +0 -0
- data/spec/interface_spec.rb +36 -0
- data/spec/resource/Buildfile +27 -0
- data/spec/spec_helper.rb +90 -0
- data/spec/version_spec.rb +282 -0
- data/template/Berksfile.erb +10 -0
- data/template/Buildfile.erb +28 -0
- data/template/Gemfile.erb +16 -0
- data/template/README.md.erb +61 -0
- data/template/Vagrantfile.erb +75 -0
- data/template/gitignore.erb +104 -0
- data/{.rubocop.yml → template/rubocop.erb} +0 -0
- metadata +203 -56
- data/.gitignore +0 -14
- data/lib/builderator/control/ami.rb +0 -65
- data/lib/builderator/control/clean.rb +0 -130
- data/lib/builderator/model.rb +0 -46
- data/lib/builderator/model/images.rb +0 -89
- data/lib/builderator/model/instances.rb +0 -55
- data/lib/builderator/model/launch_configs.rb +0 -46
- data/lib/builderator/model/scaling_groups.rb +0 -43
- data/lib/builderator/model/snapshots.rb +0 -49
- data/lib/builderator/model/volumes.rb +0 -48
- data/lib/builderator/tasks/ami.rb +0 -47
- data/lib/builderator/tasks/berks.rb +0 -68
- data/lib/builderator/tasks/clean.rb +0 -97
- data/lib/builderator/util/berkshim.rb +0 -34
- data/lib/builderator/util/cookbook.rb +0 -87
- data/lib/builderator/util/packer.rb +0 -39
- data/lib/builderator/util/shell.rb +0 -44
File without changes
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative './spec_helper'
|
2
|
+
|
3
|
+
require 'builderator/config'
|
4
|
+
require 'builderator/interface/berkshelf'
|
5
|
+
require 'builderator/interface/packer'
|
6
|
+
require 'builderator/interface/vagrant'
|
7
|
+
|
8
|
+
# :nodoc:
|
9
|
+
module Builderator
|
10
|
+
RSpec.describe Interface do
|
11
|
+
context 'Berksfile' do
|
12
|
+
berkshelf = Interface.berkshelf
|
13
|
+
|
14
|
+
it 'loads from Config values' do
|
15
|
+
expect(berkshelf.vendor).to eq Config.local.cookbook_path
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'generates the correct Berksfile' do
|
19
|
+
expect(berkshelf.render).to eq IO.read(::File.expand_path('../data/Berksfile', __FILE__))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'Vagrantfile' do
|
24
|
+
vagrant = Interface.vagrant(:default)
|
25
|
+
|
26
|
+
it 'loads from Config values' do
|
27
|
+
expect(vagrant.build_name).to eq Config.build_name
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'generates the correct Vagrantfile' do
|
31
|
+
pending "test doesn't work with absolute paths"
|
32
|
+
expect(vagrant.render).to eq IO.read(::File.expand_path('../data/Vagrantfile', __FILE__))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
##
|
2
|
+
# Test Buildfile
|
3
|
+
##
|
4
|
+
build_name 'builderator'
|
5
|
+
|
6
|
+
autoversion.create_tags false
|
7
|
+
autoversion.search_tags false
|
8
|
+
|
9
|
+
cookbook do |cookbook|
|
10
|
+
cookbook.depends 'apt'
|
11
|
+
cookbook.depends 'etcd-v2'
|
12
|
+
end
|
13
|
+
|
14
|
+
## Fetch Chef resources
|
15
|
+
vendor :chef do |vendor|
|
16
|
+
vendor.git 'git@github.com:rapid7/chef-demo-data.git'
|
17
|
+
end
|
18
|
+
|
19
|
+
profile :default do |profile|
|
20
|
+
profile.chef.run_list 'apt::default', 'etcd-v2::node'
|
21
|
+
|
22
|
+
profile.vagrant do |vagrant|
|
23
|
+
vagrant.local do |local|
|
24
|
+
local.memory 512
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
lib = File.expand_path('../../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
|
4
|
+
require 'builderator/config'
|
5
|
+
require 'builderator/util'
|
6
|
+
|
7
|
+
module Builderator
|
8
|
+
## Hack everything into running in spec/resource
|
9
|
+
module Util
|
10
|
+
class << self
|
11
|
+
def relative_path(*relative)
|
12
|
+
Pathname.new(__FILE__).join('../resource').join(*relative).expand_path
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
RSpec.configure do |config|
|
19
|
+
Builderator::Config.load(::File.expand_path('../resource/Buildfile', __FILE__))
|
20
|
+
|
21
|
+
# rspec-expectations config goes here. You can use an alternate
|
22
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
23
|
+
# assertions if you prefer.
|
24
|
+
config.expect_with :rspec do |expectations|
|
25
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
26
|
+
end
|
27
|
+
|
28
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
29
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
30
|
+
config.mock_with :rspec do |mocks|
|
31
|
+
mocks.verify_partial_doubles = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# The settings below are suggested to provide a good initial experience
|
35
|
+
# with RSpec, but feel free to customize to your heart's content.
|
36
|
+
|
37
|
+
# rubocop:disable Style/BlockComments
|
38
|
+
=begin
|
39
|
+
# These two settings work together to allow you to limit a spec run
|
40
|
+
# to individual examples or groups you care about by tagging them with
|
41
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
42
|
+
# get run.
|
43
|
+
config.filter_run :focus
|
44
|
+
config.run_all_when_everything_filtered = true
|
45
|
+
|
46
|
+
# Allows RSpec to persist some state between runs in order to support
|
47
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
48
|
+
# you configure your source control system to ignore this file.
|
49
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
50
|
+
|
51
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
52
|
+
# recommended. For more details, see:
|
53
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
54
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
55
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
56
|
+
config.disable_monkey_patching!
|
57
|
+
|
58
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
59
|
+
# be too noisy due to issues in dependencies.
|
60
|
+
config.warnings = true
|
61
|
+
|
62
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
63
|
+
# file, and it's useful to allow more verbose output when running an
|
64
|
+
# individual spec file.
|
65
|
+
if config.files_to_run.one?
|
66
|
+
# Use the documentation formatter for detailed output,
|
67
|
+
# unless a formatter has already been configured
|
68
|
+
# (e.g. via a command-line flag).
|
69
|
+
config.default_formatter = 'doc'
|
70
|
+
end
|
71
|
+
|
72
|
+
# Print the 10 slowest examples and example groups at the
|
73
|
+
# end of the spec run, to help surface which specs are running
|
74
|
+
# particularly slow.
|
75
|
+
config.profile_examples = 10
|
76
|
+
|
77
|
+
# Run specs in random order to surface order dependencies. If you find an
|
78
|
+
# order dependency and want to debug it, you can fix the order by providing
|
79
|
+
# the seed, which is printed after each run.
|
80
|
+
# --seed 1234
|
81
|
+
config.order = :random
|
82
|
+
|
83
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
84
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
85
|
+
# test failures related to randomization by passing the same `--seed` value
|
86
|
+
# as the one that triggered the failure.
|
87
|
+
Kernel.srand config.seed
|
88
|
+
=end
|
89
|
+
# rubocop:enable Style/BlockComments
|
90
|
+
end
|
@@ -0,0 +1,282 @@
|
|
1
|
+
require_relative './spec_helper'
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'builderator/control/version'
|
5
|
+
|
6
|
+
# rubocop:disable Metrics/ClassLength
|
7
|
+
|
8
|
+
module Builderator
|
9
|
+
module Control
|
10
|
+
# :nodoc:
|
11
|
+
class Version
|
12
|
+
## Test stub to load from an included JSON document
|
13
|
+
module Test
|
14
|
+
extend SCM
|
15
|
+
|
16
|
+
def self.supported?
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def self._history
|
21
|
+
JSON.parse(
|
22
|
+
IO.read(::File.expand_path('../data/history.json', __FILE__)),
|
23
|
+
:symbolize_names => true)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
## Disable the Git provider
|
28
|
+
module Git
|
29
|
+
extend SCM
|
30
|
+
|
31
|
+
def self.supported?
|
32
|
+
false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
SCM.register(Test)
|
37
|
+
|
38
|
+
RSpec.describe Builderator::Control::Version do
|
39
|
+
context 'loading, parsing, and ordering of commits and tags' do
|
40
|
+
it 'loads history from a provider' do
|
41
|
+
expect(SCM.history).to be_a Array
|
42
|
+
expect(SCM.history).to_not be_empty
|
43
|
+
expect(SCM.history).to all be_a SCM::Commit
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'parses semver strings correctly' do
|
47
|
+
it 'parses a.b.c versions correctly' do
|
48
|
+
version = Version.from_string('1.2.3')
|
49
|
+
|
50
|
+
expect(version.major).to be == 1
|
51
|
+
expect(version.minor).to be == 2
|
52
|
+
expect(version.patch).to be == 3
|
53
|
+
|
54
|
+
expect(version.is_prerelease).to be false
|
55
|
+
expect(version.prerelease_name).to be_nil
|
56
|
+
expect(version.prerelease_iteration).to be_nil
|
57
|
+
expect(version.build).to be_nil
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'parses pre-release versions correctly' do
|
61
|
+
version = Version.from_string('1.2.3-pre.42')
|
62
|
+
|
63
|
+
expect(version.major).to be == 1
|
64
|
+
expect(version.minor).to be == 2
|
65
|
+
expect(version.patch).to be == 3
|
66
|
+
expect(version.is_prerelease).to be true
|
67
|
+
expect(version.prerelease_name).to be == 'pre'
|
68
|
+
expect(version.prerelease_iteration).to be == 42
|
69
|
+
expect(version.build).to be_nil
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'parses build versions correctly' do
|
73
|
+
version = Version.from_string('1.2.3+build.9')
|
74
|
+
|
75
|
+
expect(version.major).to be == 1
|
76
|
+
expect(version.minor).to be == 2
|
77
|
+
expect(version.patch).to be == 3
|
78
|
+
expect(version.is_prerelease).to be false
|
79
|
+
expect(version.prerelease_name).to be_nil
|
80
|
+
expect(version.prerelease_iteration).to be_nil
|
81
|
+
expect(version.build).to be == 9
|
82
|
+
end
|
83
|
+
|
84
|
+
it 'parses the complete spec' do
|
85
|
+
version = Version.from_string('1.2.3-yolo.42+build.9')
|
86
|
+
|
87
|
+
expect(version.major).to be == 1
|
88
|
+
expect(version.minor).to be == 2
|
89
|
+
expect(version.patch).to be == 3
|
90
|
+
expect(version.is_prerelease).to be true
|
91
|
+
expect(version.prerelease_name).to be == 'yolo'
|
92
|
+
expect(version.prerelease_iteration).to be == 42
|
93
|
+
expect(version.build).to be == 9
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'fails on invalid specs' do
|
97
|
+
expect { Version.from_string('1.2.lizard-alpha.42+build.9') }.to raise_error RuntimeError
|
98
|
+
expect { Version.from_string('1.2.3-alpha.42+taco.9') }.to raise_error RuntimeError
|
99
|
+
expect { Version.from_string('1.2.3-alpha.guacamole+build.9') }.to raise_error RuntimeError
|
100
|
+
expect { Version.from_string('1.2.3-alpha.42+build.beef') }.to raise_error RuntimeError
|
101
|
+
expect { Version.from_string('1.2.dog') }.to raise_error RuntimeError
|
102
|
+
expect { Version.from_string('1.cat.3') }.to raise_error RuntimeError
|
103
|
+
expect { Version.from_string('cow.2.3') }.to raise_error RuntimeError
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
it 'generates Version objects from commits' do
|
108
|
+
expect(SCM.tags).to be_a Array
|
109
|
+
expect(SCM.tags).to_not be_empty
|
110
|
+
expect(SCM.tags).to all be_a Version
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'finds the current version of the module' do
|
114
|
+
expect(SCM.tags).to all be <= Version.current
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
context 'bumping versions' do
|
119
|
+
it 'attaches the correct SCM ref to new versions' do
|
120
|
+
previous = Version.current
|
121
|
+
|
122
|
+
Version.bump(:major)
|
123
|
+
expect(Version.current.ref).to eq SCM.history.first.id
|
124
|
+
expect(Version.current).to_not equal(previous)
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'fails when an invalid step is passed to #bump' do
|
128
|
+
expect { Version.bump(:lizard) }.to raise_error RuntimeError
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'bump build' do
|
132
|
+
it 'adds, increments, and resets build numbers' do
|
133
|
+
expect(Version.current.build).to be_nil
|
134
|
+
previous = Version.current
|
135
|
+
|
136
|
+
Version.bump(:build)
|
137
|
+
expect(Version.current).to_not equal(previous)
|
138
|
+
expect(Version.current.build).to be == 0
|
139
|
+
|
140
|
+
Version.bump(:build)
|
141
|
+
expect(Version.current.build).to be == 1
|
142
|
+
|
143
|
+
Version.bump(:patch)
|
144
|
+
expect(Version.current.build).to be_nil
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'bump prerelease and release' do
|
149
|
+
it 'creates and increments pre-releases from previous releases' do
|
150
|
+
expect(Version.current.is_prerelease).to be false
|
151
|
+
previous = Version.current
|
152
|
+
|
153
|
+
Version.bump(:prerelease)
|
154
|
+
expect(Version.current.patch).to be == (previous.patch + 1)
|
155
|
+
expect(Version.current.is_prerelease).to be true
|
156
|
+
expect(Version.current.prerelease_name).to be == 'alpha'
|
157
|
+
expect(Version.current.prerelease_iteration).to be == 0
|
158
|
+
|
159
|
+
Version.bump(:prerelease)
|
160
|
+
expect(Version.current.prerelease_name).to be == 'alpha'
|
161
|
+
expect(Version.current.prerelease_iteration).to be == 1
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'creates and increments pre-releases with a specified name' do
|
165
|
+
expect(Version.current.is_prerelease).to be true
|
166
|
+
|
167
|
+
Version.bump(:prerelease, 'beta')
|
168
|
+
expect(Version.current.prerelease_name).to be == 'beta'
|
169
|
+
expect(Version.current.prerelease_iteration).to be == 0
|
170
|
+
|
171
|
+
Version.bump(:prerelease)
|
172
|
+
expect(Version.current.prerelease_name).to be == 'beta'
|
173
|
+
expect(Version.current.prerelease_iteration).to be == 1
|
174
|
+
|
175
|
+
Version.bump(:prerelease, 'beta')
|
176
|
+
expect(Version.current.prerelease_name).to be == 'beta'
|
177
|
+
expect(Version.current.prerelease_iteration).to be == 2
|
178
|
+
end
|
179
|
+
|
180
|
+
it 'removes pre-release parameters for a release' do
|
181
|
+
expect(Version.current.is_prerelease).to be true
|
182
|
+
previous = Version.current
|
183
|
+
|
184
|
+
Version.bump(:release)
|
185
|
+
expect(Version.current.patch).to be == previous.patch
|
186
|
+
expect(Version.current.is_prerelease).to be false
|
187
|
+
expect(Version.current.prerelease_name).to be_nil
|
188
|
+
expect(Version.current.prerelease_iteration).to be_nil
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
context 'bump major, minor, and patch-prerelease' do
|
193
|
+
it 'creates a new patch version for a patch-prerelease' do
|
194
|
+
Version.bump(:prerelease)
|
195
|
+
previous = Version.current
|
196
|
+
expect(Version.current.is_prerelease).to be true
|
197
|
+
|
198
|
+
Version.bump('patch-prerelease')
|
199
|
+
expect(Version.current.is_prerelease).to be true
|
200
|
+
expect(Version.current.patch).to be == (previous.patch + 1)
|
201
|
+
end
|
202
|
+
|
203
|
+
it 'creates a new minor version for a minor-prerelease' do
|
204
|
+
previous = Version.current
|
205
|
+
expect(Version.current.is_prerelease).to be true
|
206
|
+
|
207
|
+
Version.bump('minor-prerelease')
|
208
|
+
expect(Version.current.is_prerelease).to be true
|
209
|
+
expect(Version.current.patch).to be == 0
|
210
|
+
expect(Version.current.minor).to be == (previous.minor + 1)
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'creates a new major version for a major-prerelease' do
|
214
|
+
previous = Version.current
|
215
|
+
expect(Version.current.is_prerelease).to be true
|
216
|
+
|
217
|
+
Version.bump('major-prerelease')
|
218
|
+
expect(Version.current.is_prerelease).to be true
|
219
|
+
expect(Version.current.patch).to be == 0
|
220
|
+
expect(Version.current.minor).to be == 0
|
221
|
+
expect(Version.current.major).to be == (previous.major + 1)
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
context 'bump major, minor, and patch' do
|
226
|
+
it 'creates a new patch version and resets build and prerelease parameters' do
|
227
|
+
Version.bump(:prerelease)
|
228
|
+
Version.bump(:build)
|
229
|
+
previous = Version.current
|
230
|
+
|
231
|
+
expect(Version.current.is_prerelease).to be true
|
232
|
+
expect(Version.current.build).to_not be_nil
|
233
|
+
|
234
|
+
Version.bump(:patch)
|
235
|
+
|
236
|
+
expect(Version.current.is_prerelease).to be false
|
237
|
+
expect(Version.current.build).to be_nil
|
238
|
+
expect(Version.current.patch).to be == (previous.patch + 1)
|
239
|
+
end
|
240
|
+
|
241
|
+
it 'creates a new minor version and resets lower-precedence parameters' do
|
242
|
+
Version.bump(:prerelease)
|
243
|
+
Version.bump(:build)
|
244
|
+
previous = Version.current
|
245
|
+
|
246
|
+
expect(Version.current.is_prerelease).to be true
|
247
|
+
expect(Version.current.build).to_not be_nil
|
248
|
+
expect(Version.current.patch).to_not be == 0
|
249
|
+
|
250
|
+
Version.bump(:minor)
|
251
|
+
|
252
|
+
expect(Version.current.is_prerelease).to be false
|
253
|
+
expect(Version.current.build).to be_nil
|
254
|
+
expect(Version.current.patch).to be == 0
|
255
|
+
expect(Version.current.minor).to be == (previous.minor + 1)
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'creates a new major version and resets lower-precedence parameters' do
|
259
|
+
Version.bump(:prerelease)
|
260
|
+
Version.bump(:build)
|
261
|
+
previous = Version.current
|
262
|
+
|
263
|
+
expect(Version.current.is_prerelease).to be true
|
264
|
+
expect(Version.current.build).to_not be_nil
|
265
|
+
expect(Version.current.patch).to_not be == 0
|
266
|
+
expect(Version.current.minor).to_not be == 0
|
267
|
+
|
268
|
+
Version.bump(:major)
|
269
|
+
|
270
|
+
expect(Version.current.is_prerelease).to be false
|
271
|
+
expect(Version.current.build).to be_nil
|
272
|
+
expect(Version.current.patch).to be == 0
|
273
|
+
expect(Version.current.minor).to be == 0
|
274
|
+
expect(Version.current.major).to be == (previous.major + 1)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
# rubocop:enable Metrics/ClassLength
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'builderator/patch/berkshelf'
|
2
|
+
|
3
|
+
<% cookbook.sources.each do |s| -%>
|
4
|
+
source '<%= s %>'
|
5
|
+
<% end -%>
|
6
|
+
<% if cookbook.metadata %>metadata<% end -%>
|
7
|
+
|
8
|
+
<% cookbook.depends.each do |name, cookbook| -%>
|
9
|
+
cookbook '<%= name %>', '<%= cookbook.fetch(:version, '>= 0.0.0') %>', <%= cookbook.to_hash %>
|
10
|
+
<% end -%>
|