machinery-tool 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.git_revision +1 -1
  3. data/NEWS +17 -0
  4. data/bin/machinery +10 -2
  5. data/html/comparison.html.haml +1 -1
  6. data/html/index.html.haml +2 -2
  7. data/html/partials/{config_files.html.haml → changed_config_files.html.haml} +10 -10
  8. data/html/partials/compare/changed_config_files.html.haml +48 -0
  9. data/html/partials/compare/{config_file_list.html.haml → changed_config_files_list.html.haml} +0 -0
  10. data/html/partials/compare/unmanaged_file_list.html.haml +1 -1
  11. data/html/partials/compare/unmanaged_files.html.haml +2 -2
  12. data/html/partials/patterns.html.haml +5 -0
  13. data/html/upgrade.html.haml +49 -0
  14. data/lib/{analyze_config_file_diffs_task.rb → analyze_changed_config_files_diffs_task.rb} +8 -8
  15. data/lib/autoyast.rb +12 -13
  16. data/lib/build_task.rb +2 -2
  17. data/lib/cli.rb +39 -32
  18. data/lib/compare_task.rb +1 -1
  19. data/lib/config_base.rb +1 -1
  20. data/lib/deploy_task.rb +4 -4
  21. data/lib/docker_system.rb +1 -1
  22. data/lib/element_filter.rb +3 -3
  23. data/lib/export_task.rb +3 -3
  24. data/lib/file_validator.rb +8 -5
  25. data/lib/filter.rb +5 -5
  26. data/lib/filter_option_parser.rb +3 -3
  27. data/lib/hint.rb +9 -4
  28. data/lib/html.rb +3 -3
  29. data/lib/inspect_task.rb +3 -3
  30. data/lib/json_schema_monkey_patch.rb +2 -2
  31. data/lib/json_validation_error_cleaner.rb +1 -1
  32. data/lib/json_validator.rb +2 -2
  33. data/lib/kiwi_config.rb +39 -14
  34. data/lib/list_task.rb +1 -1
  35. data/lib/local_system.rb +4 -4
  36. data/lib/machinery.rb +1 -1
  37. data/lib/machinery_logger.rb +4 -4
  38. data/lib/manifest.rb +5 -5
  39. data/lib/migration.rb +4 -4
  40. data/lib/object.rb +6 -10
  41. data/lib/remove_task.rb +1 -1
  42. data/lib/renderer.rb +5 -5
  43. data/lib/scope_file_access_archive.rb +2 -2
  44. data/lib/scope_file_access_flat.rb +3 -3
  45. data/lib/scope_file_store.rb +3 -3
  46. data/lib/serve_html_task.rb +15 -2
  47. data/lib/server.rb +32 -12
  48. data/lib/system.rb +1 -1
  49. data/lib/system_description.rb +16 -14
  50. data/lib/system_description_store.rb +5 -6
  51. data/lib/ui.rb +1 -1
  52. data/lib/upgrade_format_task.rb +2 -2
  53. data/lib/version.rb +1 -1
  54. data/lib/workload_mapper.rb +11 -11
  55. data/lib/zypper.rb +1 -1
  56. data/machinery-helper/Rakefile +1 -1
  57. data/machinery-helper/version.go +1 -1
  58. data/man/generated/machinery.1.gz +0 -0
  59. data/manual/docs/machinery-analyze.1.md +3 -3
  60. data/manual/docs/machinery-compare.1.md +2 -2
  61. data/manual/docs/machinery-inspect-docker.1.md +1 -1
  62. data/manual/docs/machinery-inspect.1.md +4 -1
  63. data/manual/docs/machinery-show.1.md +2 -2
  64. data/manual/docs/machinery_main_general.1.md +1 -1
  65. data/manual/docs/machinery_main_scopes.1.md +8 -6
  66. data/manual/site/machinery-analyze.1/index.html +3 -3
  67. data/manual/site/machinery-compare.1/index.html +2 -2
  68. data/manual/site/machinery-inspect-docker.1/index.html +1 -1
  69. data/manual/site/machinery-inspect.1/index.html +3 -1
  70. data/manual/site/machinery-show.1/index.html +2 -2
  71. data/manual/site/machinery_main_general.1/index.html +1 -1
  72. data/manual/site/machinery_main_scopes.1/index.html +8 -6
  73. data/manual/site/mkdocs/search_index.json +17 -17
  74. data/manual/site/sitemap.xml +23 -23
  75. data/plugins/{config_files/config_files.yml → changed_config_files/changed_config_files.yml} +3 -3
  76. data/plugins/{config_files/config_files_inspector.rb → changed_config_files/changed_config_files_inspector.rb} +14 -10
  77. data/plugins/{config_files/config_files_model.rb → changed_config_files/changed_config_files_model.rb} +1 -1
  78. data/plugins/{config_files/config_files_renderer.rb → changed_config_files/changed_config_files_renderer.rb} +9 -9
  79. data/plugins/{config_files/schema/system-description-config-files.schema-v1.json → changed_config_files/schema/system-description-changed-config-files.schema-v1.json} +0 -0
  80. data/plugins/{config_files/schema/system-description-config-files.schema-v2.json → changed_config_files/schema/system-description-changed-config-files.schema-v2.json} +0 -0
  81. data/plugins/{config_files/schema/system-description-config-files.schema-v3.json → changed_config_files/schema/system-description-changed-config-files.schema-v3.json} +0 -0
  82. data/plugins/{config_files/schema/system-description-config-files.schema-v4.json → changed_config_files/schema/system-description-changed-config-files.schema-v4.json} +0 -0
  83. data/plugins/{config_files/schema/system-description-config-files.schema-v5.json → changed_config_files/schema/system-description-changed-config-files.schema-v5.json} +0 -0
  84. data/plugins/{config_files/schema/system-description-config-files.schema-v6.json → changed_config_files/schema/system-description-changed-config-files.schema-v6.json} +0 -0
  85. data/plugins/{config_files/schema/system-description-config-files.schema-v7.json → changed_config_files/schema/system-description-changed-config-files.schema-v7.json} +0 -0
  86. data/plugins/changed_config_files/schema/system-description-changed-config-files.schema-v8.json +160 -0
  87. data/plugins/changed_managed_files/changed_managed_files_inspector.rb +6 -2
  88. data/plugins/changed_managed_files/changed_managed_files_renderer.rb +1 -1
  89. data/plugins/changed_managed_files/schema/system-description-changed-managed-files.schema-v8.json +160 -0
  90. data/plugins/environment/schema/system-description-environment.schema-v8.json +17 -0
  91. data/plugins/groups/groups_inspector.rb +1 -1
  92. data/plugins/groups/groups_renderer.rb +1 -1
  93. data/plugins/groups/schema/system-description-groups.schema-v8.json +49 -0
  94. data/plugins/os/os_inspector.rb +6 -6
  95. data/plugins/os/os_renderer.rb +1 -1
  96. data/plugins/os/schema/system-description-os.schema-v8.json +21 -0
  97. data/plugins/packages/packages_inspector.rb +1 -1
  98. data/plugins/packages/schema/system-description-packages.schema-v8.json +115 -0
  99. data/plugins/patterns/patterns.yml +5 -3
  100. data/plugins/patterns/patterns_inspector.rb +4 -3
  101. data/plugins/patterns/patterns_renderer.rb +5 -1
  102. data/plugins/patterns/schema/system-description-patterns.schema-v8.json +58 -0
  103. data/plugins/repositories/repositories_inspector.rb +2 -1
  104. data/plugins/repositories/schema/system-description-repositories.schema-v8.json +165 -0
  105. data/plugins/services/schema/system-description-services.schema-v8.json +93 -0
  106. data/plugins/services/services.yml +1 -1
  107. data/plugins/services/services_inspector.rb +1 -1
  108. data/plugins/unmanaged_files/schema/system-description-unmanaged-files.schema-v8.json +124 -0
  109. data/plugins/unmanaged_files/unmanaged_files_inspector.rb +9 -4
  110. data/plugins/unmanaged_files/unmanaged_files_model.rb +12 -5
  111. data/plugins/unmanaged_files/unmanaged_files_renderer.rb +1 -1
  112. data/plugins/users/schema/system-description-users.schema-v8.json +86 -0
  113. data/plugins/users/users_inspector.rb +7 -7
  114. data/schema/migrations/migrate1to2.rb +4 -4
  115. data/schema/migrations/migrate2to3.rb +1 -1
  116. data/schema/migrations/migrate3to4.rb +9 -9
  117. data/schema/migrations/migrate7to8.rb +47 -0
  118. data/schema/system-description-global.schema-v8.json +43 -0
  119. data/workload_mapper/rails/setup/setup.rb.erb +1 -1
  120. data/workload_mapper/wordpress/setup/setup.rb.erb +1 -1
  121. metadata +31 -17
  122. data/html/partials/compare/config_files.html.haml +0 -48
data/lib/html.rb CHANGED
@@ -30,17 +30,17 @@ class Html
30
30
 
31
31
  Machinery::Ui.warn <<-EOF.chomp
32
32
  Warning:
33
- The --public option makes the HTTP server listen on all configured IP addresses. Everyone who has access to one of those IP addresses can access all of your system descriptions stored in '~/.machinery'. Be careful if there are sensible information (such as private keys) stored in one of your descriptions.
33
+ The --public option makes the HTTP server listen on all configured IP addresses. Everyone who has access to one of those IP addresses can access all of your system descriptions stored in '~/.machinery'. Be careful if there is sensitive information (such as private keys) stored in one of your descriptions.
34
34
  EOF
35
35
  elsif opts[:ip] == "0.0.0.0"
36
36
  Machinery::Ui.warn <<-EOF.chomp
37
37
  Warning:
38
- The server is listening on all configured IP addresses. Everyone who has access to one of those IP addresses can access all of your system descriptions stored in '~/.machinery'. Be careful if there are sensible information (such as private keys) stored in one of your descriptions.
38
+ The server is listening on all configured IP addresses. Everyone who has access to one of those IP addresses can access all of your system descriptions stored in '~/.machinery'. Be careful if there is sensitive information (such as private keys) stored in one of your descriptions.
39
39
  EOF
40
40
  elsif opts[:ip] && opts[:ip] != "localhost" && opts[:ip] != "127.0.0.1"
41
41
  Machinery::Ui.warn <<-EOF.chomp
42
42
  Warning:
43
- You specified an IP address other than '127.0.0.1', your server may be reachable from the network. Everyone who can access that network can access your system descriptions stored in '~/.machinery'. Be careful if there are sensible information (such as private keys) stored in one of your descriptions.
43
+ You specified an IP address other than '127.0.0.1', your server may be reachable from the network. Everyone who can access that network can access your system descriptions stored in '~/.machinery'. Be careful if there is sensitive information (such as private keys) stored in one of your descriptions.
44
44
  EOF
45
45
  elsif !opts[:ip]
46
46
  opts[:ip] = "127.0.0.1"
data/lib/inspect_task.rb CHANGED
@@ -21,11 +21,11 @@ class InspectTask
21
21
  description, failed_inspections = build_description(store, name, system,
22
22
  scopes, filter, options)
23
23
 
24
- if !description.attributes.empty?
24
+ unless description.attributes.empty?
25
25
  print_description(description, scopes) if options[:show]
26
26
  end
27
27
 
28
- if !failed_inspections.empty?
28
+ unless failed_inspections.empty?
29
29
  Machinery::Ui.puts "\n"
30
30
  message = failed_inspections.map { |scope, msg|
31
31
  "Errors while inspecting " \
@@ -92,7 +92,7 @@ class InspectTask
92
92
  end
93
93
  description[inspector.scope].set_metadata(timestring, host)
94
94
 
95
- if !description.attributes.empty?
95
+ unless description.attributes.empty?
96
96
  effective_filter.apply!(description)
97
97
  description.set_filter_definitions("inspect", effective_filter.to_array)
98
98
  description.save
@@ -9,10 +9,10 @@ module JSON
9
9
  class Schema
10
10
  class EnumAttribute < Attribute
11
11
  def self.validate(current_schema, data, fragments, processor, validator, options = {})
12
- if !current_schema.schema['enum'].include?(data)
12
+ unless current_schema.schema["enum"].include?(data)
13
13
  if options[:record_errors]
14
14
  message = "The property '#{build_fragment(fragments)}' value #{data.inspect} did not match one of the following values:"
15
- current_schema.schema['enum'].each {|val|
15
+ current_schema.schema["enum"].each {|val|
16
16
  if val.is_a?(NilClass)
17
17
  message += " null,"
18
18
  elsif val.is_a?(Array)
@@ -33,7 +33,7 @@ class JsonValidationErrorCleaner
33
33
 
34
34
  new_path = "The property"
35
35
  new_path += " ##{position}" if position > -1
36
- new_path += " (#{details})" if !details.empty?
36
+ new_path += " (#{details})" unless details.empty?
37
37
 
38
38
  message.gsub(/The property '#\/.*?'/, new_path)
39
39
  end
@@ -21,7 +21,7 @@ class JsonValidator
21
21
 
22
22
  format_version = @json_hash["meta"]["format_version"] if @json_hash["meta"]
23
23
 
24
- if !format_version
24
+ unless format_version
25
25
  raise Machinery::Errors::SystemDescriptionValidationFailed.new(
26
26
  ["Could not determine format version"]
27
27
  )
@@ -47,7 +47,7 @@ class JsonValidator
47
47
  private
48
48
 
49
49
  def validate_scope(scope_hash, scope)
50
- return [] if !@scope_schemas[scope]
50
+ return [] unless @scope_schemas[scope]
51
51
 
52
52
  errors = JSON::Validator.fully_validate(@scope_schemas[scope], scope_hash).map do |error|
53
53
  "In scope #{scope}: #{error}"
data/lib/kiwi_config.rb CHANGED
@@ -57,6 +57,28 @@ class KiwiConfig < Exporter
57
57
 
58
58
  private
59
59
 
60
+ def optional_bootstrap_packages
61
+ [
62
+ "glibc-locale",
63
+ "module-init-tools",
64
+ "cracklib-dict-full",
65
+ "ca-certificates",
66
+ "ca-certificates-mozilla"
67
+ ]
68
+ end
69
+
70
+ def add_bootstrap_packages(xml)
71
+ xml.packages(type: "bootstrap") do
72
+ xml.package(name: "filesystem")
73
+ bootstrap_packages = @system_description.packages.select { |package|
74
+ optional_bootstrap_packages.include?(package.name)
75
+ }
76
+ bootstrap_packages.each do |package|
77
+ xml.package(name: package.name)
78
+ end
79
+ end
80
+ end
81
+
60
82
  def pre_process_config
61
83
  enable_ssh if @options[:enable_ssh]
62
84
  end
@@ -96,8 +118,8 @@ class KiwiConfig < Exporter
96
118
  end
97
119
 
98
120
  def inject_extracted_files(output_location)
99
- ["changed_managed_files", "config_files"].each do |scope|
100
- next if !@system_description.scope_extracted?(scope)
121
+ ["changed_managed_files", "changed_config_files"].each do |scope|
122
+ next unless @system_description.scope_extracted?(scope)
101
123
 
102
124
  output_root_path = File.join(output_location, "root")
103
125
  FileUtils.mkdir_p(output_root_path)
@@ -147,7 +169,7 @@ EOF
147
169
 
148
170
  def check_existance_of_extracted_files
149
171
  missing_scopes = []
150
- ["config_files", "changed_managed_files", "unmanaged_files"].each do |scope|
172
+ ["changed_config_files", "changed_managed_files", "unmanaged_files"].each do |scope|
151
173
 
152
174
  if @system_description[scope] &&
153
175
  !@system_description.scope_file_store(scope).path
@@ -155,7 +177,7 @@ EOF
155
177
  end
156
178
  end
157
179
 
158
- if !missing_scopes.empty?
180
+ unless missing_scopes.empty?
159
181
  raise Machinery::Errors::MissingExtractedFiles.new(@system_description, missing_scopes)
160
182
  end
161
183
  end
@@ -234,7 +256,9 @@ EOF
234
256
  File.join(Machinery::ROOT, "filters", "filter-packages-for-build.yaml")
235
257
  ) || []
236
258
 
237
- xml.packages(type: "bootstrap") do
259
+ add_bootstrap_packages(xml)
260
+
261
+ xml.packages(type: "image") do
238
262
  if @system_description.packages
239
263
  @system_description.packages.each do |package|
240
264
  next if filter.include?(package.name)
@@ -268,16 +292,17 @@ EOF
268
292
  xml.source(path: repo.url)
269
293
  end
270
294
  end
271
- if !repo.url.match(/^https:\/\/nu.novell.com|^https:\/\/update.suse.com/)
272
- @sh << "zypper -n ar --name='#{repo.name}' "
273
- @sh << "--type='#{repo.type}' " if repo.type
274
- @sh << "--refresh " if repo.autorefresh
275
- @sh << "--disable " unless repo.enabled
276
- @sh << "'#{repo.url}' '#{repo.alias}'\n"
277
- @sh << "zypper -n mr --priority=#{repo.priority} '#{repo.name}'\n"
278
- end
295
+
296
+ next if repo.url =~ /^https:\/\/nu.novell.com|^https:\/\/update.suse.com/
297
+
298
+ @sh << "zypper -n ar --name='#{repo.name}' "
299
+ @sh << "--type='#{repo.type}' " if repo.type
300
+ @sh << "--refresh " if repo.autorefresh
301
+ @sh << "--disable " unless repo.enabled
302
+ @sh << "'#{repo.url}' '#{repo.alias}'\n"
303
+ @sh << "zypper -n mr --priority=#{repo.priority} '#{repo.name}'\n"
279
304
  end
280
- if !usable_repositories
305
+ unless usable_repositories
281
306
  raise(
282
307
  Machinery::Errors::MissingRequirement.new(
283
308
  "The system description doesn't contain any enabled or network reachable repository." \
data/lib/list_task.rb CHANGED
@@ -117,7 +117,7 @@ EOF
117
117
 
118
118
  def show_error(error_message, options)
119
119
  if options[:short]
120
- Machinery::Ui.puts(error_message)
120
+ Machinery::Ui.puts(error_message.chomp)
121
121
  else
122
122
  Machinery::Ui.puts(" " + error_message + "\n")
123
123
  end
data/lib/local_system.rb CHANGED
@@ -20,7 +20,7 @@ class LocalSystem < System
20
20
 
21
21
  class << self
22
22
  def os
23
- if !@@os
23
+ unless @@os
24
24
  description = SystemDescription.new("localhost", SystemDescriptionMemoryStore.new)
25
25
  inspector = OsInspector.new(System.for("localhost"), description)
26
26
  inspector.inspect(nil)
@@ -57,10 +57,10 @@ Run `zypper install #{package}` to install the package.
57
57
  end
58
58
  end
59
59
 
60
- if !missing_packages.empty?
60
+ unless missing_packages.empty?
61
61
  count = missing_packages.count
62
62
  error_string = <<-EOF
63
- You need the #{Machinery::pluralize(count, "package")} '#{missing_packages.join("\',\'")}'.
63
+ You need the #{Machinery.pluralize(count, "package")} '#{missing_packages.join("\',\'")}'.
64
64
  You can install it by running `zypper install #{missing_packages.join(" ")}`.
65
65
  EOF
66
66
  raise(Machinery::Errors::MissingRequirement.new(error_string))
@@ -82,7 +82,7 @@ You can install it by running `zypper install #{package}`.
82
82
  end
83
83
 
84
84
  def validate_architecture(arch)
85
- if !matches_architecture?(arch)
85
+ unless matches_architecture?(arch)
86
86
  raise(Machinery::Errors::UnsupportedArchitecture.new(
87
87
  "This operation is not supported on architecture '#{os.architecture}'."
88
88
  ))
data/lib/machinery.rb CHANGED
@@ -74,7 +74,7 @@ require_relative "renderer_helper"
74
74
  require_relative "export_task"
75
75
  require_relative "helper"
76
76
  require_relative "deploy_task"
77
- require_relative "analyze_config_file_diffs_task"
77
+ require_relative "analyze_changed_config_files_diffs_task"
78
78
  require_relative "copy_task"
79
79
  require_relative "scope"
80
80
  require_relative "ui"
@@ -20,15 +20,15 @@ module Machinery
20
20
 
21
21
  def self.initialize_logger(log_file)
22
22
  # We rotate one old log file of 21 MB
23
- if File.exists?(log_file) && File.size(log_file) > 21*1024*1024
23
+ if File.exist?(log_file) && File.size(log_file) > 21 * 1024 * 1024
24
24
  rotated_file = log_file + ".0"
25
- FileUtils.rm(rotated_file) if File.exists?(rotated_file)
25
+ FileUtils.rm(rotated_file) if File.exist?(rotated_file)
26
26
  FileUtils.mv(log_file, rotated_file)
27
27
  end
28
28
 
29
- if !File.exists?(log_file)
29
+ unless File.exist?(log_file)
30
30
  dirname = File.dirname(log_file)
31
- if !Dir.exists?(dirname)
31
+ unless Dir.exist?(dirname)
32
32
  FileUtils.mkdir_p(dirname)
33
33
  File.chmod(0700, dirname)
34
34
  end
data/lib/manifest.rb CHANGED
@@ -22,7 +22,7 @@ class Manifest
22
22
  attr_accessor :name, :path, :json, :hash
23
23
 
24
24
  def self.load(name, path)
25
- unless File.exists?(path)
25
+ unless File.exist?(path)
26
26
  raise Machinery::Errors::SystemDescriptionNotFound.new(
27
27
  "Couldn't find a system description with the name '#{name}'."
28
28
  )
@@ -41,20 +41,20 @@ class Manifest
41
41
  end
42
42
 
43
43
  def validate
44
- return if !compatible_json?
44
+ return unless compatible_json?
45
45
 
46
46
  errors = JsonValidator.new(@hash).validate
47
- if !errors.empty?
47
+ unless errors.empty?
48
48
  Machinery::Ui.warn("Warning: System Description validation errors:")
49
49
  Machinery::Ui.warn(errors.join("\n"))
50
50
  end
51
51
  end
52
52
 
53
53
  def validate!
54
- return if !compatible_json?
54
+ return unless compatible_json?
55
55
 
56
56
  errors = JsonValidator.new(@hash).validate
57
- if !errors.empty?
57
+ unless errors.empty?
58
58
  raise Machinery::Errors::SystemDescriptionValidationFailed.new(errors)
59
59
  end
60
60
  end
data/lib/migration.rb CHANGED
@@ -49,8 +49,8 @@
49
49
  # EOT
50
50
  #
51
51
  # def migrate
52
- # is_extracted = Dir.exists?(File.join(@path, "config-files"))
53
- # @hash["config_files"]["extracted"] = is_extracted
52
+ # is_extracted = Dir.exist?(File.join(@path, "config-files"))
53
+ # @hash["changed_config_files"]["extracted"] = is_extracted
54
54
  # end
55
55
  # end
56
56
  class Migration
@@ -70,7 +70,7 @@ class Migration
70
70
 
71
71
  errors = JsonValidator.new(hash).validate
72
72
  errors += FileValidator.new(hash, store.description_path(description_name)).validate
73
- if !errors.empty?
73
+ unless errors.empty?
74
74
  if options[:force]
75
75
  Machinery::Ui.warn("Warning: System Description validation errors:")
76
76
  Machinery::Ui.warn(errors.join(", "))
@@ -80,7 +80,7 @@ class Migration
80
80
  end
81
81
 
82
82
  current_version = hash["meta"]["format_version"]
83
- if !current_version
83
+ unless current_version
84
84
  raise Machinery::Errors::SystemDescriptionIncompatible.new(
85
85
  "The system description '#{description_name}' was generated by an old " \
86
86
  "version of machinery that is not supported by the upgrade mechanism."
data/lib/object.rb CHANGED
@@ -112,16 +112,12 @@ module Machinery
112
112
  end
113
113
  key = name.to_s[0..-2]
114
114
  @attributes[key] = self.class.convert_element(key, args.first)
115
- else
116
- if @attributes.has_key?(name.to_s)
117
- if !args.empty?
118
- raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
119
- end
120
-
121
- @attributes[name.to_s]
122
- else
123
- nil
115
+ elsif @attributes.key?(name.to_s)
116
+ unless args.empty?
117
+ raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
124
118
  end
119
+
120
+ @attributes[name.to_s]
125
121
  end
126
122
  end
127
123
 
@@ -129,7 +125,7 @@ module Machinery
129
125
  if name.to_s.end_with?("=")
130
126
  true
131
127
  else
132
- @attributes.has_key?(name) || super(name, include_all)
128
+ @attributes.key?(name) || super(name, include_all)
133
129
  end
134
130
  end
135
131
 
data/lib/remove_task.rb CHANGED
@@ -41,7 +41,7 @@ class RemoveTask
41
41
  end
42
42
  end
43
43
 
44
- if !errors.empty?
44
+ unless errors.empty?
45
45
  raise Machinery::Errors::SystemDescriptionNotFound.new(errors.join("\n"))
46
46
  end
47
47
  end
data/lib/renderer.rb CHANGED
@@ -161,7 +161,7 @@ class Renderer
161
161
  end
162
162
 
163
163
  def render_comparison_common(description)
164
- return if !description[scope]
164
+ return unless description[scope]
165
165
 
166
166
  puts "Common to both systems:"
167
167
  indent { compare_content_common(description) }
@@ -182,10 +182,10 @@ class Renderer
182
182
  @stack = []
183
183
  missing_descriptions = Array.new
184
184
 
185
- if !description1[scope]
185
+ unless description1[scope]
186
186
  missing_descriptions << description1.name
187
187
  end
188
- if !description2[scope]
188
+ unless description2[scope]
189
189
  missing_descriptions << description2.name
190
190
  end
191
191
 
@@ -205,7 +205,7 @@ class Renderer
205
205
  end
206
206
 
207
207
  def puts(s)
208
- print_indented "#{s}"
208
+ print_indented Machinery.scrub(s)
209
209
  end
210
210
 
211
211
  def list(name = nil, options = {}, &block)
@@ -237,7 +237,7 @@ class Renderer
237
237
  )
238
238
  end
239
239
 
240
- print_indented "* #{s}"
240
+ print_indented "* #{Machinery.scrub(s)}"
241
241
 
242
242
  if block_given?
243
243
  @stack << :item
@@ -23,7 +23,7 @@ module ScopeFileAccessArchive
23
23
 
24
24
  target = File.join(destination, "trees")
25
25
  self.select(&:directory?).each do |system_file|
26
- raise Machinery::Errors::FileUtilsError if !system_file.directory?
26
+ raise Machinery::Errors::FileUtilsError unless system_file.directory?
27
27
 
28
28
  tarball_target = File.join(target, File.dirname(system_file.name))
29
29
 
@@ -56,7 +56,7 @@ module ScopeFileAccessArchive
56
56
  end
57
57
 
58
58
  def file_content(system_file)
59
- if !extracted
59
+ unless extracted
60
60
  raise Machinery::Errors::FileUtilsError, "The requested file '#{system_file.name}' is not" \
61
61
  " available because files for scope '#{scope_name}' were not extracted."
62
62
  end
@@ -4,7 +4,7 @@ module ScopeFileAccessFlat
4
4
  end
5
5
 
6
6
  def write_file(system_file, target)
7
- raise Machinery::Errors::FileUtilsError, "Not a file" if !system_file.file?
7
+ raise Machinery::Errors::FileUtilsError, "Not a file" unless system_file.file?
8
8
 
9
9
  target_path = File.join(target, system_file.name)
10
10
  FileUtils.mkdir_p(File.dirname(target_path))
@@ -12,13 +12,13 @@ module ScopeFileAccessFlat
12
12
  end
13
13
 
14
14
  def file_path(system_file)
15
- raise Machinery::Errors::FileUtilsError, "Not a file" if !system_file.file?
15
+ raise Machinery::Errors::FileUtilsError, "Not a file" unless system_file.file?
16
16
 
17
17
  File.join(scope_file_store.path, system_file.name)
18
18
  end
19
19
 
20
20
  def file_content(system_file)
21
- if !extracted
21
+ unless extracted
22
22
  raise Machinery::Errors::FileUtilsError, "The requested file '#{system_file.name}' is" \
23
23
  " not available because files for scope '#{scope_name}' were not extracted."
24
24
  end
@@ -33,7 +33,7 @@ class ScopeFileStore
33
33
 
34
34
  def path
35
35
  dir = File.join(base_path, store_name)
36
- Dir.exists?(dir) ? dir : nil
36
+ Dir.exist?(dir) ? dir : nil
37
37
  end
38
38
 
39
39
  def remove
@@ -60,14 +60,14 @@ class ScopeFileStore
60
60
 
61
61
  def new_dir_mode
62
62
  mode = 0700
63
- if Dir.exists?(base_path)
63
+ if Dir.exist?(base_path)
64
64
  mode = File.stat(base_path).mode & 0777
65
65
  end
66
66
  mode
67
67
  end
68
68
 
69
69
  def create_dir(dir, mode = 0700)
70
- unless Dir.exists?(dir)
70
+ unless Dir.exist?(dir)
71
71
  FileUtils.mkdir_p(dir, mode: mode)
72
72
  end
73
73
  end