falkorlib 0.6.19 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.rubocop.yml +88 -0
  4. data/.travis.yml +56 -4
  5. data/Gemfile +4 -4
  6. data/Gemfile.lock +55 -27
  7. data/Rakefile +12 -8
  8. data/Vagrantfile +68 -0
  9. data/completion/_falkor +55 -7
  10. data/falkorlib.gemspec +14 -12
  11. data/lib/falkorlib.rb +22 -21
  12. data/lib/falkorlib/bootstrap.rb +5 -1
  13. data/lib/falkorlib/bootstrap/base.rb +385 -693
  14. data/lib/falkorlib/bootstrap/git.rb +137 -0
  15. data/lib/falkorlib/bootstrap/latex.rb +186 -0
  16. data/lib/falkorlib/bootstrap/link.rb +108 -96
  17. data/lib/falkorlib/bootstrap/ruby.rb +102 -0
  18. data/lib/falkorlib/cli.rb +82 -26
  19. data/lib/falkorlib/cli/config.rb +8 -8
  20. data/lib/falkorlib/cli/link.rb +8 -9
  21. data/lib/falkorlib/cli/new.rb +25 -39
  22. data/lib/falkorlib/common.rb +425 -425
  23. data/lib/falkorlib/config.rb +114 -110
  24. data/lib/falkorlib/error.rb +27 -16
  25. data/lib/falkorlib/gem_tasks.rb +12 -11
  26. data/lib/falkorlib/git.rb +3 -4
  27. data/lib/falkorlib/git/base.rb +439 -396
  28. data/lib/falkorlib/git/flow.rb +163 -165
  29. data/lib/falkorlib/git_tasks.rb +31 -31
  30. data/lib/falkorlib/loader.rb +1 -1
  31. data/lib/falkorlib/puppet.rb +3 -5
  32. data/lib/falkorlib/puppet/base.rb +10 -15
  33. data/lib/falkorlib/puppet/modules.rb +367 -365
  34. data/lib/falkorlib/puppet_tasks.rb +11 -8
  35. data/lib/falkorlib/tasks.rb +51 -54
  36. data/lib/falkorlib/tasks/gem.rake +42 -43
  37. data/lib/falkorlib/tasks/gem.rb +12 -11
  38. data/lib/falkorlib/tasks/git.rake +101 -107
  39. data/lib/falkorlib/tasks/git.rb +31 -31
  40. data/lib/falkorlib/tasks/gitflow.rake +131 -141
  41. data/lib/falkorlib/tasks/puppet.rb +11 -8
  42. data/lib/falkorlib/tasks/puppet_modules.rake +143 -154
  43. data/lib/falkorlib/tasks/rspec.rake +94 -59
  44. data/lib/falkorlib/tasks/yard.rake +35 -39
  45. data/lib/falkorlib/version.rb +55 -55
  46. data/lib/falkorlib/versioning.rb +169 -167
  47. data/spec/falkorlib/bootstrap_helpers_spec.rb +106 -56
  48. data/spec/falkorlib/bootstrap_latex_spec.rb +145 -0
  49. data/spec/falkorlib/bootstrap_link_spec.rb +137 -0
  50. data/spec/falkorlib/bootstrap_ruby_spec.rb +118 -0
  51. data/spec/falkorlib/bootstrap_spec.rb +112 -129
  52. data/spec/falkorlib/git_spec.rb +94 -22
  53. data/spec/falkorlib/gitflow_spec.rb +54 -42
  54. data/spec/falkorlib/puppet_modules_spec.rb +35 -26
  55. data/spec/falkorlib/versioning_puppet_module_spec.rb +94 -90
  56. data/spec/falkorlib_spec.rb +5 -0
  57. data/spec/spec_helper.rb +88 -47
  58. data/templates/latex/article-ieee/main.tex.erb +509 -0
  59. data/templates/latex/article/_abstract.tex.erb +19 -0
  60. data/templates/latex/article/_acronyms.tex.erb +116 -0
  61. data/templates/latex/article/_conclusion.tex.erb +25 -0
  62. data/templates/latex/article/_context.tex.erb +17 -0
  63. data/templates/latex/article/_experiments.tex.erb +27 -0
  64. data/templates/latex/article/_implem.tex.erb +17 -0
  65. data/templates/latex/article/_introduction.tex.erb +39 -0
  66. data/templates/latex/article/_related_works.tex.erb +19 -0
  67. data/templates/latex/article/biblio.bib.erb +28 -0
  68. data/templates/latex/article/template.tex.erb +16 -0
  69. data/templates/latex/ieee/IEEEtran.bst +2409 -0
  70. data/templates/latex/ieee/IEEEtran.cls +6347 -0
  71. data/templates/motd/motd.erb +2 -1
  72. metadata +82 -2
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Jeu 2014-06-26 10:29 svarrette>
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
- # Rake tasks to pilot Git operations
16
- class GitTasks
17
- include Rake::DSL if defined? Rake::DSL
17
+ include Rake::DSL if defined? Rake::DSL
18
18
 
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
- end # class FalkorLib::GitTasks
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
- # Now install them ;)
30
- FalkorLib::GitTasks.new.install_tasks
30
+ # Now install them ;)
31
+ FalkorLib::GitTasks.new.install_tasks
31
32
  else
32
- warn "Git is not initialized for this directory."
33
- warn "==> consider running 'rake git[:flow]:init' to be able to access the regular git Rake tasks"
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 :git do
36
- ########### git:init ###########
37
- desc "Initialize Git repository"
38
- task :init do
39
- FalkorLib::Git.init
40
- end
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: <Sam 2014-08-23 15:19 svarrette>
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
- include FalkorLib::Common
17
- git_root_dir = FalkorLib::Git.rootdir
18
-
19
- ########### git:init ###########
20
- #desc "Initialize Git repository"
21
- task :init => [ 'git:flow:init' ]
22
-
23
- #.....................
24
- namespace :flow do
25
-
26
- ########### git:flow:init ###########
27
- desc "Initialize your local clone of the repository for the git-flow management"
28
- task :init do |t|
29
- info t.comment
30
- FalkorLib::GitFlow.init(git_root_dir)
31
- end # task init
32
-
33
- end # namespace git::flow
34
-
35
- #.....................
36
- namespace :feature do
37
-
38
- ######### git:feature:start ##########################
39
- desc "Start a new feature operation on the repository using the git-flow framework"
40
- task :start, [:name] do |t, args|
41
- #args.with_default[:name => '']
42
- name = args.name == 'name' ? ask("Name of the feature (the git branch will be 'feature/<name>')") : args.name
43
- info t.comment + " with name 'feature/#{name}'"
44
- really_continue?
45
- Rake::Task['git:up'].invoke unless FalkorLib::Git.remotes.empty?
46
- info "=> prepare new 'feature' using git flow"
47
- o = FalkorLib::GitFlow.start('feature', name)
48
- error "Git flow feature operation failed" unless o == 0
49
- # Now you should be in the new branch
50
- end
51
-
52
- ######### git:feature:finish ##########################
53
- desc "Finalize the feature operation"
54
- task :finish do |t|
55
- branch = FalkorLib::Git.branch?
56
- expected_branch_prefix = FalkorLib.config.gitflow[:prefix][:feature]
57
- if branch !~ /^#{expected_branch_prefix}/
58
- error "You are not in the expected branch (with prefix '#{expected_branch_prefix}')"
59
- end
60
- name = branch.sub(/^#{expected_branch_prefix}/, '')
61
- info t.comment
62
- o = FalkorLib::GitFlow.finish('feature', name)
63
- error "Git flow feature operation failed" unless o == 0
64
- unless FalkorLib::Git.remotes.empty?
65
- info "=> about to update remote tracked branches"
66
- really_continue?
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
- ########### version:info ###########
79
- #desc "Get versioning information"
80
- task :info do |t|
81
- include FalkorLib::Versioning
82
- version = get_version
83
- #major, minor, patch = bump(version, :major), bumpversion, :minor), bump(version, :patch)
84
- info "Get versioning information" # t.comment
85
- puts "Current version: " + bold(version)
86
- FalkorLib.config[:versioning][:levels].reverse.each do |level|
87
- puts "- next #{level} version: " + bump(version, level.to_sym)
88
- end
89
- end # task info
90
-
91
-
92
- #.....................
93
- namespace :bump do
94
- [ 'major', 'minor', 'patch' ].each do |level|
95
-
96
- ################# version:bump:{major,minor,patch} ##################################
97
- desc "Prepare the #{level} release of the repository"
98
- task level.to_sym do |t|
99
- version = FalkorLib::Versioning.get_version
100
- release_version = FalkorLib::Versioning.bump(version, level.to_sym)
101
- info t.comment + " (from version '#{version}' to '#{release_version}')"
102
- really_continue?
103
- Rake::Task['git:up'].invoke unless FalkorLib::Git.remotes.empty?
104
- info "=> prepare release using git flow"
105
- o = FalkorLib::GitFlow.start('release', release_version)
106
- error "Git flow release process failed" unless o == 0
107
- # Now you should be in the new branch
108
- current_branch = FalkorLib::Git.branch?
109
- expected_branch = FalkorLib.config[:gitflow][:prefix][:release] + release_version
110
- if (current_branch == expected_branch)
111
- FalkorLib::Versioning.set_version(release_version)
112
- if (! FalkorLib.config[:versioning].nil?) &&
113
- FalkorLib.config[:versioning][:type] == 'gem' &&
114
- File.exists?(File.join(FalkorLib::Git.rootdir, 'Gemfile'))
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
- end
122
- warning "The version number has already been bumped"
123
- 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"
124
- else
125
- error "You are in the '#{branch}' branch and not the expected one, i.e. #{expected_branch}"
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
- end # namespace version:bump
130
-
131
- ########### release ###########
132
- desc "Finalize the release of a given bumped version"
133
- task :release do |t|
134
- version = FalkorLib::Versioning.get_version
135
- branch = FalkorLib::Git.branch?
136
- expected_branch = FalkorLib.config[:gitflow][:prefix][:release] + version
137
- 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
138
- info "=> Finalize the release of the version '#{version}' into the '#{FalkorLib.config[:gitflow][:branches][:master]}' branch/environment"
139
- o = FalkorLib::GitFlow.finish('release', version, Dir.pwd, '-s')
140
- error "Git flow release process failed" unless o == 0
141
- if FalkorLib::Git.remotes?
142
- info("=> about to update remote tracked branches")
143
- really_continue?
144
- FalkorLib.config[:gitflow][:branches].each do |type, branch|
145
- run %{
146
- git checkout #{branch}
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
- end
150
- run %{ git push origin --tags }
151
- end
152
- #info "Update the changelog"
153
- if (! FalkorLib.config[:versioning].nil?) &&
154
- FalkorLib.config[:versioning][:type] == 'gem'
155
- warn "About to push the released new gem (version #{version}) to the gem server (rybygems.org)"
156
- really_continue?
157
- Rake::Task['gem:release'].invoke
158
- end
159
-
160
- #Rake::Task['git:push'].invoke
161
- end # task version:release
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: <Lun 2014-08-25 21:46 svarrette>
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
- class PuppetTasks
15
- include Rake::DSL if defined? Rake::DSL
14
+ # Puppet tasks for Rake
15
+ class PuppetTasks
16
16
 
17
- # Install the puppet tasks for Rake
18
- def install_tasks
19
- load 'falkorlib/tasks/puppet_modules.rake'
20
- end
21
- end
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: <Tue 2015-05-26 19:21 svarrette>
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
- namespace :puppet do
19
-
20
- ########### bootstrap:puppet:module ###########
21
- desc "Bootstrap a new Puppet module"
22
- task :module, [:name] do |t, args|
23
- info "#{t.comment}"
24
- name = (args.name.nil? or args.name.empty? or args.name == 'name') ? ask("Enter the module name (ex: 'ULHPC/modulename')") : args.name
25
- error "You need to provide a module name" unless name != ''
26
- error "The module name cannot contain spaces" if name =~ /\s+/
27
- moduledir = File.join( FalkorLib.config[:puppet][:modulesdir], name.gsub(/^\w*\//,'puppet-'))
28
- dir = ask("Destination directory:", moduledir)
29
- error "The module '#{name}' already exists" if File.directory?(dir)
30
- FalkorLib::Puppet::Modules.init(dir, name)
31
- end
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
- include FalkorLib::Common
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
- end # namespace module
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
- namespace :upgrade do
125
- ########### templates:upgrade:all ###########
126
- task :all do
127
- info "Upgrade all key module files from FalkorLib templates"
128
- FalkorLib::Puppet::Modules.upgrade()
129
- end
130
-
131
- [ 'docs', 'readme', 'rake', 'vagrant' ].each do |t|
132
- ########### templates:upgrade:{readme,rake,vagrant} ###########
133
- desc "Upgrade (overwrite) #{t.capitalize} using the current FalkorLib template"
134
- task t.to_sym do
135
- list = case t
136
- when 'readme'
137
- [ 'README.md' ]
138
- when 'docs'
139
- [ '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' ]
140
- when 'rake'
141
- [ 'Gemfile', 'Rakefile' ]
142
- when 'vagrant'
143
- [ 'Vagrantfile', '.vagrant_init.rb']
144
- else []
145
- end
146
- #info "Upgrade the module files '#{list.join(',')}' from FalkorLib templates"
147
- FalkorLib::Puppet::Modules.upgrade(Dir.pwd,{
148
- :only => list
149
- })
150
- end
151
- end
152
-
153
- ########### templates:upgrade:tests ###########
154
- task :tests do
155
- info "Upgrade the basic tests manifests in tests/"
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 'pkg'
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
- info "checking style guidelines with puppet-lint"
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
- # info "checking syntax for Puppet manifests, templates, and Hiera YAML"
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
- # t.rspec_opts = File.read("spec/spec.opts").chomp || ""
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
- # SPEC_SUITES.each do |suite|
211
- # ############ rspec:{classes,defines...} ##########
212
- # desc "Run #{suite} RSpec code examples"
213
- # RSpec::Core::RakeTask.new(suite) do |t|
214
- # t.pattern = "spec/#{suite}/**/*_spec.rb"
215
- # t.rspec_opts = File.read("spec/spec.opts").chomp || ""
216
- # end
217
- # end
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
- [ 'major', 'minor', 'patch' ].each do |level|
227
- task "version:bump:#{level}" => 'puppet:module:validate'
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