instapusher 0.0.2 → 0.0.3

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/instapusher.gemspec CHANGED
@@ -17,5 +17,4 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency("hashr", "~> 0.0.19")
19
19
  gem.add_dependency("heroku", "~> 2.25.0")
20
- gem.add_dependency("railties", ">= 3.1.0")
21
20
  end
@@ -22,24 +22,27 @@ module Instapusher
22
22
  branch_name = git.current_branch
23
23
  project_name = git.project_name
24
24
 
25
- response = Net::HTTP.post_form(URI.parse(url),
26
- { project: project_name,
27
- branch: branch_name,
28
- local: ENV['LOCAL'],
29
- 'options[callbacks]' => ENV['CALLBACKS'] })
25
+ api_key = Instapusher::Configuration.api_key || ""
30
26
 
31
- if response.code == '200'
32
- response_body = MultiJson.load(response.body)
33
- status_url = response_body['status']
27
+ options = { project: project_name,
28
+ branch: branch_name,
29
+ local: ENV['LOCAL'],
30
+ api_key: api_key }
34
31
 
35
- status_url = status_url.gsub(DEFAULT_HOSTNAME, hostname) if ENV['LOCAL']
32
+ response = Net::HTTP.post_form URI.parse(url), options
33
+
34
+ response_body = MultiJson.load(response.body)
35
+ job_status_url = response_body['status'] || response_body['job_status_url']
36
+
37
+ if job_status_url && job_status_url != ""
38
+ job_status_url = job_status_url.gsub(DEFAULT_HOSTNAME, hostname) if ENV['LOCAL']
36
39
  puts 'The appliction will be deployed to: ' + response_body['heroku_url']
37
- puts 'Monitor the job status at: ' + status_url
38
- cmd = "open #{status_url}"
40
+ puts 'Monitor the job status at: ' + job_status_url
41
+ cmd = "open #{job_status_url}"
39
42
  `#{cmd}`
40
43
  else
41
- puts 'Something has gone wrong'
44
+ puts response_body['error_message']
42
45
  end
43
46
  end
44
47
  end
45
- end
48
+ end
@@ -0,0 +1,24 @@
1
+ require 'yaml'
2
+
3
+ module Instapusher
4
+ module Configuration
5
+ extend self
6
+
7
+ @_settings = {}
8
+ attr_reader :_settings
9
+
10
+ def load(filename=nil)
11
+ filename ||= File.join(ENV['HOME'], '.instapusher')
12
+
13
+ unless File.exist? filename
14
+ File.new(filename, File::CREAT|File::TRUNC|File::RDWR, 0644).close
15
+ end
16
+
17
+ @_settings = YAML::load_file(filename) || {}
18
+ end
19
+
20
+ def method_missing(name, *args, &block)
21
+ @_settings[name.to_s]
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module Instapusher
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/instapusher.rb CHANGED
@@ -1,8 +1,7 @@
1
- require "active_support"
1
+ require 'instapusher/git'
2
+ require 'instapusher/configuration'
2
3
 
3
4
  module Instapusher
4
- extend ActiveSupport::Autoload
5
- autoload :Git
6
5
  end
7
6
 
8
- require 'instapusher/railtie'
7
+ Instapusher::Configuration.load
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.2
4
+ version: 0.0.3
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-03-01 00:00:00.000000000 Z
12
+ date: 2013-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashr
@@ -43,22 +43,6 @@ dependencies:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: 2.25.0
46
- - !ruby/object:Gem::Dependency
47
- name: railties
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: 3.1.0
54
- type: :runtime
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: 3.1.0
62
46
  description: instapusher makes it easy to push code to heroku
63
47
  email:
64
48
  - neeraj@bigbinary.com
@@ -78,6 +62,7 @@ files:
78
62
  - lib/instapusher/base.rb
79
63
  - lib/instapusher/command_builder.rb
80
64
  - lib/instapusher/commands.rb
65
+ - lib/instapusher/configuration.rb
81
66
  - lib/instapusher/executor.rb
82
67
  - lib/instapusher/git.rb
83
68
  - lib/instapusher/railtie.rb
@@ -96,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
81
  version: '0'
97
82
  segments:
98
83
  - 0
99
- hash: -2089320010673045013
84
+ hash: 1314322349882395793
100
85
  required_rubygems_version: !ruby/object:Gem::Requirement
101
86
  none: false
102
87
  requirements:
@@ -105,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
90
  version: '0'
106
91
  segments:
107
92
  - 0
108
- hash: -2089320010673045013
93
+ hash: 1314322349882395793
109
94
  requirements: []
110
95
  rubyforge_project:
111
96
  rubygems_version: 1.8.23