instapusher 0.0.19 → 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/instapusher +1 -1
- data/lib/instapusher/commands.rb +37 -15
- data/lib/instapusher/version.rb +1 -1
- metadata +3 -3
data/bin/instapusher
CHANGED
data/lib/instapusher/commands.rb
CHANGED
@@ -5,33 +5,55 @@ require 'instapusher'
|
|
5
5
|
|
6
6
|
module Instapusher
|
7
7
|
class Commands
|
8
|
+
|
8
9
|
DEFAULT_HOSTNAME = 'instapusher.com'
|
9
10
|
|
10
|
-
|
11
|
+
attr_reader :debug, :api_key, :branch_name, :project_name
|
11
12
|
|
12
|
-
|
13
|
+
def initialize init_options = {}
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
@debug = init_options[:debug]
|
16
|
+
@quick = init_options[:quick]
|
17
|
+
@local = init_options[:local]
|
16
18
|
|
17
|
-
url = "http://#{hostname}/heroku.json"
|
18
19
|
git = Git.new
|
19
|
-
branch_name =
|
20
|
-
project_name =
|
20
|
+
@branch_name = init_options[:project_name] || ENV['INSTAPUSHER_BRANCH'] || git.current_branch
|
21
|
+
@project_name = init_options[:branch_name] || ENV['INSTAPUSHER_PROJECT'] || git.project_name
|
22
|
+
end
|
23
|
+
|
24
|
+
def options
|
25
|
+
@options ||= begin
|
26
|
+
{ project: project_name,
|
27
|
+
branch: branch_name,
|
28
|
+
quick: @quick,
|
29
|
+
local: @local,
|
30
|
+
api_key: api_key }
|
31
|
+
end
|
32
|
+
end
|
21
33
|
|
22
|
-
|
34
|
+
def verify_api_key
|
35
|
+
@api_key = ENV['API_KEY'] || Instapusher::Configuration.api_key || ""
|
23
36
|
|
24
|
-
if api_key.to_s.length == 0
|
37
|
+
if @api_key.to_s.length == 0
|
25
38
|
puts "Please enter instapusher api_key at ~/.instapusher "
|
26
39
|
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def url
|
43
|
+
@url ||= begin
|
44
|
+
hostname = if options[:local]
|
45
|
+
"localhost:3000"
|
46
|
+
else
|
47
|
+
ENV['INSTAPUSHER_HOST'] || DEFAULT_HOSTNAME
|
48
|
+
end
|
49
|
+
"http://#{hostname}/heroku.json"
|
50
|
+
end
|
51
|
+
end
|
27
52
|
|
28
|
-
|
29
|
-
|
30
|
-
quick: _options[:quick],
|
31
|
-
local: _options[:local],
|
32
|
-
api_key: api_key }
|
53
|
+
def deploy
|
54
|
+
verify_api_key
|
33
55
|
|
34
|
-
if debug
|
56
|
+
if debug
|
35
57
|
puts "url to hit: #{url.inspect}"
|
36
58
|
puts "options being passed to the url: #{options.inspect}"
|
37
59
|
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.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
segments:
|
83
83
|
- 0
|
84
|
-
hash: -
|
84
|
+
hash: -3703911192431955424
|
85
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
86
|
none: false
|
87
87
|
requirements:
|
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
segments:
|
92
92
|
- 0
|
93
|
-
hash: -
|
93
|
+
hash: -3703911192431955424
|
94
94
|
requirements: []
|
95
95
|
rubyforge_project:
|
96
96
|
rubygems_version: 1.8.23
|