falkorlib 0.6.18 → 0.6.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -2
- data/falkorlib.gemspec +1 -1
- data/lib/falkorlib/tasks/rspec.rake +5 -4
- data/lib/falkorlib/version.rb +1 -1
- data/spec/falkorlib/bootstrap_helpers_spec.rb +10 -10
- data/spec/falkorlib/bootstrap_spec.rb +21 -21
- data/spec/falkorlib/common_spec.rb +45 -45
- data/spec/falkorlib/config_spec.rb +5 -5
- data/spec/falkorlib/error_spec.rb +1 -1
- data/spec/falkorlib/git_spec.rb +43 -43
- data/spec/falkorlib/gitflow_spec.rb +13 -13
- data/spec/falkorlib/puppet_modules_spec.rb +166 -166
- data/spec/falkorlib/versioning_gem_spec.rb +22 -22
- data/spec/falkorlib/versioning_puppet_module_spec.rb +11 -11
- data/spec/falkorlib/versioning_spec.rb +86 -86
- data/spec/falkorlib_spec.rb +1 -1
- metadata +15 -1
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# versioning_gem_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Sun 2016-10-16 22:13 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the versioning operations on Gems
|
8
8
|
#
|
@@ -37,12 +37,12 @@ describe FalkorLib::Versioning::Gem do
|
|
37
37
|
c[:source]['gem'][:filename] = "#{versionfile}"
|
38
38
|
c[:source]['gem'][:getmethod] = "::TestGemVersion.version"
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
41
41
|
|
42
42
|
after :all do
|
43
43
|
configatron.temp_end
|
44
44
|
FileUtils.remove_entry_secure dir
|
45
|
-
FalkorLib.config[:versioning][:type] = 'file'
|
45
|
+
FalkorLib.config[:versioning][:type] = 'file'
|
46
46
|
# configatron.temp do
|
47
47
|
# FalkorLib.config.versioning[:type] = 'file'
|
48
48
|
# end
|
@@ -62,12 +62,12 @@ describe FalkorLib::Versioning::Gem do
|
|
62
62
|
|
63
63
|
it "#get_version -- NameError on non-existing method" do
|
64
64
|
if command?('git_flow')
|
65
|
-
STDIN.
|
65
|
+
expect(STDIN).to receive(:gets).and_return('Yes')
|
66
66
|
t = FalkorLib::GitFlow.init(dir)
|
67
|
-
t.
|
67
|
+
expect(t).to eq(0)
|
68
68
|
else
|
69
69
|
t = FalkorLib::Git.init(dir)
|
70
|
-
t.
|
70
|
+
expect(t).to be_truthy
|
71
71
|
end
|
72
72
|
expect { FalkorLib::Versioning.get_version(dir) }.to raise_error (NameError)
|
73
73
|
end
|
@@ -84,61 +84,61 @@ describe FalkorLib::Versioning::Gem do
|
|
84
84
|
|
85
85
|
it "initializes the Gem version file #{versionfile} " do
|
86
86
|
t = File.exists?(versionfile_path)
|
87
|
-
t.
|
87
|
+
expect(t).to be true
|
88
88
|
u = run %{ cat #{versionfile_path} }
|
89
|
-
u.to_i.
|
89
|
+
expect(u.to_i).to eq(0)
|
90
90
|
end
|
91
91
|
|
92
92
|
it "#get_version -- should get the '#{workingversion[:default]}' version set in the file #{versionfile}" do
|
93
93
|
load "#{versionfile_path}"
|
94
94
|
v = FalkorLib::Versioning.get_version(dir)
|
95
|
-
v.
|
95
|
+
expect(v).to eq(workingversion[:default])
|
96
96
|
end
|
97
97
|
|
98
98
|
it "#major -- should collect the Gem major version" do
|
99
99
|
v = FalkorLib::Versioning.get_version(dir)
|
100
100
|
m = FalkorLib::Versioning.major(v)
|
101
|
-
m.
|
101
|
+
expect(m).to eq('4')
|
102
102
|
end
|
103
103
|
it "#minor -- should collect the Gem minor version" do
|
104
104
|
v = FalkorLib::Versioning.get_version(dir)
|
105
105
|
m = FalkorLib::Versioning.minor(v)
|
106
|
-
m.
|
106
|
+
expect(m).to eq('5')
|
107
107
|
end
|
108
108
|
it "#patch -- should collect the Gem patch version" do
|
109
109
|
v = FalkorLib::Versioning.get_version(dir)
|
110
110
|
m = FalkorLib::Versioning.patch(v)
|
111
|
-
m.
|
111
|
+
expect(m).to eq('6')
|
112
112
|
end
|
113
113
|
|
114
114
|
it "#set_version -- set Gem version #{default_version} in version file #{versionfile}" do
|
115
|
-
STDIN.
|
115
|
+
expect(STDIN).to receive(:gets).and_return('Yes')
|
116
116
|
v = FalkorLib::Versioning.set_version(default_version, dir)
|
117
|
-
v.
|
117
|
+
expect(v).to eq(0)
|
118
118
|
load "#{versionfile_path}"
|
119
119
|
v = FalkorLib::Versioning.get_version(dir)
|
120
|
-
v.
|
120
|
+
expect(v).to eq(default_version)
|
121
121
|
end
|
122
122
|
|
123
123
|
#FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
124
124
|
[ :patch, :minor ].each do |level|
|
125
125
|
it "#set_version #bump -- #{level} bump Gem version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
|
126
126
|
# restore version file
|
127
|
-
STDIN.
|
127
|
+
expect(STDIN).to receive(:gets).and_return('Yes')
|
128
128
|
v = FalkorLib::Versioning.set_version(workingversion[:default], dir)
|
129
|
-
v.
|
129
|
+
expect(v).to eq(0)
|
130
130
|
load "#{versionfile_path}"
|
131
131
|
v = FalkorLib::Versioning.get_version(dir)
|
132
|
-
v.
|
132
|
+
expect(v).to eq(workingversion[:default])
|
133
133
|
# Let's bump
|
134
134
|
v2 = FalkorLib::Versioning.bump(v, level.to_sym)
|
135
|
-
v2.
|
136
|
-
STDIN.
|
135
|
+
expect(v2).to eq(workingversion[level.to_sym])
|
136
|
+
expect(STDIN).to receive(:gets).and_return('Yes')
|
137
137
|
d = FalkorLib::Versioning.set_version(v2, dir)
|
138
|
-
d.
|
138
|
+
expect(d).to eq(0)
|
139
139
|
load "#{versionfile_path}"
|
140
140
|
v3 = FalkorLib::Versioning.get_version(dir)
|
141
|
-
v3.
|
141
|
+
expect(v3).to eq(v2)
|
142
142
|
end
|
143
143
|
end
|
144
144
|
end
|
@@ -53,50 +53,50 @@ describe FalkorLib::Versioning::Puppet do
|
|
53
53
|
|
54
54
|
ap default_version
|
55
55
|
it "#get_version -- get default version #{default_version} after initialization" do
|
56
|
-
Array.new(17).each { |e| STDIN.
|
56
|
+
Array.new(17).each { |e| expect(STDIN).to receive(:gets).and_return('') }
|
57
57
|
FalkorLib::Puppet::Modules.init(moduledir)
|
58
58
|
v = FalkorLib::Versioning.get_version(moduledir)
|
59
|
-
v.
|
59
|
+
expect(v).to eq(default_version)
|
60
60
|
if command?('git-flow')
|
61
61
|
a = FalkorLib::GitFlow.finish('feature', 'bootstrapping', moduledir)
|
62
|
-
a.
|
62
|
+
expect(a).to eq(0)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
66
|
it "#set_version -- should set the '#{workingversion[:default]}' version" do
|
67
|
-
STDIN.
|
67
|
+
expect(STDIN).to receive(:gets).and_return('Yes')
|
68
68
|
v = FalkorLib::Versioning.set_version(workingversion[:default], moduledir)
|
69
|
-
v.
|
69
|
+
expect(v).to eq(0)
|
70
70
|
end
|
71
71
|
|
72
72
|
it "#get_version -- should get the '#{workingversion[:default]}'" do
|
73
73
|
v = FalkorLib::Versioning.get_version(moduledir)
|
74
|
-
v.
|
74
|
+
expect(v).to eq(workingversion[:default])
|
75
75
|
end
|
76
76
|
|
77
77
|
it "#major -- should collect the major version" do
|
78
78
|
v = FalkorLib::Versioning.get_version(moduledir)
|
79
79
|
m = FalkorLib::Versioning.major(v)
|
80
|
-
m.
|
80
|
+
expect(m).to eq('4')
|
81
81
|
end
|
82
82
|
it "#minor -- should collect the minor version" do
|
83
83
|
v = FalkorLib::Versioning.get_version(moduledir)
|
84
84
|
m = FalkorLib::Versioning.minor(v)
|
85
|
-
m.
|
85
|
+
expect(m).to eq('5')
|
86
86
|
end
|
87
87
|
it "#patch -- should collect the patch version" do
|
88
88
|
v = FalkorLib::Versioning.get_version(moduledir)
|
89
89
|
m = FalkorLib::Versioning.patch(v)
|
90
|
-
m.
|
90
|
+
expect(m).to eq('6')
|
91
91
|
end
|
92
92
|
|
93
93
|
#FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
94
94
|
['patch', 'minor'].each do |level|
|
95
95
|
it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
|
96
96
|
v = FalkorLib::Versioning.get_version(moduledir)
|
97
|
-
v.
|
97
|
+
expect(v).to eq(workingversion[:default])
|
98
98
|
v2 = FalkorLib::Versioning.bump(v, level.to_sym)
|
99
|
-
v2.
|
99
|
+
expect(v2).to eq(workingversion[level.to_sym])
|
100
100
|
#STDIN.should_receive(:gets).and_return('Yes')
|
101
101
|
#d = FalkorLib::Versioning.set_version(v2, moduledir)
|
102
102
|
#d.should == 0
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# versioning_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Sun 2016-10-16 22:12 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the versioning operations
|
8
8
|
#
|
@@ -17,93 +17,93 @@ require 'tmpdir'
|
|
17
17
|
|
18
18
|
describe FalkorLib::Versioning do
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
20
|
+
include FalkorLib::Common
|
21
|
+
|
22
|
+
dir = Dir.mktmpdir
|
23
|
+
|
24
|
+
workdir = File.join(dir, 'version')
|
25
|
+
|
26
|
+
afile = File.join(workdir, 'a_file')
|
27
|
+
versionfile = FalkorLib.config[:versioning][:source]['file'][:filename]
|
28
|
+
default_version = FalkorLib.config[:versioning][:default]
|
29
|
+
workingversion = {
|
30
|
+
:default => '1.2.3',
|
31
|
+
:patch => '1.2.4',
|
32
|
+
:minor => '1.3.0',
|
33
|
+
:major => '2.0.0'
|
34
|
+
}
|
35
|
+
|
36
|
+
before :all do
|
37
|
+
FileUtils.mkdir_p workdir
|
38
|
+
FalkorLib.config[:versioning][:type] = 'file'
|
39
|
+
end
|
40
|
+
|
41
|
+
after :all do
|
42
|
+
FileUtils.remove_entry_secure dir
|
43
|
+
end
|
44
|
+
|
45
|
+
###################################################################
|
46
|
+
context 'Test versioning operations within temporary directory' do
|
47
|
+
|
48
|
+
it "#get_version -- get default version #{default_version}" do
|
49
|
+
if command?('git_flow')
|
50
|
+
expect(STDIN).to receive(:gets).and_return('Yes')
|
51
|
+
t = FalkorLib::GitFlow.init(workdir)
|
52
|
+
expect(t).to eq(0)
|
53
|
+
else
|
54
|
+
t = FalkorLib::Git.init(workdir)
|
55
|
+
expect(t).to be_truthy
|
56
|
+
end
|
57
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
58
|
+
expect(v).to eq(default_version)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "#get_version -- should get the '#{workingversion[:default]}' version set in the file #{versionfile}" do
|
62
|
+
execute "echo #{workingversion[:default]} > #{workdir}/#{versionfile}"
|
63
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
64
|
+
expect(v).to eq(workingversion[:default])
|
65
|
+
end
|
66
|
+
|
67
|
+
it "#major -- should collect the major version" do
|
68
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
69
|
+
m = FalkorLib::Versioning.major(v)
|
70
|
+
expect(m).to eq('1')
|
71
|
+
end
|
72
|
+
it "#minor -- should collect the minor version" do
|
73
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
74
|
+
m = FalkorLib::Versioning.minor(v)
|
75
|
+
expect(m).to eq('2')
|
43
76
|
end
|
77
|
+
it "#patch -- should collect the patch version" do
|
78
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
79
|
+
m = FalkorLib::Versioning.patch(v)
|
80
|
+
expect(m).to eq('3')
|
81
|
+
end
|
82
|
+
|
44
83
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
t.should == 0
|
53
|
-
else
|
54
|
-
t = FalkorLib::Git.init(workdir)
|
55
|
-
t.should be_true
|
56
|
-
end
|
57
|
-
v = FalkorLib::Versioning.get_version(workdir)
|
58
|
-
v.should == default_version
|
59
|
-
end
|
60
|
-
|
61
|
-
it "#get_version -- should get the '#{workingversion[:default]}' version set in the file #{versionfile}" do
|
62
|
-
execute "echo #{workingversion[:default]} > #{workdir}/#{versionfile}"
|
63
|
-
v = FalkorLib::Versioning.get_version(workdir)
|
64
|
-
v.should == workingversion[:default]
|
65
|
-
end
|
66
|
-
|
67
|
-
it "#major -- should collect the major version" do
|
68
|
-
v = FalkorLib::Versioning.get_version(workdir)
|
69
|
-
m = FalkorLib::Versioning.major(v)
|
70
|
-
m.should == '1'
|
71
|
-
end
|
72
|
-
it "#minor -- should collect the minor version" do
|
73
|
-
v = FalkorLib::Versioning.get_version(workdir)
|
74
|
-
m = FalkorLib::Versioning.minor(v)
|
75
|
-
m.should == '2'
|
76
|
-
end
|
77
|
-
it "#patch -- should collect the patch version" do
|
78
|
-
v = FalkorLib::Versioning.get_version(workdir)
|
79
|
-
m = FalkorLib::Versioning.patch(v)
|
80
|
-
m.should == '3'
|
81
|
-
end
|
82
|
-
|
83
|
-
|
84
|
-
it "#set_version -- set version #{default_version} in version file #{versionfile}" do
|
85
|
-
STDIN.should_receive(:gets).and_return('no')
|
86
|
-
v = FalkorLib::Versioning.set_version(default_version, workdir)
|
87
|
-
v.should == 0
|
88
|
-
v = FalkorLib::Versioning.get_version(workdir)
|
89
|
-
v.should == default_version
|
90
|
-
end
|
91
|
-
|
92
|
-
FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
93
|
-
it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
|
94
|
-
# restore version file
|
95
|
-
execute "echo #{workingversion[:default]} > #{workdir}/#{versionfile}"
|
96
|
-
v = FalkorLib::Versioning.get_version(workdir)
|
97
|
-
v.should == workingversion[:default]
|
98
|
-
v2 = FalkorLib::Versioning.bump(v, level.to_sym)
|
99
|
-
v2.should == workingversion[level.to_sym]
|
100
|
-
STDIN.should_receive(:gets).and_return('no')
|
101
|
-
d = FalkorLib::Versioning.set_version(v2, workdir)
|
102
|
-
d.should == 0
|
103
|
-
v3 = FalkorLib::Versioning.get_version(workdir)
|
104
|
-
v3.should == v2
|
105
|
-
end
|
106
|
-
end
|
84
|
+
it "#set_version -- set version #{default_version} in version file #{versionfile}" do
|
85
|
+
expect(STDIN).to receive(:gets).and_return('no')
|
86
|
+
v = FalkorLib::Versioning.set_version(default_version, workdir)
|
87
|
+
expect(v).to eq(0)
|
88
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
89
|
+
expect(v).to eq(default_version)
|
90
|
+
end
|
107
91
|
|
92
|
+
FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
93
|
+
it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
|
94
|
+
# restore version file
|
95
|
+
execute "echo #{workingversion[:default]} > #{workdir}/#{versionfile}"
|
96
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
97
|
+
expect(v).to eq(workingversion[:default])
|
98
|
+
v2 = FalkorLib::Versioning.bump(v, level.to_sym)
|
99
|
+
expect(v2).to eq(workingversion[level.to_sym])
|
100
|
+
expect(STDIN).to receive(:gets).and_return('no')
|
101
|
+
d = FalkorLib::Versioning.set_version(v2, workdir)
|
102
|
+
expect(d).to eq(0)
|
103
|
+
v3 = FalkorLib::Versioning.get_version(workdir)
|
104
|
+
expect(v3).to eq(v2)
|
105
|
+
end
|
108
106
|
end
|
107
|
+
|
108
|
+
end
|
109
109
|
end
|
data/spec/falkorlib_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falkorlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Varrette
|
@@ -226,6 +226,20 @@ dependencies:
|
|
226
226
|
- - "~>"
|
227
227
|
- !ruby/object:Gem::Version
|
228
228
|
version: '1.0'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: rspec
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - "~>"
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '3.0'
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - "~>"
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '3.0'
|
229
243
|
- !ruby/object:Gem::Dependency
|
230
244
|
name: pry
|
231
245
|
requirement: !ruby/object:Gem::Requirement
|