standup 0.5.14 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rbenv-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.2-p290
@@ -118,12 +118,12 @@ module Standup
118
118
  def remote_command command
119
119
  command = "#{@context[:prefix].strip} #{command}" if @context[:prefix].present?
120
120
  command = "cd #{@context[:path]} && #{command}" if @context[:path].present?
121
- command = "#{shell_command} -c \"#{command.gsub(/"/, '\"')}\""
121
+ command = "bash -c \"#{command.gsub(/"/, '\"')}\""
122
122
 
123
- if @context[:user].present?
124
- command = "sudo -u #{@context[:user]} #{command}"
125
- elsif @context[:sudo]
123
+ if @context[:sudo]
126
124
  command = "sudo #{command}"
125
+ elsif @context[:user].present?
126
+ command = "sudo -u #{@context[:user]} #{command}"
127
127
  end
128
128
 
129
129
  command
@@ -133,10 +133,6 @@ module Standup
133
133
  with_context(context) { raw_exec(remote_command(command), timeout_sec) }
134
134
  end
135
135
 
136
- def shell_command
137
- rvm_installed? ? 'rvm-shell' : 'bash'
138
- end
139
-
140
136
  def sudo command = nil, &block
141
137
  block = Proc.new { exec command } unless block_given?
142
138
  with_context(:sudo => true, &block)
@@ -152,7 +148,7 @@ module Standup
152
148
  tmp_dirname = "/tmp/standup_tmp_#{rand 10000}"
153
149
  exec "mkdir -m 777 #{tmp_dirname}"
154
150
  result = in_dir tmp_dirname, &block
155
- exec "rm -rf #{tmp_dirname}"
151
+ sudo "rm -rf #{tmp_dirname}"
156
152
  result
157
153
  end
158
154
 
@@ -200,13 +196,6 @@ module Standup
200
196
  @ssh = nil
201
197
  end
202
198
 
203
- def rvm_installed?
204
- unless instance_variable_defined? :@rvm_installed
205
- @rvm_installed = !!(raw_exec('which rvm') =~ /rvm/)
206
- end
207
- @rvm_installed
208
- end
209
-
210
199
  protected
211
200
 
212
201
  def ssh
@@ -1,5 +1,5 @@
1
1
  module Standup
2
- VERSION = "0.5.14"
2
+ VERSION = "0.6.0"
3
3
 
4
4
  def self.version
5
5
  VERSION
@@ -8,8 +8,8 @@ events {
8
8
  }
9
9
 
10
10
  http {
11
- passenger_root <%= scripts.ruby.info[:gem_dir] %>/passenger-3.0.7;
12
- passenger_ruby <%= scripts.ruby.info[:wrapper] %>;
11
+ passenger_root <%= scripts.ruby.gems_dir %>/passenger-<%= params.version %>;
12
+ passenger_ruby /usr/local/bin/ruby;
13
13
 
14
14
  include mime.types;
15
15
  default_type application/octet-stream;
data/scripts/passenger.rb CHANGED
@@ -1,15 +1,19 @@
1
1
  Standup.script :node do
2
+ self.default_params = {
3
+ :version => '3.0.9'
4
+ }
5
+
2
6
  def run
3
7
  scripts.ec2.open_port 80, 443
4
8
 
5
- if install_gem('passenger', '3.0.8') || !file_exists?('/opt/nginx/sbin/nginx')
9
+ if install_gem('passenger', params.version) || !file_exists?('/opt/nginx/sbin/nginx')
6
10
  install_package 'libcurl4-openssl-dev'
7
11
  sudo 'passenger-install-nginx-module --auto --auto-download --prefix=/opt/nginx'
8
12
  end
9
13
 
10
14
  sudo 'mkdir -p /opt/nginx/conf/servers'
11
15
 
12
- with_processed_file script_file('nginx.conf') do |file|
16
+ with_processed_file script_file('nginx.conf.erb') do |file|
13
17
  upload file,
14
18
  :to =>'/opt/nginx/conf/nginx.conf',
15
19
  :sudo => true
data/scripts/ruby.rb CHANGED
@@ -1,69 +1,62 @@
1
1
  Standup.script :node do
2
2
  def run
3
- unless remoting.rvm_installed?
4
- install_package 'git-core'
5
- sudo 'bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)'
6
- sudo 'usermod -a -G rvm ubuntu'
7
- sudo 'usermod -a -G rvm www-data'
8
- sudo 'cd /usr/local/bin && sudo ln -s /usr/local/rvm/bin/rvm-shell'
9
- upload script_file('rvmrc'), :to => '/etc/rvmrc', :sudo => true
10
- exec 'source /usr/local/rvm/scripts/rvm'
11
- remoting.instance_variable_set :@rvm_installed, true
12
- end
13
-
14
- unless exec('rvm list')[version]
15
- install_packages 'build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev'
16
-
17
- sudo "rvm install #{version}"
18
- sudo "rvm use #{version} --default"
19
-
20
- upload script_file('gemrc'),
21
- :to => '/etc/gemrc',
22
- :sudo => true
3
+ install_packages 'build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev'
4
+ build_ruby
5
+ setup_env
6
+ end
7
+
8
+ def build_ruby
9
+ return if exec('ruby -v') =~ /#{version.gsub(/-/, '')}/
10
+
11
+ install_ruby_build
12
+
13
+ sudo "ruby-build #{version} /usr/local"
14
+ end
15
+
16
+ def install_ruby_build
17
+ return if file_exists? '/usr/local/bin/ruby-build'
18
+ in_temp_dir do |path|
19
+ exec 'git clone git://github.com/sstephenson/ruby-build.git'
20
+ in_dir "#{path}/ruby-build" do
21
+ sudo './install.sh'
22
+ end
23
23
  end
24
24
  end
25
-
26
- def info
27
- @rvminfo ||= YAML.load(exec('rvm info')).values.first
28
- {
29
- :gem_dir => "#{@rvminfo['homes']['gem']}/gems",
30
- :bin_ruby => @rvminfo['binaries']['ruby'],
31
- :wrapper => "#{@rvminfo['homes']['ruby'].gsub('/rubies/', '/wrappers/')}/ruby"
32
- }
25
+
26
+ def setup_env
27
+ upload script_file('gemrc'),
28
+ :to => '/etc/gemrc',
29
+ :sudo => true
30
+ end
31
+
32
+ def gems_dir
33
+ "#{exec('gem environment gemdir').strip}/gems"
33
34
  end
34
-
35
+
35
36
  def version
36
37
  @version ||= begin
37
- files = Dir['**/.rvmrc']
38
-
39
- if files.empty?
40
- if params.version.present?
41
- params.version
42
- else
43
- puts "Cannot fine ruby version declaration neither in .rvmrc file or ruby script param"
44
- raise Exception.new('Cannot find ruby version declaration')
45
- end
38
+ versions = ([params.version] + rbenv_versions + rvm_versions).compact.uniq
39
+
40
+ if versions.size == 1
41
+ versions.first
46
42
  else
47
- declarations = files.map do |file|
48
- if (rvm_declaration = IO.read(file)).index('rvm') == 0
49
- rvm_declaration.split(' ').second.split('@').first
50
- else
51
- puts "Cannot parse .rvmrc declaration:\n#{rvm_declaration}"
52
- raise Exception.new("Cannot parse #{file}")
53
- end
54
- end.uniq
55
-
56
- if declarations.size > 1
57
- puts "Found different ruby version declarations #{declarations}"
58
- if params.version.present?
59
- params.version
60
- else
61
- raise Exception.new('Several ruby version declarations found')
62
- end
63
- else
64
- declarations.first
65
- end
43
+ raise "Found different ruby version declarations #{versions}"
66
44
  end
67
45
  end
68
46
  end
47
+
48
+ def rvm_versions
49
+ Dir['**/.rvmrc'].map do |f|
50
+ if (rvm_declaration = IO.read(f)).index('rvm') == 0
51
+ rvm_declaration.split(' ').second.split('@').first
52
+ else
53
+ puts "Cannot parse .rvmrc declaration:\n#{rvm_declaration}"
54
+ raise Exception.new("Cannot parse #{f}")
55
+ end
56
+ end
57
+ end
58
+
59
+ def rbenv_versions
60
+ Dir['**/.rbenv-version'].map{|f| IO.read(f).strip}
61
+ end
69
62
  end
data/scripts/webapp.rb CHANGED
@@ -80,14 +80,14 @@ Standup.script :node do
80
80
  with_context(:user => 'www-data', :path => app_path) do
81
81
  case params.gem_manager.to_sym
82
82
  when :bundler
83
- install_gem 'bundler'
84
- exec 'bundle install'
83
+ install_gem 'bundler', '1.0.18'
84
+ sudo 'bundle install'
85
85
  when :rake_gems
86
86
  cmd = "RAILS_ENV=#{params.rails_env} rake gems:install"
87
- output = exec cmd
87
+ output = sudo cmd
88
88
  if output.match(/Missing the Rails ([\d\.]+) gem/) || output.match(/RubyGem version error: rails\([\d\.]+ not = ([\d\.]+)\)/)
89
89
  install_gem 'rails', $1
90
- exec cmd
90
+ sudo cmd
91
91
  end
92
92
  end
93
93
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.14
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2011-09-09 00:00:00.000000000Z
14
+ date: 2011-09-14 00:00:00.000000000Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: trollop
18
- requirement: &70135903137000 !ruby/object:Gem::Requirement
18
+ requirement: &70308367915600 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ! '>='
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: '1.16'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70135903137000
26
+ version_requirements: *70308367915600
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: i18n
29
- requirement: &70135903135900 !ruby/object:Gem::Requirement
29
+ requirement: &70308367914900 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 0.5.0
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *70135903135900
37
+ version_requirements: *70308367914900
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: activesupport
40
- requirement: &70135903135000 !ruby/object:Gem::Requirement
40
+ requirement: &70308367914100 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: '3.0'
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *70135903135000
48
+ version_requirements: *70308367914100
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: settingslogic
51
- requirement: &70135903133500 !ruby/object:Gem::Requirement
51
+ requirement: &70308367913640 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ! '>='
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: '2.0'
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *70135903133500
59
+ version_requirements: *70308367913640
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: amazon-ec2
62
- requirement: &70135903132900 !ruby/object:Gem::Requirement
62
+ requirement: &70308367913160 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ! '>='
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: '0.9'
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *70135903132900
70
+ version_requirements: *70308367913160
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: aws-s3
73
- requirement: &70135903132060 !ruby/object:Gem::Requirement
73
+ requirement: &70308367912480 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ! '>='
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: '0.5'
79
79
  type: :runtime
80
80
  prerelease: false
81
- version_requirements: *70135903132060
81
+ version_requirements: *70308367912480
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: net-ssh
84
- requirement: &70135903131480 !ruby/object:Gem::Requirement
84
+ requirement: &70308367911700 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ! '>='
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: '2.0'
90
90
  type: :runtime
91
91
  prerelease: false
92
- version_requirements: *70135903131480
92
+ version_requirements: *70308367911700
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: highline
95
- requirement: &70135903112120 !ruby/object:Gem::Requirement
95
+ requirement: &70308367911040 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ! '>='
@@ -100,7 +100,7 @@ dependencies:
100
100
  version: 1.5.2
101
101
  type: :runtime
102
102
  prerelease: false
103
- version_requirements: *70135903112120
103
+ version_requirements: *70308367911040
104
104
  description: ''
105
105
  email:
106
106
  - ilia@flamefork.ru
@@ -111,6 +111,7 @@ extensions: []
111
111
  extra_rdoc_files: []
112
112
  files:
113
113
  - .gitignore
114
+ - .rbenv-version
114
115
  - .rvmrc
115
116
  - Gemfile
116
117
  - LICENSE
@@ -156,7 +157,7 @@ files:
156
157
  - scripts/mysql.rb
157
158
  - scripts/passenger.rb
158
159
  - scripts/passenger/nginx
159
- - scripts/passenger/nginx.conf
160
+ - scripts/passenger/nginx.conf.erb
160
161
  - scripts/passenger/nginx_monit.conf
161
162
  - scripts/postgresql.rb
162
163
  - scripts/postgresql/pg_hba.conf
@@ -172,7 +173,6 @@ files:
172
173
  - scripts/resque/resque_monit.conf
173
174
  - scripts/ruby.rb
174
175
  - scripts/ruby/gemrc
175
- - scripts/ruby/rvmrc
176
176
  - scripts/setup.rb
177
177
  - scripts/shell.rb
178
178
  - scripts/status.rb
@@ -196,21 +196,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
196
  - - ! '>='
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
- segments:
200
- - 0
201
- hash: 2029569967480200357
202
199
  required_rubygems_version: !ruby/object:Gem::Requirement
203
200
  none: false
204
201
  requirements:
205
202
  - - ! '>='
206
203
  - !ruby/object:Gem::Version
207
204
  version: '0'
208
- segments:
209
- - 0
210
- hash: 2029569967480200357
211
205
  requirements: []
212
206
  rubyforge_project: standup
213
- rubygems_version: 1.8.6
207
+ rubygems_version: 1.8.10
214
208
  signing_key:
215
209
  specification_version: 3
216
210
  summary: Standup is an application deployment and infrastructure management tool for
data/scripts/ruby/rvmrc DELETED
@@ -1 +0,0 @@
1
- export rvm_path=/usr/local/rvm