lib/rconf/configurators/ruby_configurator.rb in rconf-1.0.1 vs lib/rconf/configurators/ruby_configurator.rb in rconf-1.0.3

- old
+ new

@@ -105,23 +105,15 @@ # Check .ruby-version and its content # # === Return # true:: Always return true def check_ruby - exists = File.exist?('.ruby-version') - if exists - contents = IO.read('.ruby-version') - right_ruby = !!(contents =~ /#{ruby_version}/) + unless Command.execute('rbenv', 'local', ruby_version).success? + report_check("Installing ruby #{ruby_version} (this will take a while, please be patient)") + Platform.dispatch(ruby_version) { :install_ruby } + Command.execute('rbenv', 'local', ruby_version) end - - unless exists && right_ruby - unless Command.execute('rbenv', 'local', ruby_version).success? - report_check("Installing ruby #{ruby} (this will take a while, please be patient)") - Platform.dispatch(ruby_version) { :install_ruby } - Command.execute('rbenv', 'local', ruby_version) - end - end true end # Install given ruby version using rbenv # Install any prerequesites first @@ -146,9 +138,10 @@ # ruby(String):: Ruby version compatible with rbenv # # === Return # true:: Always return true def install_ruby_darwin(ruby) + Platform.dispatch(ruby) { :install_ruby_prerequisites } c_version = `system_profiler SPDeveloperToolsDataType -xml | xpath "//*[text()='_items']/following-sibling::array/dict/child::key[text()='spdevtools_version']/following-sibling::string/text()" 2> /dev/null` env = {} gcc42 = ['/usr/bin/gcc-4.2', '/usr/local/bin/gcc-4.2'].detect { |p| File.executable?(p) } if c_version =~ /^4\.2\.[0-9]+/ if !gcc42