singel 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ac0da534de9c30dd49888eca2f95dd99ba2499d
4
- data.tar.gz: 455dc5e58733ddc807573138532c7e58479142eb
3
+ metadata.gz: 8e82274c305c1b24a5b34ca59c4a0a3b1dfa0f2c
4
+ data.tar.gz: 889f5510b79cdb3f950b90c1254be0ca33df17f0
5
5
  SHA512:
6
- metadata.gz: 3e91e010c4a67280fb3d8f4ace8defaf60e74bee80bd59f2ab1c651adf175398efbc6f7c9e98ce24d9c22f22f6a3a8a0309dcce1349023a16a51b18926a14f42
7
- data.tar.gz: 01e7a456edd0bdc17c4361048de6a35c44c9fe160d0340fd404ddb0f99bd10c85f63386aadda2798170ba625da54fce1b444afd2bbaba4d220a0ff0f80b26985
6
+ metadata.gz: e038a10b508b2a9d7d1893ea47592330b81d1b5e35a1f9061711f05fcf221e769ef687d6686ed0317c85924c9cdd14bcc3377394d8e9091061046b794c9cd95e
7
+ data.tar.gz: 8d2206cb434d4005c31a25bb436ba595700ab140cc20997b72751fa17aa309c300469af0c059f456d157ee32df1fbff36c794192d0f88d283520cb400c7b619f
data/.gitignore CHANGED
@@ -32,3 +32,7 @@ build/
32
32
 
33
33
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
34
  .rvmrc
35
+
36
+ # singel related files
37
+ outputs
38
+ packer
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[:builers] = []
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
- %w(packer output).each do |dir|
24
- unless File.directory?(dir)
25
- puts "#{dir.capitalize} directory not present. Create directory '#{dir}' in the root of the singel directory before continuing.".to_red
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('packer/') do |item|
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
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'singel'
3
- s.version = '0.0.1'
3
+ s.version = '0.0.2'
4
4
  s.date = Date.today.to_s
5
5
  s.platform = Gem::Platform::RUBY
6
6
  s.extra_rdoc_files = ['README.md', 'LICENSE']
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.1
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-30 00:00:00.000000000 Z
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