falkorlib 0.6.19 → 0.7.0
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 +1 -0
- data/.rubocop.yml +88 -0
- data/.travis.yml +56 -4
- data/Gemfile +4 -4
- data/Gemfile.lock +55 -27
- data/Rakefile +12 -8
- data/Vagrantfile +68 -0
- data/completion/_falkor +55 -7
- data/falkorlib.gemspec +14 -12
- data/lib/falkorlib.rb +22 -21
- data/lib/falkorlib/bootstrap.rb +5 -1
- data/lib/falkorlib/bootstrap/base.rb +385 -693
- data/lib/falkorlib/bootstrap/git.rb +137 -0
- data/lib/falkorlib/bootstrap/latex.rb +186 -0
- data/lib/falkorlib/bootstrap/link.rb +108 -96
- data/lib/falkorlib/bootstrap/ruby.rb +102 -0
- data/lib/falkorlib/cli.rb +82 -26
- data/lib/falkorlib/cli/config.rb +8 -8
- data/lib/falkorlib/cli/link.rb +8 -9
- data/lib/falkorlib/cli/new.rb +25 -39
- data/lib/falkorlib/common.rb +425 -425
- data/lib/falkorlib/config.rb +114 -110
- data/lib/falkorlib/error.rb +27 -16
- data/lib/falkorlib/gem_tasks.rb +12 -11
- data/lib/falkorlib/git.rb +3 -4
- data/lib/falkorlib/git/base.rb +439 -396
- data/lib/falkorlib/git/flow.rb +163 -165
- data/lib/falkorlib/git_tasks.rb +31 -31
- data/lib/falkorlib/loader.rb +1 -1
- data/lib/falkorlib/puppet.rb +3 -5
- data/lib/falkorlib/puppet/base.rb +10 -15
- data/lib/falkorlib/puppet/modules.rb +367 -365
- data/lib/falkorlib/puppet_tasks.rb +11 -8
- data/lib/falkorlib/tasks.rb +51 -54
- data/lib/falkorlib/tasks/gem.rake +42 -43
- data/lib/falkorlib/tasks/gem.rb +12 -11
- data/lib/falkorlib/tasks/git.rake +101 -107
- data/lib/falkorlib/tasks/git.rb +31 -31
- data/lib/falkorlib/tasks/gitflow.rake +131 -141
- data/lib/falkorlib/tasks/puppet.rb +11 -8
- data/lib/falkorlib/tasks/puppet_modules.rake +143 -154
- data/lib/falkorlib/tasks/rspec.rake +94 -59
- data/lib/falkorlib/tasks/yard.rake +35 -39
- data/lib/falkorlib/version.rb +55 -55
- data/lib/falkorlib/versioning.rb +169 -167
- data/spec/falkorlib/bootstrap_helpers_spec.rb +106 -56
- data/spec/falkorlib/bootstrap_latex_spec.rb +145 -0
- data/spec/falkorlib/bootstrap_link_spec.rb +137 -0
- data/spec/falkorlib/bootstrap_ruby_spec.rb +118 -0
- data/spec/falkorlib/bootstrap_spec.rb +112 -129
- data/spec/falkorlib/git_spec.rb +94 -22
- data/spec/falkorlib/gitflow_spec.rb +54 -42
- data/spec/falkorlib/puppet_modules_spec.rb +35 -26
- data/spec/falkorlib/versioning_puppet_module_spec.rb +94 -90
- data/spec/falkorlib_spec.rb +5 -0
- data/spec/spec_helper.rb +88 -47
- data/templates/latex/article-ieee/main.tex.erb +509 -0
- data/templates/latex/article/_abstract.tex.erb +19 -0
- data/templates/latex/article/_acronyms.tex.erb +116 -0
- data/templates/latex/article/_conclusion.tex.erb +25 -0
- data/templates/latex/article/_context.tex.erb +17 -0
- data/templates/latex/article/_experiments.tex.erb +27 -0
- data/templates/latex/article/_implem.tex.erb +17 -0
- data/templates/latex/article/_introduction.tex.erb +39 -0
- data/templates/latex/article/_related_works.tex.erb +19 -0
- data/templates/latex/article/biblio.bib.erb +28 -0
- data/templates/latex/article/template.tex.erb +16 -0
- data/templates/latex/ieee/IEEEtran.bst +2409 -0
- data/templates/latex/ieee/IEEEtran.cls +6347 -0
- data/templates/motd/motd.erb +2 -1
- metadata +82 -2
data/lib/falkorlib/tasks/git.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Fri 2016-11-11 14:29 svarrette>
|
4
4
|
################################################################################
|
5
5
|
#
|
6
6
|
# FalkorLib rake tasks to pilot Git [flow] operations
|
@@ -11,42 +11,42 @@ require 'falkorlib'
|
|
11
11
|
require 'falkorlib/tasks'
|
12
12
|
|
13
13
|
module FalkorLib #:nodoc:
|
14
|
+
# Rake tasks to pilot Git operations
|
15
|
+
class GitTasks
|
14
16
|
|
15
|
-
|
16
|
-
class GitTasks
|
17
|
-
include Rake::DSL if defined? Rake::DSL
|
17
|
+
include Rake::DSL if defined? Rake::DSL
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
# Install the git[flow] tasks for Rake
|
20
|
+
def install_tasks
|
21
|
+
load 'falkorlib/tasks/git.rake'
|
22
|
+
load 'falkorlib/tasks/gitflow.rake'
|
23
|
+
end
|
24
|
+
|
25
|
+
end # class FalkorLib::GitTasks
|
25
26
|
end # module FalkorLib
|
26
27
|
|
27
28
|
|
28
29
|
if FalkorLib::Git.init?
|
29
|
-
|
30
|
-
|
30
|
+
# Now install them ;)
|
31
|
+
FalkorLib::GitTasks.new.install_tasks
|
31
32
|
else
|
32
|
-
|
33
|
-
|
33
|
+
warn "Git is not initialized for this directory."
|
34
|
+
warn "==> consider running 'rake git[:flow]:init' to be able to access the regular git Rake tasks"
|
35
|
+
#.....................
|
36
|
+
namespace :git do
|
37
|
+
########### git:init ###########
|
38
|
+
desc "Initialize Git repository"
|
39
|
+
task :init do
|
40
|
+
FalkorLib::Git.init
|
41
|
+
end
|
42
|
+
|
34
43
|
#.....................
|
35
|
-
namespace :
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
namespace :flow do
|
44
|
-
########### git:flow:init ###########
|
45
|
-
desc "Initialize the Git-flow repository"
|
46
|
-
task :init do
|
47
|
-
FalkorLib::GitFlow.init
|
48
|
-
end
|
49
|
-
end # namespace git:flow
|
50
|
-
|
51
|
-
end # namespace git
|
44
|
+
namespace :flow do
|
45
|
+
########### git:flow:init ###########
|
46
|
+
desc "Initialize the Git-flow repository"
|
47
|
+
task :init do
|
48
|
+
FalkorLib::GitFlow.init
|
49
|
+
end
|
50
|
+
end # namespace git:flow
|
51
|
+
end # namespace git
|
52
52
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
################################################################################
|
2
2
|
# gitflow.rake - Special tasks for the management of Git [Flow] operations
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Fri 2016-11-11 15:43 svarrette>
|
4
4
|
#
|
5
5
|
# Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
6
6
|
# http://varrette.gforge.uni.lu
|
@@ -12,154 +12,144 @@ require 'falkorlib/git'
|
|
12
12
|
|
13
13
|
#.....................
|
14
14
|
namespace :git do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
Rake::Task['git:push'].invoke
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end # End namespace 'git:feature'
|
71
|
-
|
15
|
+
include FalkorLib::Common
|
16
|
+
git_root_dir = FalkorLib::Git.rootdir
|
17
|
+
|
18
|
+
########### git:init ###########
|
19
|
+
#desc "Initialize Git repository"
|
20
|
+
task :init => [ 'git:flow:init' ]
|
21
|
+
|
22
|
+
#.....................
|
23
|
+
namespace :flow do
|
24
|
+
########### git:flow:init ###########
|
25
|
+
desc "Initialize your local clone of the repository for the git-flow management"
|
26
|
+
task :init do |t|
|
27
|
+
info t.comment
|
28
|
+
FalkorLib::GitFlow.init(git_root_dir)
|
29
|
+
end # task init
|
30
|
+
end # namespace git::flow
|
31
|
+
|
32
|
+
#.....................
|
33
|
+
namespace :feature do
|
34
|
+
######### git:feature:start ##########################
|
35
|
+
desc "Start a new feature operation on the repository using the git-flow framework"
|
36
|
+
task :start, [:name] do |t, args|
|
37
|
+
#args.with_default[:name => '']
|
38
|
+
name = (args.name == 'name') ? ask("Name of the feature (the git branch will be 'feature/<name>')") : args.name
|
39
|
+
info t.comment + " with name 'feature/#{name}'"
|
40
|
+
really_continue?
|
41
|
+
Rake::Task['git:up'].invoke unless FalkorLib::Git.remotes.empty?
|
42
|
+
info "=> prepare new 'feature' using git flow"
|
43
|
+
o = FalkorLib::GitFlow.start('feature', name)
|
44
|
+
error "Git flow feature operation failed" unless o.zero?
|
45
|
+
# Now you should be in the new branch
|
46
|
+
end
|
47
|
+
|
48
|
+
######### git:feature:finish ##########################
|
49
|
+
desc "Finalize the feature operation"
|
50
|
+
task :finish do |t|
|
51
|
+
branch = FalkorLib::Git.branch?
|
52
|
+
expected_branch_prefix = FalkorLib.config.gitflow[:prefix][:feature]
|
53
|
+
if branch !~ /^#{expected_branch_prefix}/
|
54
|
+
error "You are not in the expected branch (with prefix '#{expected_branch_prefix}')"
|
55
|
+
end
|
56
|
+
name = branch.sub(/^#{expected_branch_prefix}/, '')
|
57
|
+
info t.comment
|
58
|
+
o = FalkorLib::GitFlow.finish('feature', name)
|
59
|
+
error "Git flow feature operation failed" unless o.zero?
|
60
|
+
unless FalkorLib::Git.remotes.empty?
|
61
|
+
info "=> about to update remote tracked branches"
|
62
|
+
really_continue?
|
63
|
+
Rake::Task['git:push'].invoke
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end # End namespace 'git:feature'
|
72
67
|
end # namespace git
|
73
68
|
|
74
69
|
|
75
70
|
#.....................
|
76
71
|
namespace :version do
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
info "Updating Gemfile information"
|
116
|
-
run %{
|
72
|
+
########### version:info ###########
|
73
|
+
#desc "Get versioning information"
|
74
|
+
task :info do |_t|
|
75
|
+
include FalkorLib::Versioning
|
76
|
+
version = get_version
|
77
|
+
#major, minor, patch = bump(version, :major), bumpversion, :minor), bump(version, :patch)
|
78
|
+
info "Get versioning information" # t.comment
|
79
|
+
puts "Current version: " + bold(version)
|
80
|
+
FalkorLib.config[:versioning][:levels].reverse.each do |level|
|
81
|
+
puts "- next #{level} version: " + bump(version, level.to_sym)
|
82
|
+
end
|
83
|
+
end # task info
|
84
|
+
|
85
|
+
|
86
|
+
#.....................
|
87
|
+
namespace :bump do
|
88
|
+
%w(major minor patch).each do |level|
|
89
|
+
################# version:bump:{major,minor,patch} ##################################
|
90
|
+
desc "Prepare the #{level} release of the repository"
|
91
|
+
task level.to_sym do |t|
|
92
|
+
version = FalkorLib::Versioning.get_version
|
93
|
+
release_version = FalkorLib::Versioning.bump(version, level.to_sym)
|
94
|
+
info t.comment + " (from version '#{version}' to '#{release_version}')"
|
95
|
+
really_continue?
|
96
|
+
Rake::Task['git:up'].invoke unless FalkorLib::Git.remotes.empty?
|
97
|
+
info "=> prepare release using git flow"
|
98
|
+
o = FalkorLib::GitFlow.start('release', release_version)
|
99
|
+
error "Git flow release process failed" unless o.zero?
|
100
|
+
# Now you should be in the new branch
|
101
|
+
current_branch = FalkorLib::Git.branch?
|
102
|
+
expected_branch = FalkorLib.config[:gitflow][:prefix][:release] + release_version
|
103
|
+
if (current_branch == expected_branch)
|
104
|
+
FalkorLib::Versioning.set_version(release_version)
|
105
|
+
if (!FalkorLib.config[:versioning].nil?) &&
|
106
|
+
FalkorLib.config[:versioning][:type] == 'gem' &&
|
107
|
+
File.exist?(File.join(FalkorLib::Git.rootdir, 'Gemfile'))
|
108
|
+
info "Updating Gemfile information"
|
109
|
+
run %(
|
117
110
|
# Update cache info
|
118
111
|
bundle list > /dev/null
|
119
112
|
git commit -s -m "Update Gemfile.lock accordingly" Gemfile.lock
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
end
|
127
|
-
end
|
113
|
+
)
|
114
|
+
end
|
115
|
+
warning "The version number has already been bumped"
|
116
|
+
warning "==> run 'rake version:release' to finalize the release and merge the current version of the repository into the '#{FalkorLib.config[:gitflow][:branches][:master]}' branch"
|
117
|
+
else
|
118
|
+
error "You are in the '#{branch}' branch and not the expected one, i.e. #{expected_branch}"
|
128
119
|
end
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end # namespace version:bump
|
123
|
+
|
124
|
+
########### release ###########
|
125
|
+
desc "Finalize the release of a given bumped version"
|
126
|
+
task :release do |_t|
|
127
|
+
version = FalkorLib::Versioning.get_version
|
128
|
+
branch = FalkorLib::Git.branch?
|
129
|
+
expected_branch = FalkorLib.config[:gitflow][:prefix][:release] + version
|
130
|
+
error "You are not in the '#{expected_branch}' branch but in the '#{branch}' one. May be you forgot to run 'rake version:bump:{patch,minor,major}' first" if branch != expected_branch
|
131
|
+
info "=> Finalize the release of the version '#{version}' into the '#{FalkorLib.config[:gitflow][:branches][:master]}' branch/environment"
|
132
|
+
o = FalkorLib::GitFlow.finish('release', version, Dir.pwd, '-s')
|
133
|
+
error "Git flow release process failed" unless o.zero?
|
134
|
+
if FalkorLib::Git.remotes?
|
135
|
+
info("=> about to update remote tracked branches")
|
136
|
+
really_continue?
|
137
|
+
FalkorLib.config[:gitflow][:branches].each do |_type, br|
|
138
|
+
run %(
|
139
|
+
git checkout #{br}
|
147
140
|
git push origin
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
141
|
+
)
|
142
|
+
end
|
143
|
+
run %( git push origin --tags )
|
144
|
+
end
|
145
|
+
#info "Update the changelog"
|
146
|
+
if (!FalkorLib.config[:versioning].nil?) &&
|
147
|
+
FalkorLib.config[:versioning][:type] == 'gem'
|
148
|
+
warn "About to push the released new gem (version #{version}) to the gem server (rybygems.org)"
|
149
|
+
really_continue?
|
150
|
+
Rake::Task['gem:release'].invoke
|
151
|
+
end
|
152
|
+
|
153
|
+
#Rake::Task['git:push'].invoke
|
154
|
+
end # task version:release
|
165
155
|
end # namespace version
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Fri 2016-11-11 14:45 svarrette>
|
4
4
|
################################################################################
|
5
5
|
#
|
6
6
|
# FalkorLib rake tasks to pilot Puppet operations
|
@@ -11,14 +11,17 @@ require 'falkorlib'
|
|
11
11
|
require 'falkorlib/tasks'
|
12
12
|
|
13
13
|
module FalkorLib #:nodoc:
|
14
|
-
|
15
|
-
|
14
|
+
# Puppet tasks for Rake
|
15
|
+
class PuppetTasks
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
include Rake::DSL if defined? Rake::DSL
|
18
|
+
|
19
|
+
# Install the puppet tasks for Rake
|
20
|
+
def install_tasks
|
21
|
+
load 'falkorlib/tasks/puppet_modules.rake'
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
22
25
|
end
|
23
26
|
|
24
27
|
FalkorLib::PuppetTasks.new.install_tasks
|
@@ -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: <Fri 2016-11-11 15:49 svarrette>
|
5
5
|
#
|
6
6
|
# Copyright (c) 2014 Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
7
7
|
# http://varrette.gforge.uni.lu
|
@@ -14,158 +14,147 @@ require 'falkorlib/puppet'
|
|
14
14
|
|
15
15
|
#.....................
|
16
16
|
namespace :bootstrap do
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end # namespace bootstrap:puppet
|
17
|
+
#.....................
|
18
|
+
namespace :puppet do
|
19
|
+
########### bootstrap:puppet:module ###########
|
20
|
+
desc "Bootstrap a new Puppet module"
|
21
|
+
task :module, [:name] do |t, args|
|
22
|
+
info(t.comment).to_s
|
23
|
+
name = (args.name.nil? || args.name.empty? || (args.name == 'name')) ? ask("Enter the module name (ex: 'ULHPC/modulename')") : args.name
|
24
|
+
error "You need to provide a module name" unless name != ''
|
25
|
+
error "The module name cannot contain spaces" if name =~ /\s+/
|
26
|
+
moduledir = File.join( FalkorLib.config[:puppet][:modulesdir], name.gsub(/^\w*\//, 'puppet-'))
|
27
|
+
dir = ask("Destination directory:", moduledir)
|
28
|
+
error "The module '#{name}' already exists" if File.directory?(dir)
|
29
|
+
FalkorLib::Puppet::Modules.init(dir, name)
|
30
|
+
end
|
31
|
+
end # namespace bootstrap:puppet
|
35
32
|
end # namespace bootstrap
|
36
33
|
|
37
34
|
require 'json'
|
38
35
|
|
39
36
|
#.....................
|
40
37
|
namespace :puppet do
|
41
|
-
|
42
|
-
|
43
|
-
if command?('puppet')
|
44
|
-
#.....................
|
45
|
-
namespace :module do
|
46
|
-
|
47
|
-
########### puppet:module:build ###########
|
48
|
-
desc "Build the puppet module to publish it on the Puppet Forge"
|
49
|
-
task :build do |t|
|
50
|
-
info "#{t.comment}"
|
51
|
-
run %{ puppet module build }
|
52
|
-
if File.exists? ('metadata.json')
|
53
|
-
metadata = JSON.parse( IO.read( 'metadata.json' ) )
|
54
|
-
name = metadata["name"]
|
55
|
-
version = metadata["version"]
|
56
|
-
url = metadata["forge_url"].nil? ? "https://forge.puppetlabs.com/#{name.gsub(/-/,'/')}" : metadata["forge_url"]
|
57
|
-
warn "you can now upload the generated file 'pkg/#{name}-#{version}.tar.gz' on the puppet forge"
|
58
|
-
warn " #{url}"
|
59
|
-
end
|
60
|
-
end # task build
|
61
|
-
|
62
|
-
########### puppet:module:parse ###########
|
63
|
-
desc "Parse a given module"
|
64
|
-
task :parse do |t|
|
65
|
-
info "#{t.comment}"
|
66
|
-
FalkorLib::Puppet::Modules.parse()
|
67
|
-
end # task parse
|
68
|
-
|
69
|
-
########### puppet:module:validate ###########
|
70
|
-
desc "Validate the module by checking the syntax and programming style of the module"
|
71
|
-
task :validate => [
|
72
|
-
#:syntax,
|
73
|
-
:lint
|
74
|
-
]
|
75
|
-
# do
|
76
|
-
# info "validate parsing"
|
77
|
-
# Dir['manifests/**/*.pp'].each do |manifest|
|
78
|
-
# sh "puppet parser validate --noop #{manifest}"
|
79
|
-
# end
|
80
|
-
# Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
81
|
-
# sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
82
|
-
# end
|
83
|
-
# Dir['templates/**/*.erb'].each do |template|
|
84
|
-
# sh "erb -P -x -T '-' #{template} | ruby -c"
|
85
|
-
# end
|
86
|
-
# info "checking style guidelines with puppet-lint"
|
87
|
-
# Rake::Task[:lint].invoke
|
88
|
-
# info "checking syntax"
|
89
|
-
# Rake::Task[:syntax].invoke
|
90
|
-
# end
|
91
|
-
|
92
|
-
########### puppet:module:classes ###########
|
93
|
-
desc "Parse the module for classes definitions"
|
94
|
-
task :classes do |t|
|
95
|
-
c = FalkorLib::Puppet::Modules.classes()
|
96
|
-
info "Implemented classes:"
|
97
|
-
puts c.empty? ? red('NONE') : c.to_yaml
|
98
|
-
end # task classes
|
99
|
-
|
100
|
-
########### puppet:module:definitions ###########
|
101
|
-
desc "Parse the module for definitions"
|
102
|
-
task :definitions do |t|
|
103
|
-
d = FalkorLib::Puppet::Modules.definitions()
|
104
|
-
info "Implemented definitions:"
|
105
|
-
puts d.empty? ? red('NONE') : d.to_yaml
|
106
|
-
end # task definitions
|
107
|
-
|
108
|
-
########### puppet:module:deps ###########
|
109
|
-
desc "Parse the module for its exact dependencies"
|
110
|
-
task :deps do |t|
|
111
|
-
d = FalkorLib::Puppet::Modules.deps()
|
112
|
-
info "Module dependencies:"
|
113
|
-
puts d.empty? ? red('NONE') : d.to_yaml
|
114
|
-
end # task deps
|
115
|
-
|
38
|
+
include FalkorLib::Common
|
116
39
|
|
40
|
+
if command?('puppet')
|
41
|
+
#.....................
|
42
|
+
namespace :module do
|
43
|
+
########### puppet:module:build ###########
|
44
|
+
desc "Build the puppet module to publish it on the Puppet Forge"
|
45
|
+
task :build do |t|
|
46
|
+
info(t.comment).to_s
|
47
|
+
run %( puppet module build )
|
48
|
+
if File.exist?('metadata.json')
|
49
|
+
metadata = JSON.parse( IO.read( 'metadata.json' ) )
|
50
|
+
name = metadata["name"]
|
51
|
+
version = metadata["version"]
|
52
|
+
url = (metadata["forge_url"].nil?) ? "https://forge.puppetlabs.com/#{name.tr('-', '/')}" : metadata["forge_url"]
|
53
|
+
warn "you can now upload the generated file 'pkg/#{name}-#{version}.tar.gz' on the puppet forge"
|
54
|
+
warn " #{url}"
|
117
55
|
end
|
118
|
-
|
56
|
+
end # task build
|
57
|
+
|
58
|
+
########### puppet:module:parse ###########
|
59
|
+
desc "Parse a given module"
|
60
|
+
task :parse do |t|
|
61
|
+
info(t.comment).to_s
|
62
|
+
FalkorLib::Puppet::Modules.parse
|
63
|
+
end # task parse
|
64
|
+
|
65
|
+
########### puppet:module:validate ###########
|
66
|
+
desc "Validate the module by checking the syntax and programming style of the module"
|
67
|
+
task :validate => [
|
68
|
+
#:syntax,
|
69
|
+
:lint
|
70
|
+
]
|
71
|
+
# do
|
72
|
+
# info "validate parsing"
|
73
|
+
# Dir['manifests/**/*.pp'].each do |manifest|
|
74
|
+
# sh "puppet parser validate --noop #{manifest}"
|
75
|
+
# end
|
76
|
+
# Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
|
77
|
+
# sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
|
78
|
+
# end
|
79
|
+
# Dir['templates/**/*.erb'].each do |template|
|
80
|
+
# sh "erb -P -x -T '-' #{template} | ruby -c"
|
81
|
+
# end
|
82
|
+
# info "checking style guidelines with puppet-lint"
|
83
|
+
# Rake::Task[:lint].invoke
|
84
|
+
# info "checking syntax"
|
85
|
+
# Rake::Task[:syntax].invoke
|
86
|
+
# end
|
87
|
+
|
88
|
+
########### puppet:module:classes ###########
|
89
|
+
desc "Parse the module for classes definitions"
|
90
|
+
task :classes do |_t|
|
91
|
+
c = FalkorLib::Puppet::Modules.classes
|
92
|
+
info "Implemented classes:"
|
93
|
+
puts((c.empty?) ? red('NONE') : c.to_yaml)
|
94
|
+
end # task classes
|
95
|
+
|
96
|
+
########### puppet:module:definitions ###########
|
97
|
+
desc "Parse the module for definitions"
|
98
|
+
task :definitions do |_t|
|
99
|
+
d = FalkorLib::Puppet::Modules.definitions
|
100
|
+
info "Implemented definitions:"
|
101
|
+
puts((d.empty?) ? red('NONE') : d.to_yaml)
|
102
|
+
end # task definitions
|
103
|
+
|
104
|
+
########### puppet:module:deps ###########
|
105
|
+
desc "Parse the module for its exact dependencies"
|
106
|
+
task :deps do |_t|
|
107
|
+
d = FalkorLib::Puppet::Modules.deps
|
108
|
+
info "Module dependencies:"
|
109
|
+
puts((d.empty?) ? red('NONE') : d.to_yaml)
|
110
|
+
end # task deps
|
111
|
+
end
|
112
|
+
end # namespace module
|
119
113
|
end # namespace puppet
|
120
114
|
|
121
115
|
#.....................
|
122
116
|
namespace :templates do
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
FalkorLib::Puppet::Modules.upgrade_from_template(Dir.pwd, 'tests')
|
157
|
-
end
|
158
|
-
|
159
|
-
|
160
|
-
end # namespace upgrade
|
117
|
+
namespace :upgrade do
|
118
|
+
########### templates:upgrade:all ###########
|
119
|
+
task :all do
|
120
|
+
info "Upgrade all key module files from FalkorLib templates"
|
121
|
+
FalkorLib::Puppet::Modules.upgrade
|
122
|
+
end
|
123
|
+
|
124
|
+
%w(docs readme rake vagrant).each do |t|
|
125
|
+
########### templates:upgrade:{readme,rake,vagrant} ###########
|
126
|
+
desc "Upgrade (overwrite) #{t.capitalize} using the current FalkorLib template"
|
127
|
+
task t.to_sym do
|
128
|
+
list = case t
|
129
|
+
when 'readme'
|
130
|
+
[ 'README.md' ]
|
131
|
+
when 'docs'
|
132
|
+
[ 'docs/contacts.md', 'docs/contributing/index.md', 'docs/contributing/layout.md', 'docs/contributing/setup.md', 'docs/contributing/versioning.md', 'docs/index.md', 'docs/rtfd.md', 'docs/vagrant.md' ]
|
133
|
+
when 'rake'
|
134
|
+
%w(Gemfile Rakefile)
|
135
|
+
when 'vagrant'
|
136
|
+
[ 'Vagrantfile', '.vagrant_init.rb']
|
137
|
+
else []
|
138
|
+
end
|
139
|
+
#info "Upgrade the module files '#{list.join(',')}' from FalkorLib templates"
|
140
|
+
FalkorLib::Puppet::Modules.upgrade(Dir.pwd, :only => list)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
########### templates:upgrade:tests ###########
|
145
|
+
task :tests do
|
146
|
+
info "Upgrade the basic tests manifests in tests/"
|
147
|
+
FalkorLib::Puppet::Modules.upgrade_from_template(Dir.pwd, 'tests')
|
148
|
+
end
|
149
|
+
end # namespace upgrade
|
161
150
|
end # namespace module
|
162
151
|
|
163
152
|
|
164
153
|
#.....................
|
165
154
|
require 'rake/clean'
|
166
|
-
CLEAN.add
|
155
|
+
CLEAN.add 'pkg'
|
167
156
|
|
168
|
-
exclude_tests_paths = ['pkg/**/*','spec/**/*','manifests.old/**/*']
|
157
|
+
exclude_tests_paths = ['pkg/**/*', 'spec/**/*', 'manifests.old/**/*']
|
169
158
|
|
170
159
|
#.........................................................................
|
171
160
|
# puppet-lint tasks -- see http://puppet-lint.com/checks/
|
@@ -177,9 +166,9 @@ PuppetLint.configuration.send('disable_class_inherits_from_params_class')
|
|
177
166
|
PuppetLint.configuration.send('disable_80chars')
|
178
167
|
PuppetLint.configuration.ignore_paths = exclude_tests_paths
|
179
168
|
|
180
|
-
task :lint_info do
|
181
|
-
|
182
|
-
end
|
169
|
+
task :lint_info do
|
170
|
+
info "checking style guidelines with puppet-lint"
|
171
|
+
end
|
183
172
|
task :lint => :lint_info
|
184
173
|
|
185
174
|
#.........................................................................
|
@@ -187,11 +176,11 @@ task :lint => :lint_info
|
|
187
176
|
#
|
188
177
|
require 'puppet-syntax/tasks/puppet-syntax'
|
189
178
|
PuppetSyntax.future_parser = true
|
190
|
-
PuppetSyntax.exclude_paths = exclude_tests_paths
|
179
|
+
PuppetSyntax.exclude_paths = exclude_tests_paths
|
191
180
|
|
192
|
-
# task :syntax_info do
|
193
|
-
#
|
194
|
-
# end
|
181
|
+
# task :syntax_info do
|
182
|
+
# info "checking syntax for Puppet manifests, templates, and Hiera YAML"
|
183
|
+
# end
|
195
184
|
# task :syntax => :syntax_info
|
196
185
|
|
197
186
|
#.........................................................................
|
@@ -202,19 +191,19 @@ PuppetSyntax.exclude_paths = exclude_tests_paths
|
|
202
191
|
# ########## rspec #################
|
203
192
|
# desc "Run all RSpec code examples"
|
204
193
|
# RSpec::Core::RakeTask.new(:rspec) do |t|
|
205
|
-
#
|
194
|
+
# t.rspec_opts = File.read("spec/spec.opts").chomp || ""
|
206
195
|
# end
|
207
196
|
|
208
197
|
# SPEC_SUITES = (Dir.entries('spec') - ['.', '..','fixtures']).select {|e| File.directory? "spec/#{e}" }
|
209
198
|
# namespace :rspec do
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
213
|
-
#
|
214
|
-
#
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
199
|
+
# SPEC_SUITES.each do |suite|
|
200
|
+
# ############ rspec:{classes,defines...} ##########
|
201
|
+
# desc "Run #{suite} RSpec code examples"
|
202
|
+
# RSpec::Core::RakeTask.new(suite) do |t|
|
203
|
+
# t.pattern = "spec/#{suite}/**/*_spec.rb"
|
204
|
+
# t.rspec_opts = File.read("spec/spec.opts").chomp || ""
|
205
|
+
# end
|
206
|
+
# end
|
218
207
|
# end
|
219
208
|
# task :default => :rspec
|
220
209
|
|
@@ -223,9 +212,9 @@ PuppetSyntax.exclude_paths = exclude_tests_paths
|
|
223
212
|
|
224
213
|
################################################
|
225
214
|
|
226
|
-
|
227
|
-
|
228
|
-
end
|
215
|
+
%w(major minor patch).each do |level|
|
216
|
+
task "version:bump:#{level}" => 'puppet:module:validate'
|
217
|
+
end
|
229
218
|
|
230
219
|
#task 'version:release' => 'puppet:module:build'
|
231
220
|
Rake::Task["version:release"].enhance do
|