Class: Rockette::Exporter
- Inherits:
-
Object
- Object
- Rockette::Exporter
- Includes:
- TextHelper
- Defined in:
- lib/rockette/controller/exporter.rb
Overview
Export and download APEX application
Instance Method Summary collapse
- #do_export(app_id, apps_url, cred) ⇒ Object
-
#initialize ⇒ Exporter
constructor
A new instance of Exporter.
- #launch! ⇒ Object
Methods included from TextHelper
#bail, #check_input, #file_not_found, #no_rockette_dir, #padder
Constructor Details
#initialize ⇒ Exporter
Returns a new instance of Exporter.
11 12 13 14 15 |
# File 'lib/rockette/controller/exporter.rb', line 11 def initialize @pastel = Pastel.new @prompt = TTY::Prompt.new @spinner = TTY::Spinner.new end |
Instance Method Details
#do_export(app_id, apps_url, cred) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rockette/controller/exporter.rb', line 35 def do_export(app_id, apps_url, cred) response = @prompt.yes?("Would you like to enter a filename for the export?") if response == true file = @prompt.ask("Please enter your desired filename:") = Thor::CoreExt::HashWithIndifferentAccess.new "app_id" => app_id, "url" => apps_url, "cred" => cred, "file" => file, "force" => true else puts padder("Saving under default file name: f#{app_id}.sql") = Thor::CoreExt::HashWithIndifferentAccess.new "app_id" => app_id, "url" => apps_url, "cred" => cred, "force" => true end Rockette::Commands::Export.new().execute puts end |
#launch! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rockette/controller/exporter.rb', line 17 def launch! @conf = Psych.load(File.read(CONF)) puts padder("Choose an application to download.") puts # input/action loop loop do enviros = Rockette::Viewer.new.environments list = list_builder(enviros) action = @prompt.select("Which environment is the app found?", list) break if action == list.length apps_url = enviros[action - 1]["deployment_api"] cred = enviros[action - 1]["web_cred"] choose_app(apps_url, cred) end end |