Module: LeapCli::Bootstrap

Extended by:
Bootstrap, LogCommand
Included in:
Bootstrap
Defined in:
lib/leap_cli/bootstrap.rb

Instance Method Summary collapse

Methods included from LogCommand

assert!, bail!, log, log_level, log_raw, logger, new_logger

Instance Method Details

#handle_version(app) ⇒ Object

print out the version string and exit. called from leap executable.



23
24
25
26
27
28
29
30
31
32
# File 'lib/leap_cli/bootstrap.rb', line 23

def handle_version(app)
  puts "leap #{LeapCli::VERSION}, ruby #{RUBY_VERSION}"
  begin
    log_version
  rescue StandardError => exc
    puts exc.to_s
    raise exc if DEBUG
  end
  exit(0)
end

#load_libraries(app) ⇒ Object

load the commands. called from leap executable.



38
39
40
41
42
43
44
45
46
# File 'lib/leap_cli/bootstrap.rb', line 38

def load_libraries(app)
  if LeapCli.logger.log_level >= 2
    log_version
  end
  add_platform_lib_to_path
  load_platform_libraries
  load_commands(app)
  load_macros
end

#setup(argv, leapfile_path = nil) ⇒ Object

the argument leapfile_path is only used for tests



14
15
16
17
# File 'lib/leap_cli/bootstrap.rb', line 14

def setup(argv, leapfile_path=nil)
  setup_logging(argv)
  setup_leapfile(argv, leapfile_path)
end

#setup_global_options(app, global) ⇒ Object

initialize the global options. called from pre.rb



52
53
54
55
56
57
58
59
# File 'lib/leap_cli/bootstrap.rb', line 52

def setup_global_options(app, global)
  if global[:force]
    global[:yes] = true
  end
  if Process::Sys.getuid == 0
    Util.bail! "`leap` should not be run as root."
  end
end