Sha256: ac2472b0700edf8a1667d15277aecd55e5d21099616b81f688e17e18dc893dd1

Contents?: true

Size: 941 Bytes

Versions: 4

Compression:

Stored size: 941 Bytes

Contents

require "fileutils"
require "thor"

module Codelation
  class Cli < Thor
    RUBY_VERSION = "2.3.1".freeze

  private

    # Install Ruby binary and add it to PATH.
    def install_ruby
      return if `ruby -v`.include?(RUBY_VERSION)

      # Make sure chruby is loaded
      `source ~/.bash_profile`

      # Remove existing Ruby install from older version
      ruby_directory = File.expand_path("~/.codelation/ruby")
      FileUtils.rm_rf(ruby_directory) if Dir.exist?(ruby_directory)

      print_command("Installing Ruby #{RUBY_VERSION}")
      `ruby-install ruby #{RUBY_VERSION}`

      print_heading("Installing Ruby Gems")
      `chruby #{RUBY_VERSION}`
      install_gems
    end

    # Install the Ruby gems needed for development.
    def install_gems
      %w(bundler codelation-cli dogids-cli rubocop scss_lint).each do |gem|
        print_command("gem install #{gem}")
        `gem install #{gem}`
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
codelation-cli-0.2.0 lib/codelation/development/ruby.rb
codelation-cli-0.1.1 lib/codelation/development/ruby.rb
codelation-cli-0.1.0 lib/codelation/development/ruby.rb
codelation-cli-0.0.28 lib/codelation/development/ruby.rb