falkorlib 0.3.7 → 0.3.8
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 +1 -1
- data/lib/falkorlib/common.rb +9 -9
- data/lib/falkorlib/puppet/modules.rb +10 -9
- data/lib/falkorlib/tasks/gem.rake +11 -1
- data/lib/falkorlib/tasks/rspec.rake +3 -3
- data/lib/falkorlib/version.rb +1 -1
- data/lib/falkorlib/versioning.rb +11 -3
- data/spec/falkorlib/common_spec.rb +52 -2
- data/spec/falkorlib/puppet_modules_spec.rb +42 -15
- data/spec/falkorlib/versioning_gem_spec.rb +26 -13
- data/spec/falkorlib/versioning_puppet_module_spec.rb +111 -0
- data/spec/falkorlib/versioning_spec.rb +24 -16
- data/templates/puppet/modules/metadata.json.erb +26 -17
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac83da0f27d90c212ef11d4eb49797531aa5e182
|
4
|
+
data.tar.gz: f26283dc8a2b3d61a2d5634875d7b5c8e837d594
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c594d1cc7ae26b01db0869fe26c8f2e6a4e297192f7f2228175a795e1dbeeed5ca84b083658d1a62883b13e14f2c45225ac24ceecad7149f9fff0479366e0d12
|
7
|
+
data.tar.gz: 405cf89860590016e86e3529db29762d78a089a111c0ebecd100ca331cdb582d57e9b626f5b2de552b3c06f5b074a26cd17dee4fc674a41b6086dc695e21e824
|
data/Gemfile.lock
CHANGED
data/lib/falkorlib/common.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Dim 2014-08-31 22:32 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require "falkorlib"
|
@@ -183,14 +183,14 @@ module FalkorLib #:nodoc:
|
|
183
183
|
next if (! options[:only_files].nil?) && options[:only_files] && File.directory?(elem)
|
184
184
|
next if (! options[:only_dirs].nil?) && options[:only_dirs] && File.file?(elem)
|
185
185
|
entry = File.basename(elem)
|
186
|
-
unless options[:pattern_include].nil?
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
end
|
186
|
+
# unless options[:pattern_include].nil?
|
187
|
+
# select_entry = false
|
188
|
+
# options[:pattern_include].each do |pattern|
|
189
|
+
# #puts "considering pattern '#{pattern}' on entry '#{entry}'"
|
190
|
+
# select_entry |= entry =~ /#{pattern}/
|
191
|
+
# end
|
192
|
+
# next unless select_entry
|
193
|
+
# end
|
194
194
|
unless options[:pattern_exclude].nil?
|
195
195
|
select_entry = false
|
196
196
|
options[:pattern_exclude].each do |pattern|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sun 2014-08-31 16:24 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Interface for the main Puppet Module operations
|
6
6
|
#
|
@@ -148,13 +148,14 @@ module FalkorLib #:nodoc:
|
|
148
148
|
end
|
149
149
|
info "Initialize RVM"
|
150
150
|
init_rvm(moduledir)
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
151
|
+
unless FalkorLib::Git.init?(moduledir)
|
152
|
+
init_gitflow = command?('git-flow')
|
153
|
+
warn "Git #{init_gitflow ? '[Flow]' : ''} is not initialized in #{moduledir}."
|
154
|
+
a = ask("Proceed to git-flow initialization (Y|n)", 'Yes')
|
155
|
+
return if a =~ /n.*/i
|
156
|
+
init_gitflow ? FalkorLib::GitFlow.init(moduledir) : FalkorLib::Git.init(moduledir)
|
157
|
+
end
|
158
|
+
|
158
159
|
# Propose to commit the key files
|
159
160
|
if FalkorLib::Git.init?(moduledir)
|
160
161
|
if FalkorLib::GitFlow.init?(moduledir)
|
@@ -212,7 +213,7 @@ module FalkorLib #:nodoc:
|
|
212
213
|
puts content
|
213
214
|
if ref == content
|
214
215
|
warn "No difference to commit"
|
215
|
-
return
|
216
|
+
return []
|
216
217
|
end
|
217
218
|
info "Differences with the previous file"
|
218
219
|
Diffy::Diff.default_format = :color
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
3
|
# gem.rake - Special tasks for the management of Gem operations
|
4
|
-
# Time-stamp: <
|
4
|
+
# Time-stamp: <Dim 2014-08-31 22:59 svarrette>
|
5
5
|
#
|
6
6
|
# Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
7
7
|
# http://varrette.gforge.uni.lu
|
@@ -75,6 +75,16 @@ Rake::Task['build'].enhance do
|
|
75
75
|
Rake::Task["sign"].invoke if File.directory?(File.join(ENV['HOME'], '.gnupg') )
|
76
76
|
end
|
77
77
|
|
78
|
+
[ 'major', 'minor', 'patch' ].each do |level|
|
79
|
+
Rake::Task["version:bump:#{level}"].enhance do
|
80
|
+
warn "about to run the rspec tests to ensure the release can be done"
|
81
|
+
really_continue?
|
82
|
+
Rake::Task['rspec'].invoke
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
|
78
88
|
# Gem::Tasks.new(
|
79
89
|
# :console => false,
|
80
90
|
# :install => false,
|
@@ -30,9 +30,9 @@ begin
|
|
30
30
|
desc "Run RSpec code examples '*_spec.rb' from the spec/ directory"
|
31
31
|
RSpec::Core::RakeTask.new(:rspec) do |t|
|
32
32
|
# Glob pattern to match files.
|
33
|
-
|
34
|
-
#t.pattern = "spec
|
35
|
-
#t.pattern = "spec
|
33
|
+
#t.pattern = "spec/**/common_*.rb"
|
34
|
+
#t.pattern = "spec/**/versioning_*spec.rb"
|
35
|
+
#t.pattern = "spec/**/*puppet*spec.rb"
|
36
36
|
|
37
37
|
# Whether or not to fail Rake when an error occurs (typically when
|
38
38
|
# examples fail).
|
data/lib/falkorlib/version.rb
CHANGED
data/lib/falkorlib/versioning.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Dim 2014-08-31 22:00 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
6
6
|
#
|
@@ -72,7 +72,7 @@ module FalkorLib #:nodoc:
|
|
72
72
|
version = FalkorLib.config[:versioning][:default]
|
73
73
|
type = FalkorLib.config[:versioning][:type]
|
74
74
|
source = FalkorLib.config[:versioning][:source][ type ]
|
75
|
-
|
75
|
+
case type
|
76
76
|
when 'file'
|
77
77
|
versionfile = File.join( rootdir, source[:filename] )
|
78
78
|
version = File.read( versionfile ).chomp if File.exist? ( versionfile )
|
@@ -170,6 +170,14 @@ module FalkorLib #:nodoc:
|
|
170
170
|
end
|
171
171
|
version = [major, minor, patch].compact.join('.')
|
172
172
|
end
|
173
|
-
|
173
|
+
|
174
|
+
# for rspec
|
175
|
+
module Gem
|
176
|
+
end
|
177
|
+
# for rspec
|
178
|
+
module Puppet
|
179
|
+
end
|
180
|
+
|
181
|
+
end # module
|
174
182
|
|
175
183
|
end
|
@@ -5,6 +5,19 @@ describe FalkorLib::Common do
|
|
5
5
|
|
6
6
|
include FalkorLib::Common
|
7
7
|
|
8
|
+
dir = Dir.mktmpdir
|
9
|
+
|
10
|
+
before :all do
|
11
|
+
FileUtils.touch File.join(dir, 'file1.txt')
|
12
|
+
FileUtils.touch File.join(dir, 'file2.txt')
|
13
|
+
FileUtils.mkdir File.join(dir, 'dir1')
|
14
|
+
FileUtils.mkdir File.join(dir, 'dir2')
|
15
|
+
end
|
16
|
+
|
17
|
+
after :all do
|
18
|
+
FileUtils.remove_entry_secure dir
|
19
|
+
end
|
20
|
+
|
8
21
|
#############################################
|
9
22
|
context "Test (common) printing functions" do
|
10
23
|
|
@@ -162,8 +175,6 @@ describe FalkorLib::Common do
|
|
162
175
|
end
|
163
176
|
|
164
177
|
|
165
|
-
|
166
|
-
|
167
178
|
#############################################
|
168
179
|
context "Test (common) YAML functions" do
|
169
180
|
|
@@ -184,4 +195,43 @@ describe FalkorLib::Common do
|
|
184
195
|
|
185
196
|
end
|
186
197
|
|
198
|
+
############################################
|
199
|
+
context 'Test list selection functions' do
|
200
|
+
|
201
|
+
it "#list_items - Exit on 0" do
|
202
|
+
STDIN.should_receive(:gets).and_return('0')
|
203
|
+
expect { list_items("#{dir}/*") }.to raise_error (SystemExit)
|
204
|
+
end
|
205
|
+
|
206
|
+
it "#list_items -- select files only" do
|
207
|
+
STDIN.should_receive(:gets).and_return('1')
|
208
|
+
f = list_items("#{dir}/*", { :only_files => true })
|
209
|
+
f.should =~ /\/file.?\.txt$/
|
210
|
+
end
|
211
|
+
|
212
|
+
it "#list_items -- select files only with pattern exclude" do
|
213
|
+
STDIN.should_receive(:gets).and_return('1')
|
214
|
+
f = list_items("#{dir}/*", { :only_files => true, :pattern_exclude => [ 'file1' ] })
|
215
|
+
f.should == "#{dir}/file2.txt"
|
216
|
+
end
|
217
|
+
|
218
|
+
it "#list_items -- select dirs only" do
|
219
|
+
STDIN.should_receive(:gets).and_return('1')
|
220
|
+
f = list_items("#{dir}/*", { :only_dirs => true })
|
221
|
+
f.should =~ /\/dir.?$/
|
222
|
+
end
|
223
|
+
|
224
|
+
it "#list_items -- select dirs only with pattern exclude" do
|
225
|
+
STDIN.should_receive(:gets).and_return('1')
|
226
|
+
f = list_items("#{dir}/*", { :only_dirs => true, :pattern_exclude => [ 'dir1' ] })
|
227
|
+
f.should == "#{dir}/dir2"
|
228
|
+
end
|
229
|
+
|
230
|
+
it "#list_items -- exit on empty list" do
|
231
|
+
#STDIN.should_receive(:gets).and_return('1')
|
232
|
+
expect { list_items("#{dir}/*", { :only_files => true, :pattern_exclude => [ '.*\.txt']}) }.to raise_error (SystemExit)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
|
187
237
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# puppet_modules_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Dim 2014-08-31 22:45 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Puppet Modules operations
|
8
8
|
#
|
@@ -19,6 +19,11 @@ describe FalkorLib::Puppet::Modules do
|
|
19
19
|
include FalkorLib::Common
|
20
20
|
|
21
21
|
dir = Dir.mktmpdir
|
22
|
+
# Module name
|
23
|
+
name = 'toto'
|
24
|
+
moduledir = File.join(dir, name)
|
25
|
+
jsonfile = File.join( moduledir, 'metadata.json')
|
26
|
+
|
22
27
|
#afile = File.join(dir, 'a_file')
|
23
28
|
# before :all do
|
24
29
|
# ENV['GIT_AUTHOR_NAME'] = 'travis' if ENV['GIT_AUTHOR_NAME'].nil?
|
@@ -32,14 +37,10 @@ describe FalkorLib::Puppet::Modules do
|
|
32
37
|
#############################################################
|
33
38
|
context "Test Puppet Module creation within temporary directory " do
|
34
39
|
|
35
|
-
# Module name
|
36
|
-
name = 'toto'
|
37
|
-
moduledir = File.join(dir, name)
|
38
40
|
|
39
41
|
it "#init -- create a puppet module" do
|
40
42
|
# Prepare answer to the questions
|
41
43
|
Array.new(32).each { |e| STDIN.should_receive(:gets).and_return('') }
|
42
|
-
|
43
44
|
FalkorLib::Puppet::Modules.init(moduledir)
|
44
45
|
templatedir = File.join( FalkorLib.templates, 'puppet', 'modules')
|
45
46
|
s = true
|
@@ -56,6 +57,11 @@ describe FalkorLib::Puppet::Modules do
|
|
56
57
|
s.should be_true
|
57
58
|
end
|
58
59
|
|
60
|
+
it "#_getclassdefs -- should failed on unrecogized type" do
|
61
|
+
expect { FalkorLib::Puppet::Modules._get_classdefs(dir, 'toto') }.to raise_error (SystemExit)
|
62
|
+
end
|
63
|
+
|
64
|
+
|
59
65
|
it "#classes -- list classes" do
|
60
66
|
l = FalkorLib::Puppet::Modules._get_classdefs(moduledir, 'classes')
|
61
67
|
c = FalkorLib::Puppet::Modules.classes(moduledir)
|
@@ -88,26 +94,47 @@ describe FalkorLib::Puppet::Modules do
|
|
88
94
|
|
89
95
|
it "#parse" do
|
90
96
|
STDIN.should_receive(:gets).and_return('')
|
91
|
-
jsonfile = File.join( moduledir, 'metadata.json')
|
92
97
|
ref = JSON.parse( IO.read( jsonfile ) )
|
93
98
|
metadata = FalkorLib::Puppet::Modules.parse(moduledir)
|
94
|
-
diff = (metadata.to_a - ref.to_a).flatten
|
99
|
+
diff = (metadata.to_a - ref.to_a).flatten.sort
|
95
100
|
diff.should == [
|
96
101
|
'classes',
|
97
|
-
'
|
102
|
+
'definitions',
|
98
103
|
'toto',
|
99
104
|
'toto::common',
|
100
105
|
'toto::debian',
|
101
|
-
'toto::redhat',
|
102
|
-
'definitions',
|
103
106
|
'toto::mydef',
|
107
|
+
'toto::params',
|
108
|
+
'toto::redhat',
|
104
109
|
]
|
105
|
-
|
106
|
-
|
107
110
|
end
|
108
111
|
|
112
|
+
it "#parse again" do
|
113
|
+
metadata = FalkorLib::Puppet::Modules.parse(moduledir)
|
114
|
+
metadata.should == []
|
115
|
+
end
|
116
|
+
|
117
|
+
it "#deps -- should find a new dependency" do
|
118
|
+
classfile = File.join(moduledir, 'manifests', 'classes', 'toto.pp')
|
119
|
+
newdep = "tata"
|
120
|
+
run %{ echo 'include "#{newdep}"' >> #{classfile} }
|
121
|
+
a = FalkorLib::Puppet::Modules.deps(moduledir)
|
122
|
+
a.should include newdep
|
123
|
+
end
|
124
|
+
|
125
|
+
it "#parse -- should ask new dependency elements" do
|
126
|
+
ref = JSON.parse( IO.read( jsonfile ) )
|
127
|
+
STDIN.should_receive(:gets).and_return('svarrette')
|
128
|
+
STDIN.should_receive(:gets).and_return('1.2')
|
129
|
+
STDIN.should_receive(:gets).and_return('Yes')
|
130
|
+
metadata = FalkorLib::Puppet::Modules.parse(moduledir)
|
131
|
+
diff = (metadata.to_a - ref.to_a).flatten
|
132
|
+
diff.should == [
|
133
|
+
'dependencies',
|
134
|
+
{"name"=>"puppetlabs-stdlib", "version_range"=>">= 1.0.0"},
|
135
|
+
{"name"=>"svarrette/tata", "version_requirement"=>"1.2"}
|
136
|
+
]
|
137
|
+
end
|
138
|
+
end # context
|
109
139
|
|
110
|
-
|
111
|
-
|
112
|
-
end
|
113
140
|
end
|
@@ -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: <Dim 2014-08-31 22:34 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the versioning operations on Gems
|
8
8
|
#
|
@@ -14,7 +14,7 @@ require 'spec_helper'
|
|
14
14
|
require 'tmpdir'
|
15
15
|
|
16
16
|
|
17
|
-
describe FalkorLib::Versioning do
|
17
|
+
describe FalkorLib::Versioning::Gem do
|
18
18
|
|
19
19
|
include FalkorLib::Common
|
20
20
|
|
@@ -30,25 +30,38 @@ describe FalkorLib::Versioning do
|
|
30
30
|
:major => '5.0.0'
|
31
31
|
}
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
FalkorLib.config.versioning[:type] = 'file'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
configatron.temp do
|
41
|
-
FalkorLib.config.versioning do |c|
|
33
|
+
before :all do
|
34
|
+
configatron.temp_start
|
35
|
+
FalkorLib.config.versioning do |c|
|
42
36
|
c[:type] = 'gem'
|
43
37
|
c[:source]['gem'][:filename] = "#{versionfile}"
|
44
38
|
c[:source]['gem'][:getmethod] = "::TestGemVersion.version"
|
45
39
|
end
|
40
|
+
end
|
41
|
+
|
42
|
+
after :all do
|
43
|
+
configatron.temp_end
|
44
|
+
FileUtils.remove_entry_secure dir
|
45
|
+
FalkorLib.config[:versioning][:type] = 'file'
|
46
|
+
# configatron.temp do
|
47
|
+
# FalkorLib.config.versioning[:type] = 'file'
|
48
|
+
# end
|
49
|
+
end
|
50
|
+
|
51
|
+
# configatron.temp do
|
52
|
+
# FalkorLib.config.versioning do |c|
|
53
|
+
# c[:type] = 'gem'
|
54
|
+
# c[:source]['gem'][:filename] = "#{versionfile}"
|
55
|
+
# c[:source]['gem'][:getmethod] = "::TestGemVersion.version"
|
56
|
+
# end
|
46
57
|
|
47
58
|
|
48
59
|
###################################################################
|
49
60
|
context 'Test GEM versioning operations within temporary directory' do
|
61
|
+
|
62
|
+
|
50
63
|
it "#get_version -- NameError on non-existing method" do
|
51
|
-
|
64
|
+
if command?('git_flow')
|
52
65
|
STDIN.should_receive(:gets).and_return('Yes')
|
53
66
|
t = FalkorLib::GitFlow.init(dir)
|
54
67
|
t.should == 0
|
@@ -130,6 +143,6 @@ describe FalkorLib::Versioning do
|
|
130
143
|
end
|
131
144
|
end
|
132
145
|
|
133
|
-
end #configatron.temp
|
146
|
+
#end #configatron.temp
|
134
147
|
|
135
148
|
end # describe FalkorLib::Versioning
|
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
#########################################
|
3
|
+
# versioning_puppet_module_spec.rb
|
4
|
+
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
+
# Time-stamp: <Dim 2014-08-31 22:00 svarrette>
|
6
|
+
#
|
7
|
+
# @description Check the versioning operations on Gems
|
8
|
+
#
|
9
|
+
# Copyright (c) 2013 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
10
|
+
# . http://varrette.gforge.uni.lu
|
11
|
+
##############################################################################
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'tmpdir'
|
15
|
+
|
16
|
+
|
17
|
+
describe FalkorLib::Versioning::Puppet do
|
18
|
+
|
19
|
+
include FalkorLib::Common
|
20
|
+
|
21
|
+
dir = Dir.mktmpdir
|
22
|
+
name = 'toto'
|
23
|
+
moduledir = File.join(dir, name)
|
24
|
+
default_version = FalkorLib.config[:versioning][:default]
|
25
|
+
|
26
|
+
workingversion = {
|
27
|
+
:default => '4.5.6',
|
28
|
+
:patch => '4.5.7',
|
29
|
+
:minor => '4.6.0',
|
30
|
+
:major => '5.0.0'
|
31
|
+
}
|
32
|
+
|
33
|
+
before :all do
|
34
|
+
configatron.temp_start
|
35
|
+
FalkorLib.config.versioning do |c|
|
36
|
+
c[:type] = 'puppet_module'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
after :all do
|
41
|
+
configatron.temp_end
|
42
|
+
FileUtils.remove_entry_secure dir
|
43
|
+
FalkorLib.config.versioning[:type] = 'file'
|
44
|
+
end
|
45
|
+
|
46
|
+
# configatron.temp do
|
47
|
+
# FalkorLib.config.versioning do |c|
|
48
|
+
# c[:type] = 'puppet_module'
|
49
|
+
# end
|
50
|
+
|
51
|
+
###################################################################
|
52
|
+
context 'Test Puppet Module versioning operations within temporary directory' do
|
53
|
+
|
54
|
+
|
55
|
+
it "#get_version -- get default version #{default_version} after initialization" do
|
56
|
+
Array.new(32).each { |e| STDIN.should_receive(:gets).and_return('') }
|
57
|
+
FalkorLib::Puppet::Modules.init(moduledir)
|
58
|
+
v = FalkorLib::Versioning.get_version(moduledir)
|
59
|
+
v.should == default_version
|
60
|
+
if command?('git-flow')
|
61
|
+
a = FalkorLib::GitFlow.finish('feature', 'bootstraping', moduledir)
|
62
|
+
a.should == 0
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it "#set_version -- should set the '#{workingversion[:default]}' version" do
|
67
|
+
STDIN.should_receive(:gets).and_return('Yes')
|
68
|
+
v = FalkorLib::Versioning.set_version(workingversion[:default], moduledir)
|
69
|
+
v.should == 0
|
70
|
+
end
|
71
|
+
|
72
|
+
it "#get_version -- should get the '#{workingversion[:default]}'" do
|
73
|
+
v = FalkorLib::Versioning.get_version(moduledir)
|
74
|
+
v.should == workingversion[:default]
|
75
|
+
end
|
76
|
+
|
77
|
+
it "#major -- should collect the major version" do
|
78
|
+
v = FalkorLib::Versioning.get_version(moduledir)
|
79
|
+
m = FalkorLib::Versioning.major(v)
|
80
|
+
m.should == '4'
|
81
|
+
end
|
82
|
+
it "#minor -- should collect the minor version" do
|
83
|
+
v = FalkorLib::Versioning.get_version(moduledir)
|
84
|
+
m = FalkorLib::Versioning.minor(v)
|
85
|
+
m.should == '5'
|
86
|
+
end
|
87
|
+
it "#patch -- should collect the patch version" do
|
88
|
+
v = FalkorLib::Versioning.get_version(moduledir)
|
89
|
+
m = FalkorLib::Versioning.patch(v)
|
90
|
+
m.should == '6'
|
91
|
+
end
|
92
|
+
|
93
|
+
#FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
94
|
+
['patch', 'minor'].each do |level|
|
95
|
+
it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
|
96
|
+
v = FalkorLib::Versioning.get_version(moduledir)
|
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('Yes')
|
101
|
+
#d = FalkorLib::Versioning.set_version(v2, moduledir)
|
102
|
+
#d.should == 0
|
103
|
+
#v3 = FalkorLib::Versioning.get_version(moduledir)
|
104
|
+
#v3.should == v2
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
#end #configatron.temp
|
110
|
+
|
111
|
+
end # describe FalkorLib::Versioning
|
@@ -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: <Dim 2014-08-31 21:57 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the versioning operations
|
8
8
|
#
|
@@ -20,7 +20,10 @@ describe FalkorLib::Versioning do
|
|
20
20
|
include FalkorLib::Common
|
21
21
|
|
22
22
|
dir = Dir.mktmpdir
|
23
|
-
|
23
|
+
|
24
|
+
workdir = File.join(dir, 'version')
|
25
|
+
|
26
|
+
afile = File.join(workdir, 'a_file')
|
24
27
|
versionfile = FalkorLib.config[:versioning][:source]['file'][:filename]
|
25
28
|
default_version = FalkorLib.config[:versioning][:default]
|
26
29
|
workingversion = {
|
@@ -29,6 +32,11 @@ describe FalkorLib::Versioning do
|
|
29
32
|
:minor => '1.3.0',
|
30
33
|
:major => '2.0.0'
|
31
34
|
}
|
35
|
+
|
36
|
+
before :all do
|
37
|
+
FileUtils.mkdir_p workdir
|
38
|
+
FalkorLib.config[:versioning][:type] = 'file'
|
39
|
+
end
|
32
40
|
|
33
41
|
after :all do
|
34
42
|
FileUtils.remove_entry_secure dir
|
@@ -40,34 +48,34 @@ describe FalkorLib::Versioning do
|
|
40
48
|
it "#get_version -- get default version #{default_version}" do
|
41
49
|
if command?('git_flow')
|
42
50
|
STDIN.should_receive(:gets).and_return('Yes')
|
43
|
-
t = FalkorLib::GitFlow.init(
|
51
|
+
t = FalkorLib::GitFlow.init(workdir)
|
44
52
|
t.should == 0
|
45
53
|
else
|
46
|
-
t = FalkorLib::Git.init(
|
54
|
+
t = FalkorLib::Git.init(workdir)
|
47
55
|
t.should be_true
|
48
56
|
end
|
49
|
-
v = FalkorLib::Versioning.get_version(
|
57
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
50
58
|
v.should == default_version
|
51
59
|
end
|
52
60
|
|
53
61
|
it "#get_version -- should get the '#{workingversion[:default]}' version set in the file #{versionfile}" do
|
54
|
-
execute "echo #{workingversion[:default]} > #{
|
55
|
-
v = FalkorLib::Versioning.get_version(
|
62
|
+
execute "echo #{workingversion[:default]} > #{workdir}/#{versionfile}"
|
63
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
56
64
|
v.should == workingversion[:default]
|
57
65
|
end
|
58
66
|
|
59
67
|
it "#major -- should collect the major version" do
|
60
|
-
v = FalkorLib::Versioning.get_version(
|
68
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
61
69
|
m = FalkorLib::Versioning.major(v)
|
62
70
|
m.should == '1'
|
63
71
|
end
|
64
72
|
it "#minor -- should collect the minor version" do
|
65
|
-
v = FalkorLib::Versioning.get_version(
|
73
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
66
74
|
m = FalkorLib::Versioning.minor(v)
|
67
75
|
m.should == '2'
|
68
76
|
end
|
69
77
|
it "#patch -- should collect the patch version" do
|
70
|
-
v = FalkorLib::Versioning.get_version(
|
78
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
71
79
|
m = FalkorLib::Versioning.patch(v)
|
72
80
|
m.should == '3'
|
73
81
|
end
|
@@ -75,24 +83,24 @@ describe FalkorLib::Versioning do
|
|
75
83
|
|
76
84
|
it "#set_version -- set version #{default_version} in version file #{versionfile}" do
|
77
85
|
STDIN.should_receive(:gets).and_return('no')
|
78
|
-
v = FalkorLib::Versioning.set_version(default_version,
|
86
|
+
v = FalkorLib::Versioning.set_version(default_version, workdir)
|
79
87
|
v.should == 0
|
80
|
-
v = FalkorLib::Versioning.get_version(
|
88
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
81
89
|
v.should == default_version
|
82
90
|
end
|
83
91
|
|
84
92
|
FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
85
93
|
it "#set_version #bump -- #{level} bump version number from #{workingversion[:default]} to #{workingversion[level.to_sym]}" do
|
86
94
|
# restore version file
|
87
|
-
execute "echo #{workingversion[:default]} > #{
|
88
|
-
v = FalkorLib::Versioning.get_version(
|
95
|
+
execute "echo #{workingversion[:default]} > #{workdir}/#{versionfile}"
|
96
|
+
v = FalkorLib::Versioning.get_version(workdir)
|
89
97
|
v.should == workingversion[:default]
|
90
98
|
v2 = FalkorLib::Versioning.bump(v, level.to_sym)
|
91
99
|
v2.should == workingversion[level.to_sym]
|
92
100
|
STDIN.should_receive(:gets).and_return('no')
|
93
|
-
d = FalkorLib::Versioning.set_version(v2,
|
101
|
+
d = FalkorLib::Versioning.set_version(v2, workdir)
|
94
102
|
d.should == 0
|
95
|
-
v3 = FalkorLib::Versioning.get_version(
|
103
|
+
v3 = FalkorLib::Versioning.get_version(workdir)
|
96
104
|
v3.should == v2
|
97
105
|
end
|
98
106
|
end
|
@@ -1,19 +1,28 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
2
|
+
"name": "<%= config[:name] %>",
|
3
|
+
"version": "<%= config[:version] %>",
|
4
|
+
"author": "<%= config[:author] %>",
|
5
|
+
"mail": "<%= config[:mail] %>",
|
6
|
+
"summary": "<%= config[:summary] %>",
|
7
|
+
"description": "<%= config[:description] %>",
|
8
|
+
"license": "<%= config[:license] %>",
|
9
|
+
"source": "<%= config[:source] %>",
|
10
|
+
"project_page": "<%= config[:project_page] %>",
|
11
|
+
"issues_url": "<%= config[:issues_url] %>",
|
12
|
+
"dependencies": [
|
13
|
+
{
|
14
|
+
"name": "puppetlabs-stdlib",
|
15
|
+
"version_range": ">= 1.0.0"
|
16
|
+
}
|
17
|
+
],
|
18
|
+
"operatingsystem_support": [
|
19
|
+
{
|
20
|
+
"operatingsystem": "Debian",
|
21
|
+
"operatingsystemrelease": [
|
22
|
+
"6",
|
23
|
+
"7"
|
24
|
+
]
|
25
|
+
}
|
26
|
+
],
|
27
|
+
"tags": <%= config[:tags] %>
|
19
28
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falkorlib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Varrette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -315,6 +315,7 @@ files:
|
|
315
315
|
- spec/falkorlib/gitflow_spec.rb
|
316
316
|
- spec/falkorlib/puppet_modules_spec.rb
|
317
317
|
- spec/falkorlib/versioning_gem_spec.rb
|
318
|
+
- spec/falkorlib/versioning_puppet_module_spec.rb
|
318
319
|
- spec/falkorlib/versioning_spec.rb
|
319
320
|
- spec/falkorlib_spec.rb
|
320
321
|
- spec/spec_helper.rb
|
@@ -364,6 +365,7 @@ test_files:
|
|
364
365
|
- spec/falkorlib/gitflow_spec.rb
|
365
366
|
- spec/falkorlib/puppet_modules_spec.rb
|
366
367
|
- spec/falkorlib/versioning_gem_spec.rb
|
368
|
+
- spec/falkorlib/versioning_puppet_module_spec.rb
|
367
369
|
- spec/falkorlib/versioning_spec.rb
|
368
370
|
- spec/falkorlib_spec.rb
|
369
371
|
- spec/spec_helper.rb
|