Class: Mobilis::InteractiveDesigner
- Inherits:
-
Object
- Object
- Mobilis::InteractiveDesigner
- Extended by:
- Forwardable
- Defined in:
- lib/mobilis/interactive_designer.rb
Instance Attribute Summary collapse
-
#project ⇒ Object
Returns the value of attribute project.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
Instance Method Summary collapse
- #blank_space ⇒ Object
-
#choose_destination ⇒ Object
display, choices, and action methods all change per-state.
-
#initialize ⇒ InteractiveDesigner
constructor
A new instance of InteractiveDesigner.
- #new_relic_license_key ⇒ Object
- #reload!(print = true) ⇒ Object
- #spacer ⇒ Object
Constructor Details
#initialize ⇒ InteractiveDesigner
Returns a new instance of InteractiveDesigner.
405 406 407 408 409 |
# File 'lib/mobilis/interactive_designer.rb', line 405 def initialize super() @prompt = TTY::Prompt.new @project = Project.new end |
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project.
17 18 19 |
# File 'lib/mobilis/interactive_designer.rb', line 17 def project @project end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
18 19 20 |
# File 'lib/mobilis/interactive_designer.rb', line 18 def prompt @prompt end |
Instance Method Details
#blank_space ⇒ Object
437 438 439 |
# File 'lib/mobilis/interactive_designer.rb', line 437 def blank_space puts "" end |
#choose_destination ⇒ Object
display, choices, and action methods all change per-state
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
# File 'lib/mobilis/interactive_designer.rb', line 413 def choose_destination Mobilis.logger.info "#choose_destination" blank_space spacer display spacer blank_space if some_choices = choices then prompt.select("Choose your Path", some_choices, per_page: 20) else Mobilis.logger.info "No choices found, running action instead" action end end |
#new_relic_license_key ⇒ Object
429 430 431 |
# File 'lib/mobilis/interactive_designer.rb', line 429 def new_relic_license_key ENV.fetch "NEW_RELIC_LICENSE_KEY", false end |
#reload!(print = true) ⇒ Object
441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/mobilis/interactive_designer.rb', line 441 def reload!(print = true) puts 'Reloading ...' if print # Main project directory. root_dir = File.('../..', __dir__) # Directories within the project that should be reloaded. reload_dirs = %w{lib} # Loop through and reload every file in all relevant project directories. reload_dirs.each do |dir| Dir.glob("#{root_dir}/#{dir}/**/*.rb").each { |f| load(f) } end # Return true when complete. true end |
#spacer ⇒ Object
433 434 435 |
# File 'lib/mobilis/interactive_designer.rb', line 433 def spacer puts "|+--------------------------------------------------------+|" end |