autoproj 2.12.1 → 2.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +25 -0
  3. data/.github/workflows/test.yml +30 -0
  4. data/.rubocop.yml +79 -91
  5. data/.rubocop_todo.yml +1473 -0
  6. data/Gemfile +9 -9
  7. data/Rakefile +24 -24
  8. data/autoproj.gemspec +24 -22
  9. data/bin/alocate +4 -4
  10. data/bin/alog +6 -7
  11. data/bin/amake +4 -4
  12. data/bin/aup +4 -4
  13. data/bin/autoproj +3 -3
  14. data/bin/autoproj_bootstrap +225 -200
  15. data/bin/autoproj_bootstrap.in +7 -8
  16. data/bin/autoproj_install +224 -199
  17. data/bin/autoproj_install.in +6 -7
  18. data/lib/autoproj/aruba_minitest.rb +6 -11
  19. data/lib/autoproj/autobuild.rb +9 -6
  20. data/lib/autoproj/autobuild_extensions/archive_importer.rb +10 -11
  21. data/lib/autoproj/autobuild_extensions/dsl.rb +66 -36
  22. data/lib/autoproj/autobuild_extensions/git.rb +27 -26
  23. data/lib/autoproj/autobuild_extensions/package.rb +23 -22
  24. data/lib/autoproj/autobuild_extensions/python.rb +18 -0
  25. data/lib/autoproj/autobuild_extensions/svn.rb +1 -2
  26. data/lib/autoproj/base.rb +1 -1
  27. data/lib/autoproj/bash_completion.rb +5 -6
  28. data/lib/autoproj/build_option.rb +22 -24
  29. data/lib/autoproj/cli/base.rb +26 -26
  30. data/lib/autoproj/cli/bootstrap.rb +14 -16
  31. data/lib/autoproj/cli/build.rb +10 -7
  32. data/lib/autoproj/cli/cache.rb +11 -11
  33. data/lib/autoproj/cli/clean.rb +10 -10
  34. data/lib/autoproj/cli/commit.rb +7 -8
  35. data/lib/autoproj/cli/doc.rb +2 -2
  36. data/lib/autoproj/cli/envsh.rb +1 -2
  37. data/lib/autoproj/cli/exec.rb +60 -20
  38. data/lib/autoproj/cli/inspection_tool.rb +13 -7
  39. data/lib/autoproj/cli/locate.rb +30 -41
  40. data/lib/autoproj/cli/log.rb +7 -7
  41. data/lib/autoproj/cli/main.rb +217 -205
  42. data/lib/autoproj/cli/main_doc.rb +22 -21
  43. data/lib/autoproj/cli/main_global.rb +44 -19
  44. data/lib/autoproj/cli/main_plugin.rb +18 -18
  45. data/lib/autoproj/cli/main_test.rb +28 -27
  46. data/lib/autoproj/cli/manifest.rb +7 -7
  47. data/lib/autoproj/cli/osdeps.rb +12 -11
  48. data/lib/autoproj/cli/patcher.rb +2 -3
  49. data/lib/autoproj/cli/query.rb +17 -18
  50. data/lib/autoproj/cli/reconfigure.rb +1 -2
  51. data/lib/autoproj/cli/reset.rb +9 -12
  52. data/lib/autoproj/cli/show.rb +38 -39
  53. data/lib/autoproj/cli/status.rb +56 -44
  54. data/lib/autoproj/cli/switch_config.rb +5 -6
  55. data/lib/autoproj/cli/tag.rb +12 -11
  56. data/lib/autoproj/cli/test.rb +7 -7
  57. data/lib/autoproj/cli/update.rb +97 -43
  58. data/lib/autoproj/cli/utility.rb +14 -12
  59. data/lib/autoproj/cli/version.rb +42 -40
  60. data/lib/autoproj/cli/versions.rb +14 -15
  61. data/lib/autoproj/cli/watch.rb +33 -37
  62. data/lib/autoproj/cli/which.rb +16 -20
  63. data/lib/autoproj/cli.rb +4 -2
  64. data/lib/autoproj/configuration.rb +78 -86
  65. data/lib/autoproj/default.osdeps +29 -3
  66. data/lib/autoproj/environment.rb +42 -23
  67. data/lib/autoproj/exceptions.rb +9 -3
  68. data/lib/autoproj/find_workspace.rb +20 -25
  69. data/lib/autoproj/git_server_configuration.rb +40 -44
  70. data/lib/autoproj/gitorious.rb +1 -1
  71. data/lib/autoproj/installation_manifest.rb +64 -29
  72. data/lib/autoproj/local_package_set.rb +13 -11
  73. data/lib/autoproj/manifest.rb +139 -132
  74. data/lib/autoproj/metapackage.rb +2 -6
  75. data/lib/autoproj/ops/atomic_write.rb +7 -6
  76. data/lib/autoproj/ops/build.rb +4 -6
  77. data/lib/autoproj/ops/cache.rb +41 -43
  78. data/lib/autoproj/ops/cached_env.rb +5 -4
  79. data/lib/autoproj/ops/configuration.rb +519 -507
  80. data/lib/autoproj/ops/import.rb +88 -63
  81. data/lib/autoproj/ops/install.rb +218 -192
  82. data/lib/autoproj/ops/loader.rb +77 -76
  83. data/lib/autoproj/ops/main_config_switcher.rb +36 -45
  84. data/lib/autoproj/ops/phase_reporting.rb +4 -4
  85. data/lib/autoproj/ops/snapshot.rb +250 -247
  86. data/lib/autoproj/ops/tools.rb +76 -78
  87. data/lib/autoproj/ops/watch.rb +6 -6
  88. data/lib/autoproj/ops/which.rb +17 -14
  89. data/lib/autoproj/options.rb +13 -2
  90. data/lib/autoproj/os_package_installer.rb +102 -92
  91. data/lib/autoproj/os_package_query.rb +7 -13
  92. data/lib/autoproj/os_package_resolver.rb +189 -140
  93. data/lib/autoproj/os_repository_installer.rb +4 -4
  94. data/lib/autoproj/os_repository_resolver.rb +8 -6
  95. data/lib/autoproj/package_definition.rb +12 -13
  96. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +19 -11
  97. data/lib/autoproj/package_managers/bundler_manager.rb +186 -129
  98. data/lib/autoproj/package_managers/debian_version.rb +25 -21
  99. data/lib/autoproj/package_managers/emerge_manager.rb +2 -3
  100. data/lib/autoproj/package_managers/gem_manager.rb +68 -77
  101. data/lib/autoproj/package_managers/homebrew_manager.rb +3 -4
  102. data/lib/autoproj/package_managers/manager.rb +8 -3
  103. data/lib/autoproj/package_managers/pacman_manager.rb +2 -3
  104. data/lib/autoproj/package_managers/pip_manager.rb +30 -28
  105. data/lib/autoproj/package_managers/pkg_manager.rb +3 -4
  106. data/lib/autoproj/package_managers/port_manager.rb +2 -3
  107. data/lib/autoproj/package_managers/shell_script_manager.rb +47 -25
  108. data/lib/autoproj/package_managers/unknown_os_manager.rb +5 -8
  109. data/lib/autoproj/package_managers/yum_manager.rb +12 -15
  110. data/lib/autoproj/package_managers/zypper_manager.rb +11 -14
  111. data/lib/autoproj/package_manifest.rb +28 -74
  112. data/lib/autoproj/package_selection.rb +187 -187
  113. data/lib/autoproj/package_set.rb +145 -114
  114. data/lib/autoproj/python.rb +297 -0
  115. data/lib/autoproj/query_base.rb +20 -14
  116. data/lib/autoproj/reporter.rb +19 -19
  117. data/lib/autoproj/repository_managers/apt.rb +102 -68
  118. data/lib/autoproj/repository_managers/unknown_os_manager.rb +3 -3
  119. data/lib/autoproj/ros_condition_parser.rb +84 -0
  120. data/lib/autoproj/ros_package_manifest.rb +125 -0
  121. data/lib/autoproj/shell_completion.rb +16 -13
  122. data/lib/autoproj/source_package_query.rb +29 -36
  123. data/lib/autoproj/system.rb +32 -21
  124. data/lib/autoproj/test.rb +131 -106
  125. data/lib/autoproj/variable_expansion.rb +10 -10
  126. data/lib/autoproj/vcs_definition.rb +53 -37
  127. data/lib/autoproj/version.rb +1 -1
  128. data/lib/autoproj/workspace.rb +143 -108
  129. data/lib/autoproj/zsh_completion.rb +8 -9
  130. data/lib/autoproj.rb +55 -53
  131. data/samples/autoproj/init.rb +1 -2
  132. metadata +86 -65
  133. data/.travis.yml +0 -22
@@ -1,15 +1,16 @@
1
1
  module Autoproj
2
2
  module CLI
3
3
  class MainDoc < Thor
4
- namespace 'doc'
4
+ namespace "doc"
5
5
 
6
- default_command 'exec'
6
+ default_command "exec"
7
7
 
8
8
  no_commands do
9
9
  def report(report_options = Hash.new)
10
10
  options = self.options.merge(parent_options)
11
11
  extra_options = Hash.new
12
- if Autobuild::Subprocess.transparent_mode = options[:tool]
12
+ if options[:tool]
13
+ Autobuild::Subprocess.transparent_mode = true
13
14
  Autobuild.silent = true
14
15
  Autobuild.color = false
15
16
  report_options[:silent] = true
@@ -22,11 +23,11 @@ module Autoproj
22
23
  end
23
24
  end
24
25
 
25
- desc 'enable [PACKAGES]', 'enable docs for the given packages (or for all packages if none are given)'
26
+ desc "enable [PACKAGES]", "enable docs for the given packages (or for all packages if none are given)"
26
27
  option :deps, type: :boolean, default: false,
27
- desc: 'controls whether the dependencies of the packages given on the command line should be enabled as well (the default is not)'
28
+ desc: "controls whether the dependencies of the packages given on the command line should be enabled as well (the default is not)"
28
29
  def enable(*packages)
29
- require 'autoproj/cli/doc'
30
+ require "autoproj/cli/doc"
30
31
  report(silent: true) do
31
32
  cli = Doc.new
32
33
  args = cli.validate_options(packages, options)
@@ -34,11 +35,11 @@ module Autoproj
34
35
  end
35
36
  end
36
37
 
37
- desc 'disable [PACKAGES]', 'disable docs for the given packages (or for all packages if none are given)'
38
+ desc "disable [PACKAGES]", "disable docs for the given packages (or for all packages if none are given)"
38
39
  option :deps, type: :boolean, default: false,
39
- desc: 'controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)'
40
+ desc: "controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)"
40
41
  def disable(*packages)
41
- require 'autoproj/cli/doc'
42
+ require "autoproj/cli/doc"
42
43
  report(silent: true) do
43
44
  cli = Doc.new
44
45
  args = cli.validate_options(packages, options)
@@ -46,11 +47,11 @@ module Autoproj
46
47
  end
47
48
  end
48
49
 
49
- desc 'list [PACKAGES]', 'show doc enable/disable status for the given packages (or all packages if none are given)'
50
+ desc "list [PACKAGES]", "show doc enable/disable status for the given packages (or all packages if none are given)"
50
51
  option :deps, type: :boolean, default: true,
51
- desc: 'controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)'
52
+ desc: "controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)"
52
53
  def list(*packages)
53
- require 'autoproj/cli/doc'
54
+ require "autoproj/cli/doc"
54
55
  report(silent: true) do
55
56
  cli = Doc.new
56
57
  args = cli.validate_options(packages, options)
@@ -58,21 +59,21 @@ module Autoproj
58
59
  end
59
60
  end
60
61
 
61
- desc 'exec [PACKAGES]', 'generate documentation for the given packages, or all if no packages are given on the command line'
62
+ desc "exec [PACKAGES]", "generate documentation for the given packages, or all if no packages are given on the command line"
62
63
  option :deps, type: :boolean, default: false,
63
- desc: 'controls whether to generate documentation of the dependencies of the packages given on the command line (the default is not)'
64
- option :no_deps_shortcut, hide: true, aliases: '-n', type: :boolean,
65
- desc: 'provide -n for --no-deps'
64
+ desc: "controls whether to generate documentation of the dependencies of the packages given on the command line (the default is not)"
65
+ option :no_deps_shortcut, hide: true, aliases: "-n", type: :boolean,
66
+ desc: "provide -n for --no-deps"
66
67
  option :parallel, aliases: :p, type: :numeric,
67
- desc: 'maximum number of parallel jobs'
68
+ desc: "maximum number of parallel jobs"
68
69
  option :tool, type: :boolean, default: false,
69
- desc: "run in tool mode, which do not redirect the subcommand's outputs"
70
+ desc: "run in tool mode, which do not redirect the subcommand's outputs"
70
71
  option :color, type: :boolean, default: TTY::Color.color?,
71
- desc: 'enables or disables colored display (enabled by default if the terminal supports it)'
72
+ desc: "enables or disables colored display (enabled by default if the terminal supports it)"
72
73
  option :progress, type: :boolean, default: TTY::Color.color?,
73
- desc: 'enables or disables progress display (enabled by default if the terminal supports it)'
74
+ desc: "enables or disables progress display (enabled by default if the terminal supports it)"
74
75
  def exec(*packages)
75
- require 'autoproj/cli/doc'
76
+ require "autoproj/cli/doc"
76
77
  options = self.options.merge(parent_options)
77
78
  report do |extra_options|
78
79
  cli = Doc.new
@@ -1,38 +1,63 @@
1
1
  module Autoproj
2
2
  module CLI
3
3
  class MainGlobal < Thor
4
- namespace 'global'
4
+ namespace "global"
5
5
 
6
- desc 'register', 'register the current workspace'
6
+ WorkspaceDir = Struct.new :name, :path, :present
7
+
8
+ no_commands do
9
+ def gather_workspaces_dirs(ws)
10
+ ws.each_with_object({}) do |w, h|
11
+ w_dirs = %w[root_dir prefix_dir build_dir].map do |name|
12
+ dir = w.public_send(name)
13
+ if dir.start_with?("/")
14
+ WorkspaceDir.new(name, dir, File.directory?(dir))
15
+ end
16
+ end.compact
17
+
18
+ h[w] = w_dirs
19
+ end
20
+ end
21
+
22
+ def filter_removed_workspaces(dirs)
23
+ dirs.delete_if { |w, w_dirs| w_dirs.none?(&:present) }
24
+ end
25
+ end
26
+
27
+ desc "register", "register the current workspace"
7
28
  def register
8
- require 'autoproj'
29
+ require "autoproj"
9
30
  ws = Workspace.default
10
31
  ws.load_config
11
32
  ws.register_workspace
12
33
  end
13
34
 
14
- desc 'status', 'display information about the known workspaces'
35
+ desc "status", "display information about the known workspaces"
15
36
  def status
16
- require 'autoproj'
37
+ require "autoproj"
17
38
  ws = Workspace.registered_workspaces
18
39
  fields = Workspace::RegisteredWorkspace.members.map(&:to_s)
40
+
41
+ dirs = gather_workspaces_dirs(ws)
42
+ filter_removed_workspaces(dirs)
43
+ Workspace.save_registered_workspaces(dirs.keys)
44
+
19
45
  format_w = fields.map(&:length).max + 1
20
46
  format = "%-#{format_w}s %s (%s)"
21
- blocks = ws.map do |w|
22
- %w[root_dir prefix_dir build_dir].map do |name|
23
- dir = w.public_send(name)
24
- if dir.start_with?('/')
25
- status = if File.directory?(dir)
26
- Autobuild.color('present', :green)
27
- else
28
- Autobuild.color('absent', :yellow)
29
- end
30
-
31
- format(format, "#{name}:", dir, status)
32
- end
33
- end.compact.join("\n")
47
+ blocks = dirs.map do |w, w_dirs|
48
+ lines = w_dirs.map do |d|
49
+ status =
50
+ if d.present
51
+ Autobuild.color("present", :green)
52
+ else
53
+ Autobuild.color("absent", :yellow)
54
+ end
55
+
56
+ format(format, "#{d.name}:", d.path, status)
57
+ end
58
+ lines.join("\n")
34
59
  end
35
- puts blocks.join("---\n")
60
+ puts blocks.join("\n---\n")
36
61
  end
37
62
  end
38
63
  end
@@ -1,7 +1,7 @@
1
1
  module Autoproj
2
2
  module CLI
3
3
  class MainPlugin < Thor
4
- namespace 'plugin'
4
+ namespace "plugin"
5
5
 
6
6
  no_commands do
7
7
  def ws
@@ -15,27 +15,27 @@ module Autoproj
15
15
 
16
16
  def read_plugin_list
17
17
  ws.load_config
18
- ws.config.get('plugins', Hash.new)
18
+ ws.config.get("plugins", Hash.new)
19
19
  end
20
20
 
21
21
  def write_plugin_list(plugins)
22
22
  ws.load_config
23
- ws.config.set('plugins', plugins)
23
+ ws.config.set("plugins", plugins)
24
24
  ws.save_config
25
25
  end
26
26
  end
27
27
 
28
- desc 'install NAME', 'install or upgrade an autoproj plugin'
29
- option :version, desc: 'a gem version constraint',
30
- type: 'string', default: '>= 0'
31
- option :git, desc: 'checkout a git repository instead of downloading the gem',
32
- type: 'string'
33
- option :branch, desc: 'choose the branch that should be checked out with --git',
34
- type: 'string', default: 'master'
35
- option :path, desc: 'use the plugin that is already present on this path',
36
- type: 'string'
28
+ desc "install NAME", "install or upgrade an autoproj plugin"
29
+ option :version, desc: "a gem version constraint",
30
+ type: "string", default: ">= 0"
31
+ option :git, desc: "checkout a git repository instead of downloading the gem",
32
+ type: "string"
33
+ option :branch, desc: "choose the branch that should be checked out with --git",
34
+ type: "string", default: "master"
35
+ option :path, desc: "use the plugin that is already present on this path",
36
+ type: "string"
37
37
  def install(name)
38
- require 'autoproj'
38
+ require "autoproj"
39
39
 
40
40
  gem_options = Hash.new
41
41
  if options[:git] && options[:path]
@@ -59,18 +59,18 @@ module Autoproj
59
59
  end
60
60
  end
61
61
 
62
- desc 'list', 'list installed plugins'
62
+ desc "list", "list installed plugins"
63
63
  def list
64
- require 'autoproj'
64
+ require "autoproj"
65
65
  read_plugin_list.sort_by(&:first).each do |name, (version, options)|
66
66
  args = [version, *options.map { |k, v| "#{k}: \"#{v}\"" }]
67
- puts "#{name}: #{args.join(", ")}"
67
+ puts "#{name}: #{args.join(', ')}"
68
68
  end
69
69
  end
70
70
 
71
- desc 'remove NAME', 'uninstall a plugin'
71
+ desc "remove NAME", "uninstall a plugin"
72
72
  def remove(name)
73
- require 'autoproj'
73
+ require "autoproj"
74
74
  plugins = read_plugin_list
75
75
  updated_plugins = plugins.dup
76
76
  updated_plugins.delete(name)
@@ -1,15 +1,16 @@
1
1
  module Autoproj
2
2
  module CLI
3
3
  class MainTest < Thor
4
- namespace 'test'
4
+ namespace "test"
5
5
 
6
- default_command 'exec'
6
+ default_command "exec"
7
7
 
8
8
  no_commands do
9
9
  def report(report_options = Hash.new)
10
10
  options = self.options.merge(parent_options)
11
11
  extra_options = Hash.new
12
- if Autobuild::Subprocess.transparent_mode = options[:tool]
12
+ if options[:tool]
13
+ Autobuild::Subprocess.transparent_mode = true
13
14
  Autobuild.silent = true
14
15
  Autobuild.color = false
15
16
  report_options[:silent] = true
@@ -22,26 +23,26 @@ module Autoproj
22
23
  end
23
24
  end
24
25
 
25
- desc 'default [on|off]', 'set whether tests are enabled or disabled by default, without touching existing settings'
26
+ desc "default [on|off]", "set whether tests are enabled or disabled by default, without touching existing settings"
26
27
  def default(on_or_off)
27
- require 'autoproj/cli/test'
28
+ require "autoproj/cli/test"
28
29
  report(silent: true) do
29
30
  cli = Test.new
30
31
  args = cli.validate_options([], options)
31
32
  enabled = case on_or_off
32
- when 'on' then true
33
- when 'off' then false
33
+ when "on" then true
34
+ when "off" then false
34
35
  else raise ArgumentError, "expected 'on' or 'off'"
35
36
  end
36
37
  cli.default(enabled)
37
38
  end
38
39
  end
39
40
 
40
- desc 'enable [PACKAGES]', 'enable tests for the given packages (or for all packages if none are given)'
41
+ desc "enable [PACKAGES]", "enable tests for the given packages (or for all packages if none are given)"
41
42
  option :deps, type: :boolean, default: false,
42
- desc: 'controls whether the dependencies of the packages given on the command line should be enabled as well (the default is not)'
43
+ desc: "controls whether the dependencies of the packages given on the command line should be enabled as well (the default is not)"
43
44
  def enable(*packages)
44
- require 'autoproj/cli/test'
45
+ require "autoproj/cli/test"
45
46
  report(silent: true) do
46
47
  cli = Test.new
47
48
  args = cli.validate_options(packages, options)
@@ -49,11 +50,11 @@ module Autoproj
49
50
  end
50
51
  end
51
52
 
52
- desc 'disable [PACKAGES]', 'disable tests for the given packages (or for all packages if none are given)'
53
+ desc "disable [PACKAGES]", "disable tests for the given packages (or for all packages if none are given)"
53
54
  option :deps, type: :boolean, default: false,
54
- desc: 'controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)'
55
+ desc: "controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)"
55
56
  def disable(*packages)
56
- require 'autoproj/cli/test'
57
+ require "autoproj/cli/test"
57
58
  report(silent: true) do
58
59
  cli = Test.new
59
60
  args = cli.validate_options(packages, options)
@@ -61,11 +62,11 @@ module Autoproj
61
62
  end
62
63
  end
63
64
 
64
- desc 'list [PACKAGES]', 'show test enable/disable status for the given packages (or all packages if none are given)'
65
+ desc "list [PACKAGES]", "show test enable/disable status for the given packages (or all packages if none are given)"
65
66
  option :deps, type: :boolean, default: true,
66
- desc: 'controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)'
67
+ desc: "controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)"
67
68
  def list(*packages)
68
- require 'autoproj/cli/test'
69
+ require "autoproj/cli/test"
69
70
  report(silent: true) do
70
71
  cli = Test.new
71
72
  args = cli.validate_options(packages, options)
@@ -73,26 +74,26 @@ module Autoproj
73
74
  end
74
75
  end
75
76
 
76
- desc 'exec [PACKAGES]', 'execute the tests for the given packages, or all if no packages are given on the command line'
77
+ desc "exec [PACKAGES]", "execute the tests for the given packages, or all if no packages are given on the command line"
77
78
  option :keep_going, aliases: :k, type: :boolean,
78
- banner: '',
79
- desc: 'do not stop on build or checkout errors'
79
+ banner: "",
80
+ desc: "do not stop on build or checkout errors"
80
81
  option :deps, type: :boolean, default: false,
81
- desc: 'controls whether to execute the tests of the dependencies of the packages given on the command line (the default is not)'
82
+ desc: "controls whether to execute the tests of the dependencies of the packages given on the command line (the default is not)"
82
83
  option :parallel, aliases: :p, type: :numeric,
83
- desc: 'maximum number of parallel jobs'
84
+ desc: "maximum number of parallel jobs"
84
85
  option :fail, type: :boolean, default: true,
85
- desc: 'return with a nonzero exit code if the test does not pass'
86
+ desc: "return with a nonzero exit code if the test does not pass"
86
87
  option :coverage, type: :boolean, default: false,
87
- desc: 'whether code coverage should be generated if possible'
88
+ desc: "whether code coverage should be generated if possible"
88
89
  option :tool, type: :boolean, default: false,
89
- desc: "build in tool mode, which do not redirect the subcommand's outputs"
90
+ desc: "build in tool mode, which do not redirect the subcommand's outputs"
90
91
  option :color, type: :boolean, default: TTY::Color.color?,
91
- desc: 'enables or disables colored display (enabled by default if the terminal supports it)'
92
+ desc: "enables or disables colored display (enabled by default if the terminal supports it)"
92
93
  option :progress, type: :boolean, default: TTY::Color.color?,
93
- desc: 'enables or disables progress display (enabled by default if the terminal supports it)'
94
+ desc: "enables or disables progress display (enabled by default if the terminal supports it)"
94
95
  def exec(*packages)
95
- require 'autoproj/cli/test'
96
+ require "autoproj/cli/test"
96
97
  options = self.options.merge(parent_options)
97
98
  report do |extra_options|
98
99
  cli = Test.new
@@ -1,10 +1,10 @@
1
- require 'autoproj'
2
- require 'autoproj/cli/base'
1
+ require "autoproj"
2
+ require "autoproj/cli/base"
3
3
  module Autoproj
4
4
  module CLI
5
5
  class Manifest < Base
6
6
  def validate_options(args, options)
7
- return args, options
7
+ [args, options]
8
8
  end
9
9
 
10
10
  def run(name, options = Hash.new)
@@ -21,11 +21,12 @@ module Autoproj
21
21
  full_path = File.join(ws.config_dir, name)
22
22
  end
23
23
 
24
- if !File.file?(full_path)
24
+ unless File.file?(full_path)
25
25
  alternative_full_path = File.join(ws.config_dir, "manifest.#{name}")
26
- if !File.file?(alternative_full_path)
26
+ unless File.file?(alternative_full_path)
27
27
  raise CLIInvalidArguments, "neither #{full_path} nor #{alternative_full_path} exist"
28
28
  end
29
+
29
30
  full_path = alternative_full_path
30
31
  end
31
32
  begin
@@ -34,7 +35,7 @@ module Autoproj
34
35
  Autoproj.error "failed to load #{full_path}"
35
36
  raise
36
37
  end
37
- ws.config.set 'manifest_name', File.basename(full_path)
38
+ ws.config.set "manifest_name", File.basename(full_path)
38
39
  ws.save_config
39
40
  Autoproj.message "set manifest to #{full_path}"
40
41
  else
@@ -47,4 +48,3 @@ module Autoproj
47
48
  end
48
49
  end
49
50
  end
50
-
@@ -1,4 +1,4 @@
1
- require 'autoproj/cli/inspection_tool'
1
+ require "autoproj/cli/inspection_tool"
2
2
 
3
3
  module Autoproj
4
4
  module CLI
@@ -8,18 +8,18 @@ module Autoproj
8
8
  if options[:system_info]
9
9
  os_names, os_versions = ws.os_package_resolver.operating_system
10
10
  os_package_manager_names = OSPackageResolver::OS_PACKAGE_MANAGERS.values
11
- os_indep_managers = ws.os_package_installer.package_managers.
12
- each_key.find_all do |name, manager|
13
- !os_package_manager_names.include?(name)
14
- end
15
- puts "OS Names: #{(os_names - ['default']).join(", ")}"
16
- puts "OS Versions: #{(os_versions - ['default']).join(", ")}"
11
+ os_indep_managers = ws.os_package_installer.package_managers
12
+ .each_key.find_all do |name, manager|
13
+ !os_package_manager_names.include?(name)
14
+ end
15
+ puts "OS Names: #{(os_names - ['default']).join(', ')}"
16
+ puts "OS Versions: #{(os_versions - ['default']).join(', ')}"
17
17
  puts "OS Package Manager: #{ws.os_package_resolver.os_package_manager}"
18
- puts "Available Package Managers: #{os_indep_managers.sort.join(", ")}"
18
+ puts "Available Package Managers: #{os_indep_managers.sort.join(', ')}"
19
19
  return
20
20
  end
21
21
 
22
- _, osdep_packages, resolved_selection, _ =
22
+ _, osdep_packages, resolved_selection, =
23
23
  finalize_setup(user_selection)
24
24
 
25
25
  shell_helpers = options.fetch(:shell_helpers, ws.config.shell_helpers?)
@@ -28,10 +28,11 @@ module Autoproj
28
28
  ws.install_os_packages(
29
29
  osdep_packages,
30
30
  run_package_managers_without_packages: true,
31
- install_only: !update)
31
+ install_only: !update
32
+ )
32
33
  export_env_sh(shell_helpers: shell_helpers)
33
34
  Main.run_post_command_hook(:update, ws, source_packages: [],
34
- osdep_packages: osdep_packages)
35
+ osdep_packages: osdep_packages)
35
36
  end
36
37
  end
37
38
  end
@@ -1,11 +1,11 @@
1
- require 'autoproj/cli/inspection_tool'
1
+ require "autoproj/cli/inspection_tool"
2
2
  module Autoproj
3
3
  module CLI
4
4
  # Interface to patch/unpatch a package
5
5
  class Patcher < InspectionTool
6
6
  def run(packages, patch: true)
7
7
  initialize_and_load
8
- packages, _ = finalize_setup(packages, recursive: false, non_imported_packages: :ignore)
8
+ packages, = finalize_setup(packages, recursive: false, non_imported_packages: :ignore)
9
9
  packages.each do |package_name|
10
10
  pkg = ws.manifest.package_definition_by_name(package_name)
11
11
  if patch
@@ -18,4 +18,3 @@ module Autoproj
18
18
  end
19
19
  end
20
20
  end
21
-
@@ -1,5 +1,5 @@
1
- require 'autoproj'
2
- require 'autoproj/cli/inspection_tool'
1
+ require "autoproj"
2
+ require "autoproj/cli/inspection_tool"
3
3
 
4
4
  module Autoproj
5
5
  module CLI
@@ -10,14 +10,14 @@ module Autoproj
10
10
 
11
11
  def find_all_matches(query, packages)
12
12
  matches = packages.map do |pkg|
13
- if priority = query.match(pkg)
13
+ if (priority = query.match(pkg))
14
14
  [priority, pkg]
15
15
  end
16
16
  end.compact
17
17
  matches.sort_by { |priority, pkg| [priority, pkg.name] }
18
18
  end
19
19
 
20
- def run(query_string, format: '$NAME', search_all: false, only_present: false, osdeps: false)
20
+ def run(query_string, format: "$NAME", search_all: false, only_present: false, osdeps: false)
21
21
  initialize_and_load
22
22
  all_selected_packages, all_selected_osdeps_packages, * =
23
23
  finalize_setup([], non_imported_packages: :return)
@@ -29,7 +29,7 @@ module Autoproj
29
29
  end
30
30
  end
31
31
 
32
- def query_os_packages(query_string, selected_packages, format: '$NAME', search_all: false)
32
+ def query_os_packages(query_string, selected_packages, format: "$NAME", search_all: false)
33
33
  if query_string.empty?
34
34
  query = OSPackageQuery.all
35
35
  else
@@ -67,14 +67,14 @@ module Autoproj
67
67
 
68
68
  def format_osdep_package(format, priority, name, handler, real_package_name)
69
69
  fields = Hash.new
70
- fields['NAME'] = name
71
- fields['PRIORITY'] = priority
72
- fields['HANDLER'] = handler
73
- fields['REAL_PACKAGE'] = real_package_name
70
+ fields["NAME"] = name
71
+ fields["PRIORITY"] = priority
72
+ fields["HANDLER"] = handler
73
+ fields["REAL_PACKAGE"] = real_package_name
74
74
  Autoproj.expand(format, fields)
75
75
  end
76
76
 
77
- def query_source_packages(query_string, selected_packages, format: '$NAME', search_all: false, only_present: false)
77
+ def query_source_packages(query_string, selected_packages, format: "$NAME", search_all: false, only_present: false)
78
78
  if query_string.empty?
79
79
  query = SourcePackageQuery.all
80
80
  else
@@ -105,18 +105,17 @@ module Autoproj
105
105
  def format_source_package(format, priority, package)
106
106
  autobuild_package = package.autobuild
107
107
  fields = Hash.new
108
- fields['SRCDIR'] = autobuild_package.srcdir
109
- fields['BUILDDIR'] = if autobuild_package.respond_to?(:builddir)
108
+ fields["SRCDIR"] = autobuild_package.srcdir
109
+ fields["BUILDDIR"] = if autobuild_package.respond_to?(:builddir)
110
110
  autobuild_package.builddir
111
111
  end
112
- fields['PREFIX'] = autobuild_package.prefix
113
- fields['NAME'] = package.name
114
- fields['PRIORITY'] = priority
115
- fields['URL'] = (package.vcs.url if !package.vcs.none?)
116
- fields['PRESENT'] = File.directory?(autobuild_package.srcdir)
112
+ fields["PREFIX"] = autobuild_package.prefix
113
+ fields["NAME"] = package.name
114
+ fields["PRIORITY"] = priority
115
+ fields["URL"] = (package.vcs.url unless package.vcs.none?)
116
+ fields["PRESENT"] = File.directory?(autobuild_package.srcdir)
117
117
  Autoproj.expand(format, fields)
118
118
  end
119
119
  end
120
120
  end
121
121
  end
122
-
@@ -1,4 +1,4 @@
1
- require 'autoproj/cli/base'
1
+ require "autoproj/cli/base"
2
2
  module Autoproj
3
3
  module CLI
4
4
  class Reconfigure < Base
@@ -16,4 +16,3 @@ module Autoproj
16
16
  end
17
17
  end
18
18
  end
19
-
@@ -1,7 +1,7 @@
1
- require 'autoproj/cli'
2
- require 'autoproj/cli/inspection_tool'
3
- require 'autoproj/cli/update'
4
- require 'autoproj/cli/versions'
1
+ require "autoproj/cli"
2
+ require "autoproj/cli/inspection_tool"
3
+ require "autoproj/cli/update"
4
+ require "autoproj/cli/versions"
5
5
 
6
6
  module Autoproj
7
7
  module CLI
@@ -24,7 +24,8 @@ module Autoproj
24
24
  # Checkout the version file
25
25
  versions_file = File.join(
26
26
  Workspace::OVERRIDES_DIR,
27
- Versions::DEFAULT_VERSIONS_FILE_BASENAME)
27
+ Versions::DEFAULT_VERSIONS_FILE_BASENAME
28
+ )
28
29
  begin
29
30
  file_data = importer.show(pkg, ref_name, versions_file)
30
31
  versions_path = File.join(ws.config_dir, versions_file)
@@ -34,23 +35,19 @@ module Autoproj
34
35
  FileUtils.cp versions_path, old_versions_path
35
36
  end
36
37
  FileUtils.mkdir_p File.join(ws.config_dir, Workspace::OVERRIDES_DIR)
37
- File.open(versions_path, 'w') do |io|
38
+ File.open(versions_path, "w") do |io|
38
39
  io.write file_data
39
40
  end
40
41
 
41
42
  update = CLI::Update.new
42
43
  run_args = update.run([], reset: true)
43
-
44
44
  ensure
45
- if !options[:freeze]
45
+ unless options[:freeze]
46
46
  FileUtils.rm_f versions_path
47
- if old_versions_path
48
- FileUtils.mv old_versions_path, versions_path
49
- end
47
+ FileUtils.mv old_versions_path, versions_path if old_versions_path
50
48
  end
51
49
  end
52
50
  end
53
51
  end
54
52
  end
55
53
  end
56
-