lib/rconf/configurators/ruby_configurator.rb in rconf-0.9.20 vs lib/rconf/configurators/ruby_configurator.rb in rconf-0.9.21

- old
+ new

@@ -83,11 +83,11 @@ report_success else report_failure report_check("Creating gemset #{gemset} for #{version}") Command.execute('rvm', version, 'exec', 'rvm', 'gemset', 'create', gemset, - :abort_on_failure => "Failed to create gemset '#{gemset}'") + :abort_on_failure => "Failed to create gemset '#{gemset}'") end report_check("Switching to gemset #{gemset}") Command.execute('rvm', version, 'exec', 'rvm', 'gemset', 'use', gemset, :abort_on_failure => "Failed to switch to gemset '#{gemset}'") report_success @@ -162,11 +162,11 @@ FileUtils.mkdir_p(rvm_src) Dir.chdir(rvm_src) do Command.execute('curl', '-O', '-f', "#{RVM_RELEASES_URL}/rvm-#{version}.tar.gz", :abort_on_failure => "Failed to download rvm #{version}") - Command.execute('tar', 'zxf', "rvm-#{version}.tar.gz", + Command.execute('tar', 'zxf', "rvm-#{version}.tar.gz", :abort_on_failure => "Failed to extract rvm tgz from #{File.join(Dir.getwd, 'rvm-' + version + '.tar.gz')}") end Dir.chdir(File.join(rvm_src, "rvm-#{version}")) do Command.execute('./install', :abort_on_failure => "Failed to install rvm #{version}") end @@ -184,11 +184,11 @@ # ruby(String):: Ruby version compatible with rvm # # === Return # true:: Always return true def install_ruby(ruby) - Platform.dispatch(ruby) { :install_ruby_prerequisites } + Platform.dispatch(ruby) { :install_ruby_prerequisites } report_check("Installing #{ruby} (this will take a while, please be patient)") Command.execute('rvm', 'install', ruby, :abort_on_failure => 'Failed to install ruby') report_success true end @@ -203,11 +203,11 @@ # true:: Always return true def install_ruby_darwin(ruby) report_check("Installing #{ruby} (this will take a while, please be patient)") 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 = {} - if version =~ /^4\.2\.[0-9]+/ + if version =~ /^4\.2\.[0-9]+/ if !File.executable?('/usr/bin/gcc-4.2') 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") else env['CC'] = '/usr/bin/gcc-4.2' end @@ -216,34 +216,36 @@ report_success end # Make sure to install all required linux packages first # - # === Return + # === Return # true:: Always return true def install_ruby_prerequisites_linux_ubuntu(ruby) report_check("Installing required packages, this could take a while") packages = [] if ruby =~ /^ree-|^ruby-/ 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) end # TBD Define packages needed for other rubies - Command.sudo('apt-get', 'install', '-y', *packages) + Command.sudo('apt-get', 'install', '-y', *packages) report_success end + alias install_ruby_prerequisites_linux_debian install_ruby_prerequisites_linux_ubuntu + # Make sure to install all required CentOS / RedHhat packages first # NOTE: For centos 5.4 final iconv-devel might not be available :( # # === Return # true:: Always return true def install_ruby_prerequisites_linux_centos(ruby) report_check("Installing required packages, this could take a while") - packages = [] + packages = [] if ruby =~ /^ree-|^ruby-/ packages = %w(gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel iconv-devel) end # TBD Define packages needed for other rubies - Command.sudo('yum', 'install', '-y', *packages) + Command.sudo('yum', 'install', '-y', *packages) report_success end alias :install_ruby_prerequisites_linux_redhat :install_ruby_prerequisites_linux_centos # No pre-requesites to install ree or Matz ruby on Mac (TBD others) @@ -287,17 +289,17 @@ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id" if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] then . "${rvm_path:-$HOME/.rvm}/hooks/after_use" - fi + fi else # If the environment file has not yet been created, use the RVM CLI to select. if ! rvm --create "$environment_id" then echo "Failed to create RVM environment '${environment_id}'." return 1 - fi + fi fi if [[ $- == *i* ]] # check for interactive shells then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green else