instapusher 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +37 -46
- data/bin/instapusher +1 -1
- data/lib/instapusher/commands.rb +2 -3
- data/lib/instapusher/git.rb +3 -1
- data/lib/instapusher/version.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -4,18 +4,38 @@ Makes it easy to push to heroku.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
gem 'instapusher'
|
7
|
+
gem install instapusher
|
10
8
|
|
11
9
|
## Usage
|
12
10
|
|
13
|
-
|
11
|
+
instapusher
|
12
|
+
|
13
|
+
It detects a project name and a branch from the git repo. Else you can specify it from the command line like:
|
14
|
+
|
15
|
+
instapusher rails master
|
16
|
+
|
17
|
+
|
18
|
+
After installing the gem you should register in the `http://instapusher.com`.
|
19
|
+
Setup a project using the user and project name from the github. And create a config file `.instapusher` with api key.
|
20
|
+
Example:
|
21
|
+
|
22
|
+
api_key: 123123123
|
23
|
+
|
24
|
+
## Setup Instapusher server
|
25
|
+
|
26
|
+
You can provide the env variable `LOCAL` like:
|
27
|
+
|
28
|
+
LOCAL=1 instapusher
|
29
|
+
|
30
|
+
And instapusher will send requests to `http://localhost:3000` server.
|
31
|
+
Another solution is use env variable `INSTAPUSHER_HOST`.
|
32
|
+
|
33
|
+
INSTAPUSHER_HOST=instapusher.com instapusher
|
14
34
|
|
15
|
-
|
35
|
+
Also there are other env variables like `INSTAPUSHER_PROJECT` and `INSTAPUSHER_BRANCH`.
|
36
|
+
|
37
|
+
INSTAPUSHER_HOST=instapusher.com INSTAPUSHER_PROJECT=rails INSTAPUSHER_BRANCH=master instapusher
|
16
38
|
|
17
|
-
Change the contents of `config/instapusher.yml` as per your needs after
|
18
|
-
reading rest of README.
|
19
39
|
|
20
40
|
## What problem it solves
|
21
41
|
|
@@ -26,60 +46,31 @@ members to review. However in order to review the work all the team
|
|
26
46
|
members need to pull down the branch and fire up `rails server` and then
|
27
47
|
review.
|
28
48
|
|
29
|
-
We like to see things working. So we developed `
|
49
|
+
We like to see things working. So we developed `instapusher` to push a
|
30
50
|
feature branch to heroku instantly with one command. Executing
|
31
|
-
`
|
51
|
+
`instapusher` prints a url and we put that url in the pull request so
|
32
52
|
that team members can actually test the feature.
|
33
53
|
|
34
54
|
## Here is how it works
|
35
55
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
Lets say that I am working in a branch called
|
40
|
-
`76-facebook-authentication`. When I execute `push2heroku` then the
|
56
|
+
Lets say that I am working with github project `nimbleshop` in a branch called
|
57
|
+
`76-facebook-authentication`. When I execute `instapusher` then the
|
41
58
|
application name under which it will be deployed to heroku will be
|
42
|
-
`nimbleshop-76-facebook-
|
59
|
+
`nimbleshop-76-facebook-ip`.
|
43
60
|
|
44
61
|
`nimbleshop` is the name of the project.
|
45
62
|
`76-facebook` is the first 10 letters of the branch name.
|
46
|
-
`
|
63
|
+
`ip` is characters to mark the instance as temporal.
|
47
64
|
|
48
65
|
So in this case the url of the application will be
|
49
|
-
`http://
|
66
|
+
`http://nnimbleshop-76-facebook-ip.herokuapp.com` .
|
50
67
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
branch name. For example if I execute `rake push2heroku` from `staging`
|
68
|
+
There are two special branches `production` and `staging`.
|
69
|
+
For these branches the url generated will be just the application name and the
|
70
|
+
branch name. For example if I execute `instapusher` from `staging`
|
55
71
|
branch then the heroku url will be
|
56
72
|
`http://nimbleshop-staging.herokuapp.com`.
|
57
73
|
|
58
|
-
However if I delete `staging` key from `push2heroku.yml` then `staging`
|
59
|
-
is no longer a special branch and the heroku url would be
|
60
|
-
`http://nimbleshop-staging-neeraj.herokuapp.com` .
|
61
|
-
|
62
|
-
## Callbacks
|
63
|
-
|
64
|
-
The new design of `push2heroku` is very flexible. Let's say that Artem
|
65
|
-
wants to test something then he can add to `push2heroku.yml` something
|
66
|
-
like this
|
67
|
-
|
68
|
-
```
|
69
|
-
regenerate_images:
|
70
|
-
- bundle exec heroku run rake db:regenerate_images --app <%=ENV['HEROKU_APP_NAME']%> --trace
|
71
|
-
- bundle exec heroku run rake db:post_image_cleanup --app <%=ENV['HEROKU_APP_NAME']%> --trace
|
72
|
-
```
|
73
|
-
|
74
|
-
Now to execute all the commands under key `regenrate_images` all he has to do is
|
75
|
-
|
76
|
-
```
|
77
|
-
rake push2heroku CALLBACKS=reset_db_using_fixtures,regenerate_images
|
78
|
-
```
|
79
|
-
|
80
|
-
Just comma separate all the tasks. It's that simple. Now `push2heroku` gives all the control to the developer.
|
81
|
-
|
82
74
|
## License
|
83
75
|
|
84
76
|
`instapusher` is released under MIT License.
|
85
|
-
|
data/bin/instapusher
CHANGED
data/lib/instapusher/commands.rb
CHANGED
@@ -8,14 +8,13 @@ module Instapusher
|
|
8
8
|
DEFAULT_HOSTNAME = 'instapusher.com'
|
9
9
|
|
10
10
|
def self.deploy(project_name=nil, branch_name=nil)
|
11
|
-
|
12
11
|
hostname = ENV['INSTAPUSHER_HOST'] || DEFAULT_HOSTNAME
|
13
12
|
hostname = "localhost:3000" if ENV['LOCAL']
|
14
13
|
|
15
14
|
url = "http://#{hostname}/heroku.json"
|
16
15
|
git = Git.new
|
17
|
-
branch_name ||= git.current_branch
|
18
|
-
project_name ||= git.project_name
|
16
|
+
branch_name ||= ENV['INSTAPUSHER_BRANCH'] || git.current_branch
|
17
|
+
project_name ||= ENV['INSTAPUSHER_PROJECT'] || git.project_name
|
19
18
|
|
20
19
|
api_key = Instapusher::Configuration.api_key || ""
|
21
20
|
if api_key.to_s.length == 0
|
data/lib/instapusher/git.rb
CHANGED
@@ -14,7 +14,9 @@ module Instapusher
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def project_name
|
17
|
-
`git config remote.origin.url`.chop!.scan(/\/([^\/]+)
|
17
|
+
result = `git config remote.origin.url`.chop!.scan(/\/([^\/]+)?$/).flatten.first
|
18
|
+
result.sub!(/\.git$/, '') if result
|
19
|
+
result
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
data/lib/instapusher/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instapusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
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: 2013-
|
12
|
+
date: 2013-04-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashr
|
@@ -97,7 +97,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
97
|
version: '0'
|
98
98
|
segments:
|
99
99
|
- 0
|
100
|
-
hash:
|
100
|
+
hash: -2459523936242913019
|
101
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
102
|
none: false
|
103
103
|
requirements:
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
segments:
|
108
108
|
- 0
|
109
|
-
hash:
|
109
|
+
hash: -2459523936242913019
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
112
|
rubygems_version: 1.8.23
|