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: <Tue 2016-06-28 18:50 svarrette>
3
+ # Time-stamp: <Fri 2016-11-11 16:15 svarrette>
4
4
  ################################################################################
5
5
  # Management of Git Flow operations
6
6
 
@@ -11,183 +11,181 @@ require "falkorlib/git/base"
11
11
  include FalkorLib::Common
12
12
 
13
13
  module FalkorLib
14
- module Config
15
-
16
- # Default configuration for Gitflow
17
- module GitFlow
18
- # git flow defaults
19
- DEFAULTS = {
20
- :branches => {
21
- :master => 'production',
22
- :develop => 'master',
23
- },
24
- :prefix => {
25
- :feature => 'feature/',
26
- :release => 'release/',
27
- :hotfix => 'hotfix/',
28
- :support => 'support/',
29
- :versiontag => "v",
30
- }
31
- }
32
- end
33
- end
34
-
35
14
 
36
- # Management of [git flow](https://github.com/nvie/gitflow) operations I'm
37
- # using everywhere
15
+ module Config
16
+ # Default configuration for Gitflow
38
17
  module GitFlow
39
18
 
40
- module_function
41
-
42
- ## OLD version
43
- ## Check if git-flow is initialized
44
- # def init?(path = Dir.pwd)
45
- # res = FalkorLib::Git.init?(path)
46
- # Dir.chdir(path) do
47
- # gf_check = `git config --get-regexp 'gitflow*'`
48
- # res &= ! gf_check.empty?
49
- # end
50
- # res
51
- # end # init?(path = Dir.pwd)
52
-
53
- ###### init? ######
54
- # Check if gitflow has been initialized
55
- ##
56
- def init?(dir = Dir.pwd)
57
- res = FalkorLib::Git.init?(dir)
58
- if res
59
- res &= !FalkorLib::Git.config('gitflow*', dir).empty?
19
+ # git flow defaults
20
+ DEFAULTS = {
21
+ :branches => {
22
+ :master => 'production',
23
+ :develop => 'master'
24
+ },
25
+ :prefix => {
26
+ :feature => 'feature/',
27
+ :release => 'release/',
28
+ :hotfix => 'hotfix/',
29
+ :support => 'support/',
30
+ :versiontag => "v"
31
+ }
32
+ }
33
+
34
+ end
35
+ end
36
+
37
+
38
+ # Management of [git flow](https://github.com/nvie/gitflow) operations I'm
39
+ # using everywhere
40
+ module GitFlow
41
+
42
+ module_function
43
+
44
+ ## OLD version
45
+ ## Check if git-flow is initialized
46
+ # def init?(path = Dir.pwd)
47
+ # res = FalkorLib::Git.init?(path)
48
+ # Dir.chdir(path) do
49
+ # gf_check = `git config --get-regexp 'gitflow*'`
50
+ # res &= ! gf_check.empty?
51
+ # end
52
+ # res
53
+ # end # init?(path = Dir.pwd)
54
+
55
+ ###### init? ######
56
+ # Check if gitflow has been initialized
57
+ ##
58
+ def init?(dir = Dir.pwd)
59
+ res = FalkorLib::Git.init?(dir)
60
+ res &= !FalkorLib::Git.config('gitflow*', dir).empty? if res
61
+ res
62
+ end # init?
63
+
64
+ ## Initialize a git-flow repository
65
+ # Supported options:
66
+ # :interactive [boolean] confirm Gitflow branch names
67
+ # :master [string] Branch name for production releases
68
+ # :develop [string] Branch name for development commits
69
+ def init(path = Dir.pwd, options = {})
70
+ exit_status = FalkorLib::Git.init(path, options)
71
+ unless command?('git-flow')
72
+ # Check (mainly for Linux) if the command is not available under `/usr/lib/git-core`
73
+ git_lib = '/usr/lib/git-core/'
74
+ error "you shall install git-flow: see https://github.com/nvie/gitflow/wiki/Installation" unless File.exist?(File.join(git_lib, 'git-flow'))
75
+ end
76
+ remotes = FalkorLib::Git.remotes(path)
77
+ git_root_dir = FalkorLib::Git.rootdir( path )
78
+ Dir.chdir( git_root_dir ) do
79
+ unless FalkorLib::Git.commits?( git_root_dir)
80
+ warn "Not yet any commit detected in this repository."
81
+ readme = 'README.md'
82
+ unless File.exist?( readme )
83
+ answer = ask(cyan("=> initialize a commit with an [empty] #{readme} file (Y|n)?"), 'Yes')
84
+ exit 0 if answer =~ /n.*/i
85
+ FileUtils.touch(readme)
60
86
  end
61
- res
62
- end # init?
63
-
64
- ## Initialize a git-flow repository
65
- # Supported options:
66
- # :interactive [boolean] confirm Gitflow branch names
67
- # :master [string] Branch name for production releases
68
- # :develop [string] Branch name for development commits
69
- def init(path = Dir.pwd, options = {})
70
- exit_status = FalkorLib::Git.init(path, options)
71
- unless command?('git-flow')
72
- # Check (mainly for Linux) if the command is not available under `/usr/lib/git-core`
73
- git_lib = '/usr/lib/git-core/'
74
- error "you shall install git-flow: see https://github.com/nvie/gitflow/wiki/Installation" unless File.exist?(File.join(git_lib, 'git-flow'))
87
+ FalkorLib::Git.add(readme, "Initiate the repository with a '#{readme}' file")
88
+ end
89
+ branches = FalkorLib::Git.list_branch(path)
90
+ gitflow_branches = FalkorLib.config.gitflow[:branches].clone
91
+ # correct eventually the considered branch from the options
92
+ gitflow_branches.each do |t, _b|
93
+ gitflow_branches[t] = options[t.to_sym] if options[t.to_sym]
94
+ confs = FalkorLib::Git.config('gitflow*', path, :hash => true)
95
+ gitflow_branches[t] = confs["gitflow.branch.#{t}"] unless confs.empty?
96
+ end
97
+ if options[:interactive]
98
+ gitflow_branches[:master] = ask("=> branch name for production releases", gitflow_branches[:master])
99
+ gitflow_branches[:develop] = ask("=> branch name for development commits", gitflow_branches[:develop])
100
+ end
101
+ ap gitflow_branches if options[:debug]
102
+ if remotes.include?( 'origin' )
103
+ info "=> configure remote (tracked) branches"
104
+ exit_status = FalkorLib::Git.fetch(path)
105
+ gitflow_branches.each do |_type, branch|
106
+ if branches.include? "remotes/origin/#{branch}"
107
+ exit_status = FalkorLib::Git.grab(branch, path)
108
+ else
109
+ unless branches.include? branch
110
+ info "=> creating the branch '#{branch}'"
111
+ FalkorLib::Git.create_branch( branch, path )
112
+ end
113
+ exit_status = FalkorLib::Git.publish(branch, path )
75
114
  end
76
- remotes = FalkorLib::Git.remotes(path)
77
- git_root_dir = FalkorLib::Git.rootdir( path )
78
- Dir.chdir( git_root_dir ) do
79
- unless FalkorLib::Git.has_commits?( git_root_dir)
80
- warn "Not yet any commit detected in this repository."
81
- readme = 'README.md'
82
- unless File.exists?( readme )
83
- answer = ask(cyan("=> initialize a commit with an [empty] #{readme} file (Y|n)?"), 'Yes')
84
- exit 0 if answer =~ /n.*/i
85
- FileUtils.touch(readme)
86
- end
87
- FalkorLib::Git.add(readme, "Initiate the repository with a '#{readme}' file")
88
- end
89
- branches = FalkorLib::Git.list_branch(path)
90
- gitflow_branches = FalkorLib.config.gitflow[:branches].clone
91
- # correct eventually the considered branch from the options
92
- gitflow_branches.each do |t,b|
93
- gitflow_branches[t] = options[t.to_sym] if options[t.to_sym]
94
- confs = FalkorLib::Git.config('gitflow*', path, :hash => true)
95
- unless confs.empty?
96
- gitflow_branches[t] = confs["gitflow.branch.#{t}"]
97
- end
98
- end
99
- if options[:interactive]
100
- gitflow_branches[:master] = ask("=> branch name for production releases", gitflow_branches[:master])
101
- gitflow_branches[:develop] = ask("=> branch name for development commits", gitflow_branches[:develop])
102
- end
103
- ap gitflow_branches if options[:debug]
104
- if remotes.include?( 'origin' )
105
- info "=> configure remote (tracked) branches"
106
- exit_status = FalkorLib::Git.fetch(path)
107
- gitflow_branches.each do |type,branch|
108
- if branches.include? "remotes/origin/#{branch}"
109
- exit_status = FalkorLib::Git.grab(branch, path)
110
- else
111
- unless branches.include? branch
112
- info "=> creating the branch '#{branch}'"
113
- FalkorLib::Git.create_branch( branch, path )
114
- end
115
- exit_status = FalkorLib::Git.publish(branch, path )
116
- end
117
- end
118
- else
119
- gitflow_branches.each do |type, branch|
120
- unless branches.include? branch
121
- info " => creating the branch '#{branch}'"
122
- exit_status = FalkorLib::Git.create_branch( branch, path )
123
- end
124
- end
125
- end
126
- #info "initialize git flow configs"
127
- gitflow_branches.each do |t,branch|
128
- exit_status = execute "git config gitflow.branch.#{t} #{branch}"
129
- end
130
- FalkorLib.config.gitflow[:prefix].each do |t,prefix|
131
- exit_status = execute "git config gitflow.prefix.#{t} #{prefix}"
132
- end
133
- devel_branch = gitflow_branches[:develop]
134
- #info "checkout to the main development branch '#{devel_branch}'"
135
- exit_status = run %{
136
- git checkout #{devel_branch}
137
- }
138
- # git config branch.$(git rev-parse --abbrev-ref HEAD).mergeoptions --no-edit for the develop branch
139
- exit_status = execute "git config branch.#{devel_branch}.mergeoptions --no-edit"
140
- if branches.include?('master') && ! gitflow_branches.values.include?( 'master' )
141
- warn "Your git-flow confuguration does not hold the 'master' branch any more"
142
- warn "You probably want to get rid of it asap by running 'git branch -d master'"
143
- end
144
- if devel_branch != 'master' &&
145
- remotes.include?( 'origin' ) &&
146
- branches.include?( 'remotes/origin/master')
147
- warn "You might want to change the remote default branch to point to '#{devel_branch}"
148
- puts "=> On github: Settings > Default Branch > #{devel_branch}"
149
- puts "=> On the remote bare Git repository: 'git symbolic-ref HEAD refs/head/#{devel_branch}'"
150
- end
115
+ end
116
+ else
117
+ gitflow_branches.each do |_type, branch|
118
+ unless branches.include? branch
119
+ info " => creating the branch '#{branch}'"
120
+ exit_status = FalkorLib::Git.create_branch( branch, path )
151
121
  end
152
- exit_status
122
+ end
123
+ end
124
+ #info "initialize git flow configs"
125
+ gitflow_branches.each do |t, branch|
126
+ exit_status = execute "git config gitflow.branch.#{t} #{branch}"
153
127
  end
128
+ FalkorLib.config.gitflow[:prefix].each do |t, prefix|
129
+ exit_status = execute "git config gitflow.prefix.#{t} #{prefix}"
130
+ end
131
+ devel_branch = gitflow_branches[:develop]
132
+ #info "checkout to the main development branch '#{devel_branch}'"
133
+ exit_status = run %(
134
+ git checkout #{devel_branch}
135
+ )
136
+ # git config branch.$(git rev-parse --abbrev-ref HEAD).mergeoptions --no-edit for the develop branch
137
+ exit_status = execute "git config branch.#{devel_branch}.mergeoptions --no-edit"
138
+ if branches.include?('master') && !gitflow_branches.values.include?( 'master' )
139
+ warn "Your git-flow confuguration does not hold the 'master' branch any more"
140
+ warn "You probably want to get rid of it asap by running 'git branch -d master'"
141
+ end
142
+ if devel_branch != 'master' &&
143
+ remotes.include?( 'origin' ) &&
144
+ branches.include?( 'remotes/origin/master')
145
+ warn "You might want to change the remote default branch to point to '#{devel_branch}"
146
+ puts "=> On github: Settings > Default Branch > #{devel_branch}"
147
+ puts "=> On the remote bare Git repository: 'git symbolic-ref HEAD refs/head/#{devel_branch}'"
148
+ end
149
+ end
150
+ exit_status
151
+ end
154
152
 
155
- ## generic function to run any of the gitflow commands
156
- def command(name, type = 'feature', action = 'start', path = Dir.pwd, optional_args = '')
157
- error "Invalid git-flow type '#{type}'" unless ['feature', 'release', 'hotfix', 'support'].include?(type)
158
- error "Invalid action '#{action}'" unless ['start', 'finish'].include?(action)
159
- error "You must provide a name" if name == ''
160
- error "The name '#{name}' cannot contain spaces" if name =~ /\s+/
161
- exit_status = 1
162
- Dir.chdir( FalkorLib::Git.rootdir(path) ) do
163
- exit_status = run %{
153
+ ## generic function to run any of the gitflow commands
154
+ def command(name, type = 'feature', action = 'start', path = Dir.pwd, optional_args = '')
155
+ error "Invalid git-flow type '#{type}'" unless %w(feature release hotfix support).include?(type)
156
+ error "Invalid action '#{action}'" unless %w(start finish).include?(action)
157
+ error "You must provide a name" if name == ''
158
+ error "The name '#{name}' cannot contain spaces" if name =~ /\s+/
159
+ exit_status = 1
160
+ Dir.chdir( FalkorLib::Git.rootdir(path) ) do
161
+ exit_status = run %(
164
162
  git flow #{type} #{action} #{optional_args} #{name}
165
- }
166
- end
167
- exit_status
168
- end
163
+ )
164
+ end
165
+ exit_status
166
+ end
169
167
 
170
- ## git flow {feature, hotfix, release, support} start <name>
171
- def start (type, name, path = Dir.pwd, optional_args = '')
172
- command(name, type, 'start', path, optional_args)
173
- end
168
+ ## git flow {feature, hotfix, release, support} start <name>
169
+ def start(type, name, path = Dir.pwd, optional_args = '')
170
+ command(name, type, 'start', path, optional_args)
171
+ end
174
172
 
175
- ## git flow {feature, hotfix, release, support} finish <name>
176
- def finish (type, name, path = Dir.pwd, optional_args = '')
177
- command(name, type, 'finish', path, optional_args)
178
- end
173
+ ## git flow {feature, hotfix, release, support} finish <name>
174
+ def finish(type, name, path = Dir.pwd, optional_args = '')
175
+ command(name, type, 'finish', path, optional_args)
176
+ end
179
177
 
180
- ###
181
- # Return the Gitflow branch
182
- # :master: Master Branch name for production releases
183
- # :develop:
184
- ##
185
- def branches(type = :master, dir = Dir.pwd, options = {})
186
- FalkorLib::Git.config("gitflow.branch.#{type}", dir)
187
- #confs[type.to_sym]
188
- end # master_branch
178
+ ###
179
+ # Return the Gitflow branch
180
+ # :master: Master Branch name for production releases
181
+ # :develop:
182
+ ##
183
+ def branches(type = :master, dir = Dir.pwd, _options = {})
184
+ FalkorLib::Git.config("gitflow.branch.#{type}", dir)
185
+ #confs[type.to_sym]
186
+ end # master_branch
189
187
 
190
188
 
191
- end # module FalkorLib::GitFlow
189
+ end # module FalkorLib::GitFlow
192
190
 
193
191
  end
@@ -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
@@ -2,7 +2,7 @@
2
2
  ################################################################################
3
3
  # Time-stamp: <Ven 2015-01-30 16:19 svarrette>
4
4
  ################################################################################
5
- # Place the component you wish to see loaded
5
+ # Place the component you wish to see loaded
6
6
 
7
7
 
8
8
  require "falkorlib/error"
@@ -4,12 +4,10 @@
4
4
  ################################################################################
5
5
  # Management of [Puppet](http://puppetlabs.com/) operations
6
6
 
7
- require "falkorlib"
7
+ require 'falkorlib'
8
8
 
9
9
  module FalkorLib #:nodoc:
10
-
11
10
  end # module FalkorLib
12
11
 
13
- require "falkorlib/puppet/base"
14
- require "falkorlib/puppet/modules"
15
-
12
+ require 'falkorlib/puppet/base'
13
+ require 'falkorlib/puppet/modules'