falkorlib 0.3.8 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +18 -6
- data/lib/falkorlib/config.rb +4 -1
- data/lib/falkorlib/puppet/modules.rb +9 -9
- data/lib/falkorlib/tasks/puppet_modules.rake +44 -4
- data/lib/falkorlib/tasks/rspec.rake +51 -34
- data/lib/falkorlib/version.rb +1 -1
- data/spec/falkorlib/puppet_modules_spec.rb +5 -4
- data/spec/falkorlib/versioning_puppet_module_spec.rb +2 -2
- data/templates/puppet/modules/files/{README.md → README.md.erb} +0 -0
- data/templates/puppet/modules/manifests/classes/templatename-params.pp.erb +1 -1
- data/templates/puppet/modules/manifests/classes/templatename.pp.erb +1 -1
- data/templates/puppet/modules/manifests/definitions/templatename-mydef.pp.erb +1 -1
- data/templates/puppet/modules/manifests/init.pp.erb +1 -1
- data/templates/puppet/modules/templates/{README.md → README.md.erb} +0 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 552344c4593779ef9a71c505a6cf36944076085a
|
4
|
+
data.tar.gz: c2b78c907bd0a3793919e86285b8fc05d3329248
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80190e05c95c7615078dbf48e6fe15a8cefa4b3262d4031e3f9dff71031188a6f5c820d427cf13c2bf77c9ce6c286a1ec1a096d6aa27dc6bbe387c1b9cd15206
|
7
|
+
data.tar.gz: e954e17b3e2f48867d0bb968cdd70c9c8c005dfe1e68203d6b89fe4f94c341a92ab90fc078bb15a2b9812f2fd56f245ce7a8535bd487f7f9e1799aef3f4925b4
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -70,8 +70,9 @@ This library features two aspects
|
|
70
70
|
c.debug = true
|
71
71
|
end
|
72
72
|
|
73
|
-
You can also place a special file `.falkorlib.yaml` to customize the
|
74
|
-
FalkorLib settings
|
73
|
+
__IMPORTANT__: You can also place a special file `.falkorlib.yaml` to customize the
|
74
|
+
FalkorLib settings. Most probably, you shall ignore this file in your
|
75
|
+
`.gitignore` so you can place there your private settings (tokens etc.)
|
75
76
|
|
76
77
|
* `FalkorLib::Git`: all [git](http://git-scm.com/) operations
|
77
78
|
* `FalkorLib::GitFlow`: all [git-flow](http://nvie.com/posts/a-successful-git-branching-model/) operations
|
@@ -374,11 +375,22 @@ rake version:bump:patch # Prepare the patch release of the repository
|
|
374
375
|
rake version:info # Get versioning information
|
375
376
|
rake version:release # Finalize the release of a given bumped version
|
376
377
|
```
|
378
|
+
If your gem is coupled with [Code Climate](https://codeclimate.com/), you might
|
379
|
+
wish to set the code climate token to report the test coverage for you gem (see
|
380
|
+
[these instructions](http://docs.codeclimate.com/article/104-how-do-i-set-up-test-coverage-for-one-of-my-repos)).
|
381
|
+
To avoid exposing this token in your (potentially public) repository, simply
|
382
|
+
set that token in `.falkorlib.yaml` (ignored you shall ignore in your
|
383
|
+
`.gitignore`) as follows:
|
377
384
|
|
385
|
+
```
|
386
|
+
:tokens:
|
387
|
+
:code_climate: 'ACDDD1111222223333....'
|
388
|
+
```
|
378
389
|
|
379
|
-
## Implementation details
|
390
|
+
## FalkorLib Developments / Implementation details
|
380
391
|
|
381
|
-
If you want to contribute to the code, you shall be aware of the way I
|
392
|
+
If you want to contribute to the code, you shall be aware of the way I organized
|
393
|
+
this gem and its implementation details.
|
382
394
|
|
383
395
|
### [RVM](https://rvm.io/) setup
|
384
396
|
|
@@ -429,7 +441,7 @@ Also, to facilitate the tracking of remote branches, you probably wants to insta
|
|
429
441
|
|
430
442
|
Then, to make your local copy of the repository ready to use my git-flow workflow, you have to run the following commands once you cloned it for the first time:
|
431
443
|
|
432
|
-
$> rake setup
|
444
|
+
$> rake setup
|
433
445
|
|
434
446
|
### Working in a separate project
|
435
447
|
|
@@ -446,7 +458,7 @@ To illustrate the usage of the library as a regular user would do, you are advis
|
|
446
458
|
|
447
459
|
$> cat cat Gemfile
|
448
460
|
source "https://rubygems.org"
|
449
|
-
gem 'falkorlib'
|
461
|
+
gem 'falkorlib' #, :path => '~/git/github.com/Falkor/falkorlib' # or whichever path that works for you
|
450
462
|
|
451
463
|
Adapt the `Rakefile` and `tester.rb` file to reflect your tests.
|
452
464
|
|
data/lib/falkorlib/config.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Lun 2014-09-01 09:37 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# FalkorLib Configuration
|
6
6
|
#
|
@@ -48,6 +48,9 @@ module FalkorLib #:nodoc:
|
|
48
48
|
},
|
49
49
|
:templates => {
|
50
50
|
:puppet => {}
|
51
|
+
},
|
52
|
+
:tokens => {
|
53
|
+
:code_climate => ''
|
51
54
|
}
|
52
55
|
}
|
53
56
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Lun 2014-09-01 21:46 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Interface for the main Puppet Module operations
|
6
6
|
#
|
@@ -131,7 +131,7 @@ module FalkorLib #:nodoc:
|
|
131
131
|
# Bootstrap the directory
|
132
132
|
templatedir = File.join( FalkorLib.templates, 'puppet', 'modules')
|
133
133
|
init_from_template(templatedir, moduledir, config, {
|
134
|
-
:erb_exclude => [ 'templates\/[^\/]
|
134
|
+
:erb_exclude => [ 'templates\/[^\/]*variables\.erb$' ]
|
135
135
|
})
|
136
136
|
# Rename the files / element templatename
|
137
137
|
Dir["#{moduledir}/**/*"].each do |e|
|
@@ -162,7 +162,7 @@ module FalkorLib #:nodoc:
|
|
162
162
|
info "=> preparing git-flow feature for the newly created module '#{config[:name]}'"
|
163
163
|
FalkorLib::GitFlow.start('feature', "bootstraping", moduledir)
|
164
164
|
end
|
165
|
-
[ 'metadata.json', 'LICENSE', '.gitignore', 'Gemfile', 'Rakefile'].each do |f|
|
165
|
+
[ 'metadata.json', 'doc/', 'LICENSE', '.gitignore', 'Gemfile', 'Rakefile'].each do |f|
|
166
166
|
FalkorLib::Git.add(File.join(moduledir, f))
|
167
167
|
end
|
168
168
|
end
|
@@ -287,12 +287,12 @@ module FalkorLib #:nodoc:
|
|
287
287
|
resulttmp = result.dup
|
288
288
|
(result - result2).each do |x|
|
289
289
|
Dir["#{moduledir}/**/*.pp"].each do |ppfile|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
290
|
+
File.read(ppfile).scan(/^\s*(include|require|class\s*{)\s*["']?(::)?([0-9a-zA-Z:{$}\-]*)["']?/) do |m|
|
291
|
+
next if $3.nil?
|
292
|
+
entry = $3.split('::').first
|
293
|
+
result << entry unless entry.nil? or entry.empty?
|
294
|
+
end
|
295
|
+
end
|
296
296
|
end
|
297
297
|
result.uniq!
|
298
298
|
result2 = resulttmp.dup
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
3
|
# puppet_modules.rake - Special tasks for the management of Puppet modules
|
4
|
-
# Time-stamp: <
|
4
|
+
# Time-stamp: <Lun 2014-09-01 16:38 svarrette>
|
5
5
|
#
|
6
6
|
# Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
7
7
|
# http://varrette.gforge.uni.lu
|
@@ -65,24 +65,64 @@ namespace :puppet do
|
|
65
65
|
FalkorLib::Puppet::Modules.parse()
|
66
66
|
end # task parse
|
67
67
|
|
68
|
+
########### puppet:module:validate ###########
|
69
|
+
desc "Validate manifests, templates, and ruby files"
|
70
|
+
task :validate do
|
71
|
+
Dir['manifests/**/*.pp'].each do |manifest|
|
72
|
+
sh "puppet parser validate --noop #{manifest}"
|
73
|
+
end
|
74
|
+
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
75
|
+
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
76
|
+
end
|
77
|
+
Dir['templates/**/*.erb'].each do |template|
|
78
|
+
sh "erb -P -x -T '-' #{template} | ruby -c"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
########### puppet:module:classes ###########
|
83
|
+
desc "Parse the module for classes definitions"
|
84
|
+
task :classes do |t|
|
85
|
+
c = FalkorLib::Puppet::Modules.classes()
|
86
|
+
info "Implemented classes:"
|
87
|
+
puts c.empty? ? red('NONE') : c.to_yaml
|
88
|
+
end # task classes
|
89
|
+
|
90
|
+
########### puppet:module:definitions ###########
|
91
|
+
desc "Parse the module for definitions"
|
92
|
+
task :definitions do |t|
|
93
|
+
d = FalkorLib::Puppet::Modules.definitions()
|
94
|
+
info "Implemented definitions:"
|
95
|
+
puts d.empty? ? red('NONE') : d.to_yaml
|
96
|
+
end # task definitions
|
97
|
+
|
98
|
+
########### puppet:module:deps ###########
|
99
|
+
desc "Parse the module for its exact dependencies"
|
100
|
+
task :deps do |t|
|
101
|
+
d = FalkorLib::Puppet::Modules.deps()
|
102
|
+
info "Module dependencies:"
|
103
|
+
puts d.empty? ? red('NONE') : d.to_yaml
|
104
|
+
end # task deps
|
105
|
+
|
68
106
|
|
69
107
|
end
|
70
108
|
end # namespace module
|
71
109
|
end # namespace puppet
|
72
110
|
|
73
111
|
#.....................
|
74
|
-
namespace :
|
112
|
+
namespace :templates do
|
75
113
|
namespace :upgrade do
|
76
114
|
########### module:upgrade:readme ###########
|
77
115
|
task :readme do |t|
|
78
116
|
#info "#{t.comment}"
|
79
117
|
FalkorLib::Puppet::Modules.upgrade()
|
80
118
|
end
|
81
|
-
|
82
|
-
|
83
119
|
end # namespace upgrade
|
84
120
|
end # namespace module
|
85
121
|
|
122
|
+
[ 'major', 'minor', 'patch' ].each do |level|
|
123
|
+
task "version:bump:#{level}" => 'puppet:module:validate'
|
124
|
+
end
|
125
|
+
|
86
126
|
#task 'version:release' => 'puppet:module:build'
|
87
127
|
Rake::Task["version:release"].enhance do
|
88
128
|
Rake::Task["puppet:module:build"].invoke
|
@@ -26,49 +26,66 @@
|
|
26
26
|
# http://relishapp.com/rspec
|
27
27
|
#
|
28
28
|
begin
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
29
|
+
require "rspec/core/rake_task"
|
30
|
+
desc "Run RSpec code examples '*_spec.rb' from the spec/ directory"
|
31
|
+
RSpec::Core::RakeTask.new(:rspec) do |t|
|
32
|
+
# Glob pattern to match files.
|
33
|
+
#t.pattern = "spec/**/common_*.rb"
|
34
|
+
#t.pattern = "spec/**/versioning_*spec.rb"
|
35
|
+
#t.pattern = "spec/**/*puppet*spec.rb"
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
# Whether or not to fail Rake when an error occurs (typically when
|
38
|
+
# examples fail).
|
39
|
+
t.fail_on_error = true
|
40
40
|
|
41
|
-
|
42
|
-
|
41
|
+
# A message to print to stderr when there are failures.
|
42
|
+
t.failure_message = nil
|
43
43
|
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
# Use verbose output. If this is set to true, the task will print the
|
45
|
+
# executed spec command to stdout.
|
46
|
+
t.verbose = true
|
47
47
|
|
48
|
-
|
49
|
-
|
48
|
+
# Use rcov for code coverage?
|
49
|
+
t.rcov = false
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
# Path to rcov.
|
52
|
+
t.rcov_path = "rcov"
|
53
53
|
|
54
|
-
|
55
|
-
|
54
|
+
# Command line options to pass to rcov. See 'rcov --help' about this
|
55
|
+
t.rcov_opts = []
|
56
56
|
|
57
|
-
|
58
|
-
|
57
|
+
# Command line options to pass to ruby. See 'ruby --help' about this
|
58
|
+
t.ruby_opts = []
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
# Path to rspec
|
61
|
+
t.rspec_path = "rspec"
|
62
62
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
63
|
+
# Command line options to pass to rspec. See 'rspec --help' about this
|
64
|
+
#t.rspec_opts = ["--color", "--backtrace"]
|
65
|
+
t.rspec_opts = ["--color", "--format d", "--backtrace"] # "--format d",
|
66
|
+
end
|
67
67
|
rescue LoadError => ex
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
task :spec_test do
|
69
|
+
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
70
|
+
end
|
71
71
|
ensure
|
72
|
-
|
73
|
-
|
72
|
+
task :spec => [:spec_test]
|
73
|
+
task :test => [:spec_test]
|
74
74
|
end
|
75
|
+
|
76
|
+
#.....................
|
77
|
+
namespace :setenv do
|
78
|
+
########### code_climate ###########
|
79
|
+
#desc "Set Code Climate token to report rspec results"
|
80
|
+
task :code_climate do |t|
|
81
|
+
unless FalkorLib.config[:tokens].nil? or
|
82
|
+
FalkorLib.config[:tokens][:code_climate].nil? or
|
83
|
+
FalkorLib.config[:tokens][:code_climate].empty?
|
84
|
+
ans = ask(cyan("A Code Climate token is set - Do you want to report on Code Climate the result of the process? (y|N)"), 'No')
|
85
|
+
ENV['CODECLIMATE_REPO_TOKEN'] = FalkorLib.config[:tokens][:code_climate] if ans =~ /y.*/i
|
86
|
+
end
|
87
|
+
end # task code_climate
|
88
|
+
|
89
|
+
end # namespace set
|
90
|
+
|
91
|
+
task :rspec => 'setenv:code_climate'
|
data/lib/falkorlib/version.rb
CHANGED
@@ -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: <Lun 2014-09-01 21:51 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Puppet Modules operations
|
8
8
|
#
|
@@ -40,18 +40,19 @@ describe FalkorLib::Puppet::Modules do
|
|
40
40
|
|
41
41
|
it "#init -- create a puppet module" do
|
42
42
|
# Prepare answer to the questions
|
43
|
-
Array.new(
|
43
|
+
Array.new(36).each { |e| STDIN.should_receive(:gets).and_return('') }
|
44
44
|
FalkorLib::Puppet::Modules.init(moduledir)
|
45
45
|
templatedir = File.join( FalkorLib.templates, 'puppet', 'modules')
|
46
46
|
s = true
|
47
|
+
puts "templatedir = #{templatedir}"
|
47
48
|
Dir["#{templatedir}/**/*"].each do |e|
|
48
49
|
next if File.directory?(e)
|
49
50
|
relative_dir = Pathname.new( File.realpath( File.dirname(e) )).relative_path_from Pathname.new(templatedir)
|
50
51
|
file = e.gsub(/templatename/, "#{name}")
|
51
52
|
filename = File.basename(file)
|
52
|
-
filename = File.basename(file, '.erb') unless file =~ /templates\/toto-variables\.erb/
|
53
|
+
filename = File.basename(file, '.erb') unless file =~ /templates\/toto-variables\.erb/
|
53
54
|
f = File.join(moduledir, relative_dir, filename)
|
54
|
-
|
55
|
+
puts "checking #{f} - #{File.exists?( f )}"
|
55
56
|
s &= File.exists?( f )
|
56
57
|
end
|
57
58
|
s.should be_true
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# versioning_puppet_module_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Lun 2014-09-01 21:51 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the versioning operations on Gems
|
8
8
|
#
|
@@ -53,7 +53,7 @@ describe FalkorLib::Versioning::Puppet do
|
|
53
53
|
|
54
54
|
|
55
55
|
it "#get_version -- get default version #{default_version} after initialization" do
|
56
|
-
Array.new(
|
56
|
+
Array.new(36).each { |e| STDIN.should_receive(:gets).and_return('') }
|
57
57
|
FalkorLib::Puppet::Modules.init(moduledir)
|
58
58
|
v = FalkorLib::Versioning.get_version(moduledir)
|
59
59
|
v.should == default_version
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# File:: <tt><%= config[:name] %>-params.pp</tt>
|
2
|
-
# Author:: <%= config[:author] %> (<%= config[:
|
2
|
+
# Author:: <%= config[:author] %> (<%= config[:mail] %>)
|
3
3
|
# Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
|
4
4
|
# License:: <%= config[:license] %>
|
5
5
|
#
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# File:: <tt><%= config[:name] %>.pp</tt>
|
2
|
-
# Author:: <%= config[:author] %> (<%= config[:
|
2
|
+
# Author:: <%= config[:author] %> (<%= config[:mail] %>)
|
3
3
|
# Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
|
4
4
|
# License:: <%= config[:license] %>
|
5
5
|
#
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# File:: <tt><%= config[:name] %>-mydef.pp</tt>
|
2
|
-
# Author:: <%= config[:author] %> (<%= config[:
|
2
|
+
# Author:: <%= config[:author] %> (<%= config[:mail] %>)
|
3
3
|
# Copyright:: Copyright (c) <%= Time.now.year %> <%= config[:author] %>
|
4
4
|
# License:: <%= config[:license] %>
|
5
5
|
#
|
File without changes
|
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.9
|
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-
|
11
|
+
date: 2014-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -324,13 +324,13 @@ files:
|
|
324
324
|
- templates/puppet/modules/README.md.erb
|
325
325
|
- templates/puppet/modules/Rakefile
|
326
326
|
- templates/puppet/modules/doc/contributing.md.erb
|
327
|
-
- templates/puppet/modules/files/README.md
|
327
|
+
- templates/puppet/modules/files/README.md.erb
|
328
328
|
- templates/puppet/modules/manifests/classes/templatename-params.pp.erb
|
329
329
|
- templates/puppet/modules/manifests/classes/templatename.pp.erb
|
330
330
|
- templates/puppet/modules/manifests/definitions/templatename-mydef.pp.erb
|
331
331
|
- templates/puppet/modules/manifests/init.pp.erb
|
332
332
|
- templates/puppet/modules/metadata.json.erb
|
333
|
-
- templates/puppet/modules/templates/README.md
|
333
|
+
- templates/puppet/modules/templates/README.md.erb
|
334
334
|
- templates/puppet/modules/templates/templatename-variables.erb
|
335
335
|
- templates/puppet/modules/tests/init.pp.erb
|
336
336
|
homepage: https://github.com/Falkor/falkorlib
|