Class: Kuzushi
- Inherits:
-
Object
- Object
- Kuzushi
- Defined in:
- lib/kuzushi.rb
Overview
firewall until ready ruby 1.9 compatibility nested configs user configs
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #boot ⇒ Object
- #execute_tasks ⇒ Object
- #init ⇒ Object
-
#initialize(url = nil) ⇒ Kuzushi
constructor
A new instance of Kuzushi.
- #run ⇒ Object
- #setup ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(url = nil) ⇒ Kuzushi
Returns a new instance of Kuzushi.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/kuzushi.rb', line 21 def initialize(url = nil) if url @url = url @base_url = File.dirname(url) if @url =~ /s3.amazonaws.com.*\/([^\/]*)[.](\d+)[.]tar[.]gz/ @name = $1 @version = $2 end @scripts = true end @configs = [] @packages = [] @tasks = [] end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
16 17 18 |
# File 'lib/kuzushi.rb', line 16 def config @config end |
Class Method Details
.version ⇒ Object
18 19 |
# File 'lib/kuzushi.rb', line 18 def self.version end |
Instance Method Details
#boot ⇒ Object
41 42 43 44 45 |
# File 'lib/kuzushi.rb', line 41 def boot shell "mkdir -p /tmp/kuzushi/" shell "cd /tmp/kuzushi/ ; curl --silent '#{@url}' | tar xzv" @config = JSON.parse(File.read("/tmp/kuzushi/#{@name}/config.json")) end |
#execute_tasks ⇒ Object
69 70 71 72 73 74 75 76 |
# File 'lib/kuzushi.rb', line 69 def execute_tasks log "---- BEGIN KUZUSHI " @tasks.each do |t| log "TASK: #{t[:description]}" t[:blk].call end log "---- END KUZUSHI " end |
#init ⇒ Object
36 37 38 39 |
# File 'lib/kuzushi.rb', line 36 def init @init = true start end |
#run ⇒ Object
64 65 66 67 |
# File 'lib/kuzushi.rb', line 64 def run process_stack execute_tasks end |
#setup ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/kuzushi.rb', line 53 def setup @init = (ENV['JUDO_FIRST_BOOT'] == "true") @config = JSON.parse(File.read("config.json")) @scripts = false process :packages process :volumes execute_tasks end |
#start ⇒ Object
47 48 49 50 51 |
# File 'lib/kuzushi.rb', line 47 def start # load_config_stack(@name) boot run end |