o2h 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/o2h/recipes/deploy.rb +2 -0
- data/lib/o2h/recipes/sync.rb +3 -0
- data/lib/o2h/version.rb +1 -1
- data/spec/recipes/sync_spec.rb +14 -1
- data/spec/support/shared_contexts/capistrano.rb +8 -7
- metadata +83 -45
data/lib/o2h/recipes/deploy.rb
CHANGED
data/lib/o2h/recipes/sync.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
load 'deploy'
|
2
|
+
|
1
3
|
_cset(:sync_db_via) { :scp }
|
2
4
|
_cset(:sync_db_file) { "#{application}-dump.sql.gz" }
|
3
5
|
_cset(:sync_db_remote_file) { "#{shared_path}/backup/#{sync_db_file}" }
|
@@ -76,6 +78,7 @@ namespace :sync do
|
|
76
78
|
run_locally "gunzip --stdout #{sync_db_local_file} | #{pg.command}" if agree
|
77
79
|
end
|
78
80
|
|
81
|
+
desc "Fetch dump file"
|
79
82
|
task :fetch do
|
80
83
|
download sync_db_remote_file, sync_db_local_file, :via => sync_db_via
|
81
84
|
end
|
data/lib/o2h/version.rb
CHANGED
data/spec/recipes/sync_spec.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "sync" do
|
4
|
-
before { subject.load 'deploy' }
|
5
4
|
|
6
5
|
include_context :capistrano
|
7
6
|
|
@@ -30,5 +29,19 @@ describe "sync" do
|
|
30
29
|
subject.should have_run("mkdir -p '/shared/app/backup'")
|
31
30
|
subject.should have_run("pg_dump -c -Z 9 --no-owner -p #{port} -h #{host} -U #{username} -f /shared/app/backup/app-dump.sql.gz #{database}")
|
32
31
|
end
|
32
|
+
|
33
|
+
it "should call proper subtasks" do
|
34
|
+
namespace.should_receive(:dump)
|
35
|
+
namespace.should_receive(:fetch)
|
36
|
+
namespace.should_receive(:import)
|
37
|
+
|
38
|
+
subject.execute_task(task)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'db:fetch task' do
|
43
|
+
subject { task }
|
44
|
+
|
45
|
+
its(:description) { should match(/fetch/i) }
|
33
46
|
end
|
34
47
|
end
|
@@ -8,6 +8,13 @@ shared_context :capistrano do
|
|
8
8
|
let(:recipe_name) { self.class.top_level_description }
|
9
9
|
let(:recipe_path) { recipe(recipe_name) }
|
10
10
|
|
11
|
+
subject { capistrano }
|
12
|
+
|
13
|
+
before(:each) do
|
14
|
+
capistrano.extend Capistrano::Spec::ConfigurationExtension
|
15
|
+
capistrano.load recipe_path
|
16
|
+
end
|
17
|
+
|
11
18
|
let(:task) do
|
12
19
|
task = self.class.ancestors.map do |example|
|
13
20
|
break $1 if /^(.+?) task$/ =~ example.description
|
@@ -15,16 +22,10 @@ shared_context :capistrano do
|
|
15
22
|
|
16
23
|
if task
|
17
24
|
task = "#{recipe_name}:#{task}"
|
18
|
-
|
25
|
+
capistrano.find_task(task) or raise "Task #{task} not found"
|
19
26
|
end
|
20
27
|
end
|
21
28
|
|
22
|
-
subject { capistrano }
|
23
|
-
|
24
|
-
before do
|
25
|
-
capistrano.extend Capistrano::Spec::ConfigurationExtension
|
26
|
-
capistrano.load recipe_path
|
27
|
-
end
|
28
29
|
|
29
30
|
def recipe name
|
30
31
|
Dir["lib/o2h/recipes/**/*.rb"].find do |recipe|
|
metadata
CHANGED
@@ -1,67 +1,96 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: o2h
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 13
|
10
|
+
version: 0.1.13
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Michal Cichra
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-02-11 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: newrelic_rpm
|
16
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
24
|
none: false
|
18
|
-
requirements:
|
25
|
+
requirements:
|
19
26
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 11
|
29
|
+
segments:
|
30
|
+
- 3
|
31
|
+
- 3
|
32
|
+
- 0
|
21
33
|
version: 3.3.0
|
22
34
|
type: :runtime
|
23
|
-
|
24
|
-
|
25
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
26
37
|
name: capistrano
|
27
|
-
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
28
40
|
none: false
|
29
|
-
requirements:
|
41
|
+
requirements:
|
30
42
|
- - ~>
|
31
|
-
- !ruby/object:Gem::Version
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 43
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 9
|
48
|
+
- 0
|
32
49
|
version: 2.9.0
|
33
50
|
type: :runtime
|
34
|
-
|
35
|
-
|
36
|
-
- !ruby/object:Gem::Dependency
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
37
53
|
name: rvm
|
38
|
-
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
39
56
|
none: false
|
40
|
-
requirements:
|
57
|
+
requirements:
|
41
58
|
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 55
|
61
|
+
segments:
|
62
|
+
- 1
|
63
|
+
- 9
|
64
|
+
- 2
|
43
65
|
version: 1.9.2
|
44
66
|
type: :runtime
|
45
|
-
|
46
|
-
|
47
|
-
- !ruby/object:Gem::Dependency
|
67
|
+
version_requirements: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
48
69
|
name: pg_dumper
|
49
|
-
|
70
|
+
prerelease: false
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
50
72
|
none: false
|
51
|
-
requirements:
|
73
|
+
requirements:
|
52
74
|
- - ~>
|
53
|
-
- !ruby/object:Gem::Version
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 21
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
- 1
|
80
|
+
- 7
|
54
81
|
version: 0.1.7
|
55
82
|
type: :runtime
|
56
|
-
|
57
|
-
version_requirements: *70176353283180
|
83
|
+
version_requirements: *id004
|
58
84
|
description: Collection of recipes and gem dependencies for o2h deployment
|
59
|
-
email:
|
85
|
+
email:
|
60
86
|
- michal@o2h.cz
|
61
87
|
executables: []
|
88
|
+
|
62
89
|
extensions: []
|
90
|
+
|
63
91
|
extra_rdoc_files: []
|
64
|
-
|
92
|
+
|
93
|
+
files:
|
65
94
|
- .gitignore
|
66
95
|
- .simplecov
|
67
96
|
- .travis.yml
|
@@ -102,29 +131,38 @@ files:
|
|
102
131
|
- test/config/deploy.rb
|
103
132
|
homepage: http://o2h.cz
|
104
133
|
licenses: []
|
134
|
+
|
105
135
|
post_install_message:
|
106
136
|
rdoc_options: []
|
107
|
-
|
137
|
+
|
138
|
+
require_paths:
|
108
139
|
- lib
|
109
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
140
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
141
|
none: false
|
111
|
-
requirements:
|
112
|
-
- -
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
hash: 3
|
146
|
+
segments:
|
147
|
+
- 0
|
148
|
+
version: "0"
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
150
|
none: false
|
117
|
-
requirements:
|
118
|
-
- -
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
|
151
|
+
requirements:
|
152
|
+
- - ">="
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
hash: 3
|
155
|
+
segments:
|
156
|
+
- 0
|
157
|
+
version: "0"
|
121
158
|
requirements: []
|
159
|
+
|
122
160
|
rubyforge_project:
|
123
|
-
rubygems_version: 1.8.
|
161
|
+
rubygems_version: 1.8.15
|
124
162
|
signing_key:
|
125
163
|
specification_version: 3
|
126
164
|
summary: Collection of recipes and gem dependencies for o2h deployment
|
127
|
-
test_files:
|
165
|
+
test_files:
|
128
166
|
- spec/recipes/bluepill_spec.rb
|
129
167
|
- spec/recipes/deploy_spec.rb
|
130
168
|
- spec/recipes/git_spec.rb
|