Class: Kiel::Implementation
- Inherits:
-
Object
- Object
- Kiel::Implementation
- Defined in:
- lib/kiel.rb
Instance Method Summary collapse
- #add_versions(steps) ⇒ Object
- #create_task(step, steps) ⇒ Object
- #expand_path(file_name) ⇒ Object
-
#initialize(defaults) ⇒ Implementation
constructor
A new instance of Implementation.
Constructor Details
#initialize(defaults) ⇒ Implementation
Returns a new instance of Implementation.
24 25 26 |
# File 'lib/kiel.rb', line 24 def initialize defaults @defaults = defaults.dup end |
Instance Method Details
#add_versions(steps) ⇒ Object
103 104 105 106 107 108 |
# File 'lib/kiel.rb', line 103 def add_versions steps steps.collect() do | step | name = step[ :scm_name ] == '*' ? '*' : ( step[ :scm_name ] ) step.merge( version: scm.version( name ) ) end end |
#create_task(step, steps) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/kiel.rb', line 69 def create_task step, steps task = Rake::Task::define_task( step[ :task ] => steps.collect{ | s | s[ :task ] } ) do | task, arguments | = step, steps if cloud.exists? puts "image \'#{step[ :name ]}\' already up to date and exists:" .each{ | key, value | puts "\'#{key}\' => \'#{value}\'" } else puts "starting instance for: \'#{step[ :name ]}\'" instance = cloud.start_instance initial_image_id( step, steps ) puts "instance for: \'#{step[ :name ]}\' started." begin dns_name = cloud.dns_name instance = step.dup.merge( setup_name: ( step[ :setup_name ] ) ) puts "excuting installation for: \'#{step[ :name ]}\'" setup.execute , dns_name puts "installation for: \'#{step[ :name ]}\' done." puts "storing image for: \'#{step[ :name ]}\'" cloud.store_image instance, puts "image for: \'#{step[ :name ]}\' stored" rescue cloud.stop_instance instance raise end end end task.add_description( step[ :description ] ) if step.key? :description task end |
#expand_path(file_name) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/kiel.rb', line 41 def file_name @defaults[ :root_dir ] ||= Dir.pwd if file_name.kind_of? Array file_name.collect { |f| File. f, @defaults[ :root_dir ] } else File. file_name, @defaults[ :root_dir ] end end |