instapusher 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/instapusher/commands.rb +34 -14
- data/lib/instapusher/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763e12fcfdc87a4a6a1b88eb7e466e4bae5770a3
|
4
|
+
data.tar.gz: 74b0126234f0211e6954b396a339ffa31a94807e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed3c74edb2c2aff7d80cb9d26fd64acb090a2fa3f3799bebe7a2b47ac985c0a651650134979e347b2b7bd2112523eaac664a32a02c0e68b5983050749713e461
|
7
|
+
data.tar.gz: 4ee220fe6f7a93a0533a11ff15489fb61da7a32d2131367c3ee1f32d7a697e4daea501f61767baff26b93baf8d433c9f4ad8bd2a069ed1539bbf549498635877
|
data/lib/instapusher/commands.rb
CHANGED
@@ -5,23 +5,23 @@ require 'uri'
|
|
5
5
|
module Instapusher
|
6
6
|
class Commands
|
7
7
|
|
8
|
-
attr_reader :debug, :api_key, :branch_name, :project_name, :staging
|
8
|
+
attr_reader :debug, :api_key, :branch_name, :project_name, :staging, :local
|
9
9
|
|
10
10
|
def initialize init_options
|
11
11
|
@debug = init_options[:debug]
|
12
12
|
@staging = init_options[:staging]
|
13
13
|
@local = init_options[:local]
|
14
|
+
@branch_name = get_branch_name
|
15
|
+
@project_name = get_project_name
|
14
16
|
|
15
|
-
|
16
|
-
@branch_name = init_options[:project_name] || ENV['INSTAPUSHER_BRANCH'] || git.current_branch
|
17
|
-
@project_name = init_options[:branch_name] || ENV['INSTAPUSHER_PROJECT'] || git.project_name
|
17
|
+
detect_api_key
|
18
18
|
end
|
19
19
|
|
20
20
|
def deploy
|
21
21
|
verify_api_key
|
22
22
|
#SpecialInstructionForProduction.new.run if production?
|
23
23
|
|
24
|
-
job_submission = JobSubmission.new(debug,
|
24
|
+
job_submission = JobSubmission.new(debug, job_submission_parameters)
|
25
25
|
job_submission.submit_the_job
|
26
26
|
|
27
27
|
if job_submission.success?
|
@@ -34,28 +34,32 @@ module Instapusher
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def
|
38
|
-
@options ||= begin
|
37
|
+
def job_submission_parameters
|
39
38
|
{ project: project_name,
|
40
|
-
local:
|
39
|
+
local: local,
|
41
40
|
branch: branch_name,
|
42
|
-
owner:
|
41
|
+
owner: repo_owner,
|
43
42
|
version: VERSION,
|
44
|
-
staging:
|
43
|
+
staging: staging,
|
45
44
|
api_key: api_key }
|
46
|
-
end
|
47
45
|
end
|
48
46
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
47
|
+
def repo_owner
|
48
|
+
git.repo_owner
|
49
|
+
end
|
52
50
|
|
51
|
+
def verify_api_key
|
53
52
|
if @api_key.to_s.length == 0
|
54
53
|
puts ''
|
55
54
|
abort "No instapusher API key was found. Please execute instapusher --api-key to setup instapusher API key."
|
56
55
|
end
|
57
56
|
end
|
58
57
|
|
58
|
+
def detect_api_key
|
59
|
+
@api_key = ENV['API_KEY'] || Instapusher::Configuration.api_key(debug) || ""
|
60
|
+
log "api_key is #{@api_key}"
|
61
|
+
end
|
62
|
+
|
59
63
|
def production?
|
60
64
|
branch_name.intern == :production
|
61
65
|
end
|
@@ -64,5 +68,21 @@ module Instapusher
|
|
64
68
|
branch_name.intern == :staging
|
65
69
|
end
|
66
70
|
|
71
|
+
def log msg
|
72
|
+
puts msg if debug
|
73
|
+
end
|
74
|
+
|
75
|
+
def get_branch_name
|
76
|
+
ENV['INSTAPUSHER_BRANCH'] || git.current_branch
|
77
|
+
end
|
78
|
+
|
79
|
+
def get_project_name
|
80
|
+
ENV['INSTAPUSHER_PROJECT'] || git.project_name
|
81
|
+
end
|
82
|
+
|
83
|
+
def git
|
84
|
+
@_git ||= Git.new
|
85
|
+
end
|
86
|
+
|
67
87
|
end
|
68
88
|
end
|
data/lib/instapusher/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instapusher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Neeraj Singh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashr
|