omeka-recipes 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +1 -1
- data/lib/omeka-recipes/application.rb +1 -1
- data/lib/omeka-recipes/db.rb +12 -10
- data/lib/omeka-recipes/version.rb +1 -1
- data/tests/fixtures/test.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -133,7 +133,7 @@ set :themes, {
|
|
133
133
|
after "deploy:restart", "deploy:cleanup"
|
134
134
|
```
|
135
135
|
In each of the stages of your deployment (e.g.
|
136
|
-
`
|
136
|
+
`config/deploy/production.rb`), you will need to add a definition to
|
137
137
|
tell capistrano where to go.
|
138
138
|
|
139
139
|
```ruby
|
@@ -32,7 +32,7 @@ Capistrano::Configuration.instance.load do
|
|
32
32
|
set :rvm_ruby_string, '1.9.3' unless exists?(:rvm_ruby_string)
|
33
33
|
end
|
34
34
|
|
35
|
-
set :shared_dirs, %w(archive system) unless exists?(:shared_dirs)
|
35
|
+
set :shared_dirs, %w(archive system backup) unless exists?(:shared_dirs)
|
36
36
|
|
37
37
|
namespace :app do
|
38
38
|
task :setup, :roles => :app do
|
data/lib/omeka-recipes/db.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
1
|
require 'erb'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
Capistrano::Configuration.instance.load do
|
4
5
|
namespace :db do
|
5
6
|
namespace :mysql do
|
6
7
|
|
7
8
|
desc "|OmekaRecipes| Performs a compressed database dump. \n
|
8
|
-
WARNING: This locks your database tables for the
|
9
|
+
WARNING: This locks your database tables for the duration of the mysqldump."
|
9
10
|
task :dump, :roles => :db, :only => { :primary => true } do
|
11
|
+
FileUtils.mkdir_p "#{shared_path}/backup"
|
10
12
|
prepare_from_ini
|
11
|
-
run "mysqldump --user=#{username} --host=#{host} -p #{
|
13
|
+
run "mysqldump --user=#{username} --host=#{host} -p #{db_name} | bzip2 -z9 > #{db_remote_file}" do |channel, stream, out|
|
12
14
|
channel.send_data "#{password}\n" if out =~ /^Enter password:/
|
13
15
|
puts out
|
14
16
|
end
|
@@ -17,7 +19,7 @@ Capistrano::Configuration.instance.load do
|
|
17
19
|
desc "|OmekaRecipes| Restores the database from the latest compressed dump"
|
18
20
|
task :restore, :roles => :db, :only => { :primary => true } do
|
19
21
|
prepare_from_ini
|
20
|
-
run "bzcat #{db_remote_file} | mysql --user=#{username} -p --host=#{host} #{
|
22
|
+
run "bzcat #{db_remote_file} | mysql --user=#{username} -p --host=#{host} #{db_name}" do |channel, stream, out|
|
21
23
|
channel.send_data "#{password}" if out =~ /^Enter password:/
|
22
24
|
puts out
|
23
25
|
end
|
@@ -75,10 +77,10 @@ EOF
|
|
75
77
|
set(:db_remote_file) { "#{shared_path}/backup/#{db_file}" }
|
76
78
|
set(:db_local_file) { "/tmp/#{db_file}" }
|
77
79
|
set(:username) { db_config['database']['username'] }
|
78
|
-
set(:password) { db_config['database'][
|
79
|
-
set(:host) { db_config['database'][
|
80
|
-
set(:
|
81
|
-
set(:prefix) { db_config['database'][
|
80
|
+
set(:password) { db_config['database']['password'] }
|
81
|
+
set(:host) { db_config['database']['host'] }
|
82
|
+
set(:db_name) { db_config['database']['name'] }
|
83
|
+
set(:prefix) { db_config['database']['prefix'] }
|
82
84
|
end
|
83
85
|
|
84
86
|
def db_config
|
@@ -86,11 +88,11 @@ EOF
|
|
86
88
|
end
|
87
89
|
|
88
90
|
def fetch_db_ini
|
89
|
-
require '
|
91
|
+
require 'inifile'
|
90
92
|
|
91
|
-
file = capture "cat #{
|
93
|
+
file = capture "cat #{current_path}/db.ini"
|
92
94
|
|
93
|
-
db_config = IniFile.new(file).to_h
|
95
|
+
@db_config = IniFile.new(file).to_h
|
94
96
|
|
95
97
|
end
|
96
98
|
|
data/tests/fixtures/test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omeka-recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -139,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
139
139
|
version: '0'
|
140
140
|
segments:
|
141
141
|
- 0
|
142
|
-
hash:
|
142
|
+
hash: 415402469583493969
|
143
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
144
|
none: false
|
145
145
|
requirements:
|
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
148
|
version: '0'
|
149
149
|
segments:
|
150
150
|
- 0
|
151
|
-
hash:
|
151
|
+
hash: 415402469583493969
|
152
152
|
requirements: []
|
153
153
|
rubyforge_project:
|
154
154
|
rubygems_version: 1.8.24
|