Class: Vx::Builder::ScriptBuilder::Go

Inherits:
Base
  • Object
show all
Defined in:
lib/vx/builder/script_builder/go.rb

Constant Summary collapse

DEFAULT_GO =
'1.2'

Instance Attribute Summary

Attributes inherited from Base

#app

Instance Method Summary collapse

Methods inherited from Base

#deploy?, #do_after_deploy, #do_announce, #do_before_deploy, #do_before_install, #do_before_script, #do_cache_key, #do_cached_directories, #do_deploy_script, #do_init, #do_install, #do_script

Methods included from Helper::VxvmInstall

#vxvm_install

Methods included from Helper::TraceShCommand

#trace_sh_command

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/vx/builder/script_builder/go.rb', line 9

def call(env)
  if enabled?(env)
    vxvm_install(env, 'go', go_version(env))

    do_before_install(env) do |i|
      i << trace_sh_command('export GOPATH=$VX_ROOT/gopath:$GOPATH')
      i << trace_sh_command('export PATH=$VX_ROOT/gopath/bin:$PATH')
      i << trace_sh_command('export VX_ORIG_CODE_ROOT=$(pwd)')
      i << trace_sh_command("export VX_NEW_CODE_ROOT=$VX_ROOT/gopath/src/#{project_path env}")

      i << trace_sh_command('mkdir -p $VX_NEW_CODE_ROOT')
      i << trace_sh_command('rmdir $VX_NEW_CODE_ROOT')
      i << trace_sh_command('mv $VX_ORIG_CODE_ROOT $VX_NEW_CODE_ROOT')
      i << trace_sh_command('ln -s $VX_NEW_CODE_ROOT $VX_ORIG_CODE_ROOT')
      i << trace_sh_command('cd $VX_NEW_CODE_ROOT')
    end

    do_announce(env) do |i|
      i << trace_sh_command("go version")
      i << trace_sh_command("go env")
    end

    do_install(env) do |i|
      i << trace_sh_command("go get -v ./...")
    end

    do_script(env) do |i|
      i << trace_sh_command("go test -v ./...")
    end
  end

  app.call(env)
end