Sha256: 68f85228db1cdc110a8efb58e44fa45b36a388d2620eb0fcf87de4eb8aa77066

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

module VagrantPlugins
  module Ventriloquist
    module Cap
      module Debian
        module GoInstall
          def self.go_install(machine, version)
            return if machine.communicate.test('which go > /dev/null')

            src      = "https://go.googlecode.com/files/go#{version}.linux-amd64.tar.gz"
            bin_path = "/usr/local/go/bin"
            go_path  = "$HOME/go"

            machine.env.ui.info("Installing go #{version}")
            machine.communicate.tap do |comm|
              comm.sudo('apt-get install curl -y -q')
              # TODO: Use download + untar capability
              comm.execute("cd /usr/local && curl #{src} | sudo tar xzfv -")

              if ! comm.test("grep -q '#{bin_path}' /etc/profile.d/ventriloquist.sh 2>/dev/null")
                comm.sudo("echo 'export PATH=$PATH:#{bin_path}' >> /etc/profile.d/ventriloquist.sh")
              end

              comm.execute("mkdir -p #{go_path}") if ! comm.test("test -d #{go_path}")

              if ! comm.test("grep -q '#{go_path}' /etc/profile.d/ventriloquist.sh 2>/dev/null")
                comm.sudo("echo 'export GOPATH=#{go_path}' >> /etc/profile.d/ventriloquist.sh")
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ventriloquist-0.3.2 lib/ventriloquist/cap/debian/go_install.rb
ventriloquist-0.3.1 lib/ventriloquist/cap/debian/go_install.rb
ventriloquist-0.3.0 lib/ventriloquist/cap/debian/go_install.rb
ventriloquist-0.2.1 lib/ventriloquist/cap/debian/go_install.rb
ventriloquist-0.2.0 lib/ventriloquist/cap/debian/go_install.rb
ventriloquist-0.1.0 lib/ventriloquist/cap/debian/go_install.rb