slotbox 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.
@@ -57,7 +57,7 @@ slotbox_host = ENV["SLOTBOX_HOST"] || "slotbox.es"
57
57
 
58
58
  system <<-EOF
59
59
 
60
- export HEROKU_HOST=${HEROKU_HOST:-http://#{slotbox_host}:5000/}
60
+ export HEROKU_HOST=${HEROKU_HOST:-https://#{slotbox_host}:5000/}
61
61
  export HEROKU_STATUS_HOST=${HEROKU_STATUS_HOST:-"#{slotbox_host}"}
62
62
  export HEROKU_SSL_VERIFY=${HEROKU_SSL_VERIFY:-"disable"}
63
63
 
@@ -1,4 +1,4 @@
1
1
  module Slotbox
2
2
  UNSUPPORTED_COMMANDS = %w[addons certs db drains keys labs pg pgbackups ssl stack update version]
3
- PLUGIN_DIR = "~/.heroku/plugins/slotbox"
3
+ PLUGIN_DIR = ENV['HOME'] + "/.heroku/plugins/slotbox"
4
4
  end
@@ -1,4 +1,4 @@
1
- if ENV['HEROKU_HOST'] =~ /slotbox/
1
+ if ENV['HEROKU_HOST'] =~ /slotbox|localhost/
2
2
 
3
3
  require 'slotbox'
4
4
 
@@ -12,4 +12,4 @@ module Heroku
12
12
  end
13
13
 
14
14
  end
15
- end
15
+ end
@@ -76,4 +76,66 @@ class Heroku::Command::Base
76
76
  end
77
77
  end
78
78
 
79
+ end
80
+
81
+ module Heroku
82
+ module Command
83
+ def self.run(cmd, arguments=[])
84
+ begin
85
+ object, method = prepare_run(cmd, arguments.dup)
86
+ object.send(method)
87
+ rescue Interrupt, StandardError, SystemExit => error
88
+ # load likely error classes, as they may not be loaded yet due to defered loads
89
+ require 'heroku-api'
90
+ require 'rest_client'
91
+ raise(error)
92
+ end
93
+ rescue Heroku::API::Errors::Unauthorized, RestClient::Unauthorized
94
+ puts "Authentication failure"
95
+ unless ENV['HEROKU_API_KEY']
96
+ run "login"
97
+ retry
98
+ end
99
+ rescue Heroku::API::Errors::VerificationRequired, RestClient::PaymentRequired => e
100
+ retry if Heroku::Helpers.confirm_billing
101
+ rescue Heroku::API::Errors::NotFound => e
102
+ error extract_error(e.response.body) {
103
+ e.response.body =~ /^([\w\s]+ not found).?$/ ? $1 : "Resource not found"
104
+ }
105
+ rescue RestClient::ResourceNotFound => e
106
+ error extract_error(e.http_body) {
107
+ e.http_body =~ /^([\w\s]+ not found).?$/ ? $1 : "Resource not found"
108
+ }
109
+ rescue Heroku::API::Errors::Locked => e
110
+ app = e.response.headers[:x_confirmation_required]
111
+ if confirm_command(app, extract_error(e.response.body))
112
+ arguments << '--confirm' << app
113
+ retry
114
+ end
115
+ rescue RestClient::Locked => e
116
+ app = e.response.headers[:x_confirmation_required]
117
+ if confirm_command(app, extract_error(e.http_body))
118
+ arguments << '--confirm' << app
119
+ retry
120
+ end
121
+ rescue Heroku::API::Errors::Timeout, RestClient::RequestTimeout
122
+ error "API request timed out. Please try again, or contact support@heroku.com if this issue persists."
123
+ rescue Heroku::API::Errors::ErrorWithResponse => e
124
+ error extract_error(e.response.body)
125
+ rescue RestClient::RequestFailed => e
126
+ error extract_error(e.http_body)
127
+ rescue CommandFailed => e
128
+ error e.message
129
+ rescue OptionParser::ParseError
130
+ commands[cmd] ? run("help", [cmd]) : run("help")
131
+ rescue Excon::Errors::SocketError => e
132
+ if e.message == 'getaddrinfo: nodename nor servname provided, or not known (SocketError)'
133
+ error("Unable to connect to Heroku API, please check internet connectivity and try again.")
134
+ else
135
+ raise(e)
136
+ end
137
+ ensure
138
+ display_warnings
139
+ end
140
+ end
79
141
  end
@@ -17,11 +17,6 @@ module Heroku::Command
17
17
  path = Addressable::URI.parse(remote).path.split('/')
18
18
  remote = "https://github.com/#{path[-2]}/#{path[-1]}"
19
19
 
20
- app = git "config --get slotbox.app"
21
- if app.nil?
22
- raise(CommandFailed, "Cannot find Slotbox app name from git config")
23
- end
24
-
25
20
  process_data = action("Starting deploy", :success => "connected") do
26
21
  process_data = api.put_app_deploy(app, remote).body
27
22
  status(process_data["process"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slotbox
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-01-12 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Command-line tool to deploy and manage apps on Slotbox.
15
15
  email: tom@tombh.co.uk