autoproj 2.7.1 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
 - data/Rakefile +31 -1
 - data/autoproj.gemspec +2 -0
 - data/bin/alocate +3 -5
 - data/bin/alog +3 -3
 - data/bin/amake +3 -4
 - data/bin/aup +4 -3
 - data/bin/autoproj +1 -6
 - data/bin/autoproj_bootstrap +153 -47
 - data/bin/autoproj_install +153 -47
 - data/lib/autoproj/autobuild_extensions/dsl.rb +5 -0
 - data/lib/autoproj/bash_completion.rb +26 -0
 - data/lib/autoproj/cli/base.rb +4 -4
 - data/lib/autoproj/cli/build.rb +2 -3
 - data/lib/autoproj/cli/main.rb +52 -2
 - data/lib/autoproj/cli/main_global.rb +39 -0
 - data/lib/autoproj/cli/osdeps.rb +2 -1
 - data/lib/autoproj/cli/update.rb +13 -1
 - data/lib/autoproj/configuration.rb +14 -2
 - data/lib/autoproj/environment.rb +48 -31
 - data/lib/autoproj/ops/install.rb +153 -47
 - data/lib/autoproj/shell_completion.rb +164 -0
 - data/lib/autoproj/templates/helpers.bash.erb +79 -0
 - data/lib/autoproj/templates/helpers.zsh.erb +38 -0
 - data/lib/autoproj/templates/main.bash.erb +35 -0
 - data/lib/autoproj/templates/main.zsh.erb +9 -0
 - data/lib/autoproj/templates/subcommand.bash.erb +50 -0
 - data/lib/autoproj/templates/subcommand.zsh.erb +51 -0
 - data/lib/autoproj/version.rb +1 -1
 - data/lib/autoproj/workspace.rb +97 -19
 - data/lib/autoproj/zsh_completion.rb +43 -0
 - data/shell/autoproj_bash +67 -0
 - data/shell/autoproj_zsh +26 -0
 - data/shell/completion/alocate_bash +68 -0
 - data/shell/completion/alocate_zsh +22 -0
 - data/shell/completion/alog_bash +61 -0
 - data/shell/completion/alog_zsh +20 -0
 - data/shell/completion/amake_bash +77 -0
 - data/shell/completion/amake_zsh +27 -0
 - data/shell/completion/aup_bash +89 -0
 - data/shell/completion/aup_zsh +34 -0
 - data/shell/completion/autoproj_bash +1556 -0
 - data/shell/completion/autoproj_zsh +1005 -0
 - metadata +51 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 74382a8f78adb1bf83f20565bccc8c76972780b497bdd047559d520ed5486b09
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 55bcf45cd3caa0fa840ef9b70dc8679b476669f27362b2181a5cb424005d0b63
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: d407340e19a489609da4e291bcb09f271db61e917ff345d94160e4546c10222cbaf67158f6c59ed0b2c093520011f7c156acbcaaf7c059e52cc89c7100a5b0cb
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 68975b05b8470110377ac2b3519759351fc8c03d6df8c088e9712da35beca5a5305b699134189a83cf844ed94664d9b9825bb6b5195598a1efdbcb41b8dd4400
         
     | 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -25,5 +25,35 @@ task 'bootstrap' do 
     | 
|
| 
       25 
25 
     | 
    
         
             
                    end
         
     | 
| 
       26 
26 
     | 
    
         
             
                end
         
     | 
| 
       27 
27 
     | 
    
         
             
            end
         
     | 
| 
       28 
     | 
    
         
            -
            file 'bin/autoproj_bootstrap' => 'bootstrap'
         
     | 
| 
       29 
28 
     | 
    
         | 
| 
      
 29 
     | 
    
         
            +
            require 'autoproj/bash_completion'
         
     | 
| 
      
 30 
     | 
    
         
            +
            require 'autoproj/zsh_completion'
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            shells = [['bash', Autoproj::BashCompletion], ['zsh', Autoproj::ZshCompletion]]
         
     | 
| 
      
 33 
     | 
    
         
            +
            clis = [%w[alocate locate], %w[alog log], %w[amake build], %w[aup update],
         
     | 
| 
      
 34 
     | 
    
         
            +
                    ['autoproj', nil]]
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            shell_dir = File.join(Dir.pwd, 'shell')
         
     | 
| 
      
 37 
     | 
    
         
            +
            completion_dir = File.join(shell_dir, 'completion')
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            desc 'generate the shell helpers scripts'
         
     | 
| 
      
 40 
     | 
    
         
            +
            task 'helpers' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                require 'erb'
         
     | 
| 
      
 42 
     | 
    
         
            +
                templates_dir = File.join(Dir.pwd, 'lib', 'autoproj', 'templates')
         
     | 
| 
      
 43 
     | 
    
         
            +
                FileUtils.mkdir_p(completion_dir)
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
                shells.each do |shell|
         
     | 
| 
      
 46 
     | 
    
         
            +
                    clis.each do |cli|
         
     | 
| 
      
 47 
     | 
    
         
            +
                        completion = shell[1].new(cli[0], command: cli[1])
         
     | 
| 
      
 48 
     | 
    
         
            +
                        completion_file = File.join(completion_dir, "#{cli[0]}_#{shell[0]}")
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                        IO.write(completion_file, completion.generate)
         
     | 
| 
      
 51 
     | 
    
         
            +
                    end
         
     | 
| 
      
 52 
     | 
    
         
            +
                    erb = File.read(File.join(templates_dir, "helpers.#{shell[0]}.erb"))
         
     | 
| 
      
 53 
     | 
    
         
            +
                    helper_file = File.join(shell_dir, "autoproj_#{shell[0]}")
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                    IO.write(helper_file, ::ERB.new(erb, nil, '-').result(binding))
         
     | 
| 
      
 56 
     | 
    
         
            +
                end
         
     | 
| 
      
 57 
     | 
    
         
            +
            end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            file 'bin/autoproj_bootstrap' => 'bootstrap'
         
     | 
    
        data/autoproj.gemspec
    CHANGED
    
    | 
         @@ -34,9 +34,11 @@ Gem::Specification.new do |s| 
     | 
|
| 
       34 
34 
     | 
    
         
             
                s.add_runtime_dependency 'tty-prompt', '~> 0.15.0'
         
     | 
| 
       35 
35 
     | 
    
         
             
                s.add_runtime_dependency 'tty-spinner', '~> 0.8.0'
         
     | 
| 
       36 
36 
     | 
    
         
             
                s.add_runtime_dependency 'rb-inotify' if RbConfig::CONFIG['target_os'] =~ /linux/
         
     | 
| 
      
 37 
     | 
    
         
            +
                s.add_runtime_dependency 'xdg'
         
     | 
| 
       37 
38 
     | 
    
         
             
                s.add_development_dependency "flexmock", '~> 2.0', ">= 2.0.0"
         
     | 
| 
       38 
39 
     | 
    
         
             
                s.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
         
     | 
| 
       39 
40 
     | 
    
         
             
                s.add_development_dependency "simplecov"
         
     | 
| 
       40 
41 
     | 
    
         
             
                s.add_development_dependency "aruba"
         
     | 
| 
      
 42 
     | 
    
         
            +
                s.add_development_dependency "tty-cursor"
         
     | 
| 
       41 
43 
     | 
    
         
             
            end
         
     | 
| 
       42 
44 
     | 
    
         | 
    
        data/bin/alocate
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #! /usr/bin/env ruby
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'autoproj/cli/main'
         
     | 
| 
       4 
     | 
    
         
            -
            Autoproj::CLI.basic_setup
         
     | 
| 
      
 4 
     | 
    
         
            +
            argv = Autoproj::CLI.basic_setup
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            class Alocate < Autoproj::CLI::Main
         
     | 
| 
       7 
7 
     | 
    
         
             
                def self.banner(*)
         
     | 
| 
         @@ -10,13 +10,11 @@ class Alocate < Autoproj::CLI::Main 
     | 
|
| 
       10 
10 
     | 
    
         
             
            end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            begin
         
     | 
| 
       13 
     | 
    
         
            -
                if  
     | 
| 
      
 13 
     | 
    
         
            +
                if argv.include?('--help') || argv.include?('help')
         
     | 
| 
       14 
14 
     | 
    
         
             
                    Alocate.start(['help', 'locate'])
         
     | 
| 
       15 
15 
     | 
    
         
             
                else
         
     | 
| 
       16 
     | 
    
         
            -
                    Alocate.start(['locate', * 
     | 
| 
      
 16 
     | 
    
         
            +
                    Alocate.start(['locate', *argv])
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
            rescue Interrupt
         
     | 
| 
       19 
19 
     | 
    
         
             
                # Already notified in the reporting infrastructure
         
     | 
| 
       20 
20 
     | 
    
         
             
            end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
    
        data/bin/alog
    CHANGED
    
    | 
         @@ -3,7 +3,8 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            require 'autoproj/cli/main'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'autoproj/cli/locate'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
            argv = Autoproj::CLI.basic_setup
         
     | 
| 
      
 7 
     | 
    
         
            +
            if argv.include?('--help') || argv.include?('help')
         
     | 
| 
       7 
8 
     | 
    
         
             
                puts "Usage:"
         
     | 
| 
       8 
9 
     | 
    
         
             
                puts "  alog [package]"
         
     | 
| 
       9 
10 
     | 
    
         
             
                puts
         
     | 
| 
         @@ -11,11 +12,10 @@ if ARGV.include?('--help') || ARGV.include?('help') 
     | 
|
| 
       11 
12 
     | 
    
         
             
                exit 0
         
     | 
| 
       12 
13 
     | 
    
         
             
            end
         
     | 
| 
       13 
14 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
            Autoproj::CLI.basic_setup
         
     | 
| 
       15 
15 
     | 
    
         
             
            Autoproj.report(silent: true) do
         
     | 
| 
       16 
16 
     | 
    
         
             
                cli = Autoproj::CLI::Locate.new
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
                arg =  
     | 
| 
      
 18 
     | 
    
         
            +
                arg = argv.first || Dir.pwd
         
     | 
| 
       19 
19 
     | 
    
         
             
                if File.directory?(arg)
         
     | 
| 
       20 
20 
     | 
    
         
             
                    arg = "#{File.expand_path(arg)}/"
         
     | 
| 
       21 
21 
     | 
    
         
             
                end
         
     | 
    
        data/bin/amake
    CHANGED
    
    | 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #! /usr/bin/env ruby
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'autoproj/cli/main'
         
     | 
| 
       4 
     | 
    
         
            -
            Autoproj::CLI.basic_setup
         
     | 
| 
       5 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            argv = Autoproj::CLI.basic_setup
         
     | 
| 
       6 
6 
     | 
    
         
             
            class Amake < Autoproj::CLI::Main
         
     | 
| 
       7 
7 
     | 
    
         
             
                def self.banner(*)
         
     | 
| 
       8 
8 
     | 
    
         
             
                    "amake [options]"
         
     | 
| 
         @@ -10,12 +10,11 @@ class Amake < Autoproj::CLI::Main 
     | 
|
| 
       10 
10 
     | 
    
         
             
            end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
            begin
         
     | 
| 
       13 
     | 
    
         
            -
                if  
     | 
| 
      
 13 
     | 
    
         
            +
                if argv.include?('--help') || argv.include?('help')
         
     | 
| 
       14 
14 
     | 
    
         
             
                    Amake.start(['help', 'build'])
         
     | 
| 
       15 
15 
     | 
    
         
             
                else
         
     | 
| 
       16 
     | 
    
         
            -
                    Amake.start(['build', '--amake', * 
     | 
| 
      
 16 
     | 
    
         
            +
                    Amake.start(['build', '--amake', *argv])
         
     | 
| 
       17 
17 
     | 
    
         
             
                end
         
     | 
| 
       18 
18 
     | 
    
         
             
            rescue Interrupt
         
     | 
| 
       19 
19 
     | 
    
         
             
                # Already notified in the reporting infrastructure
         
     | 
| 
       20 
20 
     | 
    
         
             
            end
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
    
        data/bin/aup
    CHANGED
    
    | 
         @@ -1,7 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            #! /usr/bin/env ruby
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'autoproj/cli/main'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            argv = Autoproj::CLI.basic_setup
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            class Aup < Autoproj::CLI::Main
         
     | 
| 
       7 
8 
     | 
    
         
             
                def self.banner(*)
         
     | 
| 
         @@ -10,10 +11,10 @@ class Aup < Autoproj::CLI::Main 
     | 
|
| 
       10 
11 
     | 
    
         
             
            end
         
     | 
| 
       11 
12 
     | 
    
         | 
| 
       12 
13 
     | 
    
         
             
            begin
         
     | 
| 
       13 
     | 
    
         
            -
                if  
     | 
| 
      
 14 
     | 
    
         
            +
                if argv.include?('--help') || argv.include?('help')
         
     | 
| 
       14 
15 
     | 
    
         
             
                    Aup.start(['help', 'update'])
         
     | 
| 
       15 
16 
     | 
    
         
             
                else
         
     | 
| 
       16 
     | 
    
         
            -
                    Aup.start(['update', * 
     | 
| 
      
 17 
     | 
    
         
            +
                    Aup.start(['update', *argv, '--aup'])
         
     | 
| 
       17 
18 
     | 
    
         
             
                end
         
     | 
| 
       18 
19 
     | 
    
         
             
            rescue Interrupt
         
     | 
| 
       19 
20 
     | 
    
         
             
                # Already notified in the reporting infrastructure
         
     | 
    
        data/bin/autoproj
    CHANGED
    
    | 
         @@ -2,15 +2,10 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'autoproj/cli'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'autoproj/cli/main'
         
     | 
| 
       5 
     | 
    
         
            -
            Autoproj::CLI.basic_setup
         
     | 
| 
      
 5 
     | 
    
         
            +
            argv = Autoproj::CLI.basic_setup
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
            argv = ARGV.find_all { |arg| arg != "--no-plugins" }
         
     | 
| 
       8 
     | 
    
         
            -
            if argv.size == ARGV.size
         
     | 
| 
       9 
     | 
    
         
            -
                Autoproj::CLI.load_plugins
         
     | 
| 
       10 
     | 
    
         
            -
            end
         
     | 
| 
       11 
7 
     | 
    
         
             
            begin
         
     | 
| 
       12 
8 
     | 
    
         
             
                Autoproj::CLI::Main.start(argv)
         
     | 
| 
       13 
9 
     | 
    
         
             
            rescue Interrupt
         
     | 
| 
       14 
10 
     | 
    
         
             
                # Already notified in the reporting infrastructure
         
     | 
| 
       15 
11 
     | 
    
         
             
            end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
    
        data/bin/autoproj_bootstrap
    CHANGED
    
    | 
         @@ -57,13 +57,15 @@ module Autoproj 
     | 
|
| 
       57 
57 
     | 
    
         | 
| 
       58 
58 
     | 
    
         
             
                            load_config
         
     | 
| 
       59 
59 
     | 
    
         
             
                            if config['ruby_executable'] != Gem.ruby
         
     | 
| 
       60 
     | 
    
         
            -
                                raise "this autoproj installation was already bootstrapped using  
     | 
| 
      
 60 
     | 
    
         
            +
                                raise "this autoproj installation was already bootstrapped using "\
         
     | 
| 
      
 61 
     | 
    
         
            +
                                    "#{config['ruby_executable']}, but you are currently running "\
         
     | 
| 
      
 62 
     | 
    
         
            +
                                    "under #{Gem.ruby}. Changing the ruby interpreter in a given "\
         
     | 
| 
      
 63 
     | 
    
         
            +
                                    "workspace is not supported, you need to do a clean bootstrap"
         
     | 
| 
       61 
64 
     | 
    
         
             
                            end
         
     | 
| 
       62 
65 
     | 
    
         
             
                            @ruby_executable = config['ruby_executable']
         
     | 
| 
       63 
66 
     | 
    
         
             
                            @local = false
         
     | 
| 
       64 
67 
     | 
    
         | 
| 
       65 
     | 
    
         
            -
                             
     | 
| 
       66 
     | 
    
         
            -
                            @gems_install_path     = default_gem_path
         
     | 
| 
      
 68 
     | 
    
         
            +
                            install_gems_in_gem_user_dir
         
     | 
| 
       67 
69 
     | 
    
         
             
                        end
         
     | 
| 
       68 
70 
     | 
    
         | 
| 
       69 
71 
     | 
    
         
             
                        def env_for_child
         
     | 
| 
         @@ -142,13 +144,15 @@ module Autoproj 
     | 
|
| 
       142 
144 
     | 
    
         
             
                        #
         
     | 
| 
       143 
145 
     | 
    
         
             
                        # They are installed in a versioned subdirectory of this path, e.g.
         
     | 
| 
       144 
146 
     | 
    
         
             
                        # {#gem_path_suffix}.
         
     | 
| 
       145 
     | 
    
         
            -
                        # 
     | 
| 
      
 147 
     | 
    
         
            +
                        #
         
     | 
| 
       146 
148 
     | 
    
         
             
                        # @return [String]
         
     | 
| 
       147 
149 
     | 
    
         
             
                        attr_reader :gems_install_path
         
     | 
| 
       148 
150 
     | 
    
         
             
                        # The GEM_HOME under which the workspace's gems should be installed
         
     | 
| 
       149 
     | 
    
         
            -
                        # 
     | 
| 
      
 151 
     | 
    
         
            +
                        #
         
     | 
| 
       150 
152 
     | 
    
         
             
                        # @return [String]
         
     | 
| 
       151 
     | 
    
         
            -
                        def gems_gem_home 
     | 
| 
      
 153 
     | 
    
         
            +
                        def gems_gem_home
         
     | 
| 
      
 154 
     | 
    
         
            +
                            File.join(gems_install_path, gem_path_suffix)
         
     | 
| 
      
 155 
     | 
    
         
            +
                        end
         
     | 
| 
       152 
156 
     | 
    
         
             
                        # Sets where the workspace's gems should be installed
         
     | 
| 
       153 
157 
     | 
    
         
             
                        #
         
     | 
| 
       154 
158 
     | 
    
         
             
                        # @param [String] path the absolute path that should be given to
         
     | 
| 
         @@ -157,17 +161,41 @@ module Autoproj 
     | 
|
| 
       157 
161 
     | 
    
         
             
                        def gems_install_path=(path)
         
     | 
| 
       158 
162 
     | 
    
         
             
                            @gems_install_path = path
         
     | 
| 
       159 
163 
     | 
    
         
             
                        end
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                        private def xdg_var(varname, default)
         
     | 
| 
      
 166 
     | 
    
         
            +
                            if (env = ENV[varname]) && !env.empty?
         
     | 
| 
      
 167 
     | 
    
         
            +
                                env
         
     | 
| 
      
 168 
     | 
    
         
            +
                            else
         
     | 
| 
      
 169 
     | 
    
         
            +
                                default
         
     | 
| 
      
 170 
     | 
    
         
            +
                            end
         
     | 
| 
      
 171 
     | 
    
         
            +
                        end
         
     | 
| 
      
 172 
     | 
    
         
            +
             
     | 
| 
       160 
173 
     | 
    
         
             
                        # Install autoproj in Gem's default user dir
         
     | 
| 
       161 
174 
     | 
    
         
             
                        def install_gems_in_gem_user_dir
         
     | 
| 
       162 
     | 
    
         
            -
                             
     | 
| 
      
 175 
     | 
    
         
            +
                            xdg_default_gem_path = xdg_var('XDG_DATA_HOME',
         
     | 
| 
      
 176 
     | 
    
         
            +
                                File.join(Dir.home, '.local', 'share', 'autoproj', 'gems'))
         
     | 
| 
      
 177 
     | 
    
         
            +
                            default_gem_path = File.join(
         
     | 
| 
      
 178 
     | 
    
         
            +
                                Dir.home, '.autoproj', 'gems')
         
     | 
| 
      
 179 
     | 
    
         
            +
                            @gems_install_path =
         
     | 
| 
      
 180 
     | 
    
         
            +
                                if File.directory?(xdg_default_gem_path)
         
     | 
| 
      
 181 
     | 
    
         
            +
                                    xdg_default_gem_path
         
     | 
| 
      
 182 
     | 
    
         
            +
                                elsif File.directory?(default_gem_path)
         
     | 
| 
      
 183 
     | 
    
         
            +
                                    default_gem_path
         
     | 
| 
      
 184 
     | 
    
         
            +
                                else
         
     | 
| 
      
 185 
     | 
    
         
            +
                                    xdg_default_gem_path
         
     | 
| 
      
 186 
     | 
    
         
            +
                                end
         
     | 
| 
       163 
187 
     | 
    
         
             
                        end
         
     | 
| 
       164 
188 
     | 
    
         | 
| 
       165 
189 
     | 
    
         
             
                        # Whether autoproj should prefer OS-independent packages over their
         
     | 
| 
       166 
190 
     | 
    
         
             
                        # OS-packaged equivalents (e.g. the thor gem vs. the ruby-thor
         
     | 
| 
       167 
191 
     | 
    
         
             
                        # Debian package)
         
     | 
| 
       168 
     | 
    
         
            -
                        def prefer_indep_over_os_packages 
     | 
| 
      
 192 
     | 
    
         
            +
                        def prefer_indep_over_os_packages?
         
     | 
| 
      
 193 
     | 
    
         
            +
                            @prefer_indep_over_os_packages
         
     | 
| 
      
 194 
     | 
    
         
            +
                        end
         
     | 
| 
       169 
195 
     | 
    
         
             
                        # (see #prefer_index_over_os_packages?)
         
     | 
| 
       170 
     | 
    
         
            -
                        def prefer_indep_over_os_packages=(flag) 
     | 
| 
      
 196 
     | 
    
         
            +
                        def prefer_indep_over_os_packages=(flag)
         
     | 
| 
      
 197 
     | 
    
         
            +
                            @prefer_indep_over_os_packages = !!flag
         
     | 
| 
      
 198 
     | 
    
         
            +
                        end
         
     | 
| 
       171 
199 
     | 
    
         | 
| 
       172 
200 
     | 
    
         
             
                        def self.guess_gem_program
         
     | 
| 
       173 
201 
     | 
    
         
             
                            ruby_bin = RbConfig::CONFIG['RUBY_INSTALL_NAME']
         
     | 
| 
         @@ -175,7 +203,7 @@ module Autoproj 
     | 
|
| 
       175 
203 
     | 
    
         | 
| 
       176 
204 
     | 
    
         
             
                            candidates = ['gem']
         
     | 
| 
       177 
205 
     | 
    
         
             
                            if ruby_bin =~ /^ruby(.+)$/
         
     | 
| 
       178 
     | 
    
         
            -
                                candidates.unshift "gem#{$1}" 
     | 
| 
      
 206 
     | 
    
         
            +
                                candidates.unshift "gem#{$1}"
         
     | 
| 
       179 
207 
     | 
    
         
             
                            end
         
     | 
| 
       180 
208 
     | 
    
         | 
| 
       181 
209 
     | 
    
         
             
                            candidates.each do |gem_name|
         
     | 
| 
         @@ -183,7 +211,8 @@ module Autoproj 
     | 
|
| 
       183 
211 
     | 
    
         
             
                                    return gem_full_path
         
     | 
| 
       184 
212 
     | 
    
         
             
                                end
         
     | 
| 
       185 
213 
     | 
    
         
             
                            end
         
     | 
| 
       186 
     | 
    
         
            -
                            raise ArgumentError, "cannot find a gem program  
     | 
| 
      
 214 
     | 
    
         
            +
                            raise ArgumentError, "cannot find a gem program "\
         
     | 
| 
      
 215 
     | 
    
         
            +
                                "(tried #{candidates.sort.join(", ")} in #{ruby_bindir})"
         
     | 
| 
       187 
216 
     | 
    
         
             
                        end
         
     | 
| 
       188 
217 
     | 
    
         | 
| 
       189 
218 
     | 
    
         
             
                        # The content of the default {#gemfile}
         
     | 
| 
         @@ -207,39 +236,48 @@ module Autoproj 
     | 
|
| 
       207 
236 
     | 
    
         
             
                                opt.on '--skip-stage2', 'do not run the stage2 install' do
         
     | 
| 
       208 
237 
     | 
    
         
             
                                    @skip_stage2 = true
         
     | 
| 
       209 
238 
     | 
    
         
             
                                end
         
     | 
| 
       210 
     | 
    
         
            -
                                opt.on '--gem-source=URL', String, "use this source for RubyGems  
     | 
| 
      
 239 
     | 
    
         
            +
                                opt.on '--gem-source=URL', String, "use this source for RubyGems "\
         
     | 
| 
      
 240 
     | 
    
         
            +
                                    "instead of rubygems.org" do |url|
         
     | 
| 
       211 
241 
     | 
    
         
             
                                    @gem_source = url
         
     | 
| 
       212 
242 
     | 
    
         
             
                                end
         
     | 
| 
       213 
     | 
    
         
            -
                                opt.on '--gems-path=PATH', "install gems under this path instead  
     | 
| 
      
 243 
     | 
    
         
            +
                                opt.on '--gems-path=PATH', "install gems under this path instead "\
         
     | 
| 
      
 244 
     | 
    
         
            +
                                    "of ~/.autoproj/gems" do |path|
         
     | 
| 
       214 
245 
     | 
    
         
             
                                    self.gems_install_path     = path
         
     | 
| 
       215 
246 
     | 
    
         
             
                                end
         
     | 
| 
       216 
247 
     | 
    
         
             
                                opt.on '--public-gems', "install gems in the default gem location" do
         
     | 
| 
       217 
248 
     | 
    
         
             
                                    self.install_gems_in_gem_user_dir
         
     | 
| 
       218 
249 
     | 
    
         
             
                                end
         
     | 
| 
       219 
     | 
    
         
            -
                                opt.on '--version=VERSION_CONSTRAINT', String, 'use the provided  
     | 
| 
      
 250 
     | 
    
         
            +
                                opt.on '--version=VERSION_CONSTRAINT', String, 'use the provided "\
         
     | 
| 
      
 251 
     | 
    
         
            +
                                    "string as a version constraint for autoproj' do |version|
         
     | 
| 
       220 
252 
     | 
    
         
             
                                    if @gemfile
         
     | 
| 
       221 
253 
     | 
    
         
             
                                        raise "cannot give both --version and --gemfile"
         
     | 
| 
       222 
254 
     | 
    
         
             
                                    end
         
     | 
| 
       223 
255 
     | 
    
         
             
                                    @gemfile = default_gemfile_contents(version)
         
     | 
| 
       224 
256 
     | 
    
         
             
                                end
         
     | 
| 
       225 
     | 
    
         
            -
                                opt.on '--gemfile=PATH', String, 'use the given Gemfile to install  
     | 
| 
      
 257 
     | 
    
         
            +
                                opt.on '--gemfile=PATH', String, 'use the given Gemfile to install "\
         
     | 
| 
      
 258 
     | 
    
         
            +
                                    "autoproj instead of the default' do |path|
         
     | 
| 
       226 
259 
     | 
    
         
             
                                    if @gemfile
         
     | 
| 
       227 
260 
     | 
    
         
             
                                        raise "cannot give both --version and --gemfile"
         
     | 
| 
       228 
261 
     | 
    
         
             
                                    end
         
     | 
| 
       229 
262 
     | 
    
         
             
                                    @gemfile = File.read(path)
         
     | 
| 
       230 
263 
     | 
    
         
             
                                end
         
     | 
| 
       231 
     | 
    
         
            -
                                opt.on '--seed-config=PATH', String, 'path to a seed file that  
     | 
| 
      
 264 
     | 
    
         
            +
                                opt.on '--seed-config=PATH', String, 'path to a seed file that "\
         
     | 
| 
      
 265 
     | 
    
         
            +
                                    "should be used to initialize the configuration' do |path|
         
     | 
| 
       232 
266 
     | 
    
         
             
                                    @config.merge!(YAML.load(File.read(path)))
         
     | 
| 
       233 
267 
     | 
    
         
             
                                end
         
     | 
| 
       234 
     | 
    
         
            -
                                opt.on '--prefer-os-independent-packages', 'prefer OS-independent  
     | 
| 
      
 268 
     | 
    
         
            +
                                opt.on '--prefer-os-independent-packages', 'prefer OS-independent "\
         
     | 
| 
      
 269 
     | 
    
         
            +
                                    "packages (such as a RubyGem) over their OS-packaged equivalent "\
         
     | 
| 
      
 270 
     | 
    
         
            +
                                    "(e.g. the thor gem vs. the ruby-thor debian package)' do
         
     | 
| 
       235 
271 
     | 
    
         
             
                                    @prefer_indep_over_os_packages = true
         
     | 
| 
       236 
272 
     | 
    
         
             
                                end
         
     | 
| 
       237 
     | 
    
         
            -
                                opt.on '--[no-]color', 'do not use colored output (enabled by  
     | 
| 
      
 273 
     | 
    
         
            +
                                opt.on '--[no-]color', 'do not use colored output (enabled by "\
         
     | 
| 
      
 274 
     | 
    
         
            +
                                    "default if the terminal supports it)' do |color|
         
     | 
| 
       238 
275 
     | 
    
         
             
                                    if color then autoproj_options << "--color"
         
     | 
| 
       239 
276 
     | 
    
         
             
                                    else autoproj_options << '--no-color'
         
     | 
| 
       240 
277 
     | 
    
         
             
                                    end
         
     | 
| 
       241 
278 
     | 
    
         
             
                                end
         
     | 
| 
       242 
     | 
    
         
            -
                                opt.on '--[no-]progress', 'do not use progress output (enabled by  
     | 
| 
      
 279 
     | 
    
         
            +
                                opt.on '--[no-]progress', 'do not use progress output (enabled by "\
         
     | 
| 
      
 280 
     | 
    
         
            +
                                    "default if the terminal supports it)' do |color|
         
     | 
| 
       243 
281 
     | 
    
         
             
                                    if color then autoproj_options << "--progress"
         
     | 
| 
       244 
282 
     | 
    
         
             
                                    else autoproj_options << '--no-progress'
         
     | 
| 
       245 
283 
     | 
    
         
             
                                    end
         
     | 
| 
         @@ -272,9 +310,11 @@ module Autoproj 
     | 
|
| 
       272 
310 
     | 
    
         | 
| 
       273 
311 
     | 
    
         
             
                            result = system(
         
     | 
| 
       274 
312 
     | 
    
         
             
                                env_for_child.merge('GEM_HOME' => gems_gem_home),
         
     | 
| 
       275 
     | 
    
         
            -
                                Gem.ruby, gem_program, 'install', 
     | 
| 
       276 
     | 
    
         
            -
                                     
     | 
| 
       277 
     | 
    
         
            -
                                     
     | 
| 
      
 313 
     | 
    
         
            +
                                Gem.ruby, gem_program, 'install',
         
     | 
| 
      
 314 
     | 
    
         
            +
                                    '--env-shebang', '--no-document', '--no-format-executable',
         
     | 
| 
      
 315 
     | 
    
         
            +
                                    '--clear-sources', '--source', gem_source,
         
     | 
| 
      
 316 
     | 
    
         
            +
                                    *local, "--bindir=#{File.join(gems_gem_home, 'bin')}",
         
     | 
| 
      
 317 
     | 
    
         
            +
                                    'bundler', **redirection)
         
     | 
| 
       278 
318 
     | 
    
         | 
| 
       279 
319 
     | 
    
         
             
                            if !result
         
     | 
| 
       280 
320 
     | 
    
         
             
                                STDERR.puts "FATAL: failed to install bundler in #{gems_gem_home}"
         
     | 
| 
         @@ -285,14 +325,15 @@ module Autoproj 
     | 
|
| 
       285 
325 
     | 
    
         
             
                            if File.exist?(bundler_path)
         
     | 
| 
       286 
326 
     | 
    
         
             
                                bundler_path
         
     | 
| 
       287 
327 
     | 
    
         
             
                            else
         
     | 
| 
       288 
     | 
    
         
            -
                                STDERR.puts "gem install bundler returned successfully, but still  
     | 
| 
      
 328 
     | 
    
         
            +
                                STDERR.puts "gem install bundler returned successfully, but still "\
         
     | 
| 
      
 329 
     | 
    
         
            +
                                    "cannot find bundler in #{bundler_path}"
         
     | 
| 
       289 
330 
     | 
    
         
             
                                nil
         
     | 
| 
       290 
331 
     | 
    
         
             
                            end
         
     | 
| 
       291 
332 
     | 
    
         
             
                        end
         
     | 
| 
       292 
333 
     | 
    
         | 
| 
       293 
334 
     | 
    
         
             
                        def install_autoproj(bundler)
         
     | 
| 
       294 
     | 
    
         
            -
                            # Force bundler to update. If the user does not want this, let 
     | 
| 
       295 
     | 
    
         
            -
                            # Gemfile with tighter version constraints
         
     | 
| 
      
 335 
     | 
    
         
            +
                            # Force bundler to update. If the user does not want this, let
         
     | 
| 
      
 336 
     | 
    
         
            +
                            # him specify a Gemfile with tighter version constraints
         
     | 
| 
       296 
337 
     | 
    
         
             
                            lockfile = File.join(dot_autoproj, 'Gemfile.lock')
         
     | 
| 
       297 
338 
     | 
    
         
             
                            if File.exist?(lockfile)
         
     | 
| 
       298 
339 
     | 
    
         
             
                                FileUtils.rm lockfile
         
     | 
| 
         @@ -304,6 +345,7 @@ module Autoproj 
     | 
|
| 
       304 
345 
     | 
    
         
             
                            opts << '--local' if local?
         
     | 
| 
       305 
346 
     | 
    
         
             
                            opts << "--path=#{gems_install_path}"
         
     | 
| 
       306 
347 
     | 
    
         
             
                            shims_path = File.join(dot_autoproj, 'bin')
         
     | 
| 
      
 348 
     | 
    
         
            +
             
     | 
| 
       307 
349 
     | 
    
         
             
                            result = system(clean_env,
         
     | 
| 
       308 
350 
     | 
    
         
             
                                Gem.ruby, bundler, 'install',
         
     | 
| 
       309 
351 
     | 
    
         
             
                                    "--gemfile=#{autoproj_gemfile_path}",
         
     | 
| 
         @@ -316,12 +358,14 @@ module Autoproj 
     | 
|
| 
       316 
358 
     | 
    
         
             
                                exit 1
         
     | 
| 
       317 
359 
     | 
    
         
             
                            end
         
     | 
| 
       318 
360 
     | 
    
         
             
                        ensure
         
     | 
| 
       319 
     | 
    
         
            -
                            self.class.rewrite_shims(shims_path, ruby_executable, 
     | 
| 
      
 361 
     | 
    
         
            +
                            self.class.rewrite_shims(shims_path, ruby_executable,
         
     | 
| 
      
 362 
     | 
    
         
            +
                                root_dir, autoproj_gemfile_path, gems_gem_home)
         
     | 
| 
       320 
363 
     | 
    
         
             
                        end
         
     | 
| 
       321 
364 
     | 
    
         | 
| 
       322 
365 
     | 
    
         
             
                        EXCLUDED_FROM_SHIMS = %w{rake thor}
         
     | 
| 
       323 
366 
     | 
    
         | 
| 
       324 
     | 
    
         
            -
                        def self.rewrite_shims(shim_path, ruby_executable, 
     | 
| 
      
 367 
     | 
    
         
            +
                        def self.rewrite_shims(shim_path, ruby_executable,
         
     | 
| 
      
 368 
     | 
    
         
            +
                            root_dir, autoproj_gemfile_path, gems_gem_home)
         
     | 
| 
       325 
369 
     | 
    
         
             
                            FileUtils.mkdir_p shim_path
         
     | 
| 
       326 
370 
     | 
    
         
             
                            File.open(File.join(shim_path, 'ruby'), 'w') do |io|
         
     | 
| 
       327 
371 
     | 
    
         
             
                                io.puts "#! /bin/sh"
         
     | 
| 
         @@ -329,10 +373,9 @@ module Autoproj 
     | 
|
| 
       329 
373 
     | 
    
         
             
                            end
         
     | 
| 
       330 
374 
     | 
    
         
             
                            FileUtils.chmod 0755, File.join(shim_path, 'ruby')
         
     | 
| 
       331 
375 
     | 
    
         | 
| 
       332 
     | 
    
         
            -
                            FileUtils.touch File.join(shim_path, 'bundler')
         
     | 
| 
       333 
     | 
    
         
            -
                            FileUtils.touch File.join(shim_path, 'bundle')
         
     | 
| 
       334 
376 
     | 
    
         
             
                            Dir.glob(File.join(shim_path, '*')) do |bin_script|
         
     | 
| 
       335 
     | 
    
         
            -
                                next  
     | 
| 
      
 377 
     | 
    
         
            +
                                next unless File.file?(bin_script)
         
     | 
| 
      
 378 
     | 
    
         
            +
             
     | 
| 
       336 
379 
     | 
    
         
             
                                bin_name = File.basename(bin_script)
         
     | 
| 
       337 
380 
     | 
    
         
             
                                if EXCLUDED_FROM_SHIMS.include?(bin_name)
         
     | 
| 
       338 
381 
     | 
    
         
             
                                    FileUtils.rm_f bin_script
         
     | 
| 
         @@ -342,19 +385,46 @@ module Autoproj 
     | 
|
| 
       342 
385 
     | 
    
         | 
| 
       343 
386 
     | 
    
         
             
                                bin_shim = File.join(shim_path, bin_name)
         
     | 
| 
       344 
387 
     | 
    
         
             
                                bin_script_lines = File.readlines(bin_script)
         
     | 
| 
      
 388 
     | 
    
         
            +
                                next if has_autoproj_preamble?(bin_script_lines)
         
     | 
| 
      
 389 
     | 
    
         
            +
             
     | 
| 
       345 
390 
     | 
    
         
             
                                File.open(bin_shim, 'w') do |io|
         
     | 
| 
       346 
391 
     | 
    
         
             
                                    if bin_name == 'bundler' || bin_name == 'bundle'
         
     | 
| 
       347 
     | 
    
         
            -
                                        io.puts shim_bundler( 
     | 
| 
      
 392 
     | 
    
         
            +
                                        io.puts shim_bundler(bin_script_lines, ruby_executable,
         
     | 
| 
      
 393 
     | 
    
         
            +
                                            autoproj_gemfile_path, gems_gem_home)
         
     | 
| 
       348 
394 
     | 
    
         
             
                                    else
         
     | 
| 
       349 
     | 
    
         
            -
                                         
     | 
| 
       350 
     | 
    
         
            -
             
     | 
| 
      
 395 
     | 
    
         
            +
                                        io.puts shim_script(bin_script_lines, ruby_executable, root_dir,
         
     | 
| 
      
 396 
     | 
    
         
            +
                                            autoproj_gemfile_path, gems_gem_home)
         
     | 
| 
       351 
397 
     | 
    
         
             
                                    end
         
     | 
| 
       352 
398 
     | 
    
         
             
                                end
         
     | 
| 
       353 
399 
     | 
    
         
             
                                FileUtils.chmod 0755, bin_shim
         
     | 
| 
       354 
400 
     | 
    
         
             
                            end
         
     | 
| 
       355 
401 
     | 
    
         
             
                        end
         
     | 
| 
       356 
402 
     | 
    
         | 
| 
       357 
     | 
    
         
            -
                        def self. 
     | 
| 
      
 403 
     | 
    
         
            +
                        def self.new_style_bundler_binstub?(script_lines)
         
     | 
| 
      
 404 
     | 
    
         
            +
                            script_lines.any? { |l| l =~ /This file was generated by Bundler/ }
         
     | 
| 
      
 405 
     | 
    
         
            +
                        end
         
     | 
| 
      
 406 
     | 
    
         
            +
             
     | 
| 
      
 407 
     | 
    
         
            +
                        def self.has_autoproj_preamble?(script_lines)
         
     | 
| 
      
 408 
     | 
    
         
            +
                            script_lines.any? { |l| l =~ /Autoproj generated preamble/ }
         
     | 
| 
      
 409 
     | 
    
         
            +
                        end
         
     | 
| 
      
 410 
     | 
    
         
            +
             
     | 
| 
      
 411 
     | 
    
         
            +
                        def self.shim_bundler(script_lines, ruby_executable, autoproj_gemfile_path, gems_gem_home)
         
     | 
| 
      
 412 
     | 
    
         
            +
                            return shim_bundler_old(ruby_executable, autoproj_gemfile_path, gems_gem_home) \
         
     | 
| 
      
 413 
     | 
    
         
            +
                                unless new_style_bundler_binstub?(script_lines)
         
     | 
| 
      
 414 
     | 
    
         
            +
             
     | 
| 
      
 415 
     | 
    
         
            +
                            script_lines.insert(1, <<-RESTART_BUNDLER)
         
     | 
| 
      
 416 
     | 
    
         
            +
            # Autoproj generated preamble
         
     | 
| 
      
 417 
     | 
    
         
            +
            if defined?(Bundler)
         
     | 
| 
      
 418 
     | 
    
         
            +
                Bundler.with_clean_env do
         
     | 
| 
      
 419 
     | 
    
         
            +
                    exec($0, *ARGV)
         
     | 
| 
      
 420 
     | 
    
         
            +
                end
         
     | 
| 
      
 421 
     | 
    
         
            +
            end
         
     | 
| 
      
 422 
     | 
    
         
            +
            ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
         
     | 
| 
      
 423 
     | 
    
         
            +
                            RESTART_BUNDLER
         
     | 
| 
      
 424 
     | 
    
         
            +
                            script_lines.join
         
     | 
| 
      
 425 
     | 
    
         
            +
                        end
         
     | 
| 
      
 426 
     | 
    
         
            +
             
     | 
| 
      
 427 
     | 
    
         
            +
                        def self.shim_bundler_old(ruby_executable, autoproj_gemfile_path, gems_gem_home)
         
     | 
| 
       358 
428 
     | 
    
         
             
            "#! #{ruby_executable}
         
     | 
| 
       359 
429 
     | 
    
         | 
| 
       360 
430 
     | 
    
         
             
            if defined?(Bundler)
         
     | 
| 
         @@ -370,8 +440,35 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => ''] 
     | 
|
| 
       370 
440 
     | 
    
         | 
| 
       371 
441 
     | 
    
         
             
            load Gem.bin_path('bundler', 'bundler')"
         
     | 
| 
       372 
442 
     | 
    
         
             
                        end
         
     | 
| 
       373 
     | 
    
         
            -
             
     | 
| 
       374 
     | 
    
         
            -
                        def self.shim_script(ruby_executable, root_dir, 
     | 
| 
      
 443 
     | 
    
         
            +
             
     | 
| 
      
 444 
     | 
    
         
            +
                        def self.shim_script(script_lines, ruby_executable, root_dir,
         
     | 
| 
      
 445 
     | 
    
         
            +
                                autoproj_gemfile_path, gems_gem_home)
         
     | 
| 
      
 446 
     | 
    
         
            +
                            new_style = !script_lines.empty? && script_lines.any? do |l|
         
     | 
| 
      
 447 
     | 
    
         
            +
                                l =~ /This file was generated by Bundler/
         
     | 
| 
      
 448 
     | 
    
         
            +
                            end
         
     | 
| 
      
 449 
     | 
    
         
            +
                            load_line = script_lines.grep(/load Gem.bin_path/).first
         
     | 
| 
      
 450 
     | 
    
         
            +
                            return shim_script_old(ruby_executable, root_dir,
         
     | 
| 
      
 451 
     | 
    
         
            +
                                autoproj_gemfile_path, gems_gem_home, load_line) \
         
     | 
| 
      
 452 
     | 
    
         
            +
                                unless new_style
         
     | 
| 
      
 453 
     | 
    
         
            +
             
     | 
| 
      
 454 
     | 
    
         
            +
                            script_lines.insert(1, <<-AUTOPROJ_PREAMBLE)
         
     | 
| 
      
 455 
     | 
    
         
            +
            # Autoproj generated preamble, v1
         
     | 
| 
      
 456 
     | 
    
         
            +
            if defined?(Bundler)
         
     | 
| 
      
 457 
     | 
    
         
            +
                Bundler.with_clean_env do
         
     | 
| 
      
 458 
     | 
    
         
            +
                    exec(Hash['RUBYLIB' => nil], $0, *ARGV)
         
     | 
| 
      
 459 
     | 
    
         
            +
                end
         
     | 
| 
      
 460 
     | 
    
         
            +
            elsif ENV['RUBYLIB']
         
     | 
| 
      
 461 
     | 
    
         
            +
                exec(Hash['RUBYLIB' => nil], $0, *ARGV)
         
     | 
| 
      
 462 
     | 
    
         
            +
            end
         
     | 
| 
      
 463 
     | 
    
         
            +
             
     | 
| 
      
 464 
     | 
    
         
            +
            ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
         
     | 
| 
      
 465 
     | 
    
         
            +
            ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
         
     | 
| 
      
 466 
     | 
    
         
            +
                            AUTOPROJ_PREAMBLE
         
     | 
| 
      
 467 
     | 
    
         
            +
                            return script_lines.join
         
     | 
| 
      
 468 
     | 
    
         
            +
                        end
         
     | 
| 
      
 469 
     | 
    
         
            +
             
     | 
| 
      
 470 
     | 
    
         
            +
                        def self.shim_script_old(ruby_executable, root_dir, autoproj_gemfile_path,
         
     | 
| 
      
 471 
     | 
    
         
            +
                            gems_gem_home, load_line)
         
     | 
| 
       375 
472 
     | 
    
         
             
            "#! #{ruby_executable}
         
     | 
| 
       376 
473 
     | 
    
         | 
| 
       377 
474 
     | 
    
         
             
            if defined?(Bundler)
         
     | 
| 
         @@ -433,9 +530,10 @@ require 'bundler/setup' 
     | 
|
| 
       433 
530 
     | 
    
         
             
                                "if File.file?(config_path)",
         
     | 
| 
       434 
531 
     | 
    
         
             
                                "    require 'yaml'",
         
     | 
| 
       435 
532 
     | 
    
         
             
                                "    config = YAML.load(File.read(config_path)) || Hash.new",
         
     | 
| 
       436 
     | 
    
         
            -
                                "    (config['plugins'] || Hash.new). 
     | 
| 
       437 
     | 
    
         
            -
                                "         
     | 
| 
       438 
     | 
    
         
            -
                                " 
     | 
| 
      
 533 
     | 
    
         
            +
                                "    (config['plugins'] || Hash.new).",
         
     | 
| 
      
 534 
     | 
    
         
            +
                                "        each do |plugin_name, (version, options)|",
         
     | 
| 
      
 535 
     | 
    
         
            +
                                "            gem plugin_name, version, **options",
         
     | 
| 
      
 536 
     | 
    
         
            +
                                "        end",
         
     | 
| 
       439 
537 
     | 
    
         
             
                                "end"
         
     | 
| 
       440 
538 
     | 
    
         
             
                            ].join("\n")
         
     | 
| 
       441 
539 
     | 
    
         | 
| 
         @@ -449,7 +547,8 @@ require 'bundler/setup' 
     | 
|
| 
       449 
547 
     | 
    
         | 
| 
       450 
548 
     | 
    
         | 
| 
       451 
549 
     | 
    
         
             
                        def find_in_clean_path(command, *additional_paths)
         
     | 
| 
       452 
     | 
    
         
            -
                            clean_path = env_for_child['PATH'].split(File::PATH_SEPARATOR) + 
     | 
| 
      
 550 
     | 
    
         
            +
                            clean_path = env_for_child['PATH'].split(File::PATH_SEPARATOR) +
         
     | 
| 
      
 551 
     | 
    
         
            +
                                additional_paths
         
     | 
| 
       453 
552 
     | 
    
         
             
                            clean_path.each do |p|
         
     | 
| 
       454 
553 
     | 
    
         
             
                                full_path = File.join(p, command)
         
     | 
| 
       455 
554 
     | 
    
         
             
                                if File.file?(full_path)
         
     | 
| 
         @@ -473,7 +572,8 @@ require 'bundler/setup' 
     | 
|
| 
       473 
572 
     | 
    
         
             
                            #
         
     | 
| 
       474 
573 
     | 
    
         
             
                            # So, we're calling 'gem' as a subcommand to discovery the
         
     | 
| 
       475 
574 
     | 
    
         
             
                            # actual bindir
         
     | 
| 
       476 
     | 
    
         
            -
                            bindir = IO.popen(env_for_child, 
     | 
| 
      
 575 
     | 
    
         
            +
                            bindir = IO.popen(env_for_child,
         
     | 
| 
      
 576 
     | 
    
         
            +
                                [Gem.ruby, '-e', 'puts "#{Gem.user_dir}/bin"']).read
         
     | 
| 
       477 
577 
     | 
    
         
             
                            if bindir
         
     | 
| 
       478 
578 
     | 
    
         
             
                                @gem_bindir = bindir.chomp
         
     | 
| 
       479 
579 
     | 
    
         
             
                            else
         
     | 
| 
         @@ -483,7 +583,9 @@ require 'bundler/setup' 
     | 
|
| 
       483 
583 
     | 
    
         | 
| 
       484 
584 
     | 
    
         
             
                        def install
         
     | 
| 
       485 
585 
     | 
    
         
             
                            if ENV['BUNDLER_GEMFILE']
         
     | 
| 
       486 
     | 
    
         
            -
                                raise "cannot run autoproj_install or autoproj_bootstrap while  
     | 
| 
      
 586 
     | 
    
         
            +
                                raise "cannot run autoproj_install or autoproj_bootstrap while "\
         
     | 
| 
      
 587 
     | 
    
         
            +
                                    "under a 'bundler exec' subcommand or having loaded an env.sh. "\
         
     | 
| 
      
 588 
     | 
    
         
            +
                                    "Open a new console and try again"
         
     | 
| 
       487 
589 
     | 
    
         
             
                            end
         
     | 
| 
       488 
590 
     | 
    
         | 
| 
       489 
591 
     | 
    
         
             
                            gem_program  = self.class.guess_gem_program
         
     | 
| 
         @@ -513,7 +615,7 @@ require 'bundler/setup' 
     | 
|
| 
       513 
615 
     | 
    
         | 
| 
       514 
616 
     | 
    
         
             
                        def load_config
         
     | 
| 
       515 
617 
     | 
    
         
             
                            v1_config_path = File.join(root_dir, 'autoproj', 'config.yml')
         
     | 
| 
       516 
     | 
    
         
            -
             
     | 
| 
      
 618 
     | 
    
         
            +
             
     | 
| 
       517 
619 
     | 
    
         
             
                            config = Hash.new
         
     | 
| 
       518 
620 
     | 
    
         
             
                            if File.file?(v1_config_path)
         
     | 
| 
       519 
621 
     | 
    
         
             
                                config.merge!(YAML.load(File.read(v1_config_path)) || Hash.new)
         
     | 
| 
         @@ -527,7 +629,10 @@ require 'bundler/setup' 
     | 
|
| 
       527 
629 
     | 
    
         
             
                            ruby_executable = File.join(ruby_bindir, ruby)
         
     | 
| 
       528 
630 
     | 
    
         
             
                            if current = config['ruby_executable'] # When upgrading or reinstalling
         
     | 
| 
       529 
631 
     | 
    
         
             
                                if current != ruby_executable
         
     | 
| 
       530 
     | 
    
         
            -
                                    raise "this workspace has already been initialized using  
     | 
| 
      
 632 
     | 
    
         
            +
                                    raise "this workspace has already been initialized using "\
         
     | 
| 
      
 633 
     | 
    
         
            +
                                    "#{current}, you cannot run autoproj install with "\
         
     | 
| 
      
 634 
     | 
    
         
            +
                                    "#{ruby_executable}. If you know what you're doing, "\
         
     | 
| 
      
 635 
     | 
    
         
            +
                                    "delete the ruby_executable line in config.yml and try again"
         
     | 
| 
       531 
636 
     | 
    
         
             
                                end
         
     | 
| 
       532 
637 
     | 
    
         
             
                            else
         
     | 
| 
       533 
638 
     | 
    
         
             
                                config['ruby_executable'] = ruby_executable
         
     | 
| 
         @@ -586,14 +691,16 @@ require 'bundler/setup' 
     | 
|
| 
       586 
691 
     | 
    
         
             
                            save_env_sh(*vars)
         
     | 
| 
       587 
692 
     | 
    
         
             
                            puts "running 'autoproj envsh' to generate a proper env.sh"
         
     | 
| 
       588 
693 
     | 
    
         
             
                            if !system(Gem.ruby, autoproj_path, 'envsh', *autoproj_options)
         
     | 
| 
       589 
     | 
    
         
            -
                                STDERR.puts "failed to run autoproj envsh on the newly installed  
     | 
| 
      
 694 
     | 
    
         
            +
                                STDERR.puts "failed to run autoproj envsh on the newly installed "\
         
     | 
| 
      
 695 
     | 
    
         
            +
                                    "autoproj (#{autoproj_path})"
         
     | 
| 
       590 
696 
     | 
    
         
             
                                exit 1
         
     | 
| 
       591 
697 
     | 
    
         
             
                            end
         
     | 
| 
       592 
698 
     | 
    
         
             
                            # This is really needed on an existing install to install the
         
     | 
| 
       593 
699 
     | 
    
         
             
                            # gems that were present in the v1 layout
         
     | 
| 
       594 
700 
     | 
    
         
             
                            puts "running 'autoproj osdeps' to re-install missing gems"
         
     | 
| 
       595 
701 
     | 
    
         
             
                            if !system(Gem.ruby, autoproj_path, 'osdeps')
         
     | 
| 
       596 
     | 
    
         
            -
                                STDERR.puts "failed to run autoproj osdeps on the newly installed  
     | 
| 
      
 702 
     | 
    
         
            +
                                STDERR.puts "failed to run autoproj osdeps on the newly installed "\
         
     | 
| 
      
 703 
     | 
    
         
            +
                                    "autoproj (#{autoproj_path})"
         
     | 
| 
       597 
704 
     | 
    
         
             
                                exit 1
         
     | 
| 
       598 
705 
     | 
    
         
             
                            end
         
     | 
| 
       599 
706 
     | 
    
         
             
                        end
         
     | 
| 
         @@ -602,7 +709,6 @@ require 'bundler/setup' 
     | 
|
| 
       602 
709 
     | 
    
         
             
            end
         
     | 
| 
       603 
710 
     | 
    
         | 
| 
       604 
711 
     | 
    
         | 
| 
       605 
     | 
    
         
            -
             
     | 
| 
       606 
712 
     | 
    
         
             
            ENV.delete('BUNDLE_GEMFILE')
         
     | 
| 
       607 
713 
     | 
    
         
             
            ENV.delete('RUBYLIB')
         
     | 
| 
       608 
714 
     | 
    
         
             
            ops = Autoproj::Ops::Install.new(Dir.pwd)
         
     |