strobe 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/strobe.rb +3 -0
- data/lib/strobe/cli/deploys.rb +15 -9
- data/lib/strobe/cli/main.rb +47 -2
- data/lib/strobe/cli/settings.rb +4 -0
- data/lib/strobe/cli/table.rb +1 -1
- data/lib/strobe/connection.rb +2 -2
- data/lib/strobe/resources.rb +1 -0
- data/lib/strobe/resources/application.rb +16 -12
- data/lib/strobe/resources/deploy.rb +1 -0
- data/lib/strobe/resources/environment.rb +9 -0
- data/lib/strobe/resources/platform_install.rb +1 -1
- data/lib/strobe/retryable.rb +19 -0
- data/lib/strobe/version.rb +1 -1
- metadata +74 -80
data/lib/strobe.rb
CHANGED
@@ -20,6 +20,7 @@ module Strobe
|
|
20
20
|
autoload :Resources, 'strobe/resources'
|
21
21
|
autoload :Validations, 'strobe/validations'
|
22
22
|
autoload :ExceptionNotifier, 'strobe/exception_notifier'
|
23
|
+
autoload :Retryable, 'strobe/retryable'
|
23
24
|
|
24
25
|
module Addons
|
25
26
|
# Stubb out the Addons module
|
@@ -45,6 +46,8 @@ module Strobe
|
|
45
46
|
class ValidationError < StrobeError ; end
|
46
47
|
class OutdatedStrobeVersionError < StrobeError ; end
|
47
48
|
class InvalidPortError < StrobeError ; end
|
49
|
+
class InvalidAppPathError < StrobeError ; end
|
50
|
+
|
48
51
|
class UnderMaintenanceError < StrobeError
|
49
52
|
def initialize
|
50
53
|
super("We are currently down for maintenance. You can check our status " \
|
data/lib/strobe/cli/deploys.rb
CHANGED
@@ -4,31 +4,37 @@ 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
|
+
method_option "staging", :type => :boolean, :banner => "Show staging deploys"
|
7
8
|
action "list", "List all deploys for an application" do
|
9
|
+
env = options[:staging] ? "staging" : "production"
|
8
10
|
app = get_application(options)
|
9
|
-
deploys = app.
|
11
|
+
deploys = Deploy.where(:application_id => app.id, :environment => env)
|
10
12
|
|
11
|
-
|
13
|
+
puts "All #{env} deploys\n\n"
|
14
|
+
deploys_table(deploys)
|
12
15
|
end
|
13
16
|
|
14
17
|
method_option "application-id", :type => :numeric, :banner => "Use application with given id"
|
15
18
|
method_option "full", :type => :boolean, :banner => "Display full deploy info"
|
16
19
|
method_option "include-builds", :type => :boolean, :banner => "Include builds data"
|
20
|
+
method_option "staging", :type => :boolean, :banner => "Show last staging deploy"
|
17
21
|
action "show", "Show the last deploy for an application" do |*args|
|
18
22
|
sha = args.first
|
19
|
-
|
23
|
+
env = options[:staging] ? "staging" : "production"
|
20
24
|
app = get_application(options)
|
21
|
-
|
22
|
-
|
25
|
+
deploy = sha ?
|
26
|
+
app.deploys.find{|d| d[:sha1] == sha || d[:id] == sha } :
|
27
|
+
Deploy.where(:application_id => app.id, :limit => 1, :environment => env).first
|
23
28
|
|
24
29
|
raise NoDeploy.new("No deploys to show") unless deploy
|
25
30
|
|
26
31
|
puts "deploy #{deploy[:sha1] || deploy[:id]}"
|
27
32
|
|
28
|
-
if options['full'] || options['include-builds']
|
33
|
+
if options['full'] || options['include-builds'] || sha
|
29
34
|
puts <<-DEPLOY
|
30
35
|
Author: #{deploy[:name]} <#{deploy[:email]}>
|
31
36
|
Date: #{deploy[:created_at]}
|
37
|
+
Environment: #{deploy['environment.name']}
|
32
38
|
|
33
39
|
#{deploy[:message]}
|
34
40
|
DEPLOY
|
@@ -48,9 +54,9 @@ DEPLOY
|
|
48
54
|
|
49
55
|
def deploys_table(deploys)
|
50
56
|
table deploys do |t|
|
51
|
-
t.column
|
52
|
-
t.column :
|
53
|
-
t.column :email
|
57
|
+
t.column(:key){|d| d[:sha1] || d[:id] }
|
58
|
+
t.column :created_at, :header => "Date"
|
59
|
+
t.column(:user){|d| d[:name] || d[:email]}
|
54
60
|
t.column :message
|
55
61
|
end
|
56
62
|
end
|
data/lib/strobe/cli/main.rb
CHANGED
@@ -190,6 +190,8 @@ LONGDESC
|
|
190
190
|
method_option "production", :type => :boolean, :banner => "deploy to a production environment"
|
191
191
|
method_option "sc-build", :type => :boolean, :banner => "run `sc-build -c` before deploying"
|
192
192
|
method_option "no-sc-build", :type => :boolean, :banner => "skip the `sc-build -c` step"
|
193
|
+
method_option "bpm-rebuild", :type => :boolean, :banner => "run `bpm rebuild` before deploying"
|
194
|
+
method_option "no-bpm-rebuild", :type => :boolean, :banner => "skip the `bpm rebuild` step"
|
193
195
|
method_option "url", :banner => "set application's url"
|
194
196
|
long_desc <<-LONGDESC
|
195
197
|
Deploy your application to the Strobe Platform.
|
@@ -201,6 +203,10 @@ LONGDESC
|
|
201
203
|
To deploy to production, use `--production`.
|
202
204
|
LONGDESC
|
203
205
|
action "deploy", "Deploy your application to Strobe Platform" do
|
206
|
+
if Dir.pwd == Strobe.user_home
|
207
|
+
raise InvalidAppPathError.new("Can't deploy the home directory!")
|
208
|
+
end
|
209
|
+
|
204
210
|
ensure_computer_is_registered
|
205
211
|
env = (options[:production] ? "production" : "staging")
|
206
212
|
|
@@ -239,7 +245,11 @@ LONGDESC
|
|
239
245
|
end
|
240
246
|
end
|
241
247
|
|
242
|
-
|
248
|
+
# If there was an error in registration we don't want to continue
|
249
|
+
abort unless resource.errors.empty?
|
250
|
+
|
251
|
+
ran_sc_build = run_sc_build
|
252
|
+
ran_bpm_rebuild = run_bpm_rebuild(ran_sc_build)
|
243
253
|
|
244
254
|
begin
|
245
255
|
host = resource.deploy! :environment => env,
|
@@ -374,6 +384,41 @@ LONGDESC
|
|
374
384
|
unless CLI::Ticker.tick("Running `#{cmd}`", 2) { system cmd }
|
375
385
|
error! "Something went wrong while running `#{cmd}`"
|
376
386
|
end
|
387
|
+
|
388
|
+
return true
|
389
|
+
end
|
390
|
+
|
391
|
+
def run_bpm_rebuild(ran_sc_build=false)
|
392
|
+
return unless bpm_project
|
393
|
+
|
394
|
+
# Using both options at the same time makes no sense
|
395
|
+
if options["bpm-rebuild"] && options["no-bpm-rebuild"]
|
396
|
+
error! "--bpm-rebuild and --no-bpm-rebuild cannot be used at the same time"
|
397
|
+
end
|
398
|
+
|
399
|
+
# If the user explicitly says that they don't want to run bpm-rebuild,
|
400
|
+
# then just skip it
|
401
|
+
return if options["no-bpm-rebuild"]
|
402
|
+
|
403
|
+
cmd = "bpm rebuild"
|
404
|
+
|
405
|
+
# If the user doesn't ask either way, confirm first
|
406
|
+
unless options["bpm-rebuild"]
|
407
|
+
location = bpm_project.root_path == Dir.pwd ? "" : " located at #{bpm_project.root_path}"
|
408
|
+
say "This appears to be a BPM application#{location}."
|
409
|
+
return unless agree "Run `#{cmd}`? [Yn] "
|
410
|
+
end
|
411
|
+
|
412
|
+
if ran_sc_build
|
413
|
+
say "Can't build for both SproutCore 1.x and BPM! Skipping BPM rebuild."
|
414
|
+
return
|
415
|
+
end
|
416
|
+
|
417
|
+
unless CLI::Ticker.tick("Running `#{cmd}`", 2) { system cmd }
|
418
|
+
error! "Something went wrong while running `#{cmd}`"
|
419
|
+
end
|
420
|
+
|
421
|
+
return true
|
377
422
|
end
|
378
423
|
|
379
424
|
def is_sproutcore?
|
@@ -382,7 +427,7 @@ LONGDESC
|
|
382
427
|
|
383
428
|
def bpm_project
|
384
429
|
return nil unless defined?(BPM)
|
385
|
-
BPM::Project.nearest_project Dir.pwd
|
430
|
+
@bpm_project ||= BPM::Project.nearest_project Dir.pwd
|
386
431
|
end
|
387
432
|
|
388
433
|
def determine_application_root
|
data/lib/strobe/cli/settings.rb
CHANGED
@@ -128,6 +128,10 @@ module Strobe
|
|
128
128
|
end
|
129
129
|
|
130
130
|
def register_app_path(path)
|
131
|
+
if path == Strobe.user_home
|
132
|
+
raise InvalidAppPathError, "Can't register the home directory!"
|
133
|
+
end
|
134
|
+
|
131
135
|
paths = application_paths
|
132
136
|
paths |= [File.expand_path(path.to_s)]
|
133
137
|
global_set! :applications, paths
|
data/lib/strobe/cli/table.rb
CHANGED
data/lib/strobe/connection.rb
CHANGED
@@ -203,8 +203,8 @@ module Strobe
|
|
203
203
|
end
|
204
204
|
|
205
205
|
headers['authorization'] ||= authorization_header
|
206
|
-
|
207
|
-
headers['
|
206
|
+
headers['user-agent'] = Strobe.user_agent
|
207
|
+
headers['accept'] = 'application/json'
|
208
208
|
|
209
209
|
if method == "GET" || method == "HEAD"
|
210
210
|
|
data/lib/strobe/resources.rb
CHANGED
@@ -9,6 +9,7 @@ module Strobe
|
|
9
9
|
module Resources
|
10
10
|
class Application
|
11
11
|
include Resource::Collection
|
12
|
+
include Strobe::Retryable
|
12
13
|
|
13
14
|
has 1, :account
|
14
15
|
has n, :teams
|
@@ -26,7 +27,12 @@ module Strobe
|
|
26
27
|
|
27
28
|
def web_install
|
28
29
|
@web_install ||= begin
|
29
|
-
install =
|
30
|
+
install = nil
|
31
|
+
|
32
|
+
retry_on_error([IOError, Timeout::Error]) do
|
33
|
+
install = self.platform_installs.detect { |p| p.web? }
|
34
|
+
end
|
35
|
+
|
30
36
|
raise "Application does not have web platform" unless install
|
31
37
|
install
|
32
38
|
end
|
@@ -60,14 +66,20 @@ module Strobe
|
|
60
66
|
|
61
67
|
request do
|
62
68
|
qs = []
|
63
|
-
qs << "environment=#{environment}" if environment
|
64
69
|
qs << "message=#{message}" if message
|
65
|
-
qs << "deploy=#{sha}"
|
66
70
|
qs << "application_id=#{id}"
|
67
71
|
|
68
72
|
uri = URI.escape("/deploys?#{qs.join('&')}")
|
69
73
|
|
70
|
-
|
74
|
+
body = { :deploy => sha }
|
75
|
+
body[:environment] = environment if environment
|
76
|
+
|
77
|
+
headers = {
|
78
|
+
"Content-Type" => "application/json",
|
79
|
+
"Accept" => "application/json"
|
80
|
+
}
|
81
|
+
|
82
|
+
response = connection.post(uri, body, headers)
|
71
83
|
response
|
72
84
|
end
|
73
85
|
|
@@ -158,17 +170,9 @@ module Strobe
|
|
158
170
|
add_directory(m, project_path, "strobe/**/*")
|
159
171
|
end
|
160
172
|
|
161
|
-
# Make sure to build bpm before add_directory **/* so
|
162
|
-
# we get the changes from the rebuild
|
163
|
-
if project = opts[:bpm_project]
|
164
|
-
project.rebuild_dependency_list(nil, false)
|
165
|
-
project.build :production, true
|
166
|
-
end
|
167
|
-
|
168
173
|
# Add all files in current directory
|
169
174
|
add_directory(m, ".", "**/*")
|
170
175
|
|
171
|
-
|
172
176
|
if opts[:sproutcore]
|
173
177
|
picked_root_app = false
|
174
178
|
|
data/lib/strobe/version.rb
CHANGED
metadata
CHANGED
@@ -1,116 +1,113 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: strobe
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.11
|
4
5
|
prerelease:
|
5
|
-
version: 0.3.10
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Carl Lerche
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-10-21 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: activemodel
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2153265580 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
18
|
+
requirements:
|
22
19
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 3.0.0
|
25
22
|
type: :runtime
|
26
|
-
version_requirements: *id001
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: mime-types
|
29
23
|
prerelease: false
|
30
|
-
|
24
|
+
version_requirements: *2153265580
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mime-types
|
27
|
+
requirement: &2153419600 !ruby/object:Gem::Requirement
|
31
28
|
none: false
|
32
|
-
requirements:
|
29
|
+
requirements:
|
33
30
|
- - ~>
|
34
|
-
- !ruby/object:Gem::Version
|
31
|
+
- !ruby/object:Gem::Version
|
35
32
|
version: 1.16.0
|
36
33
|
type: :runtime
|
37
|
-
version_requirements: *id002
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rack
|
40
34
|
prerelease: false
|
41
|
-
|
35
|
+
version_requirements: *2153419600
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rack
|
38
|
+
requirement: &2154297300 !ruby/object:Gem::Requirement
|
42
39
|
none: false
|
43
|
-
requirements:
|
40
|
+
requirements:
|
44
41
|
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
46
43
|
version: 1.3.0
|
47
44
|
type: :runtime
|
48
|
-
version_requirements: *id003
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: thin
|
51
45
|
prerelease: false
|
52
|
-
|
46
|
+
version_requirements: *2154297300
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: thin
|
49
|
+
requirement: &2154496680 !ruby/object:Gem::Requirement
|
53
50
|
none: false
|
54
|
-
requirements:
|
51
|
+
requirements:
|
55
52
|
- - ~>
|
56
|
-
- !ruby/object:Gem::Version
|
53
|
+
- !ruby/object:Gem::Version
|
57
54
|
version: 1.2.0
|
58
55
|
type: :runtime
|
59
|
-
version_requirements: *id004
|
60
|
-
- !ruby/object:Gem::Dependency
|
61
|
-
name: em-http-request
|
62
56
|
prerelease: false
|
63
|
-
|
57
|
+
version_requirements: *2154496680
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: em-http-request
|
60
|
+
requirement: &2154620040 !ruby/object:Gem::Requirement
|
64
61
|
none: false
|
65
|
-
requirements:
|
62
|
+
requirements:
|
66
63
|
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
64
|
+
- !ruby/object:Gem::Version
|
68
65
|
version: 1.0.0.beta
|
69
66
|
type: :runtime
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: thor
|
73
67
|
prerelease: false
|
74
|
-
|
68
|
+
version_requirements: *2154620040
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: &2154721040 !ruby/object:Gem::Requirement
|
75
72
|
none: false
|
76
|
-
requirements:
|
73
|
+
requirements:
|
77
74
|
- - ~>
|
78
|
-
- !ruby/object:Gem::Version
|
75
|
+
- !ruby/object:Gem::Version
|
79
76
|
version: 0.14.0
|
80
77
|
type: :runtime
|
81
|
-
version_requirements: *id006
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: oauth
|
84
78
|
prerelease: false
|
85
|
-
|
79
|
+
version_requirements: *2154721040
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: oauth
|
82
|
+
requirement: &2154760480 !ruby/object:Gem::Requirement
|
86
83
|
none: false
|
87
|
-
requirements:
|
84
|
+
requirements:
|
88
85
|
- - ~>
|
89
|
-
- !ruby/object:Gem::Version
|
86
|
+
- !ruby/object:Gem::Version
|
90
87
|
version: 0.4.5
|
91
88
|
type: :runtime
|
92
|
-
version_requirements: *id007
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: launchy
|
95
89
|
prerelease: false
|
96
|
-
|
90
|
+
version_requirements: *2154760480
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: launchy
|
93
|
+
requirement: &2154762000 !ruby/object:Gem::Requirement
|
97
94
|
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version:
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
102
99
|
type: :runtime
|
103
|
-
|
104
|
-
|
105
|
-
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2154762000
|
102
|
+
description: The client library for deploying applications to Strobe's HTML5 deployment
|
103
|
+
platform
|
104
|
+
email:
|
106
105
|
- carl@strobecorp.com
|
107
|
-
executables:
|
106
|
+
executables:
|
108
107
|
- strobe
|
109
108
|
extensions: []
|
110
|
-
|
111
109
|
extra_rdoc_files: []
|
112
|
-
|
113
|
-
files:
|
110
|
+
files:
|
114
111
|
- lib/strobe/addons/social/facebook.rb
|
115
112
|
- lib/strobe/addons/social/twitter.rb
|
116
113
|
- lib/strobe/addons/social.rb
|
@@ -142,6 +139,7 @@ files:
|
|
142
139
|
- lib/strobe/resources/assignment.rb
|
143
140
|
- lib/strobe/resources/build.rb
|
144
141
|
- lib/strobe/resources/deploy.rb
|
142
|
+
- lib/strobe/resources/environment.rb
|
145
143
|
- lib/strobe/resources/me.rb
|
146
144
|
- lib/strobe/resources/membership.rb
|
147
145
|
- lib/strobe/resources/platform_install.rb
|
@@ -149,6 +147,7 @@ files:
|
|
149
147
|
- lib/strobe/resources/team.rb
|
150
148
|
- lib/strobe/resources/user.rb
|
151
149
|
- lib/strobe/resources.rb
|
150
|
+
- lib/strobe/retryable.rb
|
152
151
|
- lib/strobe/sproutcore.rb
|
153
152
|
- lib/strobe/validations.rb
|
154
153
|
- lib/strobe/version.rb
|
@@ -157,33 +156,28 @@ files:
|
|
157
156
|
- README.md
|
158
157
|
- lib/strobe/certs/cacert.pem
|
159
158
|
- bin/strobe
|
160
|
-
has_rdoc: true
|
161
159
|
homepage: http://rubygems.org/gems/strobe
|
162
160
|
licenses: []
|
163
|
-
|
164
161
|
post_install_message:
|
165
162
|
rdoc_options: []
|
166
|
-
|
167
|
-
require_paths:
|
163
|
+
require_paths:
|
168
164
|
- lib
|
169
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
170
166
|
none: false
|
171
|
-
requirements:
|
172
|
-
- -
|
173
|
-
- !ruby/object:Gem::Version
|
174
|
-
version:
|
175
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ! '>='
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
172
|
none: false
|
177
|
-
requirements:
|
178
|
-
- -
|
179
|
-
- !ruby/object:Gem::Version
|
173
|
+
requirements:
|
174
|
+
- - ! '>='
|
175
|
+
- !ruby/object:Gem::Version
|
180
176
|
version: 1.3.6
|
181
177
|
requirements: []
|
182
|
-
|
183
178
|
rubyforge_project: strobe
|
184
|
-
rubygems_version: 1.6
|
179
|
+
rubygems_version: 1.8.6
|
185
180
|
signing_key:
|
186
181
|
specification_version: 3
|
187
182
|
summary: A deployment tool for HTML5 applications
|
188
183
|
test_files: []
|
189
|
-
|