bin/encbs in encbs-0.2.1.beta2 vs bin/encbs in encbs-0.2.1

- old
+ new

@@ -166,42 +166,46 @@ end exit end - #TODO: Support rescue option as hash if opts.rescue? paths = opts[:rescue].split(" ") jars_list = @backup.jars + puts jars_list - include_path = lambda {|path| jars_list.keys.include? path} + include_path = lambda {|path| jars_list.has_key?(path)} jars_hashes = paths.map do |path| - path = File.expand_path path + unless path.length == 32 and path.match /[0-9a-f]{32}/ + path = File.expand_path path - unless include_path[path] or include_path["#{path}/"] - puts_fail "Jar \"#{path}\" not exists." - end + unless include_path[path] or include_path["#{path}/"] + puts_fail "Jar \"#{path}\" not exists." + end - jars_list[path] || jars_list["#{path}/"] + jars_list[path] || jars_list["#{path}/"] + else + unless jars_list.has_value? path + puts_fail "Jar with hash \"#{path}\" not exists." + else + path + end + end end if opts.to? @to = File.expand_path opts[:to] try_create_dir @to else @to = "/" end - #TODO: Confirm flag - #TODO: Empty destination directory - @index = {} jars_hashes.each do |hash| versions = @backup.jar_versions(hash) - # puts "Versions: #{versions}" #FIXME last_version = Backup::Timestamp.last_from(versions, @end_date, @start_date) unless last_version.nil? @index[hash] = last_version @@ -229,23 +233,23 @@ if !@config.paths.nil? or opts.add? if File.exists? "/var/tmp/encbs.swap" meta = YAML::load open("/var/tmp/encbs.swap").read jar_path, timestamp = meta[:jar_path], meta[:timestamp] dirs = @backup.file_item.dir File.expand_path("../", jar_path) - + if dirs.include? File.basename(jar_path) meta.delete :timestamp meta.delete :jar_path @backup.file_item.create_file_once( "#{jar_path}/#{timestamp}.yml", meta.to_yaml ) - + FileUtils.rm "/var/tmp/encbs.swap" end end - + if opts.add? paths = opts[:add].split(" ") else paths = @config.paths.split(" ") end