Class: Autoproj::CLI::Bootstrap
- Inherits:
-
Object
- Object
- Autoproj::CLI::Bootstrap
- Includes:
- Ops::Tools
- Defined in:
- lib/autoproj/cli/bootstrap.rb
Instance Attribute Summary collapse
-
#root_dir ⇒ Object
readonly
Returns the value of attribute root_dir.
Instance Method Summary collapse
-
#initialize(root_dir = Dir.pwd) ⇒ Bootstrap
constructor
A new instance of Bootstrap.
- #notify_env_sh_updated ⇒ Object
- #run(buildconf_info, interactive: nil, **options) ⇒ Object
- #validate_options(args, options) ⇒ Object
Methods included from Ops::Tools
#common_options, #create_autobuild_package, #load_autoprojrc, #load_main_initrb
Constructor Details
#initialize(root_dir = Dir.pwd) ⇒ Bootstrap
Returns a new instance of Bootstrap.
13 14 15 16 17 18 19 |
# File 'lib/autoproj/cli/bootstrap.rb', line 13 def initialize(root_dir = Dir.pwd) if File.exist?(File.join(root_dir, "autoproj", "manifest")) raise CLIException, "this installation is already bootstrapped. Remove the autoproj directory if it is not the case" end @root_dir = root_dir end |
Instance Attribute Details
#root_dir ⇒ Object (readonly)
Returns the value of attribute root_dir.
11 12 13 |
# File 'lib/autoproj/cli/bootstrap.rb', line 11 def root_dir @root_dir end |
Instance Method Details
#notify_env_sh_updated ⇒ Object
89 90 |
# File 'lib/autoproj/cli/bootstrap.rb', line 89 def notify_env_sh_updated end |
#run(buildconf_info, interactive: nil, **options) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/autoproj/cli/bootstrap.rb', line 36 def run(buildconf_info, interactive: nil, **) ws = Workspace.new(root_dir) ws.config.interactive = interactive unless interactive.nil? ws.setup seed_config = .delete(:seed_config) switcher = Ops::MainConfigSwitcher.new(ws) check_root_dir_empty = ws.config.interactive? && switcher.check_root_dir_empty? begin switcher.bootstrap(buildconf_info, check_root_dir_empty: check_root_dir_empty, **) if seed_config FileUtils.cp seed_config, File.join(ws.config_dir, "config.yml") end STDOUT.puts <<-EOTEXT #{Autoproj.color('autoproj bootstrap successfully finished', :green, :bold)} #{Autoproj.color('To further use autoproj and the installed software', :bold)}, you must add the following line at the bottom of your .bashrc: source #{root_dir}/#{Autoproj::ENV_FILENAME} WARNING: autoproj will not work until your restart all your consoles, or run the following in them: $ source #{root_dir}/#{Autoproj::ENV_FILENAME} #{Autoproj.color('To import and build the packages', :bold)}, you can now run aup amake The resulting software is installed in #{ws.prefix_dir} EOTEXT rescue RuntimeError STDERR.puts <<-EOTEXT #{Autoproj.color('autoproj bootstrap failed', :red, :bold)} To retry, first source the #{Autoproj::ENV_FILENAME} script with source #{root_dir}/#{Autoproj::ENV_FILENAME} and then re-run autoproj bootstrap autoproj bootstrap '#{ARGV.join("'")}' EOTEXT raise end end |
#validate_options(args, options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/autoproj/cli/bootstrap.rb', line 21 def (args, ) args, = Base.(args, ) if (path = [:reuse]) path = ENV["AUTOPROJ_CURRENT_ROOT"] if path == "reuse" path = File.(path) if !File.directory?(path) || !File.directory?(File.join(path, "autoproj")) raise CLIInvalidArguments, "#{path} does not look like an autoproj installation" end [:reuse] = [path] end [args, ] end |