singel 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +4 -0
- data/bin/singel +10 -8
- data/lib/orchestrator.rb +6 -8
- data/singel.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e82274c305c1b24a5b34ca59c4a0a3b1dfa0f2c
|
4
|
+
data.tar.gz: 889f5510b79cdb3f950b90c1254be0ca33df17f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e038a10b508b2a9d7d1893ea47592330b81d1b5e35a1f9061711f05fcf221e769ef687d6686ed0317c85924c9cdd14bcc3377394d8e9091061046b794c9cd95e
|
7
|
+
data.tar.gz: 8d2206cb434d4005c31a25bb436ba595700ab140cc20997b72751fa17aa309c300469af0c059f456d157ee32df1fbff36c794192d0f88d283520cb400c7b619f
|
data/.gitignore
CHANGED
data/bin/singel
CHANGED
@@ -14,8 +14,8 @@ rescue LoadError => e
|
|
14
14
|
raise "Missing gem or lib #{e}"
|
15
15
|
end
|
16
16
|
|
17
|
+
# add a few methods for manipulating text
|
17
18
|
class String
|
18
|
-
# make text green
|
19
19
|
def to_green
|
20
20
|
"\033[32m#{self}\033[0m"
|
21
21
|
end
|
@@ -31,7 +31,7 @@ class String
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def parse_opts
|
34
|
-
options = { :templates => [], :builders => [] }
|
34
|
+
options = { :templates => [], :builders => [], :packer_dir => File.expand_path('./packer') }
|
35
35
|
banner = "Singel - Unified system image creation using Packer\n\n" \
|
36
36
|
"Usage: singel [action] [options]\n\n" \
|
37
37
|
" Actions:\n" \
|
@@ -40,22 +40,24 @@ def parse_opts
|
|
40
40
|
" Options:\n"
|
41
41
|
OptionParser.new do |opts|
|
42
42
|
opts.banner = banner
|
43
|
-
opts.on('-t', '--templates', 'Build only the specified comma separated list of templates') do
|
44
|
-
options[:templates] =
|
43
|
+
opts.on('-t', '--templates t1.json,t2.json', Array, 'Build only the specified comma separated list of templates') do |t|
|
44
|
+
options[:templates] = t
|
45
45
|
end
|
46
|
-
opts.on('-b', '--builders', 'Build only the specified comma separated list of builder types') do
|
47
|
-
options[:
|
46
|
+
opts.on('-b', '--builders type1,type2', Array, 'Build only the specified comma separated list of builder types') do |b|
|
47
|
+
options[:builders] = b
|
48
|
+
end
|
49
|
+
opts.on('-p', '--packer_dir PATH', 'Path to the packer dir containing templates and other files') do |p|
|
50
|
+
options[:packer_dir] = File.expand_path(p)
|
48
51
|
end
|
49
52
|
opts.on('-h', '--help', 'Displays Help') do
|
50
53
|
puts opts
|
51
54
|
exit
|
52
55
|
end
|
53
|
-
end.parse!
|
56
|
+
end.parse!(ARGV)
|
54
57
|
|
55
58
|
options
|
56
59
|
end
|
57
60
|
|
58
|
-
# make sure the user provided a server name
|
59
61
|
unless ARGV[0]
|
60
62
|
puts "You must provide an action for singel to execute on\n".to_red
|
61
63
|
ARGV << '-h'
|
data/lib/orchestrator.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
class SingelOrchestrator
|
4
4
|
def initialize(options)
|
5
|
-
@templates = find_templates
|
6
5
|
@options = options
|
6
|
+
@templates = find_templates
|
7
7
|
end
|
8
8
|
|
9
9
|
# main method used to kick off the run
|
@@ -11,7 +11,6 @@ class SingelOrchestrator
|
|
11
11
|
puts "\nsingel - unified image creation tool"
|
12
12
|
puts "-----------------------------------------\n\n"
|
13
13
|
|
14
|
-
check_dirs
|
15
14
|
check_aws_keys
|
16
15
|
check_executables
|
17
16
|
|
@@ -20,11 +19,9 @@ class SingelOrchestrator
|
|
20
19
|
|
21
20
|
# check to make sure necessary directories exist
|
22
21
|
def check_dirs
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
exit
|
27
|
-
end
|
22
|
+
unless Dir.exist?(@options[:packer_dir])
|
23
|
+
puts "#{@options[:packer_dir]} not present. Cannot continue".to_red
|
24
|
+
exit
|
28
25
|
end
|
29
26
|
end
|
30
27
|
|
@@ -50,8 +47,9 @@ class SingelOrchestrator
|
|
50
47
|
|
51
48
|
# find the available packer templates on the host
|
52
49
|
def find_templates
|
50
|
+
check_dirs
|
53
51
|
templates = []
|
54
|
-
Dir.foreach(
|
52
|
+
Dir.foreach(@options[:packer_dir]) do |item|
|
55
53
|
templates << item if File.extname(item).downcase == '.json'
|
56
54
|
end
|
57
55
|
|
data/singel.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: singel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|