kuzushi 0.0.44 → 0.0.45

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.
data/README CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- Kuzushi ( ka ZU she ) - a technique used by martial artists to control of an
2
+ Kuzushi ( ku ZU she ) - a technique used by martial artists to control of an
3
3
  opponent by keeping them slightly off balance.
4
4
 
5
5
  The 'kuzushi' gem is a companion to the 'judo' gem. Judo handles
data/Rakefile CHANGED
@@ -7,9 +7,8 @@ Jeweler::Tasks.new do |s|
7
7
  s.author = "Orion Henry"
8
8
  s.email = "orion@heroku.com"
9
9
  s.homepage = "http://github.com/orionhenry/kuzushi"
10
- # s.rubyforge_project = "sumo"
11
10
  s.files = FileList["[A-Z]*", "{bin,lib,spec}/**/*"]
12
- s.executables = %w(kuzushi)
11
+ s.executables = %w(kuzushi kuzushi-setup kuzushi-erb)
13
12
  s.add_dependency "rest-client"
14
13
  s.add_dependency "ohai"
15
14
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.44
1
+ 0.0.45
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ require 'erb'
3
+ require 'ohai'
4
+ require 'json'
5
+
6
+ @system = Ohai::System.new.all_plugins
7
+ @config = JSON.parse(File.read("config.json") if File.exists?("config.json")
8
+
9
+ ERB.new(File.read(ARGV[0], 0, '<>').result(binding)
10
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.dirname(__FILE__) + '/../lib/kuzushi'
4
+
5
+ Kuzushi.new.setup
6
+
@@ -18,16 +18,19 @@ class Kuzushi
18
18
  def self.version
19
19
  end
20
20
 
21
- def initialize(url)
22
- @url = url
23
- @base_url = File.dirname(url)
24
- if @url =~ /s3.amazonaws.com.*\/([^\/]*)[.](\d+)[.]tar[.]gz/
25
- @name = $1
26
- @version = $2
21
+ def initialize(url = nil)
22
+ if url
23
+ @url = url
24
+ @base_url = File.dirname(url)
25
+ if @url =~ /s3.amazonaws.com.*\/([^\/]*)[.](\d+)[.]tar[.]gz/
26
+ @name = $1
27
+ @version = $2
28
+ end
29
+ @scripts = true
30
+ @configs = []
31
+ @packages = []
32
+ @tasks = []
27
33
  end
28
- @configs = []
29
- @packages = []
30
- @tasks = []
31
34
  end
32
35
 
33
36
  def init
@@ -47,14 +50,29 @@ class Kuzushi
47
50
  run
48
51
  end
49
52
 
53
+ def setup
54
+ @init = (ENV['JUDO_FIRSTBOOT'] == "true")
55
+ @config = JSON.parse(File.read("config.json"))
56
+ @scripts = false
57
+
58
+ process :packages
59
+ process :volumes
60
+
61
+ execute_tasks
62
+ end
63
+
50
64
  def run
51
65
  process_stack
52
- log "----"
66
+ execute_tasks
67
+ end
68
+
69
+ def execute_tasks
70
+ log "---- BEGIN KUZUSHI "
53
71
  @tasks.each do |t|
54
72
  log "TASK: #{t[:description]}"
55
73
  t[:blk].call
56
74
  end
57
- log "----"
75
+ log "---- END KUZUSHI "
58
76
  end
59
77
 
60
78
  protected
@@ -91,7 +109,7 @@ class Kuzushi
91
109
  if method("process_#{type}").arity == 0
92
110
  send("process_#{type}")
93
111
  else
94
- ## else call it once per item
112
+ ## else call it once per item
95
113
  get_array(type).each do |item|
96
114
  script item["before"]
97
115
  if item.is_a? Hash
@@ -277,6 +295,7 @@ class Kuzushi
277
295
 
278
296
 
279
297
  def script(scripts)
298
+ return unless @scripts
280
299
  to_array(scripts).each do |s|
281
300
  if s =~ /^#!/
282
301
  inline_script(s)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 44
9
- version: 0.0.44
8
+ - 45
9
+ version: 0.0.45
10
10
  platform: ruby
11
11
  authors:
12
12
  - Orion Henry
@@ -14,8 +14,8 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-07 00:00:00 -04:00
18
- default_executable: kuzushi
17
+ date: 2010-05-28 00:00:00 -04:00
18
+ default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rest-client
@@ -45,6 +45,8 @@ description: A tool used by the sumo gem for performing instance setup and manag
45
45
  email: orion@heroku.com
46
46
  executables:
47
47
  - kuzushi
48
+ - kuzushi-setup
49
+ - kuzushi-erb
48
50
  extensions: []
49
51
 
50
52
  extra_rdoc_files:
@@ -54,6 +56,8 @@ files:
54
56
  - Rakefile
55
57
  - VERSION
56
58
  - bin/kuzushi
59
+ - bin/kuzushi-erb
60
+ - bin/kuzushi-setup
57
61
  - lib/kuzushi.rb
58
62
  - spec/base.rb
59
63
  - spec/kuzushi_spec.rb