Skip to content

Commit

Permalink
Better file back ups
Browse files Browse the repository at this point in the history
  • Loading branch information
rcuhljr committed Apr 29, 2016
1 parent 0fd6104 commit 24fd507
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dependency.lic
Expand Up @@ -189,6 +189,11 @@ class ScriptManager
return
end
return if get_versions[filename] == info['sha']

if File.exist?("./scripts/#{filename}") && !get_versions[filename]
File.rename('./scripts/' + filename, './scripts/' + filename + "#{Time.now.to_i}.bak") }
end

echo("info:#{info}") if @debug
blob = make_request(info['url'])
File.open("./scripts/#{filename}", 'w') { |file| file.print(Base64.decode64(blob['content'])) }
Expand Down Expand Up @@ -429,7 +434,7 @@ end

def replace_all
respond 'Renaming existing scripts to replaced-script.lic.bak'
managed_scripts.each { |script| File.rename('./scripts/' + script, './scripts/' + script + '.bak') }
managed_scripts.each { |script| File.rename('./scripts/' + script, './scripts/' + script + "#{Time.now.to_i}.bak") }
respond 'Downloading all scripts'
$manager.repo_scripts.each(&method(:get_script))
end
Expand Down

0 comments on commit 24fd507

Please sign in to comment.