falkorlib 0.4.4 → 0.4.5
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 +6 -2
- data/falkorlib.gemspec +4 -2
- data/lib/falkorlib/bootstrap/base.rb +31 -4
- data/lib/falkorlib/cli/new.rb +15 -1
- data/lib/falkorlib/common.rb +2 -1
- data/lib/falkorlib/version.rb +1 -1
- data/spec/falkorlib/bootstrap_spec.rb +12 -3
- data/templates/README/header_readme.erb +2 -1
- data/templates/README/readme_gitflow.erb +4 -4
- data/templates/motd/motd.erb +17 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f187f26ec15f9da96207f2fb50947bf26ef74bf
|
4
|
+
data.tar.gz: dd8d820d7c2d5e5049a9a484c2c7c27beb8eab62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 812f7332aa6c7e44664f0dfe36c860f92d7f1fd33aa4c26fb87b96697bc45b553fae3d3e331deab657b1c771e2439614793dd416de758bd92a232cc1c8db07ef
|
7
|
+
data.tar.gz: 33618ec578e4dcf88fe9f61247c163b4622dd761e3c08155fb900a4cf659f360443b59cb01ecad0ee0c281512a8e92a1da5e7b845de9aa6f936119e03835a087
|
data/Gemfile.lock
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
falkorlib (0.4.
|
4
|
+
falkorlib (0.4.5)
|
5
5
|
artii (>= 2.1)
|
6
6
|
awesome_print (~> 1.2)
|
7
7
|
configatron (~> 3.2)
|
8
8
|
deep_merge (~> 1.0.1)
|
9
9
|
diffy (>= 3.0)
|
10
|
+
facter (~> 2.4.1)
|
10
11
|
git_remote_branch (~> 0)
|
11
12
|
json (~> 1.8)
|
12
13
|
license-generator (~> 0)
|
@@ -19,6 +20,7 @@ PATH
|
|
19
20
|
GEM
|
20
21
|
remote: http://rubygems.org/
|
21
22
|
specs:
|
23
|
+
CFPropertyList (2.2.8)
|
22
24
|
addressable (2.3.6)
|
23
25
|
artii (2.1.1)
|
24
26
|
awesome_print (1.6.1)
|
@@ -33,6 +35,8 @@ GEM
|
|
33
35
|
docile (1.1.5)
|
34
36
|
ethon (0.7.0)
|
35
37
|
ffi (>= 1.3.0)
|
38
|
+
facter (2.4.1)
|
39
|
+
CFPropertyList (~> 2.2.6)
|
36
40
|
faraday (0.9.0)
|
37
41
|
multipart-post (>= 1.2, < 3)
|
38
42
|
faraday_middleware (0.9.1)
|
@@ -87,7 +91,7 @@ GEM
|
|
87
91
|
term-ansicolor (1.3.0)
|
88
92
|
tins (~> 1.0)
|
89
93
|
thor (0.19.1)
|
90
|
-
tins (1.3.
|
94
|
+
tins (1.3.5)
|
91
95
|
travis (1.6.14)
|
92
96
|
addressable (~> 2.3)
|
93
97
|
backports
|
data/falkorlib.gemspec
CHANGED
@@ -135,8 +135,10 @@ Gem::Specification.new do |s|
|
|
135
135
|
s.add_runtime_dependency("deep_merge", '~> 1.0.1')
|
136
136
|
s.add_runtime_dependency("diffy", '>= 3.0')
|
137
137
|
s.add_runtime_dependency("logger", '>= 1.2.8')
|
138
|
-
s.add_runtime_dependency("thor",
|
139
|
-
s.add_runtime_dependency("artii",
|
138
|
+
s.add_runtime_dependency("thor", '>= 0.19')
|
139
|
+
s.add_runtime_dependency("artii", '>= 2.1')
|
140
|
+
s.add_runtime_dependency("facter", '~> 2.4.1')
|
141
|
+
|
140
142
|
#s.add_runtime_dependency("mercenary", '>= 0.3.5')
|
141
143
|
|
142
144
|
#
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Dim 2015-03-29 22:25 svarrette>
|
4
4
|
################################################################################
|
5
5
|
# Interface for the main Bootstrapping operations
|
6
6
|
#
|
@@ -9,6 +9,7 @@ require "falkorlib"
|
|
9
9
|
require "falkorlib/common"
|
10
10
|
require 'erb' # required for module generation
|
11
11
|
require 'artii'
|
12
|
+
require 'facter'
|
12
13
|
|
13
14
|
include FalkorLib::Common
|
14
15
|
|
@@ -19,6 +20,12 @@ module FalkorLib #:nodoc:
|
|
19
20
|
module Bootstrap
|
20
21
|
DEFAULTS =
|
21
22
|
{
|
23
|
+
:motd => {
|
24
|
+
:title => "Title",
|
25
|
+
:support => "#{ENV['GIT_AUTHOR_EMAIL']}",
|
26
|
+
:width => 80,
|
27
|
+
:hostname => "`hostname -f`",
|
28
|
+
},
|
22
29
|
:metadata => {
|
23
30
|
:name => '',
|
24
31
|
:type => [],
|
@@ -26,7 +33,7 @@ module FalkorLib #:nodoc:
|
|
26
33
|
:mail => "#{ENV['GIT_AUTHOR_EMAIL']}",
|
27
34
|
:summary => "rtfm",
|
28
35
|
:description => '',
|
29
|
-
:forge =>
|
36
|
+
:forge => '',
|
30
37
|
:source => '',
|
31
38
|
:project_page => '',
|
32
39
|
:license => '',
|
@@ -330,6 +337,24 @@ module FalkorLib
|
|
330
337
|
end # versionfile
|
331
338
|
|
332
339
|
|
340
|
+
###### motd ######
|
341
|
+
# Generate a new motd (Message of the Day) file
|
342
|
+
# Supported options:
|
343
|
+
# * :force [boolean] force action
|
344
|
+
##
|
345
|
+
def motd(dir = Dir.pwd, options = {})
|
346
|
+
config = FalkorLib::Config::Bootstrap::DEFAULTS[:motd].merge!(options)
|
347
|
+
path = normalized_path(dir)
|
348
|
+
erbfile = File.join( FalkorLib.templates, 'motd', 'motd.erb')
|
349
|
+
outfile = (options[:file] =~ /^\//) ? options[:file] : File.join(path, options[:file])
|
350
|
+
info "Generate a motd (Message of the Day) file '#{outfile}'"
|
351
|
+
config[:os] = Facter.value(:lsbdistdescription) if Facter.value(:lsbdistdescription)
|
352
|
+
config[:os] = "Mac " + Facter.value(:sp_os_version) if Facter.value(:sp_os_version)
|
353
|
+
write_from_erb_template(erbfile, outfile, config, options)
|
354
|
+
end # motd
|
355
|
+
|
356
|
+
|
357
|
+
|
333
358
|
###### readme ######
|
334
359
|
# Bootstrap a README file for various context
|
335
360
|
# Supported options:
|
@@ -373,11 +398,13 @@ module FalkorLib
|
|
373
398
|
forges[:url] + "/" + forges[:login] + "/" + config[:name].downcase
|
374
399
|
when :gitlab
|
375
400
|
forges[:url] + "/" + forges[:name].downcase
|
401
|
+
else
|
402
|
+
""
|
376
403
|
end
|
377
|
-
|
404
|
+
ap config
|
378
405
|
FalkorLib::Config::Bootstrap::DEFAULTS[:metadata].each do |k,v|
|
379
406
|
next if v.kind_of?(Array) or [ :license, :forge ].include?( k )
|
380
|
-
next if k == :name and ! name.empty?
|
407
|
+
next if k == :name and ! config[:name].empty?
|
381
408
|
next if k == :issues_url and ! [ :github, :gitlab ].include?( config[:forge] )
|
382
409
|
#next unless [ :name, :summary, :description ].include?(k.to_sym)
|
383
410
|
default_answer = case k
|
data/lib/falkorlib/cli/new.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Dim 2015-03-29 17:52 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require 'thor'
|
@@ -102,6 +102,20 @@ RVM_LONG_DESC
|
|
102
102
|
FalkorLib::Bootstrap.versionfile(path, options)
|
103
103
|
end # versionfile
|
104
104
|
|
105
|
+
###### motd ######
|
106
|
+
method_option :file, :aliases => '-f', :default => '/etc/motd', :desc => "File storing the message of the day"
|
107
|
+
method_option :width, :aliases => '-w', :default => 80, :type => :numeric, :desc => "Width for the text"
|
108
|
+
method_option :title, :aliases => '-t', :default => "Title", :desc => "Title to place in the motd"
|
109
|
+
method_option :subtitle, :desc => "Eventual subtitle to place below the title"
|
110
|
+
method_option :hostname, :aliases => '-h', :default => `hostname -f`, :desc => "Hostname"
|
111
|
+
method_option :support, :aliases => '-s', :default => "#{ENV['GIT_AUTHOR_EMAIL']}", :desc => "Support/Contact mail"
|
112
|
+
method_option :desc, :aliases => '-d', :desc => "Short Description of the host"
|
113
|
+
method_option :nodemodel,:aliases => '-n', :desc => "Node Model"
|
114
|
+
#......................................
|
115
|
+
desc "motd PATH [options]", "Initiate a 'motd' file - message of the day"
|
116
|
+
def motd(path = '.')
|
117
|
+
FalkorLib::Bootstrap.motd(path, options)
|
118
|
+
end # motd
|
105
119
|
|
106
120
|
###### readme ######
|
107
121
|
method_option :make, :default => true,
|
data/lib/falkorlib/common.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
################################################################################
|
3
|
-
# Time-stamp: <
|
3
|
+
# Time-stamp: <Dim 2015-03-29 18:47 svarrette>
|
4
4
|
################################################################################
|
5
5
|
|
6
6
|
require "falkorlib"
|
@@ -9,6 +9,7 @@ require 'erb' # required for module generation
|
|
9
9
|
require 'diffy'
|
10
10
|
require 'json'
|
11
11
|
require "pathname"
|
12
|
+
require "facter"
|
12
13
|
|
13
14
|
module FalkorLib #:nodoc:
|
14
15
|
|
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: <Dim 2015-03-29 22:28 svarrette>
|
6
6
|
#
|
7
7
|
# @description Check the Bootstrapping operations
|
8
8
|
#
|
@@ -150,6 +150,7 @@ describe FalkorLib::Bootstrap do
|
|
150
150
|
t.should be_true
|
151
151
|
FalkorLib.config[:no_interaction] = false
|
152
152
|
end
|
153
|
+
|
153
154
|
end # context
|
154
155
|
|
155
156
|
end # each
|
@@ -157,14 +158,22 @@ describe FalkorLib::Bootstrap do
|
|
157
158
|
############################################
|
158
159
|
context 'boostrap repo' do
|
159
160
|
dir = dirs[:default]
|
160
|
-
|
161
161
|
it '#repo' do
|
162
162
|
FalkorLib.config[:no_interaction] = true
|
163
163
|
FalkorLib::Bootstrap.repo(dir, { :no_interaction => true, :git_flow => false })
|
164
164
|
FalkorLib.config[:no_interaction] = false
|
165
165
|
end
|
166
|
-
|
167
166
|
end
|
168
167
|
|
168
|
+
############################################
|
169
|
+
context 'boostrap motd' do
|
170
|
+
dir = dirs[:default]
|
171
|
+
it "#motd" do
|
172
|
+
motdfile = File.join(dir, 'motd1')
|
173
|
+
FalkorLib::Bootstrap.motd(dir, { :file => "#{motdfile}", :no_interaction => true })
|
174
|
+
t = File.exists?(motdfile)
|
175
|
+
t.should be_true
|
176
|
+
end
|
177
|
+
end
|
169
178
|
|
170
179
|
end
|
@@ -4,7 +4,7 @@
|
|
4
4
|
[ %>)](<%= FalkorLib::Config::Bootstrap::DEFAULTS[:licenses][ config[:license] ][:url] %>)
|
5
5
|
<% end %>
|
6
6
|
|
7
|
-
Time-stamp: <
|
7
|
+
Time-stamp: <Dim 2015-03-29 14:28 svarrette>
|
8
8
|
|
9
9
|
<%= ::Artii::Base.new().asciify( config[:name] ).split("\n").join("\n ") %>
|
10
10
|
Copyright (c) <%= Time.now.year %> <%= config[:author] %> <<%= config[:mail] %>>
|
@@ -20,6 +20,7 @@
|
|
20
20
|
|
21
21
|
<%= config[:description] %>
|
22
22
|
|
23
|
+
|
23
24
|
## Installation
|
24
25
|
|
25
26
|
This repository is hosted on [<%= FalkorLib::Config::Bootstrap::DEFAULTS[:forge][ config[:forge].to_sym ][:name] %>](<%= config[:project_page] %>).
|
@@ -12,7 +12,7 @@ Thus you are more than encouraged to install the [git-flow](https://github.com/n
|
|
12
12
|
|
13
13
|
### Releasing mechanism
|
14
14
|
|
15
|
-
The operation consisting of releasing a new version of this repository is automated by a set of tasks within the root `<%=
|
15
|
+
The operation consisting of releasing a new version of this repository is automated by a set of tasks within the root `<%= options[:rake] ? 'R' : 'M' %>akefile`.
|
16
16
|
|
17
17
|
In this context, a version number have the following format:
|
18
18
|
|
@@ -31,16 +31,16 @@ The current version number is stored in the root file `VERSION`. __/!\ NEVER MAK
|
|
31
31
|
|
32
32
|
For more information on the version, run:
|
33
33
|
|
34
|
-
$> <%=
|
34
|
+
$> <%= options[:make] ? 'make versioninfo' : 'rake version:info' %>
|
35
35
|
|
36
36
|
If a new version number such be bumped, you simply have to run:
|
37
37
|
|
38
|
-
$> <%=
|
38
|
+
$> <%= options[:make] ? 'make start_bump_{major,minor,patch}' : 'rake version:{major,minor,patch}' %>
|
39
39
|
|
40
40
|
This will start the release process for you using `git-flow`.
|
41
41
|
Once you have finished to commit your last changes, make the release effective by running:
|
42
42
|
|
43
|
-
$> <%=
|
43
|
+
$> <%= options[:make] ? 'make release' : 'rake version:release' %>
|
44
44
|
|
45
45
|
it will finish the release using `git-flow`, create the appropriate tag in the `<%= FalkorLib::GitFlow.branches(:master) %>` branch and merge all things the way they should be.
|
46
46
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= ("=" * config[:width]) + "\n" %>
|
2
|
+
Welcome to <%= config[:hostname].chomp %>
|
3
|
+
<%= ("=" * config[:width]) + "\n" %>
|
4
|
+
<%= ::Artii::Base.new().asciify( config[:title] ).split("\n").join("\n ") %>
|
5
|
+
<% if config[:subtitle] %>
|
6
|
+
<%= ::Artii::Base.new().asciify( config[:subtitle] ).split("\n").join("\n ") %>
|
7
|
+
<% end %>
|
8
|
+
<%= ("=" * config[:width]) + "\n" %>
|
9
|
+
Hostname: <%= config[:hostname].chomp %>
|
10
|
+
OS: <%= config[:os] %>
|
11
|
+
Support: <%= config[:support] %>
|
12
|
+
|
13
|
+
=== <%= config[:desc] %> ===
|
14
|
+
<%= config[:nodemodel] %> (<%= Facter.value(:physicalprocessorcount) %> <%= Facter.value(:processor0) %>)
|
15
|
+
RAM: <%= Facter.value(:memorysize) %> -- Swap size: <%= Facter.value(:swapsize) %>
|
16
|
+
|
17
|
+
<%= ("=" * config[:width]) + "\n" %>
|
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.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Varrette
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -198,6 +198,20 @@ dependencies:
|
|
198
198
|
- - ">="
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: '2.1'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: facter
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - "~>"
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: 2.4.1
|
208
|
+
type: :runtime
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - "~>"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: 2.4.1
|
201
215
|
- !ruby/object:Gem::Dependency
|
202
216
|
name: bundler
|
203
217
|
requirement: !ruby/object:Gem::Requirement
|
@@ -400,6 +414,7 @@ files:
|
|
400
414
|
- templates/Rakefile/footer_rakefile.erb
|
401
415
|
- templates/Rakefile/header_rakefile.erb
|
402
416
|
- templates/Rakefile/rakefile_gitflow.erb
|
417
|
+
- templates/motd/motd.erb
|
403
418
|
- templates/puppet/modules/.gitignore
|
404
419
|
- templates/puppet/modules/.vagrant_init.rb
|
405
420
|
- templates/puppet/modules/Gemfile
|