push2heroku 0.0.3 → 0.0.4
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 +0 -12
- data/lib/push2heroku/base.rb +34 -7
- data/lib/push2heroku/railtie.rb +2 -2
- data/lib/push2heroku/util.rb +9 -1
- data/lib/push2heroku/version.rb +1 -1
- data/push2heroku.gemspec +3 -3
- metadata +7 -7
data/README.md
CHANGED
@@ -57,18 +57,6 @@ However if I delete `staging` key from `push2heroku.yml` then `staging`
|
|
57
57
|
is no longer a special branch and the heroku url would be
|
58
58
|
`http://nimbleshop-staging-neeraj.herokuapp.com` .
|
59
59
|
|
60
|
-
## Resetting the database
|
61
|
-
|
62
|
-
When the application is deployed for the very first time then you want
|
63
|
-
the database to reset and some sort of setup to be run. However on
|
64
|
-
subsequest deployment you do not need to run those setup tasks.
|
65
|
-
|
66
|
-
To incorporate that on first deployment `push2heroku` will execute
|
67
|
-
commands mentioned under key `hard`. Here `hard` stands for hard push.
|
68
|
-
Subsequent pushes will be `soft` push.
|
69
|
-
|
70
|
-
If you want to force `hard` push anytime then execute `rake push2heroku
|
71
|
-
HARD=true`.
|
72
60
|
|
73
61
|
## License
|
74
62
|
|
data/lib/push2heroku/base.rb
CHANGED
@@ -2,11 +2,11 @@ module Push2heroku
|
|
2
2
|
class Base
|
3
3
|
|
4
4
|
attr_accessor :branch_name, :commands, :current_user, :heroku_app_name, :settings, :named_branches
|
5
|
-
attr_reader :
|
5
|
+
attr_reader :callbacks, :project_name
|
6
6
|
|
7
|
-
def initialize(
|
7
|
+
def initialize(callbacks)
|
8
8
|
@project_name = File.basename(Dir.getwd)
|
9
|
-
@
|
9
|
+
@callbacks = callbacks
|
10
10
|
|
11
11
|
git = Git.new
|
12
12
|
@branch_name = git.current_branch
|
@@ -28,8 +28,10 @@ module Push2heroku
|
|
28
28
|
feedback_to_user
|
29
29
|
commands.each do |cmd|
|
30
30
|
begin
|
31
|
+
puts "Going to execute: #{cmd}"
|
31
32
|
sh cmd
|
32
33
|
rescue Exception => e
|
34
|
+
puts "command that failed was: #{cmd}"
|
33
35
|
puts e
|
34
36
|
end
|
35
37
|
end
|
@@ -50,9 +52,35 @@ module Push2heroku
|
|
50
52
|
def build_commands
|
51
53
|
commands << settings.pre_config_commands
|
52
54
|
build_config_commands
|
53
|
-
|
54
|
-
|
55
|
-
|
55
|
+
add_before_every_install
|
56
|
+
add_callback_commands
|
57
|
+
add_after_every_install
|
58
|
+
|
59
|
+
if public_url = settings.public_url
|
60
|
+
commands << "open http://#{public_url}"
|
61
|
+
else
|
62
|
+
commands << "bundle exec heroku open --app #{heroku_app_name}"
|
63
|
+
end
|
64
|
+
|
65
|
+
commands.flatten!.compact!
|
66
|
+
end
|
67
|
+
|
68
|
+
def add_before_every_install
|
69
|
+
if cmd = settings.post_config_commands.before_every_install
|
70
|
+
commands << cmd
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def add_after_every_install
|
75
|
+
if cmd = settings.post_config_commands.after_every_install
|
76
|
+
commands << cmd
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def add_callback_commands
|
81
|
+
callbacks.each do |callback|
|
82
|
+
commands << settings.post_config_commands[callback]
|
83
|
+
end
|
56
84
|
end
|
57
85
|
|
58
86
|
def build_config_commands
|
@@ -73,7 +101,6 @@ module Push2heroku
|
|
73
101
|
puts '='*50
|
74
102
|
puts 'Following commands will be executed:'
|
75
103
|
commands.each do |cmd|
|
76
|
-
puts ''
|
77
104
|
puts cmd
|
78
105
|
end
|
79
106
|
puts '='*50
|
data/lib/push2heroku/railtie.rb
CHANGED
data/lib/push2heroku/util.rb
CHANGED
@@ -2,7 +2,15 @@ class Util
|
|
2
2
|
|
3
3
|
def self.hard_push?(base)
|
4
4
|
remote_branch_name = "h#{base.branch_name}"
|
5
|
-
|
5
|
+
|
6
|
+
# do hard push only when expicitly asked
|
7
|
+
# base.hard || !remote_branch_exists?(remote_branch_name)
|
8
|
+
base.hard
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.new_install?(base)
|
12
|
+
remote_branch_name = "h#{base.branch_name}"
|
13
|
+
!remote_branch_exists?(remote_branch_name)
|
6
14
|
end
|
7
15
|
|
8
16
|
def self.remote_branch_exists?(remote_branch_name)
|
data/lib/push2heroku/version.rb
CHANGED
data/push2heroku.gemspec
CHANGED
@@ -4,9 +4,9 @@ require File.expand_path('../lib/push2heroku/version', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Neeraj Singh"]
|
6
6
|
gem.email = ["neerajdotname@gmail.com"]
|
7
|
-
gem.description = %q{push2heroku}
|
8
|
-
gem.summary = %q{push2heroku}
|
9
|
-
gem.homepage = ""
|
7
|
+
gem.description = %q{push2heroku makes it easy to push code to heroku}
|
8
|
+
gem.summary = %q{push2heroku gem makes it easy to push code to heroku}
|
9
|
+
gem.homepage = "http://bigbinary.com"
|
10
10
|
|
11
11
|
gem.files = `git ls-files`.split($\)
|
12
12
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: push2heroku
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
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-08-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashr
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
- - '='
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 2.25.0
|
46
|
-
description: push2heroku
|
46
|
+
description: push2heroku makes it easy to push code to heroku
|
47
47
|
email:
|
48
48
|
- neerajdotname@gmail.com
|
49
49
|
executables: []
|
@@ -63,7 +63,7 @@ files:
|
|
63
63
|
- lib/push2heroku/util.rb
|
64
64
|
- lib/push2heroku/version.rb
|
65
65
|
- push2heroku.gemspec
|
66
|
-
homepage:
|
66
|
+
homepage: http://bigbinary.com
|
67
67
|
licenses: []
|
68
68
|
post_install_message:
|
69
69
|
rdoc_options: []
|
@@ -77,7 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
segments:
|
79
79
|
- 0
|
80
|
-
hash:
|
80
|
+
hash: 2282767973940770
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
none: false
|
83
83
|
requirements:
|
@@ -86,11 +86,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
86
|
version: '0'
|
87
87
|
segments:
|
88
88
|
- 0
|
89
|
-
hash:
|
89
|
+
hash: 2282767973940770
|
90
90
|
requirements: []
|
91
91
|
rubyforge_project:
|
92
92
|
rubygems_version: 1.8.24
|
93
93
|
signing_key:
|
94
94
|
specification_version: 3
|
95
|
-
summary: push2heroku
|
95
|
+
summary: push2heroku gem makes it easy to push code to heroku
|
96
96
|
test_files: []
|