rosie 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +5 -4
- data/lib/rosie.rb +3 -2
- data/lib/rosie/version.rb +1 -1
- data/lib/tasks/rosie.rake +4 -2
- metadata +5 -25
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -50,12 +50,14 @@ assets_dirs:
|
|
50
50
|
- public/system
|
51
51
|
mysql_bin_dir:
|
52
52
|
|
53
|
+
prefix:
|
54
|
+
- my_app
|
53
55
|
</pre>
|
54
56
|
|
55
57
|
* `backup_dir`: This specifies the directory where the backup files will be stored. It should be specified relative to your Rails root. This setting would give you `#{Rails.root}/backups`.
|
56
58
|
* `assets_dirs`: This specifies the directorys which hold system assets you want to be added to the backup file. All entries should be specified relative to your Rails root.
|
57
59
|
* `mysql_bin_dir`: If mysql and mysqldump are not on the path of the user running this rake task, you may need to specify the directory where those commandline applications live. This should be an absolute path. By default, Rosie will try to find these in the user's PATH.
|
58
|
-
|
60
|
+
* `prefix`: If specified, this provides a way to prefix your database backup files with an app (or other) name. If present, backup files will look like <my_app>_<timestamp>.tgz
|
59
61
|
The generated backup files (zipped tarballs) will be named by timestamp and placed in `backup_dir`.
|
60
62
|
|
61
63
|
## Usage
|
@@ -76,9 +78,8 @@ Rosie Config: read from /projects/boilerplate/config/rosie.yml
|
|
76
78
|
mysql: mysql
|
77
79
|
mysqldump: mysqldump
|
78
80
|
backup dir: /projects/boilerplate/my_backups
|
79
|
-
assets dirs:
|
80
|
-
|
81
|
-
- public/my_other_assets
|
81
|
+
assets dirs: public/my_assets, public/my_other_assets
|
82
|
+
prefix: my_backup_file_prefix
|
82
83
|
</pre></code>
|
83
84
|
|
84
85
|
|
data/lib/rosie.rb
CHANGED
@@ -7,12 +7,12 @@ end
|
|
7
7
|
|
8
8
|
module Rosie
|
9
9
|
class Config
|
10
|
-
@@allowed_attributes = [:backup_dir, :assets_dirs, :mysql_bin_dir, :config_file]
|
10
|
+
@@allowed_attributes = [:backup_dir, :assets_dirs, :mysql_bin_dir, :config_file, :prefix]
|
11
11
|
|
12
12
|
attr_accessor *@@allowed_attributes
|
13
13
|
|
14
14
|
def initialize
|
15
|
-
_config = {"backup_dir"=>"backups", "assets_dirs"=> ["public/system"], "mysql_bin_dir"=>nil}
|
15
|
+
_config = {"backup_dir"=>"backups", "assets_dirs"=> ["public/system"], "mysql_bin_dir"=>nil, 'prefix' => nil}
|
16
16
|
self.config_file = File.join(Rails.root, 'config/rosie.yml')
|
17
17
|
if File.exists? self.config_file
|
18
18
|
_config.merge!(YAML.load(File.open(self.config_file)))
|
@@ -33,6 +33,7 @@ module Rosie
|
|
33
33
|
def mysqldump_cmd
|
34
34
|
mysql_bin_dir.present? ? File.join(mysql_bin_dir, 'mysqldump') : 'mysqldump'
|
35
35
|
end
|
36
|
+
|
36
37
|
end
|
37
38
|
|
38
39
|
end
|
data/lib/rosie/version.rb
CHANGED
data/lib/tasks/rosie.rake
CHANGED
@@ -38,6 +38,7 @@ namespace :rosie do
|
|
38
38
|
puts "mysqldump: #{rosie.mysqldump_cmd}"
|
39
39
|
puts "backup dir: #{rosie.backup_dir}"
|
40
40
|
puts "assets dirs: #{rosie.assets_dirs.join(', ')}"
|
41
|
+
puts "prefix: #{rosie.prefix}"
|
41
42
|
end
|
42
43
|
|
43
44
|
desc "restore data from backup tarball"
|
@@ -78,8 +79,9 @@ namespace :rosie do
|
|
78
79
|
|
79
80
|
desc "backup all data"
|
80
81
|
task :backup => ["rosie:backups:db", "rosie:backups:assets"] do
|
81
|
-
|
82
|
-
|
82
|
+
fname = (rosie.prefix.present? ? "%s_%s.tgz" % [ rosie.prefix, ts ] : "#{ts}.tgz")
|
83
|
+
puts "Bundling backup files into #{fname}"
|
84
|
+
`cd #{rosie.backup_dir}/#{ts}/../ && tar -czf #{fname}.tgz ./#{ts} && rm -rf #{ts}`
|
83
85
|
end
|
84
86
|
|
85
87
|
namespace :backups do
|
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rosie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.6
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Jon Rogers
|
@@ -16,8 +11,7 @@ autorequire:
|
|
16
11
|
bindir: bin
|
17
12
|
cert_chain: []
|
18
13
|
|
19
|
-
date:
|
20
|
-
default_executable:
|
14
|
+
date: 2012-01-15 00:00:00 Z
|
21
15
|
dependencies:
|
22
16
|
- !ruby/object:Gem::Dependency
|
23
17
|
name: rspec
|
@@ -27,9 +21,6 @@ dependencies:
|
|
27
21
|
requirements:
|
28
22
|
- - ">="
|
29
23
|
- !ruby/object:Gem::Version
|
30
|
-
hash: 3
|
31
|
-
segments:
|
32
|
-
- 0
|
33
24
|
version: "0"
|
34
25
|
type: :development
|
35
26
|
version_requirements: *id001
|
@@ -41,10 +32,6 @@ dependencies:
|
|
41
32
|
requirements:
|
42
33
|
- - ~>
|
43
34
|
- !ruby/object:Gem::Version
|
44
|
-
hash: 25
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
- 9
|
48
35
|
version: "0.9"
|
49
36
|
type: :development
|
50
37
|
version_requirements: *id002
|
@@ -68,7 +55,6 @@ files:
|
|
68
55
|
- lib/rosie/version.rb
|
69
56
|
- lib/tasks/rosie.rake
|
70
57
|
- rosie.gemspec
|
71
|
-
has_rdoc: true
|
72
58
|
homepage: http://github.com/2rye/rosie
|
73
59
|
licenses: []
|
74
60
|
|
@@ -82,25 +68,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
68
|
requirements:
|
83
69
|
- - ">="
|
84
70
|
- !ruby/object:Gem::Version
|
85
|
-
hash: 3
|
86
|
-
segments:
|
87
|
-
- 0
|
88
71
|
version: "0"
|
89
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
73
|
none: false
|
91
74
|
requirements:
|
92
75
|
- - ">="
|
93
76
|
- !ruby/object:Gem::Version
|
94
|
-
hash: 3
|
95
|
-
segments:
|
96
|
-
- 0
|
97
77
|
version: "0"
|
98
78
|
requirements: []
|
99
79
|
|
100
80
|
rubyforge_project: rosie
|
101
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.8.5
|
102
82
|
signing_key:
|
103
83
|
specification_version: 3
|
104
|
-
summary: rosie-0.0.
|
84
|
+
summary: rosie-0.0.6
|
105
85
|
test_files: []
|
106
86
|
|