strobe 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@ module Strobe
4
4
  class CLI::Deploys < CLI
5
5
 
6
6
  method_option "application-id", :type => :numeric, :banner => "Use application with given id"
7
- action "list", "list deploys" do
7
+ action "list", "List all deploys for an application" do
8
8
  app = get_application(options)
9
9
  deploys = app.deploys.all
10
10
 
@@ -14,7 +14,7 @@ module Strobe
14
14
  method_option "application-id", :type => :numeric, :banner => "Use application with given id"
15
15
  method_option "full", :type => :boolean, :banner => "Display full deploy info"
16
16
  method_option "include-builds", :type => :boolean, :banner => "Include builds data"
17
- action "show", "show the last deploy" do |*args|
17
+ action "show", "Show the last deploy for an application" do |*args|
18
18
  sha = args.first
19
19
 
20
20
  app = get_application(options)
@@ -7,9 +7,25 @@ module Strobe
7
7
  class CLI::Main < CLI
8
8
  include CLI::Preview
9
9
 
10
+
11
+ def self.help(shell, subcommand = false)
12
+ shell.say <<LONGDESC
13
+ strobe-cli (v#{Strobe::VERSION}) - cli tool for the Strobe Platform
14
+
15
+ Deploy and manage your applications on the Strobe Platform.
16
+
17
+ To get started, just run `strobe deploy` in your application directory.
18
+
19
+ LONGDESC
20
+
21
+ super shell, subcommand
22
+ end
23
+
10
24
  def help(*args)
11
25
  if args.first == "users"
12
26
  CLI::Users.start( [ "help" ] + args[1..-1] )
27
+ elsif args.first == "deploys"
28
+ CLI::Deploys.start( [ "help" ] + args[1..-1] )
13
29
  else
14
30
  super
15
31
  end
@@ -23,7 +39,15 @@ module Strobe
23
39
 
24
40
  method_option "global", :type => :boolean, :banner => "Set option globally (for all applications)"
25
41
  method_option "unset", :type => :boolean, :banner => "Unset a config option"
26
- action "config", "configure strobe", :usage => "config [KEY] [VALUE]" do |key, *val|
42
+ long_desc <<-LONGDESC
43
+ Set configuration variables for your application(s). These are primarily used by
44
+ the `strobe preview` server.
45
+
46
+ For example, you set up the social add-on with:
47
+
48
+ > $ strobe config social.twitter.consumer_key [YOUR_CONSUMER_KEY]
49
+ LONGDESC
50
+ action "config", "Set configuration variables", :usage => "config KEY [VALUE]" do |key, *val|
27
51
  val = val.first
28
52
  case
29
53
  when val
@@ -46,14 +70,14 @@ module Strobe
46
70
  end
47
71
  end
48
72
 
49
- action "users", 'manage users' do |*args|
73
+ action "users", 'Manage users' do |*args|
50
74
  argv = $__ARGV[1..-1]
51
75
  argv = [ 'list' ] + argv if args.empty?
52
76
  CLI::Users.start(argv)
53
77
  end
54
78
 
55
79
  method_option "production", :type => :boolean, :banner => "open production version of this application"
56
- action "open", "opens application in browser" do
80
+ action "open", "Opens your application in a web browser" do
57
81
  resource get_application
58
82
 
59
83
  environment = options[:production] ? "production" : "staging"
@@ -62,13 +86,13 @@ module Strobe
62
86
  Launchy.open("http://#{url}")
63
87
  end
64
88
 
65
- action "deploys", "manage deploys" do |*args|
89
+ action "deploys", "Manage deploys" do |*args|
66
90
  argv = $__ARGV[1..-1]
67
91
  argv = [ 'list' ] + argv if args.empty?
68
92
  CLI::Deploys.start(argv)
69
93
  end
70
94
 
71
- action "signup", "signup for a new Strobe account" do
95
+ action "signup", "Sign up for a new Strobe account" do
72
96
  resource Signup.new :account => { :name => 'default' }
73
97
 
74
98
  if settings[:token]
@@ -98,7 +122,7 @@ module Strobe
98
122
  end
99
123
  end
100
124
 
101
- action "login", "register this computer with an existing Strobe account" do
125
+ action "login", "Register this computer with an existing Strobe account" do
102
126
  resource Me.new
103
127
 
104
128
  until_success do
@@ -116,14 +140,32 @@ module Strobe
116
140
  end
117
141
 
118
142
  method_option "port", :type => :string, :banner => "port to start server on", :aliases => "-p", :default => "9292"
119
- action "preview", "preview your application as it would show up on Strobe Platform" do
143
+ long_desc <<-LONGDESC
144
+ Preview your application as it would show up on Strobe Platform.
145
+
146
+ This command runs a development server that mimics the Strobe
147
+ Platform on your local computer, making it possible to check your
148
+ code without having to deploy it.
149
+
150
+ By default the preview server runs on port 9292 but you can specify
151
+ a different port with the `--port` option.
152
+ LONGDESC
153
+ action "preview", "Preview your application as it would show up on Strobe Platform" do
120
154
  preview_strobe_application(options[:port])
121
155
  end
122
156
 
123
157
  application_path_option
124
158
  method_option "message", :type => :string, :banner => "add rollback message", :aliases => "-m"
125
159
  method_option "production", :type => :boolean, :banner => "rollback a production environment"
126
- action "rollback", "rollback application to a state from given deploy" do |sha|
160
+ long_desc <<-LONGDESC
161
+ Rollback an application to the state specified by a given deploy key.
162
+
163
+ This is useful if you discovered that you deployed bad code and allows
164
+ you to quickly return to a known good state.
165
+
166
+ For a list of deploy keys, run `strobe deploys list`.
167
+ LONGDESC
168
+ action "rollback", "Rollback application to a state from given deploy", :usage => "rollback KEY" do |sha|
127
169
  ensure_computer_is_registered
128
170
 
129
171
  id = options['application-id'] || config[:application_id]
@@ -150,7 +192,16 @@ module Strobe
150
192
  method_option "sc-build", :type => :boolean, :banner => "run `sc-build -c` before deploying"
151
193
  method_option "no-sc-build", :type => :boolean, :banner => "skip the `sc-build -c` step"
152
194
  method_option "url", :banner => "set application's url"
153
- action "deploy", "deploy your application to Strobe" do
195
+ long_desc <<-LONGDESC
196
+ Deploy your application to the Strobe Platform.
197
+
198
+ If you have not yet logged in or created an application, you will
199
+ be prompted to do so.
200
+
201
+ By default your application is deployed to the staging enviroment.
202
+ To deploy to production, use `--production`.
203
+ LONGDESC
204
+ action "deploy", "Deploy your application to Strobe Platform" do
154
205
  ensure_computer_is_registered
155
206
  env = (options[:production] ? "production" : "staging")
156
207
 
@@ -218,14 +269,22 @@ module Strobe
218
269
  end
219
270
 
220
271
 
221
- action "applications", "list all of your applications" do
272
+ action "applications", "List all of your applications" do
222
273
  empty = "You do not have any applications. Try deploying one with `strobe deploy`."
223
274
  list_applications :empty => empty
224
275
  end
225
276
 
226
277
  method_option "url", :type => :string
227
278
  application_path_option
228
- action "set", "update the settings for the application" do
279
+ long_desc <<-LONGDESC
280
+ Update the settings for your Application.
281
+
282
+ At the moment, this command is only used for setting your application's URL.
283
+ To do this, run as:
284
+
285
+ > $ strobe set --url URL
286
+ LONGDESC
287
+ action "set", "Update the settings for the application" do
229
288
  resource get_application
230
289
 
231
290
  if options['url'].blank?
@@ -241,7 +300,12 @@ module Strobe
241
300
 
242
301
  application_path_option
243
302
  method_option "application-id", :type => :numeric, :banner => "Delete application with given id"
244
- action "delete", "delete a specific application" do
303
+ long_desc <<-LONGDESC
304
+ Delete a specific application.
305
+
306
+ This is a dangerous and permanant action. Fortunately, we confirm it with you before proceeding.
307
+ LONGDESC
308
+ action "delete", "Delete a specific application" do
245
309
  id = options['application-id'] || (application_dir? && config[:application_id])
246
310
  resource(id ? Application.get!(id) : pick_application)
247
311
 
@@ -263,7 +327,14 @@ module Strobe
263
327
 
264
328
  application_path_option
265
329
  method_option "application-id", :type => :numeric, :banner => "The ID of the remote application"
266
- action "register", "registers a local application with an existing Strobe application" do
330
+ long_desc <<-LONGDESC
331
+ Register a local application with an existing Strobe application.
332
+
333
+ In the event that you have already set up a Strobe application elsewhere
334
+ (i.e. via the web interface or on another computer), you can use this
335
+ command to link your local application to the one on Strobe Platform.
336
+ LONGDESC
337
+ action "register", "Registers a local application with an existing Strobe application" do
267
338
  if config[:application_id] && app = Application.get(config[:application_id])
268
339
  say "The directory is already registered with the application `#{app[:name]}`"
269
340
  say "Aborting..."
@@ -2,7 +2,7 @@ module Strobe
2
2
  class CLI::Users < CLI
3
3
 
4
4
  application_path_option
5
- action "list", "list users that have access to this application" do
5
+ action "list", "List users that have access to this application" do
6
6
  @team = get_current_team!
7
7
  if @team.memberships.any?
8
8
  say "The following users also have access to the application"
@@ -18,7 +18,7 @@ module Strobe
18
18
  end
19
19
 
20
20
  application_path_option
21
- action "add", "give a user access to this application",
21
+ action "add", "Give a user access to this application",
22
22
  :usage => "users add <email>" do |email|
23
23
  @team = get_current_team!
24
24
  @team.memberships.create! :email => email
@@ -27,7 +27,7 @@ module Strobe
27
27
  end
28
28
 
29
29
  application_path_option
30
- action "remove", "remove a user's access from this application",
30
+ action "remove", "Remove a user's access to this application",
31
31
  :usage => "users remove <email>" do |email|
32
32
  @team = get_current_team!
33
33
  @team.memberships.each do |m|
data/lib/strobe/cli.rb CHANGED
@@ -68,8 +68,12 @@ module Strobe
68
68
  options = args.last if args.last.is_a?(Hash)
69
69
  usage = if options && options[:usage]
70
70
  options[:usage]
71
+ elsif self == Users
72
+ "users #{name}"
73
+ elsif self == Deploys
74
+ "deploys #{name}"
71
75
  else
72
- self == Users ? "users #{name}" : name
76
+ name
73
77
  end
74
78
  desc usage, *args
75
79
  define_method("__hax__#{name}", &blk)
@@ -89,17 +89,17 @@ module Strobe
89
89
  end
90
90
 
91
91
  def validate!
92
- msg = body['errors'] && body['errors']['request']
93
92
  case status
94
93
  when 401
95
- # TODO Fix this on the server
96
- raise UnauthenticatedError, msg
94
+ raise UnauthenticatedError, error_message
97
95
  when 404
98
- raise ResourceNotFoundError, msg
96
+ raise ResourceNotFoundError, error_message
99
97
  when 412
100
- raise OutdatedStrobeVersionError, msg
98
+ raise OutdatedStrobeVersionError, error_message
99
+ when 503
100
+ headers["x-strobe-maintenance"] ? raise(UnderMaintenanceError) : server_error
101
101
  when 500...600
102
- raise ServerError.new("The server encountered an error", :response => to_hash, :request => @request.to_hash)
102
+ server_error
103
103
  end
104
104
 
105
105
  self
@@ -123,12 +123,19 @@ module Strobe
123
123
  end
124
124
  end
125
125
 
126
+ def error_message
127
+ body['errors'] && body['errors']['request']
128
+ end
129
+
126
130
  def json_decode(data)
127
131
  ActiveSupport::JSON.decode(@response.body)
128
132
  rescue ActiveSupport::JSON.parse_error => e
129
133
  raise JSONParseError.new(e, data)
130
134
  end
131
135
 
136
+ def server_error
137
+ raise ServerError.new("The server encountered an error", :response => to_hash, :request => @request.to_hash)
138
+ end
132
139
  end
133
140
 
134
141
  class Request
@@ -1,3 +1,3 @@
1
1
  module Strobe
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
data/lib/strobe.rb CHANGED
@@ -45,6 +45,12 @@ module Strobe
45
45
  class ValidationError < StrobeError ; end
46
46
  class OutdatedStrobeVersionError < StrobeError ; end
47
47
  class InvalidPortError < StrobeError ; end
48
+ class UnderMaintenanceError < StrobeError
49
+ def initialize
50
+ super("We are currently down for maintenance. You can check our status " \
51
+ "at http://twitter.com/strobestatus. Please try again soon.")
52
+ end
53
+ end
48
54
 
49
55
  class NotifiableError < StrobeError
50
56
  attr_reader :data
metadata CHANGED
@@ -1,113 +1,160 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: strobe
3
- version: !ruby/object:Gem::Version
4
- version: 0.3.7
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 8
10
+ version: 0.3.8
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Carl Lerche
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2011-09-02 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2011-09-20 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
15
22
  name: activemodel
16
- requirement: &2153617160 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
17
25
  none: false
18
- requirements:
26
+ requirements:
19
27
  - - ~>
20
- - !ruby/object:Gem::Version
28
+ - !ruby/object:Gem::Version
29
+ hash: 7
30
+ segments:
31
+ - 3
32
+ - 0
33
+ - 0
21
34
  version: 3.0.0
22
35
  type: :runtime
23
- prerelease: false
24
- version_requirements: *2153617160
25
- - !ruby/object:Gem::Dependency
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
26
38
  name: mime-types
27
- requirement: &2153616420 !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
28
41
  none: false
29
- requirements:
42
+ requirements:
30
43
  - - ~>
31
- - !ruby/object:Gem::Version
44
+ - !ruby/object:Gem::Version
45
+ hash: 87
46
+ segments:
47
+ - 1
48
+ - 16
49
+ - 0
32
50
  version: 1.16.0
33
51
  type: :runtime
34
- prerelease: false
35
- version_requirements: *2153616420
36
- - !ruby/object:Gem::Dependency
52
+ version_requirements: *id002
53
+ - !ruby/object:Gem::Dependency
37
54
  name: rack
38
- requirement: &2153615720 !ruby/object:Gem::Requirement
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
39
57
  none: false
40
- requirements:
58
+ requirements:
41
59
  - - ~>
42
- - !ruby/object:Gem::Version
60
+ - !ruby/object:Gem::Version
61
+ hash: 27
62
+ segments:
63
+ - 1
64
+ - 3
65
+ - 0
43
66
  version: 1.3.0
44
67
  type: :runtime
45
- prerelease: false
46
- version_requirements: *2153615720
47
- - !ruby/object:Gem::Dependency
68
+ version_requirements: *id003
69
+ - !ruby/object:Gem::Dependency
48
70
  name: thin
49
- requirement: &2153614780 !ruby/object:Gem::Requirement
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
50
73
  none: false
51
- requirements:
74
+ requirements:
52
75
  - - ~>
53
- - !ruby/object:Gem::Version
76
+ - !ruby/object:Gem::Version
77
+ hash: 31
78
+ segments:
79
+ - 1
80
+ - 2
81
+ - 0
54
82
  version: 1.2.0
55
83
  type: :runtime
56
- prerelease: false
57
- version_requirements: *2153614780
58
- - !ruby/object:Gem::Dependency
84
+ version_requirements: *id004
85
+ - !ruby/object:Gem::Dependency
59
86
  name: em-http-request
60
- requirement: &2153613700 !ruby/object:Gem::Requirement
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
61
89
  none: false
62
- requirements:
90
+ requirements:
63
91
  - - ~>
64
- - !ruby/object:Gem::Version
92
+ - !ruby/object:Gem::Version
93
+ hash: 31098193
94
+ segments:
95
+ - 1
96
+ - 0
97
+ - 0
98
+ - beta
65
99
  version: 1.0.0.beta
66
100
  type: :runtime
67
- prerelease: false
68
- version_requirements: *2153613700
69
- - !ruby/object:Gem::Dependency
101
+ version_requirements: *id005
102
+ - !ruby/object:Gem::Dependency
70
103
  name: thor
71
- requirement: &2153612040 !ruby/object:Gem::Requirement
104
+ prerelease: false
105
+ requirement: &id006 !ruby/object:Gem::Requirement
72
106
  none: false
73
- requirements:
107
+ requirements:
74
108
  - - ~>
75
- - !ruby/object:Gem::Version
109
+ - !ruby/object:Gem::Version
110
+ hash: 39
111
+ segments:
112
+ - 0
113
+ - 14
114
+ - 0
76
115
  version: 0.14.0
77
116
  type: :runtime
78
- prerelease: false
79
- version_requirements: *2153612040
80
- - !ruby/object:Gem::Dependency
117
+ version_requirements: *id006
118
+ - !ruby/object:Gem::Dependency
81
119
  name: oauth
82
- requirement: &2153610140 !ruby/object:Gem::Requirement
120
+ prerelease: false
121
+ requirement: &id007 !ruby/object:Gem::Requirement
83
122
  none: false
84
- requirements:
123
+ requirements:
85
124
  - - ~>
86
- - !ruby/object:Gem::Version
125
+ - !ruby/object:Gem::Version
126
+ hash: 5
127
+ segments:
128
+ - 0
129
+ - 4
130
+ - 5
87
131
  version: 0.4.5
88
132
  type: :runtime
89
- prerelease: false
90
- version_requirements: *2153610140
91
- - !ruby/object:Gem::Dependency
133
+ version_requirements: *id007
134
+ - !ruby/object:Gem::Dependency
92
135
  name: launchy
93
- requirement: &2153602640 !ruby/object:Gem::Requirement
136
+ prerelease: false
137
+ requirement: &id008 !ruby/object:Gem::Requirement
94
138
  none: false
95
- requirements:
96
- - - ! '>='
97
- - !ruby/object:Gem::Version
98
- version: '0'
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ hash: 3
143
+ segments:
144
+ - 0
145
+ version: "0"
99
146
  type: :runtime
100
- prerelease: false
101
- version_requirements: *2153602640
102
- description: The client library for deploying applications to Strobe's HTML5 deployment
103
- platform
104
- email:
147
+ version_requirements: *id008
148
+ description: The client library for deploying applications to Strobe's HTML5 deployment platform
149
+ email:
105
150
  - carl@strobecorp.com
106
- executables:
151
+ executables:
107
152
  - strobe
108
153
  extensions: []
154
+
109
155
  extra_rdoc_files: []
110
- files:
156
+
157
+ files:
111
158
  - lib/strobe/addons/social/facebook.rb
112
159
  - lib/strobe/addons/social/twitter.rb
113
160
  - lib/strobe/addons/social.rb
@@ -154,28 +201,41 @@ files:
154
201
  - README.md
155
202
  - lib/strobe/certs/cacert.pem
156
203
  - bin/strobe
204
+ has_rdoc: true
157
205
  homepage: http://rubygems.org/gems/strobe
158
206
  licenses: []
207
+
159
208
  post_install_message:
160
209
  rdoc_options: []
161
- require_paths:
210
+
211
+ require_paths:
162
212
  - lib
163
- required_ruby_version: !ruby/object:Gem::Requirement
213
+ required_ruby_version: !ruby/object:Gem::Requirement
164
214
  none: false
165
- requirements:
166
- - - ! '>='
167
- - !ruby/object:Gem::Version
168
- version: '0'
169
- required_rubygems_version: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - ">="
217
+ - !ruby/object:Gem::Version
218
+ hash: 3
219
+ segments:
220
+ - 0
221
+ version: "0"
222
+ required_rubygems_version: !ruby/object:Gem::Requirement
170
223
  none: false
171
- requirements:
172
- - - ! '>='
173
- - !ruby/object:Gem::Version
224
+ requirements:
225
+ - - ">="
226
+ - !ruby/object:Gem::Version
227
+ hash: 23
228
+ segments:
229
+ - 1
230
+ - 3
231
+ - 6
174
232
  version: 1.3.6
175
233
  requirements: []
234
+
176
235
  rubyforge_project: strobe
177
- rubygems_version: 1.8.6
236
+ rubygems_version: 1.6.2
178
237
  signing_key:
179
238
  specification_version: 3
180
239
  summary: A deployment tool for HTML5 applications
181
240
  test_files: []
241
+