pushdeploy 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/pushdeploy_install_hook +1 -1
- data/lib/pushdeploy/version.rb +1 -1
- metadata +1 -2
- data/lib/pushdeploy/pushdeploy.rb +0 -58
data/bin/pushdeploy_install_hook
CHANGED
@@ -90,7 +90,7 @@ unset GIT_DIR && cd \$deploy_dir && git --work-tree=\$deploy_dir pull #{reposito
|
|
90
90
|
|
91
91
|
hook_file.write %{source "#{rvm_path}/scripts/rvm"\nrvm #{rvm_string}} if rvm_path && rvm_string
|
92
92
|
|
93
|
-
hook_file.write "\$deploy_dir/config/
|
93
|
+
hook_file.write "\$deploy_dir/config/after_deploy.rb \$oldrev \$newrev \$refname \$deploy_dir"
|
94
94
|
|
95
95
|
`chmod 770 #{repository}/hooks/post-receive`
|
96
96
|
|
data/lib/pushdeploy/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: pushdeploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.16
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Artem Yankov
|
@@ -34,7 +34,6 @@ files:
|
|
34
34
|
- config/after_deploy.rb
|
35
35
|
- hooks/post-receive
|
36
36
|
- lib/pushdeploy.rb
|
37
|
-
- lib/pushdeploy/pushdeploy.rb
|
38
37
|
- lib/pushdeploy/version.rb
|
39
38
|
- pushdeploy.gemspec
|
40
39
|
homepage: ""
|
@@ -1,58 +0,0 @@
|
|
1
|
-
class PushDeploy
|
2
|
-
|
3
|
-
EMPTY_DIR = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'
|
4
|
-
|
5
|
-
def initialize(args, &block)
|
6
|
-
|
7
|
-
puts 'Running auto_deploy...'
|
8
|
-
|
9
|
-
@deploy_to = args[3]
|
10
|
-
|
11
|
-
@oldrev, @newrev = args.shift, args.shift || 'HEAD'
|
12
|
-
if @oldrev == '0000000000000000000000000000000000000000'
|
13
|
-
@oldrev = EMPTY_DIR
|
14
|
-
elsif @oldrev.nil?
|
15
|
-
@oldrev = '@{-1}'
|
16
|
-
end
|
17
|
-
|
18
|
-
instance_exec(&block)
|
19
|
-
|
20
|
-
end
|
21
|
-
|
22
|
-
def bundle
|
23
|
-
return if @oldrev == '0'
|
24
|
-
|
25
|
-
return unless File.exist?('Gemfile')
|
26
|
-
if %x{git diff --name-only #{@oldrev} #{@newrev}} =~ /^Gemfile|\.gemspec$/
|
27
|
-
begin
|
28
|
-
# If Bundler in turn spawns Git, it can get confused by $GIT_DIR
|
29
|
-
git_dir = ENV.delete('GIT_DIR')
|
30
|
-
run "bundle check"
|
31
|
-
unless $?.success?
|
32
|
-
puts "Bundling..."
|
33
|
-
run "bundle | grep -v '^Using ' | grep -v ' is complete'"
|
34
|
-
end
|
35
|
-
ensure
|
36
|
-
ENV['GIT_DIR'] = git_dir
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def run(command)
|
42
|
-
Kernel.system "#{command} >&1"
|
43
|
-
end
|
44
|
-
|
45
|
-
def migrate
|
46
|
-
return if @oldrev == '0'
|
47
|
-
|
48
|
-
schema = %x{git diff --name-status #{@oldrev} #{@newrev} -- db/schema.rb}
|
49
|
-
if schema =~ /^A/
|
50
|
-
run "bundle exec rake db:create"
|
51
|
-
end
|
52
|
-
|
53
|
-
if `git diff HEAD^`.index("db/migrate")
|
54
|
-
puts "Migrating.."
|
55
|
-
run 'bundle exec rake db:migrate RAILS_ENV="production"'
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|