Class: Perkins::Build::Script::Go
Constant Summary
collapse
- DEFAULTS =
{
gobuild_args: '-v',
go: '1.3.1'
}
STAGES, TEMPLATES_PATH
Instance Attribute Summary
#data, #options, #repo, #stack
Instance Method Summary
collapse
#compile, defaults, #initialize
Methods included from Helpers
#announce?, #before_install, #failure, #sh, #stacking
Methods included from Stages
#call_custom_stage, #run_builtin_stage, #run_stage, #run_stages
Instance Method Details
27
28
29
30
31
32
|
# File 'lib/perkins/build/script/go.rb', line 27
def announce
super
'gvm version && ' <<
'go version && ' <<
'go env'
end
|
#cache_slug ⇒ Object
10
11
12
|
# File 'lib/perkins/build/script/go.rb', line 10
def cache_slug
super << "--go-" << config[:go].to_s
end
|
18
19
20
|
# File 'lib/perkins/build/script/go.rb', line 18
def configure
puts "configure"
end
|
22
23
24
25
|
# File 'lib/perkins/build/script/go.rb', line 22
def export
super
"export GO_VERSION=#{go_version}"
end
|
54
55
56
57
58
59
60
|
# File 'lib/perkins/build/script/go.rb', line 54
def install
if uses_make?
'true'
else
"go get #{config[:gobuild_args]} ./..."
end
end
|
#pre_setup ⇒ Object
14
15
16
|
# File 'lib/perkins/build/script/go.rb', line 14
def pre_setup
puts "configure"
end
|
62
63
64
65
66
67
68
|
# File 'lib/perkins/build/script/go.rb', line 62
def script
if uses_make?
'make'
else
"go test #{config[:gobuild_args]} ./..."
end
end
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/perkins/build/script/go.rb', line 34
def setup
super
"gvm get &&" <<
"gvm update && source #{HOME_DIR}/.gvm/scripts/gvm && " <<
"gvm install #{go_version} --binary || gvm install #{go_version} && " <<
"gvm use #{go_version} && "
source_path = repo.url.gsub(/https\:\/\/|\.git/, "")
source_owner_path = source_path.split('/')[0..1].join("/")
local_path = self.repo.working_dir + self.repo.download_name
"export GOPATH=#{HOME_DIR}/gopath:$GOPATH && " <<
"mkdir -p #{HOME_DIR}/gopath/src/#{source_owner_path} && " <<
"cp -r #{local_path} #{HOME_DIR}/gopath/src/#{source_owner_path} && " <<
"export BUILD_DIR=#{HOME_DIR}/gopath/src/#{source_path} && " <<
"cd #{HOME_DIR}/gopath/src/#{source_path}"
end
|