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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 86917f65bf8082648676b3cfab63bda29cf02f9a
4
- data.tar.gz: d3caeb037564958fe3dfb85c7c497c5ba43851ae
3
+ metadata.gz: 763e12fcfdc87a4a6a1b88eb7e466e4bae5770a3
4
+ data.tar.gz: 74b0126234f0211e6954b396a339ffa31a94807e
5
5
  SHA512:
6
- metadata.gz: 3749cd7596f66ee0afc6e160931c752caf34caf9832d04277131c61d9d41aab13ac5d13c95b2e791596cbf2ca518d0948f5dfa0f5e002d3773fb4222d5d65e4b
7
- data.tar.gz: be068428eb629db62c79a33bb59221046f23117682b265cc9d581af6c2465aff090dd73d6082fb04eaa4c1d436f657715d8f211a61dd56c7a13ad6d9e824b53b
6
+ metadata.gz: ed3c74edb2c2aff7d80cb9d26fd64acb090a2fa3f3799bebe7a2b47ac985c0a651650134979e347b2b7bd2112523eaac664a32a02c0e68b5983050749713e461
7
+ data.tar.gz: 4ee220fe6f7a93a0533a11ff15489fb61da7a32d2131367c3ee1f32d7a697e4daea501f61767baff26b93baf8d433c9f4ad8bd2a069ed1539bbf549498635877
@@ -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
- git = Git.new
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, options)
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 options
38
- @options ||= begin
37
+ def job_submission_parameters
39
38
  { project: project_name,
40
- local: @local,
39
+ local: local,
41
40
  branch: branch_name,
42
- owner: Git.new.repo_owner,
41
+ owner: repo_owner,
43
42
  version: VERSION,
44
- staging: @staging,
43
+ staging: staging,
45
44
  api_key: api_key }
46
- end
47
45
  end
48
46
 
49
- def verify_api_key
50
- @api_key = ENV['API_KEY'] || Instapusher::Configuration.api_key(debug) || ""
51
- puts "api_key is #{@api_key}" if debug
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
@@ -1,3 +1,3 @@
1
1
  module Instapusher
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
3
3
  end
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.8
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-25 00:00:00.000000000 Z
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hashr