recap 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/recap/support/capistrano_extensions.rb +5 -1
- data/lib/recap/tasks/rails.rb +2 -2
- data/lib/recap/version.rb +1 -1
- data/spec/tasks/rails_spec.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 93a885c11e132676dc0f220d5eb9cbd50508e861
|
4
|
+
data.tar.gz: fb685ee8cded3a4771b985ea60c2d0823c5d1fbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 512cd41ee586903a52d2d65f6c298ece8a0329906ed2b28e20503af8797198098da12d5c5df5172432c85ddeda906b79ced0368d63cbcf47843e69f81fe41342
|
7
|
+
data.tar.gz: 3d1358e405a2fe2815f2d9280e10b9a344bb8009e235222d83ebb392e13ba5a62d659a18697e896623ab6ef02263aaf9d3e21cf57aed9f1451a5ac5e2e1e0374
|
@@ -9,6 +9,10 @@ module Recap::Support::CapistranoExtensions
|
|
9
9
|
sudo "su - #{application_user} -c 'cd #{pwd} && #{command}'"
|
10
10
|
end
|
11
11
|
|
12
|
+
def as_app_once(command, pwd = deploy_to)
|
13
|
+
sudo "su - #{application_user} -c 'cd #{pwd} && #{command}'", once: true
|
14
|
+
end
|
15
|
+
|
12
16
|
# Put a string into a file as the application user
|
13
17
|
def put_as_app(string, path)
|
14
18
|
put string, "/tmp/recap-put-as-app"
|
@@ -84,4 +88,4 @@ module Recap::Support::CapistranoExtensions
|
|
84
88
|
end
|
85
89
|
|
86
90
|
Capistrano::Configuration.send :include, self
|
87
|
-
end
|
91
|
+
end
|
data/lib/recap/tasks/rails.rb
CHANGED
@@ -25,13 +25,13 @@ module Recap::Tasks::Rails
|
|
25
25
|
namespace :db do
|
26
26
|
task :load_schema do
|
27
27
|
if deployed_file_exists?("db/schema.rb")
|
28
|
-
|
28
|
+
as_app_once './bin/rake db:create db:schema:load'
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
task :migrate do
|
33
33
|
if deployed_file_exists?("db/schema.rb") && trigger_update?("db/")
|
34
|
-
|
34
|
+
as_app_once './bin/rake db:migrate'
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
data/lib/recap/version.rb
CHANGED
data/spec/tasks/rails_spec.rb
CHANGED
@@ -36,13 +36,13 @@ describe Recap::Tasks::Rails do
|
|
36
36
|
describe 'rails:db:load_schema' do
|
37
37
|
it 'loads the schema if db/schema.rb exists' do
|
38
38
|
namespace.stubs(:deployed_file_exists?).with('db/schema.rb').returns(true)
|
39
|
-
namespace.expects(:
|
39
|
+
namespace.expects(:as_app_once).with('./bin/rake db:create db:schema:load')
|
40
40
|
config.find_and_execute_task('rails:db:load_schema')
|
41
41
|
end
|
42
42
|
|
43
43
|
it 'does nothing if db/schema.rb does not exist' do
|
44
44
|
namespace.stubs(:deployed_file_exists?).with('db/schema.rb').returns(false)
|
45
|
-
namespace.expects(:
|
45
|
+
namespace.expects(:as_app_once).never
|
46
46
|
config.find_and_execute_task('rails:db:load_schema')
|
47
47
|
end
|
48
48
|
end
|
@@ -51,21 +51,21 @@ describe Recap::Tasks::Rails do
|
|
51
51
|
it 'runs migrations if schema.rb has changed' do
|
52
52
|
namespace.stubs(:deployed_file_exists?).with('db/schema.rb').returns(true)
|
53
53
|
namespace.stubs(:changed_files).returns(["db/schema.rb"])
|
54
|
-
namespace.expects(:
|
54
|
+
namespace.expects(:as_app_once).with('./bin/rake db:migrate')
|
55
55
|
config.find_and_execute_task('rails:db:migrate')
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'runs migrations if migrations have changed' do
|
59
59
|
namespace.stubs(:deployed_file_exists?).with('db/schema.rb').returns(true)
|
60
60
|
namespace.stubs(:changed_files).returns(["db/migrate/12345_migrations.rb"])
|
61
|
-
namespace.expects(:
|
61
|
+
namespace.expects(:as_app_once).with('./bin/rake db:migrate')
|
62
62
|
config.find_and_execute_task('rails:db:migrate')
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'does nothing if the migrations have not changed' do
|
66
66
|
namespace.stubs(:deployed_file_exists?).with('db/schema.rb').returns(true)
|
67
67
|
namespace.stubs(:trigger_update?).with('db/').returns(false)
|
68
|
-
namespace.expects(:
|
68
|
+
namespace.expects(:as_app_once).never
|
69
69
|
config.find_and_execute_task('rails:db:migrate')
|
70
70
|
end
|
71
71
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Ward
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|