class Conify::Command::Global
Public Instance Methods
init()
click to toggle source
# File lib/conify/command/global.rb, line 10 def init # Error out if conflux-manifest.json already exists if File.exists?(manifest_path) error "Manifest File #{manifest_filename} already exists." else begin # Create new conflux-manifest.json file from template 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) # Remove file if something screws up during file creation display "Error initializing conify manifest: #{e.message}" end end end
open()
click to toggle source
# File lib/conify/command/global.rb, line 69 def open # First ensure manifest exists. 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()
click to toggle source
# File lib/conify/command/global.rb, line 48 def push # First ensure manifest exists. if !File.exists?(manifest_path) error "No Conflux manifest exists yet.\nRun 'conflux init' to create a new manifest." end # Run Manifest Test to ensure file is valid. Conify::ManifestTest.new(manifest_content).call # Request Conflux email/password creds. creds = ask_for_conflux_creds # Login to Conflux with these creds, returning a valid user-token. auth_resp = Conify::Api::Users.new.login(creds) # Push new service to Conflux. 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()
click to toggle source
# File lib/conify/command/global.rb, line 32 def test begin # Get the content from conflux-manifest.json and add the 'env' # key specifying which environment to test. data = manifest_content data['env'] = (@args[0] === '--production') ? 'production' : 'test' # Run all tests to ensure Conflux integration is set up correctly 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