Class: SSC::Handler::Build
- Inherits:
-
Base
- Object
- Thor
- Base
- SSC::Handler::Build
show all
- Defined in:
- lib/handlers/build.rb
Constant Summary
Constants inherited
from Base
SSC::Handler::Base::API_URL
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Methods included from Helper
included
Instance Method Details
#build ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/handlers/build.rb', line 10
def build
require_appliance_directory do |appliance, files|
if appliance.status.state != "ok"
raise Thor::Error, "Appliance is not OK. Please fix before building.\n#{appliance.status.issues.join("\n")}\n"
else
build = StudioApi::RunningBuild.new(:appliance_id => appliance.id, :image_type => options.image_type, :force => true)
build.save
config_file= File.join(Dir.pwd, '.sscrc')
if File.exists?(config_file)
config= YAML::load(File.read(config_file))
config.merge!('latest_build_id' => build.id)
File.open(config_file, 'w') do |file|
file.write(config.to_yaml)
end
end
say "Build Started. Build id: #{build.id}"
end
end
end
|
#list ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/handlers/build.rb', line 42
def list
builds= if options.running?
StudioApi::RunningBuild.find(:all, :params => {:appliance_id => options.appliance_id})
else
StudioApi::Build.find(:all, :params => {:appliance_id => options.appliance_id})
end
say "Build List:\n"
builds_info = builds.collect{ |i|
[i.id, "v#{i.version}", i.state, format_download_url(i)]
}
print_table([["id", "version", "state", "download link"]]+ builds_info)
end
|
#status ⇒ Object
33
34
35
36
37
|
# File 'lib/handlers/build.rb', line 33
def status
build = StudioApi::RunningBuild.find options.build_id
say "Build Status: #{build.state}"
say "#{build.percent}% completed" if build.state == "running"
end
|