lib/system_description_store.rb in machinery-tool-1.18.0 vs lib/system_description_store.rb in machinery-tool-1.19.0
- old
+ new
@@ -49,12 +49,13 @@
File.join(description_path(name), "index.html")
end
def list
Dir["#{@base_path}/*"].
- select { |item| File.exists?(manifest_path(File.basename(item)))}.
- map { |item| File.basename(item) }.sort
+ select { |item| File.exist?(manifest_path(File.basename(item))) }.map { |item|
+ File.basename(item)
+ }.sort
end
def remove(name)
unless name.empty?
SystemDescription.validate_name(name)
@@ -122,13 +123,11 @@
end
private
def create_dir(dir, mode = 0700)
- unless Dir.exists?(dir)
- FileUtils.mkdir_p(dir, mode: mode)
- end
+ FileUtils.mkdir_p(dir, mode: mode) unless Dir.exist?(dir)
end
def get_backup_name(description_name)
backup_name = "#{description_name}.backup"
number = 1
@@ -140,10 +139,10 @@
backup_name
end
def validate_existence_of_description(description_name)
- if !list.include?(description_name)
+ unless list.include?(description_name)
raise Machinery::Errors::SystemDescriptionNotFound.new(
"System description '#{description_name}' does not exist."
)
end
end