backup 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.3
1
+ 1.3.4
data/backup.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{backup}
8
- s.version = "1.3.3"
8
+ s.version = "1.3.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael van Rooijen"]
@@ -1,23 +1,19 @@
1
- def generate_yaml(config_file)
2
- File.open(File.join(RAILS_ROOT, 'config', 'backup', config_file), 'r') do |file|
3
- tmp_file = File.new(File.join(RAILS_ROOT, 'config', 'backup', 'tmp.yml'), 'w+')
4
- tmp_file.write(file.read.gsub(/:rails_root/, RAILS_ROOT))
5
- tmp_file.close
6
- end
7
- yaml_file = YAML.load_file(File.join(RAILS_ROOT, 'config', 'backup', 'tmp.yml'))
8
- File.delete(File.join(RAILS_ROOT, 'config', 'backup', 'tmp.yml'))
9
- return yaml_file
1
+ # Opens and Reads the Backup YAML File from the RAILS_ROOT/config/backup path
2
+ # Replaces all the :rails_root tokens with the actual RAILS_ROOT path
3
+ # Returns the content of the file in YAML format
4
+ def read_backup_yaml_file(config_file)
5
+ YAML.load File.open(File.join(RAILS_ROOT, 'config', 'backup', config_file), 'r').read.gsub(/:rails_root/, RAILS_ROOT)
10
6
  end
11
7
 
12
8
  namespace :backup do
13
9
 
14
10
  task :s3_config => :environment do
15
- @config = generate_yaml('s3.yml')
11
+ @config = read_backup_yaml_file('s3.yml')
16
12
  @adapters = ['mysql', 'sqlite3', 'assets', 'custom']
17
13
  end
18
14
 
19
15
  task :ssh_config => :environment do
20
- @config = generate_yaml('ssh.yml')
16
+ @config = read_backup_yaml_file('ssh.yml')
21
17
  @adapters = ['mysql', 'sqlite3', 'assets', 'custom']
22
18
  end
23
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van Rooijen