spatula 0.0.11 → 0.0.12

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.
@@ -50,8 +50,9 @@ module Spatula
50
50
  method_options :identity => nil
51
51
  method_options :upload_key => nil
52
52
  method_options :keyfile => :string
53
+ method_options :ruby_version => :string
53
54
  def prepare(server)
54
- Prepare.run(server, options[:port], options[:login], options[:identity], options[:upload_key], options[:keyfile])
55
+ Prepare.run(server, options[:port], options[:login], options[:identity], options[:upload_key], options[:keyfile], options[:ruby_version])
55
56
  end
56
57
 
57
58
  private
@@ -3,7 +3,7 @@ module Spatula
3
3
  class Prepare < SshCommand
4
4
 
5
5
  RUBYGEMS_VERSION = "1.6.2"
6
- RUBY_PATH = "1.9/ruby-1.9.2-p180.tar.gz"
6
+ DEFAULT_RUBY_VERSION = "1.9.2-p180"
7
7
 
8
8
  def run
9
9
 
@@ -49,18 +49,27 @@ module Spatula
49
49
 
50
50
  def run_for_fedora
51
51
  sudo = ssh('which sudo > /dev/null 2>&1') ? 'sudo' : ''
52
- ssh "#{sudo} yum install -y make gcc rsync sudo openssl-devel rubygems ruby-devel ruby-shadow curl"
52
+ ssh "#{sudo} yum install -y make gcc gcc-c++ rsync sudo openssl-devel rubygems ruby-devel ruby-shadow curl"
53
53
  end
54
54
 
55
55
  def run_for_centos
56
- ssh "#{sudo} yum install -y make gcc rsync sudo openssl-devel curl"
57
- install_ruby_1_9_2
56
+ ssh "#{sudo} yum install -y make gcc gcc-c++ rsync sudo openssl-devel curl"
57
+ install_ruby
58
58
  install_chef
59
59
  end
60
60
 
61
- def install_ruby_1_9_2
62
- ssh "curl -L 'ftp://ftp.ruby-lang.org//pub/ruby/#{RUBY_PATH}' | tar xvzf -"
63
- ssh "cd ruby-1.9.2-* && ./configure && make && #{sudo} make install"
61
+ def ruby_version
62
+ @ruby_version || DEFAULT_RUBY_VERSION
63
+ end
64
+
65
+ def ruby_path
66
+ rev = ruby_version.match(/^(\d+\.\d+)/)[1]
67
+ "#{rev}/ruby-#{ruby_version}.tar.gz"
68
+ end
69
+
70
+ def install_ruby
71
+ ssh "curl -L 'ftp://ftp.ruby-lang.org/pub/ruby/#{ruby_path}' | tar xvzf -"
72
+ ssh "cd ruby-#{ruby_version} && ./configure && make && #{sudo} make install"
64
73
  end
65
74
 
66
75
  def install_rubygems
@@ -4,7 +4,7 @@ module Spatula
4
4
  new(*args).run
5
5
  end
6
6
 
7
- def initialize(server, port=nil, login=nil, identity=nil, upload_key=nil, key_file=nil)
7
+ def initialize(server, port=nil, login=nil, identity=nil, upload_key=nil, key_file=nil, ruby_version=nil)
8
8
  @server = server
9
9
  @port = port
10
10
  @port_switch = port ? " -p #{port}" : ''
@@ -12,6 +12,7 @@ module Spatula
12
12
  @identity_switch = identity ? %Q|-i "#{identity}"| : ''
13
13
  @upload_key = upload_key
14
14
  @key_file = key_file
15
+ @ruby_version = ruby_version
15
16
  end
16
17
 
17
18
  def ssh(command)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spatula
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-05-12 00:00:00.000000000 -04:00
12
+ date: 2011-05-16 00:00:00.000000000 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thor
17
- requirement: &2152565900 !ruby/object:Gem::Requirement
17
+ requirement: &2157008840 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 0.13.4
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *2152565900
25
+ version_requirements: *2157008840
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: json
28
- requirement: &2152565380 !ruby/object:Gem::Requirement
28
+ requirement: &2157008240 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: 1.2.4
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *2152565380
36
+ version_requirements: *2157008240
37
37
  description: ! " Spatula is a command line helper app for use with Chef. It currently
38
38
  lets you\n search and install cookbooks from http://cookbooks.opscode.com.\n"
39
39
  email: cashion@gmail.com