Class: Conify::Command::Global
Defined Under Namespace
Modules: CommandInfo
Instance Attribute Summary
#args, #options
Instance Method Summary
collapse
#initialize
Methods included from Helpers
#allow_user_response, #ask_for_conflux_creds, #ask_for_password, #ask_for_password_on_windows, #camelize, #display, #echo_off, #echo_on, #error, #exclusive_deep_merge, #format_with_bang, #host, #host_url, #kensa_manifest_name, #kensa_manifest_path, #manifest_content, #manifest_filename, #manifest_path, #manually_added_methods, #open_url, #running_on_a_mac?, #running_on_windows?, #site_url, #to_table, #with_tty
Instance Method Details
#init ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/conify/command/global.rb', line 10
def init
if File.exists?(manifest_path)
error "Manifest File #{manifest_filename} already exists."
else
begin
File.open(manifest_path, 'w+') do |f|
f.write(Conify::Manifest.template)
end
display([
"Created new manifest template at #{manifest_filename}.",
"Modify it to your service's specs and then run 'conify test'."
].join("\n"))
rescue Exception => e
File.delete(manifest_path) display "Error initializing conify manifest: #{e.message}"
end
end
end
|
#open ⇒ Object
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/conify/command/global.rb', line 69
def open
if !File.exists?(manifest_path)
error "No Conflux manifest exists yet.\nRun 'conflux init' to create a new manifest."
end
service_id = manifest_content['id'] || ''
error 'Manifest must have an "id" field.' if service_id.empty?
edit_service_url = "#{site_url}/services/#{service_id}/edit"
display "Opening Conflux Service at: #{edit_service_url}"
open_url(edit_service_url)
end
|
#push ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/conify/command/global.rb', line 48
def push
if !File.exists?(manifest_path)
error "No Conflux manifest exists yet.\nRun 'conflux init' to create a new manifest."
end
Conify::ManifestTest.new(manifest_content).call
creds = ask_for_conflux_creds
auth_resp = Conify::Api::Users.new.login(creds)
push_resp = Conify::Api::Addons.new.push(manifest_content, auth_resp['user_token'])
display "Successfully pushed draft service to Conflux!\nRun 'conify open' to finish editing your service's information."
end
|
#test ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/conify/command/global.rb', line 32
def test
begin
data = manifest_content
data['env'] = (@args[0] === '--production') ? 'production' : 'test'
Conify::AllTest.new(data).call
display "Everything checks out!\nRun 'conify push' to push your service to Conflux."
rescue Exception => e
display e.message
end
end
|