dollhouse 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,8 +2,8 @@ module Dollhouse
2
2
  class Instance < Struct.new(:instance_name, :deployment_name, :server_name, :ip)
3
3
  attr_accessor :user, :password
4
4
 
5
- def bootstrap
6
- cloud_adapter.execute(instance_name, %Q{bash -c "`wget -O- babushka.me/up/hard`"}, default_opts)
5
+ def bootstrap args = []
6
+ cloud_adapter.execute(instance_name, %Q{bash -c "`wget -O- babushka.me/up/#{[*args].push('hard').uniq.join(',')}`"}, default_opts)
7
7
  end
8
8
 
9
9
  def babushka taskname, vars = {}
@@ -11,12 +11,7 @@ module Dollhouse
11
11
  if vars == :no_defaults
12
12
  cloud_adapter.execute(instance_name, "babushka '#{taskname}'", default_opts)
13
13
  else
14
- if !vars.empty?
15
- write_file(".babushka/vars/#{taskname}", {
16
- :vars => vars.map_keys(&:to_s).map_values { |v| {:value => v} }
17
- }.to_yaml)
18
- end
19
- cloud_adapter.execute(instance_name, "babushka '#{taskname}' --defaults", default_opts)
14
+ cloud_adapter.execute(instance_name, "babushka '#{taskname}' --defaults #{cmdline_vars(vars)}", default_opts)
20
15
  end
21
16
  end
22
17
 
@@ -28,6 +23,10 @@ module Dollhouse
28
23
  cloud_adapter.write_file(instance_name, path, content, default_opts.merge(opts))
29
24
  end
30
25
 
26
+ def locally &blk
27
+ local_adapter.instance_eval &blk
28
+ end
29
+
31
30
  def as user, opts = {}, &blk
32
31
  old_user = self.user
33
32
  old_password = self.password
@@ -69,9 +68,18 @@ module Dollhouse
69
68
  opts
70
69
  end
71
70
 
71
+ def cmdline_vars vars
72
+ vars.keys.map {|key|
73
+ %{#{key}="#{vars[key].strip.gsub('"', '\"')}"}
74
+ }.join(' ')
75
+ end
76
+
72
77
  # This could return different adapters, that connect to servers in different ways. For now we have a simple
73
78
  def cloud_adapter
74
79
  @cloud_adapter ||= ManualConfig.new
75
80
  end
81
+ def local_adapter
82
+ @local_adapter ||= LocalAdapter.new
83
+ end
76
84
  end
77
85
  end
@@ -0,0 +1,26 @@
1
+ module Dollhouse
2
+ class LocalAdapter
3
+ def babushka taskname, vars = {}
4
+ if !vars.empty?
5
+ write_file("~/.babushka/vars/#{taskname}", {
6
+ :vars => vars.map_keys(&:to_s).map_values {|v| {:value => v} }
7
+ }.to_yaml)
8
+ end
9
+ shell "babushka '#{taskname}' --defaults"
10
+ end
11
+
12
+ def shell cmd, opts = {}
13
+ puts "Running #{cmd}"
14
+ output = `#{cmd}`
15
+ puts output
16
+ $? == 0
17
+ end
18
+
19
+ def write_file path, content
20
+ puts "Writing to #{path}"
21
+ File.open(File.expand_path(path), "w") {|f|
22
+ f << content
23
+ }
24
+ end
25
+ end
26
+ end
@@ -1,3 +1,3 @@
1
1
  module Dollhouse
2
- VERSION = "0.2.1" unless defined?(Dollhouse::VERSION)
2
+ VERSION = "0.2.2" unless defined?(Dollhouse::VERSION)
3
3
  end
metadata CHANGED
@@ -1,144 +1,90 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dollhouse
3
- version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Glen Maddern
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-01-18 00:00:00 +11:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2012-01-02 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: main
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70137320130120 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
18
+ requirements:
27
19
  - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 55
30
- segments:
31
- - 4
32
- - 2
33
- - 0
20
+ - !ruby/object:Gem::Version
34
21
  version: 4.2.0
35
22
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: fog
39
23
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70137320130120
25
+ - !ruby/object:Gem::Dependency
26
+ name: fog
27
+ requirement: &70137320129400 !ruby/object:Gem::Requirement
41
28
  none: false
42
- requirements:
29
+ requirements:
43
30
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 43
46
- segments:
47
- - 0
48
- - 2
49
- - 30
31
+ - !ruby/object:Gem::Version
50
32
  version: 0.2.30
51
33
  type: :runtime
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
- name: net-ssh
55
34
  prerelease: false
56
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70137320129400
36
+ - !ruby/object:Gem::Dependency
37
+ name: net-ssh
38
+ requirement: &70137320128800 !ruby/object:Gem::Requirement
57
39
  none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 33
62
- segments:
63
- - 2
64
- - 0
65
- - 23
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
66
43
  version: 2.0.23
67
44
  type: :runtime
68
- version_requirements: *id003
69
- - !ruby/object:Gem::Dependency
70
- name: net-sftp
71
45
  prerelease: false
72
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70137320128800
47
+ - !ruby/object:Gem::Dependency
48
+ name: net-sftp
49
+ requirement: &70137320128200 !ruby/object:Gem::Requirement
73
50
  none: false
74
- requirements:
51
+ requirements:
75
52
  - - ~>
76
- - !ruby/object:Gem::Version
77
- hash: 7
78
- segments:
79
- - 2
80
- - 0
81
- - 4
53
+ - !ruby/object:Gem::Version
82
54
  version: 2.0.4
83
55
  type: :runtime
84
- version_requirements: *id004
85
- - !ruby/object:Gem::Dependency
86
- name: cucumber
87
56
  prerelease: false
88
- requirement: &id005 !ruby/object:Gem::Requirement
89
- none: false
90
- requirements:
91
- - - ~>
92
- - !ruby/object:Gem::Version
93
- hash: 61
94
- segments:
95
- - 0
96
- - 9
97
- - 3
98
- version: 0.9.3
99
- type: :development
100
- version_requirements: *id005
101
- - !ruby/object:Gem::Dependency
57
+ version_requirements: *70137320128200
58
+ - !ruby/object:Gem::Dependency
102
59
  name: rake
103
- prerelease: false
104
- requirement: &id006 !ruby/object:Gem::Requirement
60
+ requirement: &70137320127020 !ruby/object:Gem::Requirement
105
61
  none: false
106
- requirements:
107
- - - ~>
108
- - !ruby/object:Gem::Version
109
- hash: 49
110
- segments:
111
- - 0
112
- - 8
113
- - 7
114
- version: 0.8.7
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
115
66
  type: :development
116
- version_requirements: *id006
117
- - !ruby/object:Gem::Dependency
118
- name: rspec
119
67
  prerelease: false
120
- requirement: &id007 !ruby/object:Gem::Requirement
68
+ version_requirements: *70137320127020
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: &70137320126300 !ruby/object:Gem::Requirement
121
72
  none: false
122
- requirements:
123
- - - ~>
124
- - !ruby/object:Gem::Version
125
- hash: 15
126
- segments:
127
- - 2
128
- - 0
129
- - 0
130
- version: 2.0.0
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
131
77
  type: :development
132
- version_requirements: *id007
133
- description: Dollhouse is a way to deploy servers. It is designed to be used with Babushka.
78
+ prerelease: false
79
+ version_requirements: *70137320126300
80
+ description: Dollhouse is a way to deploy servers. It is designed to be used with
81
+ Babushka.
134
82
  email: glen.maddern@gmail.com
135
- executables:
83
+ executables:
136
84
  - dollhouse
137
85
  extensions: []
138
-
139
86
  extra_rdoc_files: []
140
-
141
- files:
87
+ files:
142
88
  - bin/dollhouse
143
89
  - lib/core_ext/hash.rb
144
90
  - lib/dollhouse/config_loader.rb
@@ -146,6 +92,7 @@ files:
146
92
  - lib/dollhouse/dollhouse.rb
147
93
  - lib/dollhouse/instance.rb
148
94
  - lib/dollhouse/instances.rb
95
+ - lib/dollhouse/local_adapter.rb
149
96
  - lib/dollhouse/manual_config.rb
150
97
  - lib/dollhouse/remote_server.rb
151
98
  - lib/dollhouse/server.rb
@@ -153,41 +100,28 @@ files:
153
100
  - lib/dollhouse.rb
154
101
  - LICENSE
155
102
  - README.md
156
- has_rdoc: true
157
103
  homepage: http://github.com/geelen/dollhouse
158
104
  licenses: []
159
-
160
105
  post_install_message:
161
106
  rdoc_options: []
162
-
163
- require_paths:
107
+ require_paths:
164
108
  - lib
165
- required_ruby_version: !ruby/object:Gem::Requirement
109
+ required_ruby_version: !ruby/object:Gem::Requirement
166
110
  none: false
167
- requirements:
168
- - - ">="
169
- - !ruby/object:Gem::Version
170
- hash: 3
171
- segments:
172
- - 0
173
- version: "0"
174
- required_rubygems_version: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
175
116
  none: false
176
- requirements:
177
- - - ">="
178
- - !ruby/object:Gem::Version
179
- hash: 23
180
- segments:
181
- - 1
182
- - 3
183
- - 6
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
184
120
  version: 1.3.6
185
121
  requirements: []
186
-
187
122
  rubyforge_project: dollhouse
188
- rubygems_version: 1.3.7
123
+ rubygems_version: 1.8.11
189
124
  signing_key:
190
125
  specification_version: 3
191
126
  summary: A place to manage your babushkas.
192
127
  test_files: []
193
-