Sha256: 43bd0d45e560e32c7200d8fc8a2c506b949f7204696529c1a3db87a14515eb9e

Contents?: true

Size: 910 Bytes

Versions: 1

Compression:

Stored size: 910 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")
      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

1 entries across 1 versions & 1 rubygems

Version Path
codelation-cli-0.0.27 lib/codelation/development/ruby.rb