strobe 0.3.4 → 0.3.5

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.
@@ -1,10 +1,11 @@
1
1
  module Strobe
2
+ class NoDeploy < StrobeError; end
3
+
2
4
  class CLI::Deploys < CLI
3
5
 
4
6
  method_option "application-id", :type => :numeric, :banner => "Use application with given id"
5
7
  action "list", "list deploys" do
6
- id = options['application-id'] || config[:application_id]
7
- app = Application.get!(id)
8
+ app = get_application(options)
8
9
  deploys = app.deploys.all
9
10
 
10
11
  deploys_table deploys
@@ -16,10 +17,11 @@ module Strobe
16
17
  action "show", "show the last deploy" do |*args|
17
18
  sha = args.first
18
19
 
19
- id = options['application-id'] || config[:application_id]
20
- app = Application.get!(id)
20
+ app = get_application(options)
21
+
22
+ deploy = sha ? app.deploys.where(:id => sha) : Deploy.where(:limit => 1, :application_id => app.id).first
21
23
 
22
- deploy = sha ? app.deploys.where(:id => sha) : Deploy.where(:limit => 1, :application_id => id).first
24
+ raise NoDeploy.new("No deploys to show") unless deploy
23
25
 
24
26
  puts "deploy #{deploy[:id]}"
25
27
 
@@ -203,7 +203,15 @@ module Strobe
203
203
  :pre_deploy => config["pre_deploy_hook"],
204
204
  :post_deploy => config["post_deploy_hook"]
205
205
 
206
- say "The application has successfully been deployed and is available at #{host}"
206
+ if host
207
+ say "The application has successfully been deployed and is available at #{host}"
208
+ else
209
+ unless resource.errors.empty?
210
+ say "[ERROR] Deployment failed with errors:\n #{resource.errors.full_messages.join("\n ")}"
211
+ else
212
+ say "[ERROR] Deployment failed with an unknown error."
213
+ end
214
+ end
207
215
  rescue Strobe::DeployInterrupted => e
208
216
  say "[ERROR] #{e.message}"
209
217
  end
@@ -390,16 +398,14 @@ module Strobe
390
398
  m.choice(:login) { invoke :login }
391
399
  m.choice(:signup) { invoke :signup }
392
400
  end
393
- end
394
- end
395
401
 
396
- def get_application(opts = {})
397
- unless application_dir? && (id = opts.delete(:application_id) || config[:application_id])
398
- error "No application found. Are you currently in the correct directory?"
399
- exit 1
402
+ # HAXTREME!
403
+ # There is a bug related to this where we have two simultaneous
404
+ # Settings instances. When one persists it overwrites the other
405
+ # since nothing should have been set in the settings yet, force
406
+ # a new one that will reload from the file - PW
407
+ @settings = nil
400
408
  end
401
-
402
- Application.get!(id, opts)
403
409
  end
404
410
 
405
411
  def git_repo?
@@ -438,8 +444,14 @@ module Strobe
438
444
 
439
445
  def git(cmd)
440
446
  Dir.chdir path do
441
- retval = `git #{cmd}`
442
- retval.chomp if $? == 0
447
+ cmd = "git #{cmd}"
448
+
449
+ # Hide stderr output for *nix and Windows
450
+ null_out = %w(/dev/null NUL).find{|n| File.exist?(n)}
451
+ cmd += " 2>#{null_out}" if null_out
452
+
453
+ retval = `#{cmd}`
454
+ retval.chomp if $?.success?
443
455
  end
444
456
  end
445
457
  end
data/lib/strobe/cli.rb CHANGED
@@ -46,6 +46,13 @@ module Strobe
46
46
  abort
47
47
  rescue Interrupt
48
48
  abort "\nQuitting..."
49
+ rescue SystemExit => e
50
+ exit e.status
51
+ rescue Exception => e
52
+ warn "Unfortunately, a fatal error has occurred. " +
53
+ "Please report this error to Strobe Support at " +
54
+ "http://support.strobeapp.com/home so that we can fix it. Thanks!"
55
+ raise e
49
56
  end
50
57
 
51
58
  def self.action(name, *args, &blk)
@@ -78,6 +85,10 @@ module Strobe
78
85
  method_option :path, :type => :string, :banner => "Path to your application"
79
86
  end
80
87
 
88
+ def self.handle_argument_error(task, error) #:nodoc:
89
+ raise InvocationError, "#{task.name.sub('__hax__','').inspect} was called incorrectly. Call as #{self.banner(task).inspect}."
90
+ end
91
+
81
92
  def initialize(*)
82
93
  super
83
94
 
@@ -93,6 +104,15 @@ module Strobe
93
104
 
94
105
  private
95
106
 
107
+ def get_application(opts = {})
108
+ unless application_dir? && (id = opts[:application_id] || config[:application_id])
109
+ error "No application found. Are you currently in the correct directory?"
110
+ exit 1
111
+ end
112
+
113
+ Application.get!(id, opts)
114
+ end
115
+
96
116
  def path
97
117
  options[:path] || Dir.pwd
98
118
  end
@@ -90,7 +90,7 @@ module Strobe
90
90
  when 412
91
91
  raise OutdatedStrobeVersionError, msg
92
92
  when 500...600
93
- raise ServerError.new("The server puked :(", :response => to_hash, :request => @request.to_hash)
93
+ raise ServerError.new("The server encountered an error", :response => to_hash, :request => @request.to_hash)
94
94
  end
95
95
 
96
96
  self
@@ -155,10 +155,8 @@ module Strobe
155
155
  http.read_timeout = 900 # For deploys
156
156
  http.open_timeout = 10
157
157
  if port == 443
158
- pem = File.read(File.expand_path("../cert.pem", __FILE__))
159
158
  http.use_ssl = true
160
- http.cert = OpenSSL::X509::Certificate.new(pem)
161
- http.key = http.cert.public_key
159
+ http.ca_file = File.expand_path("../certs/cacert.pem", __FILE__)
162
160
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
163
161
  http.verify_depth = 5
164
162
  end
@@ -20,6 +20,10 @@ module Strobe
20
20
 
21
21
  validates "account", "name", :presence => true
22
22
 
23
+ def id
24
+ self[:id]
25
+ end
26
+
23
27
  def web_install
24
28
  # TODO: eventually it will be better to us name for identifying web platform
25
29
  install = self.platform_installs.detect { |p| p.web? }
@@ -1,3 +1,3 @@
1
1
  module Strobe
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strobe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-31 00:00:00.000000000Z
12
+ date: 2011-09-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
16
- requirement: &2156152220 !ruby/object:Gem::Requirement
16
+ requirement: &2156401120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156152220
24
+ version_requirements: *2156401120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mime-types
27
- requirement: &2156151340 !ruby/object:Gem::Requirement
27
+ requirement: &2156400360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.16.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2156151340
35
+ version_requirements: *2156400360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rack
38
- requirement: &2156143460 !ruby/object:Gem::Requirement
38
+ requirement: &2156399500 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.3.0
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2156143460
46
+ version_requirements: *2156399500
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: thin
49
- requirement: &2156141520 !ruby/object:Gem::Requirement
49
+ requirement: &2156398360 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.2.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2156141520
57
+ version_requirements: *2156398360
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: em-http-request
60
- requirement: &2156140060 !ruby/object:Gem::Requirement
60
+ requirement: &2156397400 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0.beta
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2156140060
68
+ version_requirements: *2156397400
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
- requirement: &2156138260 !ruby/object:Gem::Requirement
71
+ requirement: &2156389880 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.14.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2156138260
79
+ version_requirements: *2156389880
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: oauth
82
- requirement: &2156136060 !ruby/object:Gem::Requirement
82
+ requirement: &2156388480 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.4.5
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2156136060
90
+ version_requirements: *2156388480
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: launchy
93
- requirement: &2156132400 !ruby/object:Gem::Requirement
93
+ requirement: &2156386900 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,7 +98,7 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *2156132400
101
+ version_requirements: *2156386900
102
102
  description: The client library for deploying applications to Strobe's HTML5 deployment
103
103
  platform
104
104
  email:
@@ -152,7 +152,7 @@ files:
152
152
  - lib/strobe.rb
153
153
  - CHANGELOG.md
154
154
  - README.md
155
- - lib/strobe/cert.pem
155
+ - lib/strobe/certs/cacert.pem
156
156
  - bin/strobe
157
157
  homepage: http://rubygems.org/gems/strobe
158
158
  licenses: []
data/lib/strobe/cert.pem DELETED
@@ -1,32 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIFjzCCBHegAwIBAgIQbApvs79PZIagOHNx2QR8EzANBgkqhkiG9w0BAQUFADCB
3
- iTELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
4
- A1UEBxMHU2FsZm9yZDEaMBgGA1UEChMRQ09NT0RPIENBIExpbWl0ZWQxLzAtBg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