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.
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Wed 2016-06-29 14:47 svarrette>
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
- module CLI
12
+ module CLI
13
13
 
14
- # Thor class for all bootstrapping / initialization
15
- class New < ::Thor
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
- #map %w[--help -h] => :help
23
+ #map %w[--help -h] => :help
19
24
 
20
- ###### commands ######
21
- # desc "commands", "Lists available commands" #, :hide => true
22
- # def commands
23
- # puts App.all_commands.to_yaml #.keys - ["commands", "completions"]
24
- # end
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
- ###### repo ######
27
- desc "repo NAME [options]", "Bootstrap a Git Repository"
28
- long_desc <<-REPO_LONG_DESC
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
- method_option :git_flow, :default => true, :type => :boolean, :desc => 'Bootstrap the repository with Git-glow'
38
- method_option :make, :default => true, :type => :boolean, :desc => 'Use a Makefile to pilot the repository actions'
39
- method_option :rake, :type => :boolean, :desc => 'Use a Rakefile (and FalkorLib) to pilot the repository actions'
40
- method_option :interactive, :aliases => '-i', :default => true,
41
- :type => :boolean, :desc => "Interactive mode, in particular to confirm Gitflow branch names"
42
- method_option :remote_sync, :aliases => '-r',
43
- :type => :boolean, :desc => "Operate a git remote synchronization with remote. By default, all commits stay local"
44
- method_option :master, :default => 'production', :banner => 'BRANCH', :desc => "Master Branch name for production releases"
45
- method_option :develop, :aliases => [ '-b', '--branch', '--devel'],
46
- :default => 'devel', :banner => 'BRANCH', :desc => "Branch name for development commits"
47
- method_option :latex, :aliases => '-l', :type => :boolean, :desc => "Initiate a LaTeX project"
48
- #method_option :gem, :type => :boolean, :desc => "Initiate a Ruby gem project"
49
- method_option :rvm, :type => :boolean, :desc => "Initiate a RVM-based Ruby project"
50
- method_option :ruby, :default => '1.9.3', :desc => "Ruby version to configure for RVM"
51
- #method_option :pyenv, :type => :boolean, :desc => "Initiate a pyenv-based Python project"
52
- #method_option :octopress, :aliases => ['-o', '--www'], :type => :boolean, :desc => "Initiate an Octopress web site"
53
- #___________________
54
- def repo(name = '.')
55
- options[:rvm] = true if options[:rake] or options[:gem]
56
- # _newrepo(name, options)
57
- FalkorLib::Bootstrap.repo(name, options)
58
- end # repo
59
-
60
- ###### articles ######
61
- #......................................
62
- # desc "article [options]", "Bootstrap LaTeX Article"
63
- # method_option :name, :aliases => '-n', :desc => 'Name of the LaTeX project'
64
- # method_option :dir, :aliases => '-d', :desc => 'Project directory (relative to the git root directory)'
65
- # method_option :type, :default => 'ieee', :aliases => '-t', :desc => 'LaTeX Style to apply'
66
- # #___________________
67
- # def article(path = Dir.pwd)
68
- # FalkorLib::Bootstrap.latex(path, :article, options)
69
- # end # article
70
-
71
-
72
- ###### letter ######
73
- method_option :name, :aliases => '-n', :desc => 'Name of the LaTeX project'
74
- method_option :dir, :aliases => '-d', :desc => 'Project directory (relative to the git root directory)'
75
- #......................................
76
- desc "letter [options]", "LaTeX-based letter"
77
- #___________________
78
- def letter(path = Dir.pwd)
79
- FalkorLib::Bootstrap.latex(path, :letter, options)
80
- end # letter
81
-
82
-
83
-
84
- ###### slides ######
85
- #......................................
86
- desc "slides [options]", "Bootstrap LaTeX Beamer slides"
87
- method_option :name, :aliases => '-n', :desc => 'Name of the LaTeX project'
88
- #method_option :dir, :aliases => '-d', :desc => 'Project directory (relative to the git root directory)'
89
- #___________________
90
- def slides(path = Dir.pwd)
91
- FalkorLib::Bootstrap.latex(path, :beamer, options)
92
- end # slides
93
-
94
- ###### trash ######
95
- desc "trash PATH", "Add a Trash directory"
96
- #________________________
97
- def trash(path = Dir.pwd)
98
- FalkorLib::Bootstrap.trash(path)
99
- end # trash
100
-
101
- ###### rvm ######
102
- desc "rvm PATH [options]", "Initialize RVM"
103
- long_desc <<-RVM_LONG_DESC
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
- method_option :force, :aliases => '-f',
112
- :type => :boolean, :desc => 'Force overwritting the RVM config'
113
- method_option :ruby, :banner => 'VERSION',
114
- :desc => 'Ruby version to configure / install for RVM'
115
- method_option :versionfile, :banner => 'FILE',
116
- :default => FalkorLib.config[:rvm][:versionfile], :desc => 'RVM ruby version file'
117
- method_option :gemset, :desc => 'RVM gemset to configure for this directory'
118
- method_option :gemsetfile, :banner => 'FILE',
119
- :default => FalkorLib.config[:rvm][:gemsetfile], :desc => 'RVM gemset file'
120
- #____________________
121
- def rvm(path = '.')
122
- FalkorLib::Bootstrap.rvm(path, options)
123
- end # rvm
124
-
125
- ###### versionfile ######
126
- desc "versionfile PATH [options]", "initiate a VERSION file"
127
- method_option :file, :aliases => '-f',
128
- :desc => "Set the VERSION filename"
129
- method_option :tag, :aliases => '-t',
130
- :desc => "Git tag to use"
131
- method_option :version, :aliases => '-v',
132
- :desc => "Set the version to initialize in the version file"
133
- #_______________
134
- def versionfile(path = '.')
135
- FalkorLib::Bootstrap.versionfile(path, options)
136
- end # versionfile
137
-
138
- ###### motd ######
139
- method_option :file, :aliases => '-f', :default => '/etc/motd', :desc => "File storing the message of the day"
140
- method_option :width, :aliases => '-w', :default => 80, :type => :numeric, :desc => "Width for the text"
141
- method_option :title, :aliases => '-t', :default => "Title", :desc => "Title to place in the motd"
142
- method_option :subtitle, :desc => "Eventual subtitle to place below the title"
143
- method_option :hostname, :aliases => '-h', :default => `hostname -f`, :desc => "Hostname"
144
- method_option :support, :aliases => '-s', :default => "#{ENV['GIT_AUTHOR_EMAIL']}", :desc => "Support/Contact mail"
145
- method_option :desc, :aliases => '-d', :desc => "Short Description of the host"
146
- method_option :nodemodel,:aliases => '-n', :desc => "Node Model"
147
- #......................................
148
- desc "motd PATH [options]", "Initiate a 'motd' file - message of the day"
149
- def motd(path = '.')
150
- FalkorLib::Bootstrap.motd(path, options)
151
- end # motd
152
-
153
- ###### readme ######
154
- method_option :make, :default => true,
155
- :type => :boolean, :desc => 'Use a Makefile to pilot the repository actions'
156
- method_option :rake,
157
- :type => :boolean, :desc => 'Use a Rakefile (and FalkorLib) to pilot the repository actions'
158
- method_option :latex, :aliases => '-l', :type => :boolean, :desc => "Describe a LaTeX project"
159
- method_option :gem, :type => :boolean, :desc => "Describe a Ruby gem project"
160
- method_option :rvm, :type => :boolean, :desc => "Describe a RVM-based Ruby project"
161
- method_option :pyenv, :type => :boolean, :desc => "Describe a pyenv-based Python project"
162
- method_option :octopress, :aliases => '--www', :type => :boolean, :desc => "Describe an Octopress web site"
163
- #......................................
164
- desc "readme PATH [options]", "Initiate a README file in the PATH directory ('./' by default)"
165
- def readme(path = '.')
166
- FalkorLib::Bootstrap.readme(path, options)
167
- end # readme
168
-
169
- end # class New
170
- end # module CLI
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: <Wed 2016-06-29 14:41 svarrette>
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
- # desc "commands", "Lists all available commands", :hide => true
43
- # def commands
44
- # puts App.all_commands.keys - ["commands", "completions"]
45
- # end
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 (~/.falkor/config), in that order of priority.
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 (in ~/.falkor/config)'
55
- method_option :local, :aliases => '-l', :type => :boolean, :desc => 'Operate on the local configuration of the repository (in <git_rootdir>/.falkor/config)'
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
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Tue 2015-06-16 09:33 svarrette>
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 )
@@ -19,7 +19,7 @@ module FalkorLib #:nodoc:
19
19
  # MAJOR: Defines the major version
20
20
  # MINOR: Defines the minor version
21
21
  # PATCH: Defines the patch version
22
- MAJOR, MINOR, PATCH = 0, 6, 17
22
+ MAJOR, MINOR, PATCH = 0, 6, 18
23
23
 
24
24
  module_function
25
25
 
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -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.