class Autoproj::CLI::Bootstrap
Attributes
root_dir[R]
Public Class Methods
new(root_dir = Dir.pwd)
click to toggle source
# 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
Public Instance Methods
notify_env_sh_updated()
click to toggle source
# File lib/autoproj/cli/bootstrap.rb, line 89 def notify_env_sh_updated end
run(buildconf_info, interactive: nil, **options)
click to toggle source
# File lib/autoproj/cli/bootstrap.rb, line 36 def run(buildconf_info, interactive: nil, **options) ws = Workspace.new(root_dir) ws.config.interactive = interactive unless interactive.nil? ws.setup seed_config = options.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, **options) 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)
click to toggle source
# File lib/autoproj/cli/bootstrap.rb, line 21 def validate_options(args, options) args, options = Base.validate_options(args, options) if (path = options[:reuse]) path = ENV["AUTOPROJ_CURRENT_ROOT"] if path == "reuse" path = File.expand_path(path) if !File.directory?(path) || !File.directory?(File.join(path, "autoproj")) raise CLIInvalidArguments, "#{path} does not look like an autoproj installation" end options[:reuse] = [path] end [args, options] end