engineyard-serverside 1.5.28.pre1 → 1.5.28.pre2

Sign up to get free protection for your applications and to get access to all the features.
@@ -215,21 +215,10 @@ module EY
215
215
  servers = EY::Serverside::Server.all.find_all { |server| !server.local? }
216
216
 
217
217
  futures = EY::Serverside::Future.call(servers) do |server|
218
- egrep_escaped_version = EY::Serverside::VERSION.gsub(/\./, '\.')
219
- # the [,)] is to stop us from looking for e.g. 0.5.1, seeing
220
- # 0.5.11, and mistakenly thinking 0.5.1 is there
221
- has_gem_cmd = "#{gem_binary} list engineyard-serverside | grep \"engineyard-serverside\" | egrep -q '#{egrep_escaped_version}[,)]'"
222
-
223
- if !server.run(has_gem_cmd) # doesn't have this exact version
218
+ if !server.gem?('engineyard-serverside', EY::Serverside::VERSION) # doesn't have this exact version
224
219
  puts "~> Installing engineyard-serverside on #{server.hostname}"
225
220
 
226
- system(Escape.shell_command([
227
- 'scp', '-i', "#{ENV['HOME']}/.ssh/internal",
228
- "-o", "StrictHostKeyChecking=no",
229
- local_gem_file,
230
- "#{config.user}@#{server.hostname}:#{remote_gem_file}",
231
- ]))
232
- server.run("sudo #{gem_binary} install --no-rdoc --no-ri '#{remote_gem_file}'")
221
+ server.install_gem(local_gem_file, remote_gem_file)
233
222
  end
234
223
  end
235
224
 
@@ -83,12 +83,39 @@ module EY
83
83
  if local?
84
84
  logged_system(command)
85
85
  else
86
- logged_system(ssh_command + " " + Escape.shell_command(["#{user}@#{hostname}", command]))
86
+ logged_system(ssh_command + Escape.shell_command(["#{user}@#{hostname}", command]))
87
87
  end
88
88
  end
89
89
 
90
90
  def ssh_command
91
- "ssh -i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
91
+ "ssh #{ssh_options} "
92
+ end
93
+
94
+ def scp_command
95
+ "scp #{ssh_options} "
96
+ end
97
+
98
+ def ssh_options
99
+ "-i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
100
+ end
101
+
102
+ #
103
+ # check whether a gem is installed in the server
104
+ #
105
+ def gem?(name, version)
106
+ egrep_escaped_version = version.gsub(/\./, '\.')
107
+ # the [,)] is to stop us from looking for e.g. 0.5.1, seeing
108
+ # 0.5.11, and mistakenly thinking 0.5.1 is there
109
+ has_gem_cmd = "#{gem_binary} list #{name} | grep \"#{name}\" | egrep -q '#{egrep_escaped_version}[,)]'"
110
+ run(has_gem_cmd)
111
+ end
112
+
113
+ #
114
+ # copy a local gem to the remove server and install it
115
+ #
116
+ def install_gem(local_gem_file, remote_gem_file)
117
+ logged_system(scp_command + Escape.shell_command([local_gem_file, "#{user}@#{hostname}:#{remote_gem_file}"]))
118
+ run("sudo #{gem_binary} install --no-rdoc --no-ri '#{remote_gem_file}'")
92
119
  end
93
120
 
94
121
  end
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '1.5.28.pre1'
3
+ VERSION = '1.5.28.pre2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.28.pre1
4
+ version: 1.5.28.pre2
5
5
  prerelease: 7
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-01-31 00:00:00.000000000 Z
12
+ date: 2012-02-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2161682860 !ruby/object:Gem::Requirement
16
+ requirement: &2157318860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - =
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 1.3.2
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2161682860
24
+ version_requirements: *2157318860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &2161682300 !ruby/object:Gem::Requirement
27
+ requirement: &2157318360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.9.2.2
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2161682300
35
+ version_requirements: *2157318360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rdoc
38
- requirement: &2161681900 !ruby/object:Gem::Requirement
38
+ requirement: &2157317980 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2161681900
46
+ version_requirements: *2157317980
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: timecop
49
- requirement: &2161681360 !ruby/object:Gem::Requirement
49
+ requirement: &2157317520 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2161681360
57
+ version_requirements: *2157317520
58
58
  description:
59
59
  email: cloud@engineyard.com
60
60
  executables: