rconf 0.9.20 → 0.9.21

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ tags
2
2
  pkg/*
3
3
  .rvmrc
4
4
  Gemfile.lock
5
+ .idea/
data/bin/rconf CHANGED
@@ -213,11 +213,16 @@ where [options] are:
213
213
  report_fatal("Validation of configuration file failed:\n - #{lang.validation_errors.map(&:red).join("\n - ")}") unless lang.validation_errors.empty?
214
214
  report_error(lang.warnings.join(', ').green) unless lang.warnings.empty?
215
215
  aborted = false
216
- Dir.chdir(File.dirname(options[:config])) do
217
- lang.configurators.each do |c|
218
- c.run
219
- break if aborted = c.aborting
220
- c.post_process
216
+ if Platform.release == 'unknown'
217
+ report_fatal("Unable to determine platform flavor and release. You may need to install a package to enable platform detection by command line.")
218
+ aborted = true
219
+ else
220
+ Dir.chdir(File.dirname(options[:config])) do
221
+ lang.configurators.each do |c|
222
+ c.run
223
+ break if aborted = c.aborting
224
+ c.post_process
225
+ end
221
226
  end
222
227
  end
223
228
  project = File.basename(options[:config], CONFIG_EXTENSION).blue
@@ -25,7 +25,8 @@ module RightConf
25
25
  settings :version => 'Cassandra version to install',
26
26
  :install_path => 'Path to Cassandra installation directory, uses /opt/cassandra if it ' +
27
27
  'is writable by the current user or ~/cassandra otherwise by default',
28
- :abort_on_failure => 'Whether to abort if Cassandra failed to install (false by default)'
28
+ :abort_on_failure => 'Whether to abort if Cassandra failed to install (false by default)',
29
+ :endpoint_snitch => 'Set custom endpoint snitch for installed cassandra'
29
30
 
30
31
  validate_has_settings :version
31
32
 
@@ -75,6 +76,15 @@ module RightConf
75
76
  aborting(true)
76
77
  end
77
78
  report_success
79
+ if (endpoint_snitch)
80
+ report_check 'Change cassandra configuration.'
81
+ config_path = File.join(install_path, "apache-cassandra-#{version}", 'conf', 'cassandra.yaml')
82
+ backup_path = File.join(install_path, "apache-cassandra-#{version}", 'conf', 'cassandra.yaml.orig')
83
+ Command.execute('cp', config_path, backup_path)
84
+ Command.execute('sed', '-i', "s%^endpoint_snitch: .*$%endpoint_snitch: #{endpoint_snitch}%", config_path)
85
+ report_success
86
+ post_note "Origin config file in #{backup_path}"
87
+ end
78
88
  end
79
89
  alias :run_darwin :run_linux
80
90
 
@@ -169,7 +169,7 @@ module RightConf
169
169
  "alias nstart='#{install_path}/sbin/nginx'\n" +
170
170
  "alias nstop='#{install_path}/sbin/nginx -s stop'"
171
171
  end
172
- post_note (post_note || '') + "\nNow open http://right-site.rightscale.local:3000 in your browser"
172
+ post_note (post_note || '') + "\nThe nginx settings will make right_site available at http://right-site.rightscale.local:3000"
173
173
  File.delete(File.join(ruby_dir, 'rake')) unless rake_exist
174
174
  report_success
175
175
  end
@@ -180,7 +180,11 @@ module RightConf
180
180
  # === Return
181
181
  # entry(String):: Hosts entry required to run local dev
182
182
  def hosts_entry
183
- '127.0.0.1 right-site.rightscale.local library.rightscale.local rightscale.local'
183
+ "\n" +
184
+ "# added by rconf's passenger_configurator\n"
185
+ "#\n" +
186
+ "255.255.255.255 broadcasthost\n" +
187
+ "127.0.0.1 right-site.rightscale.local library.rightscale.local rightscale.local"
184
188
  end
185
189
 
186
190
  # Nginx error log path
@@ -85,7 +85,7 @@ module RightConf
85
85
  report_failure
86
86
  report_check("Creating gemset #{gemset} for #{version}")
87
87
  Command.execute('rvm', version, 'exec', 'rvm', 'gemset', 'create', gemset,
88
- :abort_on_failure => "Failed to create gemset '#{gemset}'")
88
+ :abort_on_failure => "Failed to create gemset '#{gemset}'")
89
89
  end
90
90
  report_check("Switching to gemset #{gemset}")
91
91
  Command.execute('rvm', version, 'exec', 'rvm', 'gemset', 'use', gemset,
@@ -164,7 +164,7 @@ module RightConf
164
164
  Command.execute('curl', '-O', '-f',
165
165
  "#{RVM_RELEASES_URL}/rvm-#{version}.tar.gz",
166
166
  :abort_on_failure => "Failed to download rvm #{version}")
167
- Command.execute('tar', 'zxf', "rvm-#{version}.tar.gz",
167
+ Command.execute('tar', 'zxf', "rvm-#{version}.tar.gz",
168
168
  :abort_on_failure => "Failed to extract rvm tgz from #{File.join(Dir.getwd, 'rvm-' + version + '.tar.gz')}")
169
169
  end
170
170
  Dir.chdir(File.join(rvm_src, "rvm-#{version}")) do
@@ -186,7 +186,7 @@ module RightConf
186
186
  # === Return
187
187
  # true:: Always return true
188
188
  def install_ruby(ruby)
189
- Platform.dispatch(ruby) { :install_ruby_prerequisites }
189
+ Platform.dispatch(ruby) { :install_ruby_prerequisites }
190
190
  report_check("Installing #{ruby} (this will take a while, please be patient)")
191
191
  Command.execute('rvm', 'install', ruby, :abort_on_failure => 'Failed to install ruby')
192
192
  report_success
@@ -205,7 +205,7 @@ module RightConf
205
205
  report_check("Installing #{ruby} (this will take a while, please be patient)")
206
206
  version = `system_profiler SPDeveloperToolsDataType -xml | xpath "//*[text()='_items']/following-sibling::array/dict/child::key[text()='spdevtools_version']/following-sibling::string/text()" 2> /dev/null`
207
207
  env = {}
208
- if version =~ /^4\.2\.[0-9]+/
208
+ if version =~ /^4\.2\.[0-9]+/
209
209
  if !File.executable?('/usr/bin/gcc-4.2')
210
210
  report_fatal("The C compiler included with Xcode #{version} produces buggy ruby interpreters, please install the C compilers from https://github.com/downloads/kennethreitz/osx-gcc-installer/GCC-10.7-v2.pkg and re-run rconf")
211
211
  else
@@ -218,7 +218,7 @@ module RightConf
218
218
 
219
219
  # Make sure to install all required linux packages first
220
220
  #
221
- # === Return
221
+ # === Return
222
222
  # true:: Always return true
223
223
  def install_ruby_prerequisites_linux_ubuntu(ruby)
224
224
  report_check("Installing required packages, this could take a while")
@@ -226,10 +226,12 @@ module RightConf
226
226
  if ruby =~ /^ree-|^ruby-/
227
227
  packages = %w(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)
228
228
  end # TBD Define packages needed for other rubies
229
- Command.sudo('apt-get', 'install', '-y', *packages)
229
+ Command.sudo('apt-get', 'install', '-y', *packages)
230
230
  report_success
231
231
  end
232
232
 
233
+ alias install_ruby_prerequisites_linux_debian install_ruby_prerequisites_linux_ubuntu
234
+
233
235
  # Make sure to install all required CentOS / RedHhat packages first
234
236
  # NOTE: For centos 5.4 final iconv-devel might not be available :(
235
237
  #
@@ -237,11 +239,11 @@ module RightConf
237
239
  # true:: Always return true
238
240
  def install_ruby_prerequisites_linux_centos(ruby)
239
241
  report_check("Installing required packages, this could take a while")
240
- packages = []
242
+ packages = []
241
243
  if ruby =~ /^ree-|^ruby-/
242
244
  packages = %w(gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel iconv-devel)
243
245
  end # TBD Define packages needed for other rubies
244
- Command.sudo('yum', 'install', '-y', *packages)
246
+ Command.sudo('yum', 'install', '-y', *packages)
245
247
  report_success
246
248
  end
247
249
  alias :install_ruby_prerequisites_linux_redhat :install_ruby_prerequisites_linux_centos
@@ -289,14 +291,14 @@ then
289
291
  if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
290
292
  then
291
293
  . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
292
- fi
294
+ fi
293
295
  else
294
296
  # If the environment file has not yet been created, use the RVM CLI to select.
295
297
  if ! rvm --create "$environment_id"
296
298
  then
297
299
  echo "Failed to create RVM environment '${environment_id}'."
298
300
  return 1
299
- fi
301
+ fi
300
302
  fi
301
303
  if [[ $- == *i* ]] # check for interactive shells
302
304
  then
@@ -13,7 +13,7 @@ module RightConf
13
13
 
14
14
  MAJOR = 0
15
15
  MINOR = 9
16
- BUILD = 20
16
+ BUILD = 21
17
17
 
18
18
  VERSION = [MAJOR, MINOR, BUILD].map(&:to_s).join('.')
19
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rconf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.20
4
+ version: 0.9.21
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-07-06 00:00:00.000000000Z
12
+ date: 2012-08-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70209399567560 !ruby/object:Gem::Requirement
16
+ requirement: &70332318079960 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.5'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70209399567560
24
+ version_requirements: *70332318079960
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: flexmock
27
- requirement: &70209399566940 !ruby/object:Gem::Requirement
27
+ requirement: &70332318079280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0.9'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70209399566940
35
+ version_requirements: *70332318079280
36
36
  description: ! 'rconf configures the environment for a given application. rconf reads
37
37
 
38
38
  the content of an application configuration file and installs and/or