rails-backup-migrate 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module RailsBackupMigrate
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -35,7 +35,11 @@ namespace :site do
35
35
  # private task: add the `files` directory to the archive
36
36
  task :_add_files_directory_to_archive, [:backup_file] do |t, args|
37
37
  puts "adding 'files' dir to archive list." if RailsBackupMigrate::VERBOSE
38
- RailsBackupMigrate.add_to_archive "files"
38
+ if (File.exist?("files") && File.directory?("files"))
39
+ RailsBackupMigrate.add_to_archive "files"
40
+ else
41
+ puts "Warning, cannot archive 'files' directory, it does not exist." if RailsBackupMigrate::VERBOSE
42
+ end
39
43
  end
40
44
 
41
45
  desc "Dump schema to a backup file. Default backup = 'site-backup.tgz'."
@@ -95,8 +99,16 @@ namespace :site do
95
99
  task :_restore_files_directory, [:backup_file] => [:_set_backup_file] do |t, args|
96
100
  Dir::chdir RAILS_ROOT
97
101
  # extract the 'files' directory in place
98
- options = RailsBackupMigrate::VERBOSE ? '-xvzf' : '-xzf'
99
- `tar #{options} #{RailsBackupMigrate.backup_file} files`
102
+
103
+ # check if there is 'files/' in the archive file (perhaps this app doesn't have downloads)
104
+ # fixing issue #2 on github.
105
+ `tar -tzf #{RailsBackupMigrate.backup_file} | grep '^files/'`
106
+ if $? == 0
107
+ options = RailsBackupMigrate::VERBOSE ? '-xvzf' : '-xzf'
108
+ `tar #{options} #{RailsBackupMigrate.backup_file} files`
109
+ else
110
+ puts "Warning: cannot extract 'files', not in archive" if RailsBackupMigrate::VERBOSE
111
+ end
100
112
  end
101
113
 
102
114
  desc "Erase and reload db schema from backup file. Default backup file is 'site-backup.tgz'. Runs `rake db:schema:load`."
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-backup-migrate
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Connolly
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-17 00:00:00 +10:00
18
+ date: 2011-07-25 00:00:00 +10:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency