Module: CLI::Mastermind

Extended by:
UserInterface
Defined in:
lib/cli/mastermind.rb,
lib/cli/mastermind/plan.rb,
lib/cli/mastermind/errors.rb,
lib/cli/mastermind/loader.rb,
lib/cli/mastermind/version.rb,
lib/cli/mastermind/arg_parse.rb,
lib/cli/mastermind/configuration.rb,
lib/cli/mastermind/plan/interface.rb,
lib/cli/mastermind/loader/planfile_loader.rb

Defined Under Namespace

Modules: UserInterface, VERSION Classes: ArgParse, Configuration, Error, InvalidPlanError, Loader, Plan, UnsupportedFileTypeError

Class Method Summary collapse

Methods included from UserInterface

ask, concurrently, confirm, enable_ui, frame, select, spinner, stylize, titleize, ui_enabled?

Class Method Details

.configurationObject

Expose the configuration loaded during execute.



17
18
19
# File 'lib/cli/mastermind.rb', line 17

def configuration
  @config
end

.execute(cli_args = ARGV) ⇒ Object

Process incoming options and take an appropriate action. This is normally called by the mastermind executable.



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/cli/mastermind.rb', line 23

def execute(cli_args=ARGV)
  @arguments = ArgParse.new(cli_args)

  enable_ui if @arguments.display_ui?

  frame('Mastermind') do
    @config = spinner('Loading configuration') { Configuration.new }

    if @arguments.dump_config?
      do_print_configuration
      exit 0
    end

    @plans = spinner('Loading plans') { @config.load_plans }

    if @arguments.display_plans?
      do_filtered_plan_display
      exit 0
    end

    process_plan_names

    do_interactive_plan_selection until executable_plan_selected?

    if user_is_sure?
      execute_plan!
    else
      puts 'aborted!'
    end
  end
end

.gem_versionObject



4
5
6
# File 'lib/cli/mastermind/version.rb', line 4

def self.gem_version
  Gem::Version.new VERSION::STRING
end