falkorlib 0.6.17 → 0.6.18
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/Gemfile +11 -0
- data/Gemfile.lock +11 -18
- data/bin/falkor +7 -6
- data/completion/.gitignore +1 -0
- data/completion/_falkor +203 -0
- data/falkorlib.gemspec +159 -214
- data/lib/falkorlib/bootstrap/base.rb +19 -9
- data/lib/falkorlib/bootstrap/link.rb +8 -4
- data/lib/falkorlib/cli/link.rb +47 -41
- data/lib/falkorlib/cli/new.rb +146 -141
- data/lib/falkorlib/cli.rb +14 -11
- data/lib/falkorlib/common.rb +3 -3
- data/lib/falkorlib/version.rb +1 -1
- data/templates/gems/Gemfile +3 -0
- data/templates/gems/LICENCE.md +22 -0
- data/templates/gems/README.md +192 -0
- data/templates/gems/Rakefile +39 -0
- data/templates/gems/lib/sysadmin-warrior/loader.rb +5 -0
- data/templates/gems/lib/sysadmin-warrior/version.rb +49 -0
- data/templates/gems/lib/sysadmin-warrior.rb +40 -0
- data/templates/gems/sysadmin-warrior.gemspec +200 -0
- data/templates/latex/.gitignore +1 -0
- data/templates/latex/letter/_content.md.erb +6 -3
- data/templates/latex/letter/main.tex.erb +23 -15
- metadata +19 -28
- data/completion/falkor.zsh +0 -25
data/lib/falkorlib/cli/new.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sat 2016-10-15 18:45 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require 'thor'
|
@@ -9,23 +9,28 @@ require 'falkorlib'
|
|
9
9
|
require "falkorlib/bootstrap"
|
10
10
|
|
11
11
|
module FalkorLib
|
12
|
-
|
12
|
+
module CLI
|
13
13
|
|
14
|
-
|
15
|
-
|
14
|
+
# Thor class for all bootstrapping / initialization
|
15
|
+
class New < ::Thor
|
16
16
|
|
17
|
+
###### commands ######
|
18
|
+
desc "commands", "Lists all available commands", :hide => true
|
19
|
+
def commands
|
20
|
+
puts New.all_commands.keys.sort - [ 'commands' ]
|
21
|
+
end
|
17
22
|
|
18
|
-
|
23
|
+
#map %w[--help -h] => :help
|
19
24
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
###### commands ######
|
26
|
+
# desc "commands", "Lists available commands" #, :hide => true
|
27
|
+
# def commands
|
28
|
+
# puts App.all_commands.to_yaml #.keys - ["commands", "completions"]
|
29
|
+
# end
|
25
30
|
|
26
|
-
|
27
|
-
|
28
|
-
|
31
|
+
###### repo ######
|
32
|
+
desc "repo NAME [options]", "Bootstrap a Git Repository"
|
33
|
+
long_desc <<-REPO_LONG_DESC
|
29
34
|
Initiate a Git repository according to my classical layout.
|
30
35
|
\x5 * the repository will be configured according to the guidelines of [Git Flow]
|
31
36
|
\x5 * the high-level operations will be piloted either by a Makefile (default) or a Rakefile
|
@@ -33,74 +38,74 @@ Initiate a Git repository according to my classical layout.
|
|
33
38
|
By default, NAME is '.' meaning that the repository will be initialized in the current directory.
|
34
39
|
\x5Otherwise, the NAME subdirectory will be created and bootstraped accordingly.
|
35
40
|
REPO_LONG_DESC
|
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
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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
|
-
|
41
|
+
#......................................................
|
42
|
+
method_option :git_flow, :default => true, :type => :boolean, :desc => 'Bootstrap the repository with Git-glow'
|
43
|
+
method_option :make, :default => true, :type => :boolean, :desc => 'Use a Makefile to pilot the repository actions'
|
44
|
+
method_option :rake, :type => :boolean, :desc => 'Use a Rakefile (and FalkorLib) to pilot the repository actions'
|
45
|
+
method_option :interactive, :aliases => '-i', :default => true,
|
46
|
+
:type => :boolean, :desc => "Interactive mode, in particular to confirm Gitflow branch names"
|
47
|
+
method_option :remote_sync, :aliases => '-r',
|
48
|
+
:type => :boolean, :desc => "Operate a git remote synchronization with remote. By default, all commits stay local"
|
49
|
+
method_option :master, :default => 'production', :banner => 'BRANCH', :desc => "Master Branch name for production releases"
|
50
|
+
method_option :develop, :aliases => [ '-b', '--branch', '--devel'],
|
51
|
+
:default => 'devel', :banner => 'BRANCH', :desc => "Branch name for development commits"
|
52
|
+
method_option :latex, :aliases => '-l', :type => :boolean, :desc => "Initiate a LaTeX project"
|
53
|
+
#method_option :gem, :type => :boolean, :desc => "Initiate a Ruby gem project"
|
54
|
+
method_option :rvm, :type => :boolean, :desc => "Initiate a RVM-based Ruby project"
|
55
|
+
method_option :ruby, :default => '1.9.3', :desc => "Ruby version to configure for RVM"
|
56
|
+
#method_option :pyenv, :type => :boolean, :desc => "Initiate a pyenv-based Python project"
|
57
|
+
#method_option :octopress, :aliases => ['-o', '--www'], :type => :boolean, :desc => "Initiate an Octopress web site"
|
58
|
+
#___________________
|
59
|
+
def repo(name = '.')
|
60
|
+
options[:rvm] = true if options[:rake] or options[:gem]
|
61
|
+
# _newrepo(name, options)
|
62
|
+
FalkorLib::Bootstrap.repo(name, options)
|
63
|
+
end # repo
|
64
|
+
|
65
|
+
###### articles ######
|
66
|
+
#......................................
|
67
|
+
# desc "article [options]", "Bootstrap LaTeX Article"
|
68
|
+
# method_option :name, :aliases => '-n', :desc => 'Name of the LaTeX project'
|
69
|
+
# method_option :dir, :aliases => '-d', :desc => 'Project directory (relative to the git root directory)'
|
70
|
+
# method_option :type, :default => 'ieee', :aliases => '-t', :desc => 'LaTeX Style to apply'
|
71
|
+
# #___________________
|
72
|
+
# def article(path = Dir.pwd)
|
73
|
+
# FalkorLib::Bootstrap.latex(path, :article, options)
|
74
|
+
# end # article
|
75
|
+
|
76
|
+
|
77
|
+
###### letter ######
|
78
|
+
method_option :name, :aliases => '-n', :desc => 'Name of the LaTeX project'
|
79
|
+
method_option :dir, :aliases => '-d', :desc => 'Project directory (relative to the git root directory)'
|
80
|
+
#......................................
|
81
|
+
desc "letter [options]", "LaTeX-based letter"
|
82
|
+
#___________________
|
83
|
+
def letter(path = Dir.pwd)
|
84
|
+
FalkorLib::Bootstrap.latex(path, :letter, options)
|
85
|
+
end # letter
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
###### slides ######
|
90
|
+
#......................................
|
91
|
+
desc "slides [options]", "Bootstrap LaTeX Beamer slides"
|
92
|
+
method_option :name, :aliases => '-n', :desc => 'Name of the LaTeX project'
|
93
|
+
#method_option :dir, :aliases => '-d', :desc => 'Project directory (relative to the git root directory)'
|
94
|
+
#___________________
|
95
|
+
def slides(path = Dir.pwd)
|
96
|
+
FalkorLib::Bootstrap.latex(path, :beamer, options)
|
97
|
+
end # slides
|
98
|
+
|
99
|
+
###### trash ######
|
100
|
+
desc "trash PATH", "Add a Trash directory"
|
101
|
+
#________________________
|
102
|
+
def trash(path = Dir.pwd)
|
103
|
+
FalkorLib::Bootstrap.trash(path)
|
104
|
+
end # trash
|
105
|
+
|
106
|
+
###### rvm ######
|
107
|
+
desc "rvm PATH [options]", "Initialize RVM"
|
108
|
+
long_desc <<-RVM_LONG_DESC
|
104
109
|
Initialize Ruby Version Manager (RVM) for the current directory (or at the root directory of the Git repository).
|
105
110
|
It consists of two files:
|
106
111
|
\x5 * `.ruby-version`: Project file hosting a single line for the ruby version
|
@@ -108,64 +113,64 @@ It consists of two files:
|
|
108
113
|
|
109
114
|
These files will be committed in Git to ensure a consistent environment for the project.
|
110
115
|
RVM_LONG_DESC
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
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
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
116
|
+
method_option :force, :aliases => '-f',
|
117
|
+
:type => :boolean, :desc => 'Force overwritting the RVM config'
|
118
|
+
method_option :ruby, :banner => 'VERSION',
|
119
|
+
:desc => 'Ruby version to configure / install for RVM'
|
120
|
+
method_option :versionfile, :banner => 'FILE',
|
121
|
+
:default => FalkorLib.config[:rvm][:versionfile], :desc => 'RVM ruby version file'
|
122
|
+
method_option :gemset, :desc => 'RVM gemset to configure for this directory'
|
123
|
+
method_option :gemsetfile, :banner => 'FILE',
|
124
|
+
:default => FalkorLib.config[:rvm][:gemsetfile], :desc => 'RVM gemset file'
|
125
|
+
#____________________
|
126
|
+
def rvm(path = '.')
|
127
|
+
FalkorLib::Bootstrap.rvm(path, options)
|
128
|
+
end # rvm
|
129
|
+
|
130
|
+
###### versionfile ######
|
131
|
+
desc "versionfile PATH [options]", "initiate a VERSION file"
|
132
|
+
method_option :file, :aliases => '-f',
|
133
|
+
:desc => "Set the VERSION filename"
|
134
|
+
method_option :tag, :aliases => '-t',
|
135
|
+
:desc => "Git tag to use"
|
136
|
+
method_option :version, :aliases => '-v',
|
137
|
+
:desc => "Set the version to initialize in the version file"
|
138
|
+
#_______________
|
139
|
+
def versionfile(path = '.')
|
140
|
+
FalkorLib::Bootstrap.versionfile(path, options)
|
141
|
+
end # versionfile
|
142
|
+
|
143
|
+
###### motd ######
|
144
|
+
method_option :file, :aliases => '-f', :default => '/etc/motd', :desc => "File storing the message of the day"
|
145
|
+
method_option :width, :aliases => '-w', :default => 80, :type => :numeric, :desc => "Width for the text"
|
146
|
+
method_option :title, :aliases => '-t', :default => "Title", :desc => "Title to place in the motd"
|
147
|
+
method_option :subtitle, :desc => "Eventual subtitle to place below the title"
|
148
|
+
method_option :hostname, :aliases => '-h', :default => `hostname -f`, :desc => "Hostname"
|
149
|
+
method_option :support, :aliases => '-s', :default => "#{ENV['GIT_AUTHOR_EMAIL']}", :desc => "Support/Contact mail"
|
150
|
+
method_option :desc, :aliases => '-d', :desc => "Short Description of the host"
|
151
|
+
method_option :nodemodel,:aliases => '-n', :desc => "Node Model"
|
152
|
+
#......................................
|
153
|
+
desc "motd PATH [options]", "Initiate a 'motd' file - message of the day"
|
154
|
+
def motd(path = '.')
|
155
|
+
FalkorLib::Bootstrap.motd(path, options)
|
156
|
+
end # motd
|
157
|
+
|
158
|
+
###### readme ######
|
159
|
+
method_option :make, :default => true,
|
160
|
+
:type => :boolean, :desc => 'Use a Makefile to pilot the repository actions'
|
161
|
+
method_option :rake,
|
162
|
+
:type => :boolean, :desc => 'Use a Rakefile (and FalkorLib) to pilot the repository actions'
|
163
|
+
method_option :latex, :aliases => '-l', :type => :boolean, :desc => "Describe a LaTeX project"
|
164
|
+
method_option :gem, :type => :boolean, :desc => "Describe a Ruby gem project"
|
165
|
+
method_option :rvm, :type => :boolean, :desc => "Describe a RVM-based Ruby project"
|
166
|
+
method_option :pyenv, :type => :boolean, :desc => "Describe a pyenv-based Python project"
|
167
|
+
method_option :octopress, :aliases => '--www', :type => :boolean, :desc => "Describe an Octopress web site"
|
168
|
+
#......................................
|
169
|
+
desc "readme PATH [options]", "Initiate a README file in the PATH directory ('./' by default)"
|
170
|
+
def readme(path = '.')
|
171
|
+
FalkorLib::Bootstrap.readme(path, options)
|
172
|
+
end # readme
|
173
|
+
|
174
|
+
end # class New
|
175
|
+
end # module CLI
|
171
176
|
end # module FalkorLib
|
data/lib/falkorlib/cli.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sat 2016-10-15 18:27 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Interface for the CLI
|
6
6
|
#
|
@@ -8,6 +8,8 @@
|
|
8
8
|
require 'thor'
|
9
9
|
require 'thor/actions'
|
10
10
|
require 'thor/group'
|
11
|
+
require 'thor/zsh_completion'
|
12
|
+
|
11
13
|
require "falkorlib"
|
12
14
|
|
13
15
|
require "falkorlib/cli/new"
|
@@ -29,6 +31,7 @@ module FalkorLib
|
|
29
31
|
|
30
32
|
include Thor::Actions
|
31
33
|
include FalkorLib::Common
|
34
|
+
include ZshCompletion::Command
|
32
35
|
|
33
36
|
#default_command :info
|
34
37
|
|
@@ -36,23 +39,23 @@ module FalkorLib
|
|
36
39
|
:type => :boolean, :desc => "Enable verbose output mode"
|
37
40
|
class_option :debug,
|
38
41
|
:type => :boolean, :default => FalkorLib.config[:debug], :desc => "Enable debug output mode"
|
39
|
-
class_option :dry_run, :aliases => '-n', :type => :boolean
|
42
|
+
class_option :dry_run, :aliases => '-n', :desc => "Perform a trial run with (normally) no changes made", :type => :boolean
|
40
43
|
|
41
44
|
###### commands ######
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
45
|
+
desc "commands", "Lists all available commands"
|
46
|
+
def commands
|
47
|
+
puts App.all_commands.keys.sort - [ "zsh-completions"]
|
48
|
+
end
|
46
49
|
|
47
50
|
###### config ######
|
48
51
|
desc "config [option] [KEY]", "Print the current configuration of FalkorLib" #, :hide => true
|
49
52
|
long_desc <<-CONFIG_LONG_DESC
|
50
53
|
This command allows you to interact with FalkorLib's configuration system.
|
51
54
|
FalkorLib retrieves its configuration from the local repository (in '<git_rootdir>/.falkor/config'),
|
52
|
-
environment variables (NOT YET IMPLEMENTED), and the user's home directory (
|
55
|
+
environment variables (NOT YET IMPLEMENTED), and the user's home directory (<home>/.falkor/config), in that order of priority.
|
53
56
|
CONFIG_LONG_DESC
|
54
|
-
method_option :global, :aliases => '-g', :type => :boolean, :desc => 'Operate on the global configuration
|
55
|
-
method_option :local, :aliases => '-l', :type => :boolean, :desc => 'Operate on the local configuration of the repository
|
57
|
+
method_option :global, :aliases => '-g', :type => :boolean, :desc => 'Operate on the global configuration'
|
58
|
+
method_option :local, :aliases => '-l', :type => :boolean, :desc => 'Operate on the local configuration of the repository'
|
56
59
|
def config(key = '')
|
57
60
|
info "Thor options:"
|
58
61
|
puts options.to_yaml
|
@@ -79,10 +82,10 @@ CONFIG_LONG_DESC
|
|
79
82
|
say "Falkor[Lib] version " + FalkorLib::VERSION, :yellow # + "on ruby " + `ruby --version`
|
80
83
|
end
|
81
84
|
|
85
|
+
end # class App
|
82
86
|
|
87
|
+
#puts Thor::ZshCompletion::Generator.new(App, "falkor").generate
|
83
88
|
|
84
|
-
|
85
|
-
end # class App
|
86
89
|
end # module CLI
|
87
90
|
|
88
91
|
end
|
data/lib/falkorlib/common.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Sat 2016-10-15 22:49 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require "falkorlib"
|
@@ -307,7 +307,7 @@ module FalkorLib #:nodoc:
|
|
307
307
|
warning "about to initialize/update the directory #{rootdir}"
|
308
308
|
really_continue?
|
309
309
|
run %{ mkdir -p #{rootdir} } unless File.directory?( rootdir )
|
310
|
-
run %{ rsync --exclude '*.erb' -avzu #{templatedir}/ #{rootdir}/ }
|
310
|
+
run %{ rsync --exclude '*.erb' --exclude '.texinfo*' -avzu #{templatedir}/ #{rootdir}/ }
|
311
311
|
Dir["#{templatedir}/**/*.erb"].each do |erbfile|
|
312
312
|
relative_outdir = Pathname.new( File.realpath( File.dirname(erbfile) )).relative_path_from Pathname.new(templatedir)
|
313
313
|
filename = File.basename(erbfile, '.erb')
|
@@ -349,7 +349,7 @@ module FalkorLib #:nodoc:
|
|
349
349
|
warning "Unable to find the template ERBfile '#{erb}'"
|
350
350
|
really_continue? unless options[:no_interaction]
|
351
351
|
next
|
352
|
-
end
|
352
|
+
end
|
353
353
|
content += ERB.new(File.read("#{erb}"), nil, '<>').result(binding)
|
354
354
|
end
|
355
355
|
# error "Unable to find the template file #{erbfile}" unless File.exists? (erbfile )
|
data/lib/falkorlib/version.rb
CHANGED
@@ -0,0 +1,22 @@
|
|
1
|
+
# The MIT Licence
|
2
|
+
|
3
|
+
Copyright (c) 2012 - Sebastien Varrette
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|