falkorlib 0.8.5 → 0.8.6
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.lock +1 -1
- data/lib/falkorlib/bootstrap/base.rb +20 -13
- data/lib/falkorlib/bootstrap/git.rb +5 -2
- data/lib/falkorlib/bootstrap/mkdocs.rb +3 -4
- data/lib/falkorlib/bootstrap/vagrant.rb +9 -3
- data/lib/falkorlib/cli.rb +34 -175
- data/lib/falkorlib/cli/link.rb +5 -1
- data/lib/falkorlib/cli/make.rb +15 -1
- data/lib/falkorlib/cli/new.rb +22 -5
- data/lib/falkorlib/tasks/rspec.rake +29 -9
- data/lib/falkorlib/version.rb +1 -1
- data/spec/falkorlib/bootstrap_spec.rb +26 -1
- data/spec/falkorlib/bootstrap_vagrant_spec.rb +14 -14
- data/templates/README/header_readme.erb +18 -21
- data/templates/README/readme_pyenv.erb +44 -0
- data/templates/mkdocs/docs/README.md.erb +7 -7
- data/templates/mkdocs/docs/contributing/setup.md.erb +3 -3
- data/templates/mkdocs/docs/layout.md.erb +25 -4
- data/templates/mkdocs/docs/setup.md.erb +315 -0
- data/templates/mkdocs/docs/vagrant.md.erb +85 -0
- data/templates/mkdocs/mkdocs.yml.erb +5 -4
- data/templates/vagrant/Vagrantfile.erb +73 -28
- data/templates/vagrant/vagrant/config.yaml.sample +8 -4
- data/templates/vagrant/vagrant/puppet/Makefile +40 -0
- data/templates/vagrant/vagrant/puppet/hiera.yaml +36 -0
- data/templates/vagrant/vagrant/puppet/hieradata/.gitignore +2 -0
- data/templates/vagrant/vagrant/puppet/hieradata/defaults.yaml +4 -0
- data/templates/vagrant/vagrant/puppet/hieradata/roles/example.yaml +13 -0
- data/templates/vagrant/vagrant/puppet/manifests/default.pp +23 -0
- data/templates/vagrant/vagrant/puppet/modules/.gitignore +3 -0
- data/templates/vagrant/vagrant/puppet/site/profiles/manifests/pxe/server.pp +12 -0
- data/templates/vagrant/vagrant/{bootstrap.sh → scripts/bootstrap.sh} +27 -30
- data/templates/vagrant/vagrant/shared/.gitignore +3 -0
- metadata +15 -6
- data/templates/mkdocs/docs/setup/README.md.erb +0 -6
- data/templates/mkdocs/docs/setup/install.md.erb +0 -61
- data/templates/mkdocs/docs/setup/preliminaries.md.erb +0 -73
data/lib/falkorlib/cli/link.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Mon 2020-04-20 17:12 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require 'thor'
|
@@ -26,6 +26,9 @@ module FalkorLib
|
|
26
26
|
#......................................
|
27
27
|
desc "rootdir [options]", "Create a symlink '.root' which targets the root of the repository"
|
28
28
|
def rootdir(dir = Dir.pwd)
|
29
|
+
# TODO: find a generic way to handle help in subcommands
|
30
|
+
# -- see https://github.com/erikhuda/thor/issues/532
|
31
|
+
(help(__method__) and exit 0) if options[:help]
|
29
32
|
FalkorLib::Bootstrap::Link.root(dir, options)
|
30
33
|
end # rootdir
|
31
34
|
|
@@ -49,6 +52,7 @@ module FalkorLib
|
|
49
52
|
#......................................
|
50
53
|
desc "make [options]", "Create a symlink to one of Falkor's Makefile, set as Git submodule"
|
51
54
|
def make(dir = Dir.pwd)
|
55
|
+
(help(__method__) and exit 0) if options[:help]
|
52
56
|
FalkorLib::Bootstrap::Link.makefile(dir, options)
|
53
57
|
end # make
|
54
58
|
|
data/lib/falkorlib/cli/make.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Mon 2020-04-20 17:11 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require 'thor'
|
@@ -14,6 +14,7 @@ module FalkorLib
|
|
14
14
|
class Make < ::Thor
|
15
15
|
|
16
16
|
include FalkorLib::Common
|
17
|
+
class_option :help, :aliases => ['-h', '--help'], type: :boolean
|
17
18
|
|
18
19
|
###### commands ######
|
19
20
|
desc "commands", "Lists all available commands", :hide => true
|
@@ -29,6 +30,9 @@ module FalkorLib
|
|
29
30
|
#......................................
|
30
31
|
desc "repo", "Create a root Makefile piloting repository operations"
|
31
32
|
def repo(dir = Dir.pwd)
|
33
|
+
# TODO: find a generic way to handle help in subcommands
|
34
|
+
# -- see https://github.com/erikhuda/thor/issues/532
|
35
|
+
(help(__method__) and exit 0) if options[:help]
|
32
36
|
FalkorLib::Bootstrap.makefile(dir, options)
|
33
37
|
end # repo
|
34
38
|
|
@@ -36,18 +40,28 @@ module FalkorLib
|
|
36
40
|
###### latex ######
|
37
41
|
desc "latex", "Symlink to a Makefile to compile LaTeX documents"
|
38
42
|
def latex(dir = Dir.pwd)
|
43
|
+
(help(__method__) and exit 0) if options[:help]
|
39
44
|
FalkorLib::Bootstrap::Link.makefile(dir, :latex => true)
|
40
45
|
end # latex
|
41
46
|
|
47
|
+
###### src ######
|
48
|
+
desc "src", "Symlink to a Makefile to recursively compile anything under src/"
|
49
|
+
def src(dir = Dir.pwd)
|
50
|
+
(help(__method__) and exit 0) if options[:help]
|
51
|
+
FalkorLib::Bootstrap::Link.makefile(dir, :src => true)
|
52
|
+
end # latex_src
|
53
|
+
|
42
54
|
##### gnuplot #####
|
43
55
|
desc "gnuplot", "Symlink to a Makefile to compile GnuPlot scripts"
|
44
56
|
def gnuplot(dir = Dir.pwd)
|
57
|
+
(help(__method__) and exit 0) if options[:help]
|
45
58
|
FalkorLib::Bootstrap::Link.makefile(dir, :gnuplot => true)
|
46
59
|
end # gnuplot
|
47
60
|
|
48
61
|
##### generic #####
|
49
62
|
desc "generic", "Symlink to Generic Makefile for sub directory"
|
50
63
|
def generic(dir = Dir.pwd)
|
64
|
+
(help(__method__) and exit 0) if options[:help]
|
51
65
|
FalkorLib::Bootstrap::Link.makefile(dir, :generic => true)
|
52
66
|
end # generic
|
53
67
|
|
data/lib/falkorlib/cli/new.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Mon 2020-04-20 17:12 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require 'thor'
|
@@ -15,18 +15,21 @@ module FalkorLib
|
|
15
15
|
|
16
16
|
package_name "Falkor[Lib] 'new'"
|
17
17
|
namespace :new
|
18
|
+
map %w[--help -h] => :help
|
18
19
|
|
19
20
|
def self.banner(task, _namespace = true, subcommand = false)
|
20
21
|
"#{basename} #{task.formatted_usage(self, true, subcommand)}"
|
21
22
|
end
|
22
23
|
|
24
|
+
class_option :help, :aliases => ['-h', '--help'], type: :boolean
|
25
|
+
|
23
26
|
###### commands ######
|
24
27
|
desc "commands", "Lists all available commands", :hide => true
|
25
28
|
def commands
|
26
29
|
puts New.all_commands.keys.sort - [ 'commands' ]
|
27
30
|
end
|
28
31
|
|
29
|
-
|
32
|
+
map %w[--help -h] => :help
|
30
33
|
|
31
34
|
###### repo ######
|
32
35
|
desc "repo NAME [options]", "Bootstrap a Git Repository"
|
@@ -56,12 +59,17 @@ By default, NAME is '.' meaning that the repository will be initialized in the c
|
|
56
59
|
method_option :mkdocs, :type => :boolean, :desc => "Initiate Mk Docs within your project"
|
57
60
|
method_option :license, :default => 'none', :desc => "Open Source License to use within your project"
|
58
61
|
method_option :licensefile, :default => 'LICENSE', :desc => "LICENSE File name"
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
+
method_option :pyenv, :type => :boolean, :desc => "Initiate a pyenv-based Python project"
|
63
|
+
method_option :python, :banner => 'VERSION', :aliases => [ '--pyenv', '-p' ],
|
64
|
+
:desc => 'Python version to configure / install for pyenv'
|
65
|
+
method_option :virtualenv, :aliases => [ '--env', '-e' ],
|
66
|
+
:desc => 'Python virtualenv name to configure for this directory'
|
62
67
|
#method_option :octopress, :aliases => ['-o', '--www'], :type => :boolean, :desc => "Initiate an Octopress web site"
|
63
68
|
#___________________
|
64
69
|
def repo(name = '.')
|
70
|
+
# TODO: find a generic way to handle help in subcommands
|
71
|
+
# -- see https://github.com/erikhuda/thor/issues/532
|
72
|
+
(help(__method__) and exit 0) if options[:help]
|
65
73
|
options[:rvm] = true if options[:rake] || options[:gem]
|
66
74
|
# _newrepo(name, options)
|
67
75
|
FalkorLib::Bootstrap.repo(name, options)
|
@@ -77,6 +85,7 @@ By default, NAME is '.' meaning that the repository will be initialized in the c
|
|
77
85
|
desc "article [options]", "Bootstrap a LaTeX Article"
|
78
86
|
#___________________
|
79
87
|
def article(path = Dir.pwd)
|
88
|
+
(help(__method__) and exit 0) if options[:help]
|
80
89
|
FalkorLib::Bootstrap.latex(path, :article, options)
|
81
90
|
end # article
|
82
91
|
|
@@ -88,6 +97,7 @@ By default, NAME is '.' meaning that the repository will be initialized in the c
|
|
88
97
|
desc "letter [options]", "LaTeX-based letter"
|
89
98
|
#___________________
|
90
99
|
def letter(path = Dir.pwd)
|
100
|
+
(help(__method__) and exit 0) if options[:help]
|
91
101
|
FalkorLib::Bootstrap.latex(path, :letter, options)
|
92
102
|
end # letter
|
93
103
|
|
@@ -97,6 +107,7 @@ By default, NAME is '.' meaning that the repository will be initialized in the c
|
|
97
107
|
#......................................
|
98
108
|
desc "license [options]", "Generate an Open-Source License for your project"
|
99
109
|
def license(path = Dir.pwd)
|
110
|
+
(help(__method__) and exit 0) if options[:help]
|
100
111
|
license = options[:license] ? options[:license] : FalkorLib::Bootstrap.select_licence('none')
|
101
112
|
FalkorLib::Bootstrap.license(path, license, '', options)
|
102
113
|
end # license
|
@@ -117,6 +128,7 @@ By default, NAME is '.' meaning that the repository will be initialized in the c
|
|
117
128
|
#......................................
|
118
129
|
desc "make [options]", "Initiate one of Falkor's Makefile"
|
119
130
|
def make(dir = Dir.pwd)
|
131
|
+
(help(__method__) and exit 0) if options[:help]
|
120
132
|
if options[:repo]
|
121
133
|
FalkorLib::Bootstrap.makefile(dir)
|
122
134
|
elsif (options[:latex] or options[:gnuplot] or options[:generic] or options[:images] or options[:src])
|
@@ -156,6 +168,7 @@ PYENV_LONG_DESC
|
|
156
168
|
:default => true, :desc => 'Force overwritting the pyenv/direnv config'
|
157
169
|
#____________________
|
158
170
|
def pyenv(path = '.')
|
171
|
+
(help(__method__) and exit 0) if options[:help]
|
159
172
|
FalkorLib::Bootstrap.pyenv(path, options)
|
160
173
|
end # pyenv
|
161
174
|
|
@@ -167,6 +180,7 @@ PYENV_LONG_DESC
|
|
167
180
|
#method_option :dir, :aliases => '-d', :desc => 'Project directory (relative to the git root directory)'
|
168
181
|
#___________________
|
169
182
|
def slides(path = Dir.pwd)
|
183
|
+
(help(__method__) and exit 0) if options[:help]
|
170
184
|
FalkorLib::Bootstrap.latex(path, :beamer, options)
|
171
185
|
end # slides
|
172
186
|
|
@@ -174,6 +188,7 @@ PYENV_LONG_DESC
|
|
174
188
|
desc "trash PATH", "Add a Trash directory"
|
175
189
|
#________________________
|
176
190
|
def trash(path = Dir.pwd)
|
191
|
+
(help(__method__) and exit 0) if options[:help]
|
177
192
|
FalkorLib::Bootstrap.trash(path)
|
178
193
|
end # trash
|
179
194
|
|
@@ -198,6 +213,7 @@ RVM_LONG_DESC
|
|
198
213
|
:default => FalkorLib.config[:rvm][:gemsetfile], :desc => 'RVM gemset file'
|
199
214
|
#____________________
|
200
215
|
def rvm(path = '.')
|
216
|
+
(help(__method__) and exit 0) if options[:help]
|
201
217
|
FalkorLib::Bootstrap.rvm(path, options)
|
202
218
|
end # rvm
|
203
219
|
|
@@ -228,6 +244,7 @@ RVM_LONG_DESC
|
|
228
244
|
#......................................
|
229
245
|
desc "readme PATH [options]", "Initiate a README file in the PATH directory ('./' by default)"
|
230
246
|
def readme(path = '.')
|
247
|
+
(help(__method__) and exit 0) if options[:help] # pas boooooo
|
231
248
|
FalkorLib::Bootstrap.readme(path, options)
|
232
249
|
end # readme
|
233
250
|
|
@@ -52,13 +52,33 @@ begin
|
|
52
52
|
namespace :suite do
|
53
53
|
specsuite.each do |name, _files|
|
54
54
|
########### #{name} ###########
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
55
|
+
if _files.count == 1
|
56
|
+
desc "Run all specs in #{name} spec suite"
|
57
|
+
RSpec::Core::RakeTask.new(name.to_sym) do |t|
|
58
|
+
t.pattern = "spec/**/#{name}_*spec.rb"
|
59
|
+
#t.pattern = "spec/**/git_*spec.rb"
|
60
|
+
t.verbose = false
|
61
|
+
t.rspec_opts = rspec_opts
|
62
|
+
end # task #{name}
|
63
|
+
else
|
64
|
+
namespace "#{name.to_sym}" do
|
65
|
+
desc "Run all specs in #{name} spec suite"
|
66
|
+
RSpec::Core::RakeTask.new(:all) do |t|
|
67
|
+
t.pattern = "spec/**/#{name}_*spec.rb"
|
68
|
+
t.verbose = false
|
69
|
+
t.rspec_opts = rspec_opts
|
70
|
+
end # task rspec:suite:#{name}:all
|
71
|
+
_files.map { |f| File.basename(f, '_spec.rb').gsub("#{name}_", '') }.each do |subname|
|
72
|
+
next if subname == name
|
73
|
+
desc "Run the '#{subname}' specs in the #{name} spec suite"
|
74
|
+
RSpec::Core::RakeTask.new(subname.to_sym) do |t|
|
75
|
+
t.pattern = "spec/**/#{name}_#{subname}*spec.rb"
|
76
|
+
t.verbose = false
|
77
|
+
t.rspec_opts = rspec_opts
|
78
|
+
end # task rspec:suite:#{name}:#{subname}
|
79
|
+
end
|
80
|
+
end # namespace #{name}
|
81
|
+
end # id
|
62
82
|
end
|
63
83
|
end # namespace suite
|
64
84
|
end # namespace rspec
|
@@ -121,8 +141,8 @@ namespace :setenv do
|
|
121
141
|
#desc "Set Code Climate token to report rspec results"
|
122
142
|
task :code_climate do |_t|
|
123
143
|
unless FalkorLib.config[:tokens].nil? ||
|
124
|
-
|
125
|
-
|
144
|
+
FalkorLib.config[:tokens][:code_climate].nil? ||
|
145
|
+
FalkorLib.config[:tokens][:code_climate].empty?
|
126
146
|
ans = ask(cyan("A Code Climate token is set - Do you want to report on Code Climate the result of the process? (y|N)"), 'No')
|
127
147
|
ENV['CODECLIMATE_REPO_TOKEN'] = FalkorLib.config[:tokens][:code_climate] if ans =~ /y.*/i
|
128
148
|
end
|
data/lib/falkorlib/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# bootstrap_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Mon 2020-04-20 09:58 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the basic Bootstrapping operations
|
8
8
|
#
|
@@ -135,6 +135,31 @@ describe FalkorLib::Bootstrap do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
+
it "#readme rvm/mkdocs/pyenv" do
|
139
|
+
readme = File.join(dir, 'README.md')
|
140
|
+
#Array.new(6).each { |e| STDIN.should_receive(:gets).and_return('') }
|
141
|
+
#STDIN.should_receive(:gets).and_return('')
|
142
|
+
#STDIN.should_receive(:gets).and_return('1')
|
143
|
+
FalkorLib::Bootstrap.readme(dir,
|
144
|
+
{
|
145
|
+
:no_interaction => true,
|
146
|
+
:rvm => true,
|
147
|
+
:mkdocs => true,
|
148
|
+
:pyenv => true
|
149
|
+
})
|
150
|
+
expect(File).to exist( readme )
|
151
|
+
File.read(File.realpath( readme )) do |f|
|
152
|
+
[
|
153
|
+
"## Ruby stuff", # from readme_rvm.erb
|
154
|
+
"## Documentation", # from readme_mkdocs.erb
|
155
|
+
"## Python Virtualenv", # from readme_pyenv.erb
|
156
|
+
].each do |pattern|
|
157
|
+
f.should include "#{pattern}"
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
|
138
163
|
### LICENSE file generation
|
139
164
|
it "#license -- don't generate LICENSE by default" do
|
140
165
|
license = File.join(dir, 'LICENSE')
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#########################################
|
3
3
|
# bootstrap_vagrant_spec.rb
|
4
4
|
# @author Sebastien Varrette <Sebastien.Varrette@uni.lu>
|
5
|
-
# Time-stamp: <
|
5
|
+
# Time-stamp: <Mon 2020-04-20 10:10 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Bootstrapping operations for Vagrant
|
8
8
|
#
|
@@ -58,24 +58,24 @@ describe FalkorLib::Bootstrap do
|
|
58
58
|
it "#vagrant -- #{ctx}" do
|
59
59
|
c = FalkorLib::Bootstrap.vagrant(dir)
|
60
60
|
expect(c).to eq(0)
|
61
|
-
confdir = File.join(dir, 'vagrant')
|
62
61
|
conffile = File.join(dir, 'Vagrantfile')
|
63
|
-
expect(File.directory?(confdir)).to be true
|
64
62
|
expect(File.exists?(conffile)).to be true
|
65
|
-
|
63
|
+
confdir = File.join(dir, 'vagrant')
|
64
|
+
puppetdir = File.join(confdir, 'puppet')
|
65
|
+
scriptsdir = File.join(confdir, 'scripts')
|
66
|
+
[ confdir, puppetdir, scriptsdir ].each do |d|
|
67
|
+
expect(File.directory?(d)).to be true
|
68
|
+
end
|
69
|
+
bootstrap = File.join(scriptsdir, 'bootstrap.sh')
|
66
70
|
expect(File.exists?(bootstrap)).to be true
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
# ].each do |pattern|
|
73
|
-
# f.should include "#{pattern}"
|
74
|
-
# end
|
75
|
-
# end
|
71
|
+
hiera_config = File.join(puppetdir, 'hiera.yaml')
|
72
|
+
expect(File.exists?(hiera_config)).to be true
|
73
|
+
[ 'hieradata', 'manifests', 'modules', 'site/profiles' ].each do |d|
|
74
|
+
expect(File.directory?(File.join(puppetdir, d))).to be true
|
75
|
+
end
|
76
76
|
end
|
77
77
|
|
78
|
-
end # context "bootstrap/
|
78
|
+
end # context "bootstrap/vagrant"
|
79
79
|
end # each
|
80
80
|
|
81
81
|
end
|
@@ -1,18 +1,11 @@
|
|
1
|
-
-*- mode: markdown; mode: visual-line; fill-column: 80 -*-
|
2
|
-
|
3
1
|
<% unless (config[:license].empty? or config[:license] == "none") %>
|
4
2
|
[ %>)](<%= FalkorLib::Config::Bootstrap::DEFAULTS[:licenses][ config[:license] ][:url] %>)
|
5
3
|
<% end %>
|
6
4
|
![By <%= config[:by] %>](https://img.shields.io/badge/by-<%= config[:by] %>-blue.svg) [![<%= config[:forge] %>](https://img.shields.io/badge/git-<%= config[:forge] %>-lightgray.svg)](<%= config[:source] %>) [](<%= config[:issues_url] %>)
|
7
5
|
|
8
|
-
Time-stamp: <Tue 2017-04-04 12:01 svarrette>
|
9
|
-
|
10
6
|
<%= ::Artii::Base.new().asciify( config[:name] ).split("\n").join("\n ") %>
|
11
7
|
Copyright (c) <%= Time.now.year %> <%= config[:author] %> <<%= config[:mail] %>>
|
12
8
|
|
13
|
-
|
14
|
-
## Synopsis
|
15
|
-
|
16
9
|
<%= config[:description] %>
|
17
10
|
|
18
11
|
|
@@ -26,9 +19,11 @@ This repository is hosted on [<%= FalkorLib::Config::Bootstrap::DEFAULTS[:forge]
|
|
26
19
|
<% end %>
|
27
20
|
* To clone this repository, proceed as follows (adapt accordingly):
|
28
21
|
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
```bash
|
23
|
+
$> mkdir -p ~/<%= config[:rootdir].gsub(ENV['HOME'] + '/', '').gsub(File.basename(config[:rootdir]), '') %>
|
24
|
+
$> cd ~/<%= config[:rootdir].gsub(ENV['HOME'] + '/', '').gsub(File.basename(config[:rootdir]), '') %>
|
25
|
+
$> git clone <%= config[:origin] %>
|
26
|
+
```
|
32
27
|
|
33
28
|
<% end %>
|
34
29
|
<% if config[:type].include?( :rvm ) %>
|
@@ -45,27 +40,29 @@ Configure the dependencies detailed in the [`Gemfile`](Gemfile) through the [Bun
|
|
45
40
|
|
46
41
|
**`/!\ IMPORTANT`**: Once cloned, initiate your local copy of the repository by running:
|
47
42
|
|
48
|
-
|
43
|
+
```bash
|
44
|
+
$> cd <%= name.downcase %>
|
49
45
|
<% if options[:make] %>
|
50
|
-
|
46
|
+
$> make setup
|
51
47
|
<% else %>
|
52
|
-
|
48
|
+
$> rake setup
|
53
49
|
<% end %>
|
50
|
+
```
|
54
51
|
|
55
|
-
This will initiate the [Git submodules of this repository](.gitmodules) and setup the [git flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) layout for this repository.
|
56
|
-
|
57
|
-
Later on, you can upgrade the [Git submodules](.gitmodules) to the latest version by running:
|
52
|
+
This will initiate the [Git submodules of this repository](.gitmodules) and setup the [git flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) layout for this repository. Later on, you can update your local branches by running:
|
58
53
|
|
59
54
|
<% if options[:make] %>
|
60
|
-
|
55
|
+
$> make up
|
61
56
|
<% else %>
|
62
|
-
|
57
|
+
$> rake up
|
63
58
|
<% end %>
|
64
59
|
|
65
|
-
If upon pulling the repository, you end in a state where another collaborator have upgraded the Git submodules for this repository, you'll end in a dirty state (as reported by modifications within the `.submodules/` directory). In that case, just after the pull, you **have to run**
|
60
|
+
If upon pulling the repository, you end in a state where another collaborator have upgraded the Git submodules for this repository, you'll end in a dirty state (as reported by modifications within the `.submodules/` directory). In that case, just after the pull, you **have to run** `make up` to ensure consistency with regards the Git submodules:
|
61
|
+
|
62
|
+
Finally, you can upgrade the [Git submodules](.gitmodules) to the latest version by running:
|
66
63
|
|
67
64
|
<% if options[:make] %>
|
68
|
-
$> make
|
65
|
+
$> make upgrade
|
69
66
|
<% else %>
|
70
|
-
$> rake git:submodules:
|
67
|
+
$> rake git:submodules:upgrade
|
71
68
|
<% end %>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
## Python Virtualenv / Pyenv and Direnv
|
2
|
+
|
3
|
+
You will have to ensure you have installed [direnv](https://direnv.net/) (configured by [`.envrc`](.envrc)), [pyenv](https://github.com/pyenv/pyenv) and [`pyenv-virtualenv`](https://github.com/pyenv/pyenv-virtualenv). This assumes also the presence of `~/.config/direnv/direnvrc` from [this page](https://github.com/Falkor/dotfiles/blob/master/direnv/direnvrc) - for more details, see [this blog post](https://varrette.gforge.uni.lu/blog/2019/09/10/using-pyenv-virtualenv-direnv/).
|
4
|
+
|
5
|
+
You can run the following command to setup your local machine in a compliant way:
|
6
|
+
|
7
|
+
```
|
8
|
+
make setup-pyenv # AND/OR 'make setup-direnv'
|
9
|
+
```
|
10
|
+
|
11
|
+
Running `direnv allow` (this will have to be done only once), you should automatically enable the virtualenv `<%= name.downcase %>` based on the python version specified in [`.python-version`](.python-version). You'll eventually need to install the appropripriate Python version with `pyenv`:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
pyenv versions # Plural: show all versions
|
15
|
+
pyenv install $(head .python-version)
|
16
|
+
# Activate the virtualenv by reentering into the directory
|
17
|
+
cd ..
|
18
|
+
cd -
|
19
|
+
```
|
20
|
+
|
21
|
+
From that point, you should install the required packages using:
|
22
|
+
|
23
|
+
pip install -r requirements.txt
|
24
|
+
|
25
|
+
Alternatively, you can use `make setup-python`
|
26
|
+
|
27
|
+
## Python Code Development
|
28
|
+
|
29
|
+
The Python code for `<%= name.downcase %>` is developed as a Python package, i.e. following the [official guidelines](https://packaging.python.org/overview/).
|
30
|
+
|
31
|
+
To play in live with the code while developing it, install it in "_editable_" mode by running:
|
32
|
+
|
33
|
+
pip install -e ./
|
34
|
+
|
35
|
+
In practice:
|
36
|
+
|
37
|
+
cd src
|
38
|
+
make
|
39
|
+
|
40
|
+
Later on, you can clean the directory using
|
41
|
+
|
42
|
+
make clean
|
43
|
+
|
44
|
+
Now you can enjoy live runs.
|