lib/codelation/development/ruby.rb in codelation-cli-0.0.2 vs lib/codelation/development/ruby.rb in codelation-cli-0.0.3

- old
+ new

@@ -9,13 +9,15 @@ private # Install Ruby binary and add it to PATH. def install_ruby - puts RUBY_VERSION return if `~/.codelation/ruby/bin/ruby -v`.include?(RUBY_VERSION) + # Create the directory ~/.codelation/temp if it doesn't exist + FileUtils.mkdir_p("~/.codelation/temp") + print_command("Installing ruby-install") install_ruby_install print_command("Installing Ruby #{RUBY_VERSION} to ~/.codelation/ruby") `ruby-install -i ~/.codelation/ruby ruby #{RUBY_VERSION}` @@ -33,14 +35,14 @@ `~/.codelation/ruby/bin/gem install scss-lint` end # Install ruby-install from https://github.com/postmodern/ruby-install. def install_ruby_install - @downloaded_file_path = File.join(Cli.source_root, "temp", "ruby-install.tar.gz") + @downloaded_file_path = File.join("~/.codelation", "temp", "ruby-install.tar.gz") `curl -L -o #{@downloaded_file_path} #{RUBY_INSTALL_URL}` - `tar -xzvf #{@downloaded_file_path} -C #{File.join(Cli.source_root, "temp")}` + `tar -xzvf #{@downloaded_file_path} -C #{File.join("~/.codelation", "temp")}` - @extracted_path = File.join(Cli.source_root, "temp", "ruby-install-#{RUBY_INSTALL_VERSION}") + @extracted_path = File.join("~/.codelation", "temp", "ruby-install-#{RUBY_INSTALL_VERSION}") `cd #{@extracted_path} && sudo make install` end # Delete temporary files from installing Ruby. def ruby_install_cleanup