Module: Expansions::CLIInterface

Extended by:
CLIInterface
Included in:
CLIInterface
Defined in:
lib/expansions/cli_interface.rb

Instance Method Summary collapse

Instance Method Details

#ensure_expansion_file_provided(file) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/expansions/cli_interface.rb', line 9

def ensure_expansion_file_provided(file)
  unless File.exist?(file)
    print <<-prompt
dwp_expand aborted!
No Expansionfile found (looking for: ExpansionFile)
    prompt
    exit
  end
end

#get_expansion_file_name(args) ⇒ Object



5
6
7
# File 'lib/expansions/cli_interface.rb', line 5

def get_expansion_file_name(args)
  return args.count > 0 ? args[0] : "ExpansionFile"
end

#run(*args) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/expansions/cli_interface.rb', line 19

def run(*args)
  file_to_run = get_expansion_file_name(args)
  ensure_expansion_file_provided file_to_run
  Startup.run
  load file_to_run
  Expansion.instance.run
end