pushdeploy 0.0.10 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,59 @@
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
+
59
+ end
@@ -1,3 +1,3 @@
1
1
  module Pushdeploy
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.12"
3
3
  end
data/lib/pushdeploy.rb CHANGED
@@ -1,59 +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
-
59
- end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: pushdeploy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Artem Yankov
@@ -24,6 +24,7 @@ extensions: []
24
24
  extra_rdoc_files: []
25
25
 
26
26
  files:
27
+ - lib/pushdeploy/pushdeploy.rb
27
28
  - lib/pushdeploy/version.rb
28
29
  - lib/pushdeploy.rb
29
30
  - bin/pushdeploy_create_config
@@ -51,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
52
  requirements: []
52
53
 
53
54
  rubyforge_project: pushdeploy
54
- rubygems_version: 1.7.2
55
+ rubygems_version: 1.8.5
55
56
  signing_key:
56
57
  specification_version: 3
57
58
  summary: Easy deployment after 'git push' for Ruby applications