falkorlib 0.7.2 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c3236e419d1298b136ca095a3281e55bbd95c24
4
- data.tar.gz: 738b0c020f67cb4fe942c0d8f0b20152e08093d6
3
+ metadata.gz: 2174c9bbc6ebc626b201624fb6b26bb76e1eaadd
4
+ data.tar.gz: a129e47f1f9ec644481b772b10339477f79ee69a
5
5
  SHA512:
6
- metadata.gz: 2ee4c52e5143aa60d36db2485f648232c7fce15103143f8b24fd375257ad177457677df4a8aea5497f6d9fab325cd98afe0ad24812ca46ee510f6205b6f7127c
7
- data.tar.gz: 425cb5392539fef2b19386b2c59436495731719d879f1643e9cc1c940e12dc987597a2a75d2f70957613d2ea7051830bef2fb4ecfd36f6cbe803b418368c0f8c
6
+ metadata.gz: d42ce3ec359f2cda55cafdcd8b1b3c9e3b4cd9aa40207829bc67f72987c15e8406f4c9329a04668955d330d2ae3381c010dffac32996f3013cabfa27c3ab9ab8
7
+ data.tar.gz: 2dd4f397718652a00fc5ae35505102d7fa6f8d3ac0139d31edef029f6403d2facd7cf9475282232cfd9f10105b0ad2b5dc6b3b6cfc3f596618b9ffea1d6b5b2e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- falkorlib (0.7.2)
4
+ falkorlib (0.7.3)
5
5
  activesupport (~> 4.0)
6
6
  artii (>= 2.1)
7
7
  awesome_print (~> 1.2)
data/completion/_falkor CHANGED
@@ -1,7 +1,7 @@
1
1
  #compdef falkor
2
2
  ########################################################################################
3
3
  # -*- mode:sh; -*-
4
- # Time-stamp: <Sun 2017-01-15 23:15 svarrette>
4
+ # Time-stamp: <Mon 2017-01-16 12:24 svarrette>
5
5
  #
6
6
  # ZSH completion for [FalkorLib](https://github.com/Falkor/falkorlib)
7
7
  #
@@ -101,6 +101,7 @@ __falkor_new()
101
101
  'trash:Add a Trash directory for your LaTeX project'
102
102
  'rvm:Initialize RVM'
103
103
  'versionfile:initiate a VERSION file'
104
+ 'license:Generate an Open-Source License for your project'
104
105
  'motd:Initiate a ''motd'' file - message of the day'
105
106
  'readme:Initiate a README file in the PATH directory (''./'' by default)'
106
107
  'help:Describe subcommands or one specific subcommand'
@@ -128,11 +129,19 @@ __falkor_new()
128
129
  '(-n --name)'{-n,--name}'[Name of the LaTeX project]' \
129
130
  '(-d --dir)'{-d,--dir}':Project directory (relative to the git root directory):_directories' && ret=0
130
131
  ;;
132
+ (license)
133
+ _arguments -C \
134
+ '(-l --license)'{-l,--licence}'[Open Source License to use within your project]:lic:(none Apache-2.0 BSD CC-by-nc-sa GPL-2.0 GPL-3.0 LGPL-2.1 LGPL-3.0 MIT)' \
135
+ '(-f --licensefile)'{-f,--licensefile}'[License Filename]:filename:(LICENSE)' && ret=0
136
+ ;;
131
137
  (repo)
132
138
  _arguments -C \
133
139
  '(--no-git-flow)--git-flow[Bootstrap the repository with Git-flow]' \
134
140
  '--make[Use a Makefile to pilot the repository actions]' \
135
141
  '--rake[Use a Rakefile (and FalkorLib) to pilot the repository actions]' \
142
+ '--mkdocs[Initiate MkDocs within your project]' \
143
+ '--license[Open Source License to use within your project]:lic:(none Apache-2.0 BSD CC-by-nc-sa GPL-2.0 GPL-3.0 LGPL-2.1 LGPL-3.0 MIT)' \
144
+ '--licensefile[License Filename]:filename:(LICENSE)' \
136
145
  '(-i --interactive)'{-i,--interactive}'[Interactive mode, in particular to confirm Gitflow branch names]' \
137
146
  '(-r --remote-sync)'{-r,--remote-sync}'[Operate a git remote synchronization with remote. By default, all commits stay local]' \
138
147
  '--master[Master Branch name for production releases]' \
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Sun 2017-01-15 22:52 svarrette>
3
+ # Time-stamp: <Mon 2017-01-16 12:07 svarrette>
4
4
  ################################################################################
5
5
  # Interface for the main Bootstrapping operations
6
6
  #
@@ -82,7 +82,7 @@ module FalkorLib #:nodoc:
82
82
  :url => "http://www.linfo.org/bsdlicense.html",
83
83
  :logo => "http://upload.wikimedia.org/wikipedia/commons/thumb/b/bf/License_icon-bsd.svg/200px-License_icon-bsd.svg.png"
84
84
  },
85
- "CC by-nc-sa" => {
85
+ "CC-by-nc-sa" => {
86
86
  :name => "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International",
87
87
  :url => "http://creativecommons.org/licenses/by-nc-sa/4.0",
88
88
  :logo => "https://licensebuttons.net/l/by-nc-sa/4.0/88x31.png"
@@ -235,6 +235,8 @@ module FalkorLib
235
235
  # Supported options:
236
236
  # * :no_interaction [boolean]: do not interact
237
237
  # * :force [boolean] force overwritting
238
+ # * :license [string] License to use
239
+ # * :licensefile [string] License filename (default: LICENSE)
238
240
  # * :latex [boolean] describe a LaTeX project
239
241
  # * :octopress [boolean] octopress site
240
242
  ##
@@ -253,6 +255,7 @@ module FalkorLib
253
255
  options[:make] = false
254
256
  options[:rvm] = true
255
257
  end
258
+ config[:license] = options[:license] if options[:license]
256
259
  config[:type] << :rvm if options[:rake]
257
260
  # Type of project
258
261
  config[:type] << :latex if options[:latex]
@@ -264,7 +267,7 @@ module FalkorLib
264
267
  config[:type] << :python if t == :pyenv
265
268
  end
266
269
  config[:type].uniq!
267
- ap config
270
+ #ap config
268
271
  config[:type] = config[:type].uniq.flatten
269
272
  # Apply options (if provided)
270
273
  [ :name, :forge ].each do |k|
@@ -327,6 +330,7 @@ module FalkorLib
327
330
  erbfiles << "readme_git.erb" if FalkorLib::Git.init?(dir)
328
331
  erbfiles << "readme_gitflow.erb" if FalkorLib::GitFlow.init?(dir)
329
332
  erbfiles << "readme_rvm.erb" if config[:type].include?(:rvm)
333
+ erbfiles << "readme_mkdocs.erb" if options[:mkdocs]
330
334
  erbfiles << "footer_readme.erb"
331
335
 
332
336
  content = ""
@@ -336,9 +340,9 @@ module FalkorLib
336
340
  end
337
341
  show_diff_and_write(content, config[:filename], options)
338
342
 
339
- # Eventually save/upgrade local config
343
+ # Force save/upgrade local config
340
344
  info "=> saving customization of the FalkorLib configuration in #{FalkorLib.config[:config_files][:local]}"
341
- really_continue?
345
+ # really_continue?
342
346
  FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].keys.each do |k|
343
347
  local_config[:project] = {} unless local_config[:project]
344
348
  local_config[:project][k.to_sym] = config[k.to_sym]
@@ -375,7 +379,7 @@ module FalkorLib
375
379
  ##
376
380
  def select_licence(default_licence = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:license],
377
381
  _options = {})
378
- list_license = FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys
382
+ list_license = FalkorLib::Bootstrap::DEFAULTS[:licenses].keys
379
383
  idx = list_license.index(default_licence) unless default_licence.nil?
380
384
  select_from(list_license,
381
385
  'Select the license index for this project:',
@@ -383,6 +387,33 @@ module FalkorLib
383
387
  #licence
384
388
  end # select_licence
385
389
 
390
+ ###### license ######
391
+ # Generate the licence file
392
+ #
393
+ # Supported options:
394
+ # * :force [boolean] force action
395
+ # * :filename [string] License file name
396
+ # * :organization [string] Organization
397
+ ##
398
+ def license(dir = Dir.pwd,
399
+ license = FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:license],
400
+ authors = '',
401
+ options = {
402
+ :filename => 'LICENSE'
403
+ })
404
+ return if (license.empty? or license == :none or license =~ /^CC/)
405
+ return unless FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.include?( license )
406
+ info "Generate the licence file"
407
+ path = normalized_path(dir)
408
+ use_git = FalkorLib::Git.init?(path)
409
+ rootdir = (use_git) ? FalkorLib::Git.rootdir(path) : path
410
+ Dir.chdir( rootdir ) do
411
+ run %( licgen #{license.downcase} #{authors} )
412
+ run %( mv LICENSE #{options[:filename]} ) if( options[:filename] and options[:filename] != 'LICENSE')
413
+ end
414
+ end # license
415
+
416
+
386
417
  ###### guess_project_config ######
387
418
  # Guess the project configuration
388
419
  ##
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Fri 2016-11-11 15:05 svarrette>
3
+ # Time-stamp: <Mon 2017-01-16 11:52 svarrette>
4
4
  ################################################################################
5
5
  # Interface for the main Bootstrapping operations
6
6
  #
@@ -26,17 +26,20 @@ module FalkorLib
26
26
  # Supported options:
27
27
  # * :no_interaction [boolean]: do not interact
28
28
  # * :gitflow [boolean]: bootstrap with git-flow
29
+ # * :license [string] License to use
30
+ # * :licensefile [string] License filename (default: LICENSE)
29
31
  # * :interactive [boolean] Confirm Gitflow branch names
30
32
  # * :master [string] Branch name for production releases
31
33
  # * :develop [string] Branch name for development commits
32
34
  # * :make [boolean] Use a Makefile to pilot the repository actions
33
35
  # * :rake [boolean] Use a Rakefile (and FalkorLib) to pilot the repository action
34
36
  # * :remote_sync [boolean] Operate a git remote synchronization
35
- # * :latex [boolean] Initiate a LaTeX project
36
- # * :gem [boolean] Initiate a Ruby gem project
37
+ # * :latex [boolean] Initiate a LaTeX project **NOT YET IMPLEMENTED**
38
+ # * :gem [boolean] Initiate a Ruby gem project **NOT YET IMPLEMENTED**
39
+ # * :mkdocs [boolean] Initiate MkDocs within your project
37
40
  # * :rvm [boolean] Initiate a RVM-based Ruby project
38
- # * :pyenv [boolean] Initiate a pyenv-based Python project
39
- # * :octopress [boolean] Initiate an Octopress web site
41
+ # * :pyenv [boolean] Initiate a pyenv-based Python project **NOT YET IMPLEMENTED**
42
+ # * :octopress [boolean] Initiate an Octopress web site **NOT YET IMPLEMENTED**
40
43
  ##
41
44
  def repo(name, options = {})
42
45
  ap options if options[:debug]
@@ -109,13 +112,26 @@ module FalkorLib
109
112
  end
110
113
 
111
114
  # === VERSION file ===
112
- FalkorLib::Bootstrap.versionfile(path, :tag => 'v0.0.0')
115
+ FalkorLib::Bootstrap.versionfile(path, :tag => 'v0.0.0') unless options[:gem]
113
116
 
114
117
  # === RVM ====
115
118
  FalkorLib::Bootstrap.rvm(path, options) if options[:rvm]
116
119
 
117
120
  # === README ===
118
- FalkorLib::Bootstrap.readme(path, options)
121
+ FalkorLib::Bootstrap.readme(path, options) # This should also save the project configuration
122
+ # collect the set options
123
+ local_config = FalkorLib::Config.get(path)
124
+
125
+ # === MkDocs ===
126
+ FalkorLib::Bootstrap.mkdocs(path, options) if options[:mkdocs]
127
+
128
+ # === Licence ===
129
+ if (local_config[:project] and local_config[:project][:license])
130
+ author = local_config[:project][:author] ? local_config[:project][:author] : FalkorLib::Config::Bootstrap::DEFAULTS[:metadata][:author]
131
+ FalkorLib::Bootstrap.licence(path, local_config[:project][:license], author, options)
132
+ end
133
+ #
134
+
119
135
 
120
136
  #===== remote synchro ========
121
137
  if options[:remote_sync]
@@ -1,8 +1,8 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Sun 2017-01-15 23:22 svarrette>
3
+ # Time-stamp: <Mon 2017-01-16 10:13 svarrette>
4
4
  ################################################################################
5
- # Interface for the main Bootstrapping operations
5
+ # Interface for Bootstrapping MkDocs
6
6
  #
7
7
 
8
8
  require "falkorlib"
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  ################################################################################
3
- # Time-stamp: <Mon 2016-11-07 10:23 svarrette>
3
+ # Time-stamp: <Mon 2017-01-16 12:20 svarrette>
4
4
  ################################################################################
5
5
 
6
6
  require 'thor'
@@ -51,8 +51,13 @@ By default, NAME is '.' meaning that the repository will be initialized in the c
51
51
  :default => 'devel', :banner => 'BRANCH', :desc => "Branch name for development commits"
52
52
  #method_option :latex, :aliases => '-l', :type => :boolean, :desc => "Initiate a LaTeX project"
53
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
54
  method_option :ruby, :default => '2.1.10', :desc => "Ruby version to configure for RVM"
55
+ method_option :rvm, :type => :boolean, :desc => "Initiate a RVM-based Ruby project"
56
+ method_option :mkdocs, :type => :boolean, :desc => "Initiate Mk Docs within your project"
57
+ method_option :license, :default => 'none', :desc => "Open Source License to use within your project"
58
+ method_option :licensefile, :default => 'LICENSE', :desc => "LICENSE File name"
59
+
60
+
56
61
  #method_option :pyenv, :type => :boolean, :desc => "Initiate a pyenv-based Python project"
57
62
  #method_option :octopress, :aliases => ['-o', '--www'], :type => :boolean, :desc => "Initiate an Octopress web site"
58
63
  #___________________
@@ -84,6 +89,15 @@ By default, NAME is '.' meaning that the repository will be initialized in the c
84
89
  FalkorLib::Bootstrap.latex(path, :letter, options)
85
90
  end # letter
86
91
 
92
+ ###### license ######
93
+ method_option :license, :aliases => ['--lic' , '-l'], :desc => "Open Source License to use within your project"
94
+ method_option :licensefile, :aliases => ['-f' ], :default => 'LICENSE', :desc => "LICENSE File name"
95
+ #......................................
96
+ desc "license [options]", "Generate an Open-Source License for your project"
97
+ def license(path = Dir.pwd)
98
+ license = options[:license] ? options[:license] : FalkorLib::Bootstrap.select_licence('none')
99
+ FalkorLib::Bootstrap.license(path, license, '', options)
100
+ end # license
87
101
 
88
102
 
89
103
  ###### slides ######
@@ -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, 7, 2
22
+ MAJOR, MINOR, PATCH = 0, 7, 3
23
23
 
24
24
  module_function
25
25
 
@@ -2,7 +2,7 @@
2
2
  #########################################
3
3
  # bootstrap_spec.rb
4
4
  # @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
5
- # Time-stamp: <Wed 2016-11-09 20:17 svarrette>
5
+ # Time-stamp: <Mon 2017-01-16 11:30 svarrette>
6
6
  #
7
7
  # @description Check the basic Bootstrapping operations
8
8
  #
@@ -37,7 +37,7 @@ describe FalkorLib::Bootstrap do
37
37
  end
38
38
 
39
39
  [ :without_git, :with_git ].each do |ctx|
40
- #[ :with_git ].each do |ctx|
40
+ # [ :with_git ].each do |ctx|
41
41
  dir = dirs[ctx]
42
42
  #############################################################
43
43
  context "bootstrap/base (#{ctx}) within temporary directory '#{dir}'" do
@@ -127,6 +127,26 @@ describe FalkorLib::Bootstrap do
127
127
  end
128
128
  end
129
129
 
130
+ ### LICENSE file generation
131
+ it "#license -- don't generate LICENSE by default" do
132
+ license = File.join(dir, 'LICENSE')
133
+ FalkorLib::Bootstrap.license(dir)
134
+ expect(File).not_to exist( license )
135
+ end
136
+
137
+
138
+ it "#licence -- Generate LICENSE files for all supported licenses" do
139
+ FalkorLib::Config::Bootstrap::DEFAULTS[:licenses].keys.each do |lic|
140
+ # drop for some special cases
141
+ next if [ 'none', 'BSD', 'CC-by-nc-sa'].include?(lic)
142
+ authors = "Dummy Author"
143
+ license = File.join(dir, "LICENSE.#{lic.downcase}")
144
+ FalkorLib::Bootstrap.license(dir, lic, authors, { :filename => license })
145
+ expect(File).to exist( license )
146
+ end
147
+ end
148
+
149
+
130
150
  end # context "bootstrap/base"
131
151
  end # each
132
152
 
@@ -1,7 +1,7 @@
1
1
  <% unless (config[:license].empty? or config[:license] == "none") %>
2
2
  ## Licence
3
3
 
4
- This project is released under the terms of the [<%= config[:license] %>](LICENCE) licence.
4
+ This project is released under the terms of the [<%= config[:license] %>](<%= options[:licensefile] %>) licence.
5
5
 
6
6
  [![Licence](<%= FalkorLib::Config::Bootstrap::DEFAULTS[:licenses][ config[:license] ][:logo] %>)](<%= FalkorLib::Config::Bootstrap::DEFAULTS[:licenses][ config[:license] ][:url] %>)
7
7
  <% end %>
@@ -0,0 +1,15 @@
1
+ ## Contribution
2
+
3
+ See [`docs/contributing/`](docs/contributing/index.md).
4
+
5
+ ## Documentation
6
+
7
+ See `docs/`.
8
+
9
+ The documentation for this project is handled by [`mkdocs`](http://www.mkdocs.org/#installation).
10
+ You might wish to generate locally the docs:
11
+
12
+ * Install [`mkdocs`](http://www.mkdocs.org/#installation)
13
+ * Preview your documentation from the project root by running `mkdocs serve` and visit with your favorite browser the URL `http://localhost:8000`
14
+ - Alternatively, you can run `make doc` at the root of the repository.
15
+ * (eventually) build the full documentation locally (in the `site/` directory) by running `mkdocs build`.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falkorlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastien Varrette
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-15 00:00:00.000000000 Z
11
+ date: 2017-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -474,6 +474,7 @@ files:
474
474
  - templates/README/readme_gitflow.erb
475
475
  - templates/README/readme_issues.erb
476
476
  - templates/README/readme_latex.erb
477
+ - templates/README/readme_mkdocs.erb
477
478
  - templates/README/readme_rvm.erb
478
479
  - templates/Rakefile/footer_rakefile.erb
479
480
  - templates/Rakefile/header_rakefile.erb