autoproj 2.7.1 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/bin/autoproj_install
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)
|
@@ -105,6 +105,11 @@ def self.package_handler_for(full_path)
|
|
105
105
|
end
|
106
106
|
toplevel_dir ||= find_topmost_directory_containing(full_path, 'CMakeLists.txt')
|
107
107
|
|
108
|
+
manifest_xml = File.join(toplevel_dir, 'manifest.xml')
|
109
|
+
package_xml = File.join(toplevel_dir, 'package.xml')
|
110
|
+
if File.file?(package_xml) && !File.file?(manifest_xml)
|
111
|
+
return "catkin_package", toplevel_dir
|
112
|
+
end
|
108
113
|
return "cmake_package", toplevel_dir
|
109
114
|
elsif dir = find_topmost_directory_containing(full_path, "Rakefile") ||
|
110
115
|
find_topmost_directory_containing(full_path, "lib/*.rb")
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'autoproj/shell_completion'
|
2
|
+
|
3
|
+
module Autoproj
|
4
|
+
# This class generates shell completion for code for a given Thor subclasss
|
5
|
+
class BashCompletion < ShellCompletion
|
6
|
+
MAIN_FUNCTION_TEMPLATE = 'main.bash.erb'
|
7
|
+
SUBCOMMAND_FUNCTION_TEMPLATE = 'subcommand.bash.erb'
|
8
|
+
|
9
|
+
def setup_file_completion(metadata)
|
10
|
+
metadata[:completer] = '_filedir'
|
11
|
+
end
|
12
|
+
|
13
|
+
def setup_executable_completion(metadata)
|
14
|
+
metadata[:completer] = 'COMPREPLY=( $( compgen -d -c -- "$cur" ) )'
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup_package_completion(metadata)
|
18
|
+
metadata[:completer] = '_autoproj_installed_packages'
|
19
|
+
end
|
20
|
+
|
21
|
+
def disable_completion(metadata)
|
22
|
+
metadata[:completer] = nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
data/lib/autoproj/cli/base.rb
CHANGED
@@ -9,7 +9,7 @@ class Base
|
|
9
9
|
include Ops::Tools
|
10
10
|
|
11
11
|
# The underlying workspace
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# @return [Workspace]
|
14
14
|
attr_reader :ws
|
15
15
|
|
@@ -85,7 +85,7 @@ def resolve_user_selection(selected_packages, **options)
|
|
85
85
|
if handler
|
86
86
|
Autoproj.message " auto-adding #{srcdir} using the #{handler.gsub(/_package/, '')} package handler"
|
87
87
|
srcdir = File.expand_path(srcdir)
|
88
|
-
relative_to_root = Pathname.new(srcdir).relative_path_from(Pathname.new(ws.
|
88
|
+
relative_to_root = Pathname.new(srcdir).relative_path_from(Pathname.new(ws.source_dir))
|
89
89
|
pkg = ws.in_package_set(ws.manifest.main_package_set, ws.manifest.file) do
|
90
90
|
send(handler, relative_to_root.to_s, workspace: ws)
|
91
91
|
end
|
@@ -213,9 +213,9 @@ def notify_env_sh_updated
|
|
213
213
|
return if @env_sh_updated.nil?
|
214
214
|
|
215
215
|
if @env_sh_updated
|
216
|
-
Autoproj.message " updated
|
216
|
+
Autoproj.message " updated environment", :green
|
217
217
|
else
|
218
|
-
Autoproj.message "
|
218
|
+
Autoproj.message " environment already up-to-date", :green
|
219
219
|
end
|
220
220
|
end
|
221
221
|
end
|