blimpy 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/lib/blimpy/box.rb CHANGED
@@ -167,15 +167,32 @@ module Blimpy
167
167
 
168
168
  def bootstrap_livery
169
169
  if livery == :cwd
170
+ unpack_command = 'true'
170
171
  dir_name = File.basename(Dir.pwd)
171
- run_command('rsync', '-avL',
172
- '--exclude=.git',
173
- '--exclude=.svn',
174
- '--exclude=.blimpy.d',
175
- '.',
176
- "#{username}@#{dns_name}:#{dir_name}/")
172
+
173
+ if can_rsync?
174
+ unpack_command = "cd #{dir_name}"
175
+ run_command('rsync', '-avL',
176
+ '--exclude=.git',
177
+ '--exclude=.svn',
178
+ '--exclude=.blimpy.d',
179
+ '.',
180
+ "#{username}@#{dns_name}:#{dir_name}/")
181
+ else
182
+ puts "Remote host has no rsync(1), falling back to copying a full tarball over"
183
+ tarball = Blimpy::Livery.tarball_directory(Dir.pwd)
184
+ scp_file(tarball)
185
+ # HAXX
186
+ basename = File.basename(tarball)
187
+ unpack_command = "tar -zxf #{basename} && cd #{dir_name}"
188
+ end
189
+
177
190
  puts 'Bootstrapping the livery'
178
- ssh_into("cd #{dir_name} && sudo ./bootstrap.sh")
191
+ run_sudo = 'sudo'
192
+ if username == 'root'
193
+ run_sudo = ''
194
+ end
195
+ ssh_into("#{unpack_command} && #{run_sudo} ./bootstrap.sh")
179
196
  end
180
197
  end
181
198
 
@@ -206,6 +223,11 @@ module Blimpy
206
223
  raise NotImplementedError, '#fog should be implemented by cloud-specific subclasses'
207
224
  end
208
225
 
226
+ def can_rsync?
227
+ @can_rsync ||= ssh_into('-q', 'which rsync > /dev/null')
228
+ end
229
+
230
+
209
231
  private
210
232
 
211
233
  def create_host
@@ -1,3 +1,3 @@
1
1
  module Blimpy
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
@@ -148,6 +148,7 @@ describe Blimpy::Box do
148
148
  context 'with a livery of :cwd' do
149
149
  before :each do
150
150
  subject.livery = :cwd
151
+ subject.stub(:can_rsync?).and_return(true)
151
152
  end
152
153
 
153
154
  it 'should tarball up the current directory' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blimpy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-18 00:00:00.000000000Z
12
+ date: 2012-07-08 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
16
- requirement: &14091140 !ruby/object:Gem::Requirement
16
+ requirement: &7560740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *14091140
24
+ version_requirements: *7560740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &14090460 !ruby/object:Gem::Requirement
27
+ requirement: &7559940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *14090460
35
+ version_requirements: *7559940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: minitar
38
- requirement: &14089460 !ruby/object:Gem::Requirement
38
+ requirement: &7559080 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *14089460
46
+ version_requirements: *7559080
47
47
  description: Blimpy is a tool for managing a fleet of machines in the CLOUD!
48
48
  email:
49
49
  - tyler@monkeypox.org
@@ -106,7 +106,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
106
106
  version: '0'
107
107
  segments:
108
108
  - 0
109
- hash: -3393293475964109853
109
+ hash: -306445518054353312
110
110
  required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  none: false
112
112
  requirements:
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  segments:
117
117
  - 0
118
- hash: -3393293475964109853
118
+ hash: -306445518054353312
119
119
  requirements: []
120
120
  rubyforge_project:
121
121
  rubygems_version: 1.8.10