falkorlib 0.4.0 → 0.4.1
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/.gitignore +2 -0
- data/Gemfile.lock +3 -1
- data/falkorlib.gemspec +1 -0
- data/lib/falkorlib/bootstrap/base.rb +84 -13
- data/lib/falkorlib/cli/new.rb +8 -2
- data/lib/falkorlib/common.rb +72 -65
- data/lib/falkorlib/config.rb +49 -54
- data/lib/falkorlib/error.rb +28 -0
- data/lib/falkorlib/git/base.rb +4 -2
- data/lib/falkorlib/loader.rb +3 -1
- data/lib/falkorlib/tasks/rspec.rake +2 -1
- data/lib/falkorlib/version.rb +1 -1
- data/lib/falkorlib/versioning.rb +84 -74
- data/spec/falkorlib/bootstrap_spec.rb +2 -2
- data/spec/falkorlib/common_spec.rb +11 -11
- data/spec/falkorlib/error_spec.rb +33 -0
- data/spec/falkorlib/git_spec.rb +7 -1
- data/templates/README/footer_readme.erb +67 -0
- data/templates/README/header_readme.erb +17 -0
- metadata +21 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be6b7e9b76a06c18709b775c77d17e487e318cbd
|
4
|
+
data.tar.gz: 7ba5fa7986575faea59f5c26d085c5f953f444d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91aeab1807f5b5bbdc057bebe6430d686bbd0471985afa9ef89de425ea8e03530912d0b450fc84092d84ec6e2529c7bebc4a404476ec2a5e36b79fa703e7ac28
|
7
|
+
data.tar.gz: 079ed9bf07a7a96afc217af7e4b66b75e3ada0d595197ed4cede9c043750fbe4b7233016942125d3db1ce5f003ea6f2ec23b066516dced0dfa711bc2d0f90f42
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
falkorlib (0.4.
|
4
|
+
falkorlib (0.4.1)
|
5
5
|
awesome_print (~> 1.2)
|
6
6
|
configatron (~> 3.2)
|
7
|
+
deep_merge (~> 1.0.1)
|
7
8
|
diffy (>= 3.0)
|
8
9
|
git_remote_branch (~> 0)
|
9
10
|
json (~> 1.8)
|
@@ -24,6 +25,7 @@ GEM
|
|
24
25
|
simplecov (>= 0.7.1, < 1.0.0)
|
25
26
|
coderay (1.1.0)
|
26
27
|
configatron (3.2.0)
|
28
|
+
deep_merge (1.0.1)
|
27
29
|
diff-lcs (1.1.3)
|
28
30
|
diffy (3.0.7)
|
29
31
|
docile (1.1.5)
|
data/falkorlib.gemspec
CHANGED
@@ -132,6 +132,7 @@ Gem::Specification.new do |s|
|
|
132
132
|
s.add_runtime_dependency("awesome_print", "~> 1.2")
|
133
133
|
s.add_runtime_dependency("json", "~> 1.8")
|
134
134
|
s.add_runtime_dependency("license-generator", '~> 0')
|
135
|
+
s.add_runtime_dependency("deep_merge", '~> 1.0.1')
|
135
136
|
s.add_runtime_dependency("diffy", '>= 3.0')
|
136
137
|
s.add_runtime_dependency("logger", '>= 1.2.8')
|
137
138
|
s.add_runtime_dependency("thor", '>= 0.19')
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Dim 2015-02-01 14:43 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Interface for the main Bootstrapping operations
|
6
6
|
#
|
@@ -17,14 +17,27 @@ module FalkorLib #:nodoc:
|
|
17
17
|
module Bootstrap
|
18
18
|
DEFAULTS =
|
19
19
|
{
|
20
|
+
:metadata => {
|
21
|
+
:name => '',
|
22
|
+
:version => '0.0.1',
|
23
|
+
:author => "#{ENV['GIT_AUTHOR_NAME']}",
|
24
|
+
:mail => "#{ENV['GIT_AUTHOR_EMAIL']}",
|
25
|
+
:summary => "rtfm",
|
26
|
+
:description => '',
|
27
|
+
:source => '',
|
28
|
+
:project_page => '',
|
29
|
+
:issues_url => '',
|
30
|
+
:tags => []
|
31
|
+
},
|
20
32
|
:trashdir => '.Trash',
|
21
33
|
:types => [ 'article', 'slides', 'gem', 'octopress', 'puppet_module', 'rvm' ],
|
22
|
-
:rvm => {
|
23
|
-
:version => '1.9.3',
|
24
|
-
:versionfile => '.ruby-version',
|
25
|
-
:gemsetfile => '.ruby-gemset'
|
26
|
-
},
|
27
34
|
:puppet => {},
|
35
|
+
:forge => {
|
36
|
+
:gforge => { :url => 'http://gforge.uni.lu', :name => 'GForge @ Uni.lu' },
|
37
|
+
:github => { :url => 'http://github.com', :name => 'Github', :login => 'ULHPC' },
|
38
|
+
:gitlab => { :url => 'http://gitlab.uni.lu', :name => 'Gitlab @ Uni.lu' },
|
39
|
+
:none => { :url => '', :name => "None"}
|
40
|
+
},
|
28
41
|
}
|
29
42
|
|
30
43
|
|
@@ -210,7 +223,8 @@ module FalkorLib
|
|
210
223
|
###### versionfile ######
|
211
224
|
# Bootstrap a VERSION file at the root of a project
|
212
225
|
# Supported options:
|
213
|
-
# * :file
|
226
|
+
# * :file [string] filename
|
227
|
+
# * :version [string] version to mention in the file
|
214
228
|
##
|
215
229
|
def versionfile(dir = Dir.pwd, options = {})
|
216
230
|
file = options[:file] ? options[:file] : 'VERSION'
|
@@ -225,17 +239,74 @@ module FalkorLib
|
|
225
239
|
end
|
226
240
|
versionfile = File.join(path, file)
|
227
241
|
unless File.exists?( versionfile )
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
242
|
+
FalkorLib::Versioning.set_version(version, path, {
|
243
|
+
:type => 'file',
|
244
|
+
:source => { :filename => file }
|
245
|
+
})
|
246
|
+
Dir.chdir( path ) do
|
247
|
+
run %{ git tag #{options[:tag]} } if options[:tag]
|
234
248
|
end
|
235
249
|
else
|
236
250
|
puts " ... not overwriting the #{file} file which already exists"
|
237
251
|
end
|
252
|
+
|
253
|
+
# unless File.exists?( versionfile )
|
254
|
+
# run %{ echo "#{version}" > #{versionfile} }
|
255
|
+
# if FalkorLib::Git.init?(path)
|
256
|
+
# FalkorLib::Git.add(versionfile, "Initialize #{file} file")
|
257
|
+
# Dir.chdir( path ) do
|
258
|
+
# run %{ git tag #{options[:tag]} } if options[:tag]
|
259
|
+
# end
|
260
|
+
# end
|
261
|
+
# else
|
262
|
+
# puts " ... not overwriting the #{file} file which already exists"
|
263
|
+
# end
|
238
264
|
end # versionfile
|
239
265
|
|
266
|
+
|
267
|
+
###### readme ######
|
268
|
+
# Bootstrap a README file for various context
|
269
|
+
# Supported options:
|
270
|
+
# * :force [boolean] force overwritting
|
271
|
+
# * :latex [boolean] describe a LaTeX project
|
272
|
+
# * :octopress [boolean] octopress site
|
273
|
+
##
|
274
|
+
def readme(dir = Dir.pwd, type = 'latex', options = {})
|
275
|
+
info "Bootstrap a README file"
|
276
|
+
#if File.exists?(File.join(dir, ))
|
277
|
+
config = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].clone
|
278
|
+
config[:filename] = options[:filename] ? options[:filename] : 'README.md'
|
279
|
+
config[:name] = options[:name] ? options[:name] : File.basename(dir)
|
280
|
+
default_forge = options[:forge] ? options[:forge] : :github
|
281
|
+
forges = FalkorLib::Config::Bootstrap::DEFAULTS[:forge]
|
282
|
+
case select_forge(default_forge)
|
283
|
+
when :gforge
|
284
|
+
config[:project_page] = forges[:url] + "/projects/"
|
285
|
+
end
|
286
|
+
|
287
|
+
|
288
|
+
# config[:project_page] = case forge
|
289
|
+
# when :gforge
|
290
|
+
|
291
|
+
# end
|
292
|
+
end # readme
|
293
|
+
|
294
|
+
###
|
295
|
+
# Select the forge (gforge, github, etc.) hosting the project sources
|
296
|
+
##
|
297
|
+
def select_forge(default = :gforge, options = {})
|
298
|
+
forge = FalkorLib::Config::Bootstrap::DEFAULTS[:forge]
|
299
|
+
ap forge
|
300
|
+
default_idx = forge.keys.index(default)
|
301
|
+
default_idx = 0 if default_idx.nil?
|
302
|
+
v = select_from(forge.map{ |k,v| v[:name] },
|
303
|
+
"Select the Forge hosting the project sources",
|
304
|
+
default_idx+1,
|
305
|
+
forge.keys)
|
306
|
+
ap v
|
307
|
+
end # select_forge
|
308
|
+
|
309
|
+
|
310
|
+
|
240
311
|
end # module Bootstrap
|
241
312
|
end # module FalkorLib
|
data/lib/falkorlib/cli/new.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <Ven 2015-01-
|
3
|
+
# Time-stamp: <Ven 2015-01-30 15:20 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require 'thor'
|
@@ -88,7 +88,13 @@ These files will be committed in Git to ensure a consistent environment for the
|
|
88
88
|
FalkorLib::Bootstrap.versionfile(path, options)
|
89
89
|
end # versionfile
|
90
90
|
|
91
|
-
|
91
|
+
|
92
|
+
###### readme ######
|
93
|
+
#......................................
|
94
|
+
desc "readme PATH [options]", "Initiate a README file in the PATH directory"
|
95
|
+
def readme(path = '.')
|
96
|
+
FalkorLib::Bootstrap.readme(path, options)
|
97
|
+
end # readme
|
92
98
|
end # class Init
|
93
99
|
end # module CLI
|
94
100
|
end # module FalkorLib
|
data/lib/falkorlib/common.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sam 2015-01-31 23:54 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require "falkorlib"
|
@@ -244,8 +244,15 @@ module FalkorLib #:nodoc:
|
|
244
244
|
###############################
|
245
245
|
|
246
246
|
# Return the yaml content as a Hash object
|
247
|
-
def load_config(
|
248
|
-
|
247
|
+
def load_config(file)
|
248
|
+
unless File.exists?(file)
|
249
|
+
raise FalkorLib::Error, "Unable to find the YAML file '#{file}'"
|
250
|
+
end
|
251
|
+
loaded = YAML::load_file(file)
|
252
|
+
unless loaded.is_a?(Hash)
|
253
|
+
raise FalkorLib::Error, "Corrupted or invalid YAML file '#{file}'"
|
254
|
+
end
|
255
|
+
loaded
|
249
256
|
end
|
250
257
|
|
251
258
|
# Store the Hash object as a Yaml file
|
@@ -273,11 +280,11 @@ module FalkorLib #:nodoc:
|
|
273
280
|
# :erb_exclude [array of strings]: pattern(s) to exclude from erb file
|
274
281
|
# interpretation and thus to copy 'as is'
|
275
282
|
# :no_interaction [boolean]: do not interact
|
276
|
-
def init_from_template(templatedir, rootdir, config = {},
|
283
|
+
def init_from_template(templatedir, rootdir, config = {},
|
277
284
|
options = {
|
278
|
-
|
279
|
-
|
280
|
-
|
285
|
+
:erb_exclude => [],
|
286
|
+
:no_interaction => false
|
287
|
+
})
|
281
288
|
error "Unable to find the template directory" unless File.directory?(templatedir)
|
282
289
|
warning "about to initialize/update the directory #{rootdir}"
|
283
290
|
really_continue?
|
@@ -307,61 +314,61 @@ module FalkorLib #:nodoc:
|
|
307
314
|
end
|
308
315
|
end
|
309
316
|
|
310
|
-
###
|
317
|
+
###
|
311
318
|
# ERB generation of the file `outfile` using the source template file `erbfile`
|
312
319
|
# Supported options:
|
313
320
|
# :no_interaction [boolean]: do not interact
|
314
|
-
def write_from_erb_template(erbfile, outfile, config = {},
|
321
|
+
def write_from_erb_template(erbfile, outfile, config = {},
|
315
322
|
options = {
|
316
|
-
|
317
|
-
|
323
|
+
:no_interaction => false
|
324
|
+
})
|
318
325
|
error "Unable to find the template file #{erbfile}" unless File.exists? (erbfile )
|
319
326
|
template = File.read("#{erbfile}")
|
320
327
|
output = ERB.new(template, nil, '<>')
|
321
328
|
content = output.result(binding)
|
322
|
-
|
329
|
+
show_diff_and_write(content, outfile, options)
|
323
330
|
end
|
324
331
|
|
325
332
|
## Show the difference between a `content` string and an destination file (using Diff algorithm).
|
326
|
-
# Obviosuly, if the outfile does not exists, no difference is proposed.
|
333
|
+
# Obviosuly, if the outfile does not exists, no difference is proposed.
|
327
334
|
# Supported options:
|
328
335
|
# :no_interaction [boolean]: do not interact
|
329
336
|
# :json_pretty_format [boolean]: write a json content, in pretty format
|
330
337
|
#
|
331
338
|
# return 0 if nothing happened, 1 if a write has been done
|
332
339
|
def show_diff_and_write(content, outfile, options = {
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
340
|
+
:no_interaction => false,
|
341
|
+
:json_pretty_format => false,
|
342
|
+
})
|
343
|
+
if File.exists?( outfile )
|
344
|
+
ref = File.read( outfile )
|
345
|
+
if options[:json_pretty_format]
|
346
|
+
ref = JSON.pretty_generate (JSON.parse( IO.read( outfile ) ))
|
347
|
+
end
|
348
|
+
if ref == content
|
349
|
+
warn "Nothing to update"
|
350
|
+
return 0
|
351
|
+
end
|
352
|
+
warn "the file '#{outfile}' already exists and will be overwritten."
|
353
|
+
warn "Expected difference: \n------"
|
354
|
+
Diffy::Diff.default_format = :color
|
355
|
+
puts Diffy::Diff.new(ref, content, :context => 1)
|
356
|
+
else
|
357
|
+
watch = options[:no_interaction] ? 'no' : ask( cyan(" ==> Do you want to see the generated file before commiting the writing (y|N)"), 'No')
|
358
|
+
puts content if watch =~ /y.*/i
|
359
|
+
end
|
360
|
+
proceed = options[:no_interaction] ? 'yes' : ask( cyan(" ==> proceed with the writing (Y|n)"), 'Yes')
|
354
361
|
return 0 if proceed =~ /n.*/i
|
355
362
|
info("=> writing #{outfile}")
|
356
363
|
File.open("#{outfile}", "w+") do |f|
|
357
|
-
|
364
|
+
f.write content
|
365
|
+
end
|
366
|
+
if FalkorLib::Git.init?(File.dirname(outfile))
|
367
|
+
do_commit = options[:no_interaction] ? 'yes' : ask( cyan(" ==> commit the changes (Y|n)"), 'Yes')
|
368
|
+
FalkorLib::Git.add(outfile, "update content of '#{File.basename(outfile)}'") if do_commit =~ /y.*/i
|
358
369
|
end
|
359
|
-
|
360
|
-
|
361
|
-
FalkorLib::Git.add(outfile, "update content of '#{File.basename(outfile)}'") if do_commit =~ /y.*/i
|
362
|
-
end
|
363
|
-
return 1
|
364
|
-
end
|
370
|
+
return 1
|
371
|
+
end
|
365
372
|
|
366
373
|
|
367
374
|
## Blind copy of a source file `src` into its destination directory `dstdir`
|
@@ -370,26 +377,26 @@ module FalkorLib #:nodoc:
|
|
370
377
|
# :srcdir [string]: source directory, make the `src` file relative to that directory
|
371
378
|
# :outfile [string]: alter the outfile name (File.basename(src) by default)
|
372
379
|
def write_from_template(src,dstdir,options = {
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
380
|
+
:no_interaction => false,
|
381
|
+
:srcdir => '',
|
382
|
+
:outfile => ''
|
383
|
+
})
|
384
|
+
srcfile = options[:srcdir].nil? ? src : File.join(options[:srcdir], src)
|
385
|
+
error "Unable to find the source file #{srcfile}" unless File.exists? ( srcfile )
|
386
|
+
error "The destination directory '#{dstdir}' do not exist" unless File.directory?( dstdir )
|
387
|
+
dstfile = options[:outfile].nil? ? File.basename(srcfile) : options[:outfile]
|
388
|
+
outfile = File.join(dstdir, dstfile)
|
389
|
+
content = File.read( srcfile )
|
390
|
+
show_diff_and_write(content, outfile, options)
|
384
391
|
end # copy_from_template
|
385
392
|
|
386
393
|
|
387
394
|
### RVM init
|
388
395
|
def init_rvm(rootdir = Dir.pwd, gemset = '')
|
389
396
|
rvm_files = {
|
390
|
-
|
391
|
-
|
392
|
-
|
397
|
+
:version => File.join(rootdir, '.ruby-version'),
|
398
|
+
:gemset => File.join(rootdir, '.ruby-gemset')
|
399
|
+
}
|
393
400
|
unless File.exists?( "#{rvm_files[:version]}")
|
394
401
|
v = select_from(FalkorLib.config[:rvm][:rubies],
|
395
402
|
"Select RVM ruby to configure for this directory",
|
@@ -414,16 +421,16 @@ module FalkorLib #:nodoc:
|
|
414
421
|
# * :relative [boolean] return relative path to the root dir
|
415
422
|
##
|
416
423
|
def normalized_path(dir = Dir.pwd, options = {})
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
424
|
+
rootdir = FalkorLib::Git.init?(dir) ? FalkorLib::Git.rootdir(dir) : dir
|
425
|
+
path = dir
|
426
|
+
path = Dir.pwd if dir == '.'
|
427
|
+
path = File.join(Dir.pwd, dir) unless (dir =~ /^\// or dir == '.')
|
428
|
+
if (options[:relative] or options[:relative_to])
|
429
|
+
root = options[:relative_to] ? options[:relative_to] : rootdir
|
430
|
+
relative_path_to_root = Pathname.new( File.realpath(path) ).relative_path_from Pathname.new(root)
|
431
|
+
path = relative_path_to_root.to_s
|
432
|
+
end
|
433
|
+
return path
|
427
434
|
end # normalize_path
|
428
435
|
|
429
436
|
end
|
data/lib/falkorlib/config.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Jeu 2015-02-12 11:07 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# FalkorLib Configuration
|
6
6
|
#
|
@@ -11,6 +11,7 @@ require "falkorlib"
|
|
11
11
|
|
12
12
|
require "configatron"
|
13
13
|
require "configatron/store"
|
14
|
+
require "deep_merge"
|
14
15
|
|
15
16
|
module FalkorLib #:nodoc:
|
16
17
|
|
@@ -40,74 +41,68 @@ module FalkorLib #:nodoc:
|
|
40
41
|
module Config #:nodoc:
|
41
42
|
# Defaults global settings
|
42
43
|
DEFAULTS = {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
44
|
+
:debug => false,
|
45
|
+
:verbose => false,
|
46
|
+
:root => Dir.pwd,
|
47
|
+
:config_files => {
|
48
|
+
:local => '.falkor/config',
|
49
|
+
:private => '.falkor/private',
|
50
|
+
#:project => '.falkor/project',
|
51
|
+
},
|
52
|
+
#:custom_cfg => '.falkorlib.yaml',
|
53
|
+
:rvm => {
|
54
|
+
:rubies => [ '1.9.3', '2.0.0', '2.1.0'],
|
55
|
+
:version => '1.9.3',
|
56
|
+
:versionfile => '.ruby-version',
|
57
|
+
:gemsetfile => '.ruby-gemset'
|
58
|
+
},
|
59
|
+
:templates => {
|
60
|
+
:trashdir => '.Trash',
|
61
|
+
:puppet => {}
|
62
|
+
},
|
63
|
+
:tokens => { :code_climate => '' },
|
64
|
+
:project => {}
|
65
|
+
}
|
59
66
|
|
60
67
|
module_function
|
61
68
|
|
62
69
|
## Build the default configuration hash, to be used to initiate the default.
|
63
|
-
# The hash is built depending on the loaded files.
|
70
|
+
# The hash is built depending on the loaded files.
|
64
71
|
def default
|
65
72
|
res = FalkorLib::Config::DEFAULTS
|
66
|
-
|
73
|
+
$LOADED_FEATURES.each do |path|
|
67
74
|
res[:git] = FalkorLib::Config::Git::DEFAULTS if path.include?('lib/falkorlib/git.rb')
|
68
75
|
res[:gitflow] = FalkorLib::Config::GitFlow::DEFAULTS if path.include?('lib/falkorlib/git.rb')
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
76
|
+
res[:versioning] = FalkorLib::Config::Versioning::DEFAULTS if path.include?('lib/falkorlib/versioning.rb')
|
77
|
+
if path.include?('lib/falkorlib/puppet.rb')
|
78
|
+
res[:puppet] = FalkorLib::Config::Puppet::DEFAULTS
|
79
|
+
res[:templates][:puppet][:modules] = FalkorLib::Config::Puppet::Modules::DEFAULTS[:metadata]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
# Check the potential local customizations
|
83
|
+
[:local, :private].each do |type|
|
84
|
+
custom_cfg = File.join( res[:root], res[:config_files][type.to_sym])
|
85
|
+
if File.exists?( custom_cfg )
|
86
|
+
res.deep_merge!( load_config( custom_cfg ) )
|
87
|
+
end
|
74
88
|
end
|
75
|
-
# Check the potential local customizations
|
76
|
-
custom_cfg = File.join( res[:root], res[:custom_cfg])
|
77
|
-
if File.exists?( custom_cfg )
|
78
|
-
res.merge!( load_config( custom_cfg ) )
|
79
|
-
end
|
80
89
|
res
|
81
90
|
end
|
82
91
|
|
83
|
-
|
84
|
-
|
85
|
-
|
92
|
+
###### load_project ######
|
93
|
+
# Return the local project configuration
|
94
|
+
##
|
95
|
+
def load_project(dir = Dir.pwd, options = {})
|
96
|
+
project_file = options[:file] ? options[:file] : FalkorLib.config[:config_files][:local]
|
97
|
+
path = normalized_path(dir)
|
98
|
+
path = FalkorLib::Git.rootdir(path) if FalkorLib::Git.init?(path)
|
99
|
+
res = {}
|
100
|
+
#if File.exists?( )
|
101
|
+
end # load_project
|
86
102
|
|
87
|
-
# # Singleton configuration class
|
88
|
-
# class Config
|
89
|
-
# include Singleton
|
90
103
|
|
91
|
-
|
92
|
-
# #
|
93
|
-
# # @example Usage
|
94
|
-
# # conf = Configuration.instance.defaults
|
95
|
-
# # conf.base_url #=> "http://ambito.com/economia/mercados/monedas/dolar/"
|
96
|
-
# # conf.blue.buy.xpath #=> "//*[@id=\"contenido\"]/div[1]/div[2]/div/div/div[2]/big"
|
97
|
-
# #
|
98
|
-
# # @return [Configatron::Store] the magic configuration instance with hash and dot '.' indifferent access
|
99
|
-
# def defaults
|
100
|
-
# return @config if @config
|
101
|
-
|
102
|
-
# @config = Configatron::Store.new
|
103
|
-
# file_path = File.expand_path('../../../config/falkorlib.yml', __FILE__)
|
104
|
-
# hash_config = YAML::load_file(file_path)
|
104
|
+
end
|
105
105
|
|
106
|
-
# @config.configure_from_hash(hash_config)
|
107
|
-
# @config.lock!
|
108
|
-
# @config
|
109
|
-
# end
|
110
|
-
# end
|
111
106
|
|
112
107
|
|
113
108
|
end # module FalkorLib
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
################################################################################
|
3
|
+
# Time-stamp: <Sam 2015-01-31 21:07 svarrette>
|
4
|
+
################################################################################
|
5
|
+
# Falkorlib errors
|
6
|
+
|
7
|
+
module FalkorLib
|
8
|
+
|
9
|
+
# Errors
|
10
|
+
class Error < ::StandardError
|
11
|
+
|
12
|
+
class << self
|
13
|
+
attr_accessor :status_code
|
14
|
+
end
|
15
|
+
|
16
|
+
def status_code
|
17
|
+
self.class.status_code
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class Exit < Error; self.status_code = 0; end
|
22
|
+
class FalkorError < Error; self.status_code = 1; end
|
23
|
+
class ExecError < Error; self.status_code = 2; end
|
24
|
+
class InternalError < Error; self.status_code = 3; end
|
25
|
+
class ArgumentError < Error; self.status_code = 4; end
|
26
|
+
class AbortError < Error; self.status_code = 5; end
|
27
|
+
class TemplateNotFound < Error; self.status_code = 6; end
|
28
|
+
end
|
data/lib/falkorlib/git/base.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sam 2015-01-24 19:33 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Interface for the main Git operations
|
6
6
|
#
|
@@ -155,10 +155,12 @@ module FalkorLib #:nodoc:
|
|
155
155
|
cg = MiniGit::Capturing.new(dir)
|
156
156
|
res = (cg.config :list => true).split("\n")
|
157
157
|
res.select! { |e| e.match(key) } unless key =='*'
|
158
|
-
res = res.map { |e| e.split('=') }.to_h if options[:hash]
|
158
|
+
#res = res.map { |e| e.split('=') }.to_h if options[:hash]
|
159
|
+
res = Hash[ res.map { |e| e.split('=') } ] if options[:hash]
|
159
160
|
else
|
160
161
|
g = MiniGit.new(dir)
|
161
162
|
res = g[key]
|
163
|
+
res = { key => g[key] } if options[:hash]
|
162
164
|
end
|
163
165
|
#ap res
|
164
166
|
res
|
data/lib/falkorlib/loader.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Ven 2015-01-30 16:19 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Place the component you wish to see loaded
|
6
6
|
|
7
|
+
|
8
|
+
require "falkorlib/error"
|
7
9
|
require "falkorlib/config"
|
8
10
|
require "falkorlib/common"
|
9
11
|
require "falkorlib/git"
|
@@ -35,7 +35,8 @@ begin
|
|
35
35
|
#t.pattern = "spec/**/puppet*spec.rb"
|
36
36
|
#t.pattern = "spec/**/bootstrap*spec.rb"
|
37
37
|
#t.pattern = "spec/**/gitf*spec.rb"
|
38
|
-
|
38
|
+
#t.pattern = "spec/**/error*spec.rb"
|
39
|
+
|
39
40
|
# Whether or not to fail Rake when an error occurs (typically when
|
40
41
|
# examples fail).
|
41
42
|
t.fail_on_error = true
|
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: <Dim
|
3
|
+
# Time-stamp: <Dim 2015-01-25 16:04 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
6
6
|
#
|
@@ -16,27 +16,27 @@ module FalkorLib #:nodoc:
|
|
16
16
|
module Versioning
|
17
17
|
# Versioning Management defaults
|
18
18
|
DEFAULTS = {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
19
|
+
:default => '0.0.1',
|
20
|
+
:levels => [ 'major', 'minor', 'patch' ],
|
21
|
+
:type => 'file',
|
22
|
+
:source => {
|
23
|
+
'file' => {
|
24
|
+
:filename => 'VERSION'
|
25
|
+
},
|
26
|
+
'gem' => {
|
27
|
+
:filename => 'lib/falkorlib/version.rb',
|
28
|
+
:getmethod => 'FalkorLib::Version.to_s',
|
29
|
+
#:setmethod => 'FalkorLib::Version.set',
|
30
|
+
#:pattern => '^(\s*)MAJOR\s*,\s*MINOR,\s*PATCH\s*=\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)'
|
31
|
+
},
|
32
|
+
'puppet_module' => {
|
33
|
+
:filename => 'metadata.json'
|
34
|
+
},
|
35
|
+
'tag' => {
|
36
|
+
:suffix => 'v'
|
37
|
+
},
|
38
|
+
}
|
39
|
+
}
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -66,13 +66,17 @@ module FalkorLib #:nodoc:
|
|
66
66
|
res
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
69
|
+
######
|
70
|
+
# Get the current version
|
71
|
+
# Supported options:
|
72
|
+
# * :default [string] default version
|
73
|
+
# * :type in ['file','gem','puppet_module'] type of versionning mechanism
|
74
|
+
# * :source [Hash] information on the way to retrieve the information
|
75
|
+
def get_version(rootdir = Dir.pwd, options = {})
|
76
|
+
version = options[:default] ? options[:default] : FalkorLib.config[:versioning][:default]
|
77
|
+
type = options[:type] ? options[:type] : FalkorLib.config[:versioning][:type]
|
78
|
+
source = options[:source] ? options[:source] : FalkorLib.config[:versioning][:source][ type ]
|
79
|
+
case type
|
76
80
|
when 'file'
|
77
81
|
versionfile = File.join( rootdir, source[:filename] )
|
78
82
|
version = File.read( versionfile ).chomp if File.exist? ( versionfile )
|
@@ -80,71 +84,77 @@ module FalkorLib #:nodoc:
|
|
80
84
|
getmethod = source[:getmethod ]
|
81
85
|
version = eval( getmethod ) unless (getmethod.nil? || getmethod.empty?)
|
82
86
|
when 'puppet_module'
|
83
|
-
|
84
|
-
|
85
|
-
|
87
|
+
jsonfile = File.join( rootdir, source[:filename] )
|
88
|
+
metadata = JSON.parse( IO.read( jsonfile ) )
|
89
|
+
version = metadata["version"]
|
86
90
|
end
|
87
91
|
version
|
88
92
|
end
|
89
93
|
|
90
|
-
|
91
|
-
|
94
|
+
######
|
95
|
+
# Set the version
|
96
|
+
# Supported options:
|
97
|
+
# * :type in ['file','gem','puppet_module'] type of versionning mechanism
|
98
|
+
# * :source [Hash] information on the way to retrieve the information
|
99
|
+
def set_version(version, rootdir = Dir.pwd, options = {})
|
92
100
|
exit_status = 0
|
93
|
-
type = FalkorLib.config[:versioning][:type]
|
94
|
-
source = FalkorLib.config[:versioning][:source][ type ]
|
95
|
-
|
96
|
-
filelist = FalkorLib::Git.list_files( rootdir )
|
101
|
+
type = options[:type] ? options[:type] : FalkorLib.config[:versioning][:type]
|
102
|
+
source = options[:source] ? options[:source] : FalkorLib.config[:versioning][:source][ type ]
|
103
|
+
versionfile = File.join( rootdir, source[:filename] ) unless source[:filename].nil?
|
97
104
|
major, minor, patch = major(version), minor(version), patch(version)
|
98
105
|
#tocommit = ""
|
99
106
|
case type
|
100
107
|
when 'file'
|
101
|
-
|
102
|
-
|
108
|
+
info "writing version changes in #{source[:filename]}"
|
109
|
+
File.open(versionfile, 'w') {|f| f.puts version } #if File.exist? ( versionfile )
|
103
110
|
when 'gem'
|
104
|
-
|
105
|
-
|
111
|
+
info "=> writing version changes in #{source[:filename]}"
|
112
|
+
File.open(versionfile, 'r+') do |f|
|
106
113
|
text = f.read
|
107
|
-
|
108
|
-
|
114
|
+
text.gsub!(/^(\s*)MAJOR\s*,\s*MINOR,\s*PATCH\s*=\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(.*)$/,
|
115
|
+
'\1' + "MAJOR, MINOR, PATCH = #{major}, #{minor}, #{patch}" + '\5')
|
109
116
|
f.rewind
|
110
117
|
f.write(text)
|
111
118
|
end
|
112
119
|
when 'puppet_module'
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
120
|
+
info "=> writing version changes in #{source[:filename]}"
|
121
|
+
metadata = JSON.parse( IO.read( versionfile ) )
|
122
|
+
metadata["version"] = version
|
123
|
+
File.open(versionfile,"w") do |f|
|
124
|
+
f.write JSON.pretty_generate( metadata )
|
118
125
|
end
|
119
|
-
|
126
|
+
#exit 1
|
120
127
|
end
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
128
|
+
if FalkorLib::Git.init?(rootdir)
|
129
|
+
filelist = FalkorLib::Git.list_files( rootdir )
|
130
|
+
Dir.chdir( rootdir ) do
|
131
|
+
next if source[:filename].nil?
|
132
|
+
unless filelist.include?( source[:filename] )
|
133
|
+
warning "The version file #{source[:filename]} is not part of the Git repository"
|
134
|
+
answer = ask("Adding the file to the repository? (Y|n)", 'Yes')
|
135
|
+
next if answer =~ /n.*/i
|
136
|
+
exit_status = FalkorLib::Git.add(versionfile, "Adding the version file '#{source[:filename]}', inialized to the '#{version}' version" )
|
137
|
+
next
|
138
|
+
end
|
139
|
+
run %{
|
140
|
+
git diff #{source[:filename]}
|
141
|
+
}
|
142
|
+
answer = ask(cyan("=> Commit the changes of the version file to the repository? (Y|n)"), 'Yes')
|
126
143
|
next if answer =~ /n.*/i
|
127
|
-
|
128
|
-
|
144
|
+
run %{
|
145
|
+
git commit -s -m "bump to version '#{version}'" #{source[:filename]}
|
146
|
+
}
|
147
|
+
exit_status = $?.to_i
|
148
|
+
# if (type == 'gem' && File.exists?(File.join(rootdir, 'Gemfile')) )
|
149
|
+
# run %{
|
150
|
+
# sleep 2
|
151
|
+
# bundle update falkorlib
|
152
|
+
# git commit -s -m "Update Gemfile.lock accordingly" Gemfile.lock
|
153
|
+
# } if command?( 'bundle' )
|
154
|
+
# end
|
129
155
|
end
|
130
|
-
run %{
|
131
|
-
git diff #{source[:filename]}
|
132
|
-
}
|
133
|
-
answer = ask(cyan("=> Commit the changes of the version file to the repository? (Y|n)"), 'Yes')
|
134
|
-
next if answer =~ /n.*/i
|
135
|
-
run %{
|
136
|
-
git commit -s -m "bump to version '#{version}'" #{source[:filename]}
|
137
|
-
}
|
138
|
-
exit_status = $?.to_i
|
139
|
-
# if (type == 'gem' && File.exists?(File.join(rootdir, 'Gemfile')) )
|
140
|
-
# run %{
|
141
|
-
# sleep 2
|
142
|
-
# bundle update falkorlib
|
143
|
-
# git commit -s -m "Update Gemfile.lock accordingly" Gemfile.lock
|
144
|
-
# } if command?( 'bundle' )
|
145
|
-
# end
|
146
156
|
end
|
147
|
-
|
157
|
+
exit_status
|
148
158
|
end
|
149
159
|
|
150
160
|
## Return a new version number based on
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# bootstrap_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Sam 2015-01-24 19:05 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Bootstrapping operations
|
8
8
|
#
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
require 'spec_helper'
|
14
14
|
require 'tmpdir'
|
15
|
-
require '
|
15
|
+
require 'fileutils'
|
16
16
|
|
17
17
|
describe FalkorLib::Bootstrap do
|
18
18
|
|
@@ -12,7 +12,7 @@ describe FalkorLib::Common do
|
|
12
12
|
FileUtils.touch File.join(dir, 'file2.txt')
|
13
13
|
FileUtils.mkdir File.join(dir, 'dir1')
|
14
14
|
FileUtils.mkdir File.join(dir, 'dir2')
|
15
|
-
end
|
15
|
+
end
|
16
16
|
|
17
17
|
after :all do
|
18
18
|
FileUtils.remove_entry_secure dir
|
@@ -137,7 +137,7 @@ describe FalkorLib::Common do
|
|
137
137
|
it "#nice_execute -- check stderr output" do
|
138
138
|
b = capture(:stderr) {
|
139
139
|
nice_execute("echo 'toto' 1>&2")
|
140
|
-
}
|
140
|
+
}
|
141
141
|
b.should == red("** [err] toto\n")
|
142
142
|
end
|
143
143
|
|
@@ -150,7 +150,7 @@ describe FalkorLib::Common do
|
|
150
150
|
b = capture(:stderr) {
|
151
151
|
expect { not_implemented }.to raise_error (SystemExit)
|
152
152
|
}
|
153
|
-
b.should =~ /NOT YET IMPLEMENTED/
|
153
|
+
b.should =~ /NOT YET IMPLEMENTED/
|
154
154
|
end
|
155
155
|
|
156
156
|
it "#exec_or_exit - should exit" do
|
@@ -179,25 +179,25 @@ describe FalkorLib::Common do
|
|
179
179
|
context "Test (common) YAML functions" do
|
180
180
|
|
181
181
|
it "#load_config - load the correct hash from YAML" do
|
182
|
-
file_config = {:domain => "foo.com", :nested => { 'a1' => 2 }}
|
183
|
-
YAML.stub(:load_file).and_return(file_config)
|
184
|
-
loaded = load_config('
|
182
|
+
file_config = {:domain => "foo.com", :nested => { 'a1' => 2 }}
|
183
|
+
YAML.stub(:load_file).and_return(file_config)
|
184
|
+
loaded = load_config('/tmp') # /tmp to ensure existing target
|
185
185
|
loaded.should == file_config
|
186
|
-
end
|
186
|
+
end
|
187
187
|
|
188
188
|
it "#store_config - should store the correct hash to YAML" do
|
189
|
-
file_config = {:domain => "foo.com", :nested => { 'a1' => 2 }}
|
189
|
+
file_config = {:domain => "foo.com", :nested => { 'a1' => 2 }}
|
190
190
|
f = Tempfile.new('toto')
|
191
191
|
store_config(f.path, file_config)
|
192
192
|
copy_file_config = YAML::load_file(f.path)
|
193
193
|
copy_file_config.should == file_config
|
194
|
-
end
|
194
|
+
end
|
195
195
|
|
196
|
-
end
|
196
|
+
end
|
197
197
|
|
198
198
|
############################################
|
199
199
|
context 'Test list selection functions' do
|
200
|
-
|
200
|
+
|
201
201
|
it "#list_items - Exit on 0" do
|
202
202
|
STDIN.should_receive(:gets).and_return('0')
|
203
203
|
expect { list_items("#{dir}/*") }.to raise_error (SystemExit)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require "falkorlib/error"
|
3
|
+
|
4
|
+
|
5
|
+
describe FalkorLib::Error do
|
6
|
+
|
7
|
+
#############################################
|
8
|
+
context "Test Falkorlib errors" do
|
9
|
+
|
10
|
+
exceptions = [
|
11
|
+
FalkorLib::Exit,
|
12
|
+
FalkorLib::FalkorError,
|
13
|
+
FalkorLib::ExecError,
|
14
|
+
FalkorLib::InternalError,
|
15
|
+
FalkorLib::ArgumentError,
|
16
|
+
FalkorLib::AbortError,
|
17
|
+
FalkorLib::TemplateNotFound
|
18
|
+
]
|
19
|
+
exceptions.each do |e|
|
20
|
+
it "##{e} -- exit code #{exceptions.index(e)}" do
|
21
|
+
expect { raise e }.to raise_error
|
22
|
+
begin
|
23
|
+
raise e
|
24
|
+
rescue StandardError => s
|
25
|
+
i = s.status_code
|
26
|
+
i.should == exceptions.index(e)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
end
|
data/spec/falkorlib/git_spec.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# git_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Dim 2015-01-25 00:00 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Git operations
|
8
8
|
#
|
@@ -172,6 +172,12 @@ describe FalkorLib::Git do
|
|
172
172
|
c.keys.length.should == 2
|
173
173
|
end
|
174
174
|
|
175
|
+
it "#config -- check hash correctness" do
|
176
|
+
key = 'user.name'
|
177
|
+
c = FalkorLib::Git.config('user*', dir, :hash => true)
|
178
|
+
n = FalkorLib::Git.config('user.name', dir)
|
179
|
+
n.should == c[ key ]
|
180
|
+
end
|
175
181
|
|
176
182
|
# ---------- Submodules ---------------
|
177
183
|
it "#submodules_init" do
|
@@ -0,0 +1,67 @@
|
|
1
|
+
|
2
|
+
## Resources / Complementary information
|
3
|
+
|
4
|
+
### Git
|
5
|
+
|
6
|
+
You should become familiar (if not yet) with Git. Consider these resources:
|
7
|
+
|
8
|
+
* [Simple Git Guide](http://rogerdudler.github.io/git-guide/)
|
9
|
+
* [Git book](http://book.git-scm.com/index.html)
|
10
|
+
* [Github:help](http://help.github.com/mac-set-up-git/)
|
11
|
+
* [Git reference](http://gitref.org/)
|
12
|
+
|
13
|
+
At least, you shall configure the following variables
|
14
|
+
|
15
|
+
$> git config --global user.name "Your Name Comes Here"
|
16
|
+
$> git config --global user.email you@yourdomain.example.com
|
17
|
+
# configure colors
|
18
|
+
$> git config --global color.diff auto
|
19
|
+
$> git config --global color.status auto
|
20
|
+
$> git config --global color.branch auto
|
21
|
+
|
22
|
+
You might want also to configure various aliases to Git command.
|
23
|
+
Consider my personal [`.gitconfig`](https://github.com/Falkor/dotfiles/blob/master/git/.gitconfig) as an example -- if you decide to use it, simply copy it in your home directory and adapt the `[user]` section.
|
24
|
+
|
25
|
+
### [git-flow](https://github.com/nvie/gitflow)
|
26
|
+
|
27
|
+
The Git branching model for this repository follows the guidelines of
|
28
|
+
[gitflow](http://nvie.com/posts/a-successful-git-branching-model/).
|
29
|
+
In particular, the central repository holds two main branches with an infinite lifetime:
|
30
|
+
|
31
|
+
* `<%= config[:gitflow][:branches][:master] %>`: the *production-ready* branch
|
32
|
+
* `<%= config[:gitflow][:branches][:develop] %>`: the main branch where the latest developments interviene. This is the *default* branch you get when you clone the repository.
|
33
|
+
|
34
|
+
### Releasing mechanism
|
35
|
+
|
36
|
+
The operation consisting of releasing a new version of this repository is automated by a set of tasks within the root `<%= config[:rake] ? 'R' : 'M' %>akefile`.
|
37
|
+
|
38
|
+
In this context, a version number have the following format:
|
39
|
+
|
40
|
+
<major>.<minor>.<patch>[-b<build>]
|
41
|
+
|
42
|
+
where:
|
43
|
+
|
44
|
+
* `< major >` corresponds to the major version number
|
45
|
+
* `< minor >` corresponds to the minor version number
|
46
|
+
* `< patch >` corresponds to the patching version number
|
47
|
+
* (eventually) `< build >` states the build number _i.e._ the total number of commits within the `<%= config[:gitflow][:branches][:develop] %>` branch.
|
48
|
+
|
49
|
+
Example: \`1.0.0-b28\`
|
50
|
+
|
51
|
+
The current version number is stored in the root file `VERSION`. __/!\ NEVER MAKE ANY MANUAL CHANGES TO THIS FILE__
|
52
|
+
|
53
|
+
For more information on the version, run:
|
54
|
+
|
55
|
+
$> <%= config[:make] ? 'make versioninfo' : 'rake version:info' %>
|
56
|
+
|
57
|
+
If a new version number such be bumped, you simply have to run:
|
58
|
+
|
59
|
+
$> <%= config[:make] ? 'make start_bump_{major,minor,patch}' : 'rake version:{major,minor,patch}' %>
|
60
|
+
|
61
|
+
This will start the release process for you using `git-flow`.
|
62
|
+
Once you have finished to commit your last changes, make the release effective by running:
|
63
|
+
|
64
|
+
$> <%= config[:make] ? 'make release' : 'rake version:release' %>
|
65
|
+
|
66
|
+
it will finish the release using `git-flow`, create the appropriate tag in the `<%= config[:gitflow][:branches][:master] %>` branch and merge all things the way they should be.
|
67
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
-*- mode: markdown; mode: visual-line; fill-column: 80 -*-
|
2
|
+
`<%= config[:filename] %>`
|
3
|
+
|
4
|
+
Time-stamp: <Lun 2015-01-26 10:39 svarrette>
|
5
|
+
|
6
|
+
------------------
|
7
|
+
|
8
|
+
# <%= config[:shortname].capitalize %>
|
9
|
+
|
10
|
+
<%= config[:summary] %>
|
11
|
+
|
12
|
+
Copyright (c) <%= Time.now.year %> <%= config[:author] %> <<%= config[:mail] %>>
|
13
|
+
|
14
|
+
## Synopsis
|
15
|
+
|
16
|
+
<%= config[:description] %>
|
17
|
+
|
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Varrette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -128,6 +128,20 @@ dependencies:
|
|
128
128
|
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: deep_merge
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: 1.0.1
|
138
|
+
type: :runtime
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 1.0.1
|
131
145
|
- !ruby/object:Gem::Dependency
|
132
146
|
name: diffy
|
133
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -325,6 +339,7 @@ files:
|
|
325
339
|
- lib/falkorlib/cli/new.rb
|
326
340
|
- lib/falkorlib/common.rb
|
327
341
|
- lib/falkorlib/config.rb
|
342
|
+
- lib/falkorlib/error.rb
|
328
343
|
- lib/falkorlib/gem_tasks.rb
|
329
344
|
- lib/falkorlib/git.rb
|
330
345
|
- lib/falkorlib/git/base.rb
|
@@ -349,6 +364,7 @@ files:
|
|
349
364
|
- lib/falkorlib/versioning.rb
|
350
365
|
- spec/falkorlib/bootstrap_spec.rb
|
351
366
|
- spec/falkorlib/common_spec.rb
|
367
|
+
- spec/falkorlib/error_spec.rb
|
352
368
|
- spec/falkorlib/git_spec.rb
|
353
369
|
- spec/falkorlib/gitflow_spec.rb
|
354
370
|
- spec/falkorlib/puppet_modules_spec.rb
|
@@ -357,6 +373,8 @@ files:
|
|
357
373
|
- spec/falkorlib/versioning_spec.rb
|
358
374
|
- spec/falkorlib_spec.rb
|
359
375
|
- spec/spec_helper.rb
|
376
|
+
- templates/README/footer_readme.erb
|
377
|
+
- templates/README/header_readme.erb
|
360
378
|
- templates/puppet/modules/.gitignore
|
361
379
|
- templates/puppet/modules/.vagrant_init.rb
|
362
380
|
- templates/puppet/modules/Gemfile
|
@@ -402,6 +420,7 @@ summary: Sebastien Varrette aka Falkor's Common library to share Ruby code and {
|
|
402
420
|
test_files:
|
403
421
|
- spec/falkorlib/bootstrap_spec.rb
|
404
422
|
- spec/falkorlib/common_spec.rb
|
423
|
+
- spec/falkorlib/error_spec.rb
|
405
424
|
- spec/falkorlib/git_spec.rb
|
406
425
|
- spec/falkorlib/gitflow_spec.rb
|
407
426
|
- spec/falkorlib/puppet_modules_spec.rb
|