Sha256: 0bbb4ad623350aca474596ddd26ecdd6234e9af1d30b2d0a88bfd742d086b731

Contents?: true

Size: 1.02 KB

Versions: 43

Compression:

Stored size: 1.02 KB

Contents

module Incline
  class CLI
    class Prepare
      
      private
      
      def install_rbenv(shell)
        
        shell.with_stat('Installing rbenv') do
          shell.exec "git clone https://github.com/rbenv/rbenv.git #{shell.home_path}/.rbenv"
          shell.exec "git clone https://github.com/rbenv/ruby-build.git #{shell.home_path}/.rbenv/plugins/ruby-build"

          bashrc = shell.read_file(shell.home_path + '/.bashrc') || ''
          lines = bashrc.split("\n")
          first_line = nil
          lines.each_with_index do |line,index|
            if line.strip[0] != '#'
              first_line = index
              break
            end
          end
          first_line ||= lines.count
          lines.insert first_line, <<-EORC

# Initialize rbenv and ruby.
export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/plugins/ruby-build/bin:$PATH"
eval "$(rbenv init -)"

          EORC

          bashrc = lines.join("\n")
          shell.write_file(shell.home_path + '/.bashrc', bashrc)
        end
        
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
incline-0.3.14 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.13 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.12 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.11 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.10 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.9 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.8 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.7 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.6 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.5 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.4 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.3 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.2 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.1 lib/incline/cli/prepare/install_rbenv.rb
incline-0.3.0 lib/incline/cli/prepare/install_rbenv.rb
incline-0.2.36 lib/incline/cli/prepare/install_rbenv.rb
incline-0.2.35 lib/incline/cli/prepare/install_rbenv.rb
incline-0.2.34 lib/incline/cli/prepare/install_rbenv.rb
incline-0.2.28 lib/incline/cli/prepare/install_rbenv.rb
incline-0.2.27 lib/incline/cli/prepare/install_rbenv.rb