shelly 0.0.58 → 0.0.59

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/lib/shelly/app.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'erb'
2
- require "shelly/backup"
2
+ require 'launchy'
3
+ require 'shelly/backup'
3
4
 
4
5
  module Shelly
5
6
  class App < Model
@@ -217,5 +218,9 @@ module Shelly
217
218
  def edit_billing_url
218
219
  "#{shelly.shellyapp_url}/apps/#{code_name}/billing/edit"
219
220
  end
221
+
222
+ def open
223
+ Launchy.open("http://#{attributes["domain"]}")
224
+ end
220
225
  end
221
226
  end
@@ -326,6 +326,13 @@ We have been notified about it. We will be adding new resources shortly}
326
326
  say_error "You have no access to '#{app}' cloud defined in Cloudfile"
327
327
  end
328
328
 
329
+ desc "open", "Open application page in browser"
330
+ method_option :cloud, :type => :string, :aliases => "-c", :desc => "Specify cloud"
331
+ def open
332
+ app = multiple_clouds(options[:cloud], "open")
333
+ app.open
334
+ end
335
+
329
336
  # FIXME: move to helpers
330
337
  no_tasks do
331
338
  # Returns valid arguments for rake, removes shelly gem arguments
@@ -1,3 +1,3 @@
1
1
  module Shelly
2
- VERSION = "0.0.58"
2
+ VERSION = "0.0.59"
3
3
  end
data/shelly.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  end
24
24
  s.add_development_dependency "fakefs"
25
25
  s.add_development_dependency "fakeweb"
26
+ s.add_development_dependency "launchy"
26
27
  s.add_runtime_dependency "wijet-thor", "~> 0.14.7"
27
28
  s.add_runtime_dependency "rest-client"
28
29
  s.add_runtime_dependency "json"
@@ -373,4 +373,13 @@ config
373
373
  @app.edit_billing_url.should == "http://shellyapp.example.com/apps/foo-staging/billing/edit"
374
374
  end
375
375
  end
376
+
377
+ describe "#open" do
378
+ it "should open returned domain with launchy" do
379
+ @client.should_receive(:app).with("foo-staging").
380
+ and_return({"domain" => "example.com"})
381
+ Launchy.should_receive(:open).with("http://example.com")
382
+ @app.open
383
+ end
384
+ end
376
385
  end
@@ -21,6 +21,7 @@ describe Shelly::CLI::Backup do
21
21
  FileUtils.mkdir_p("/projects/foo")
22
22
  Dir.chdir("/projects/foo")
23
23
  File.open("Cloudfile", 'w') { |f| f.write("foo-staging:\n") }
24
+ $stdout.stub(:puts)
24
25
  end
25
26
 
26
27
  it "should ensure user has logged in" do
@@ -120,6 +121,7 @@ describe Shelly::CLI::Backup do
120
121
  FileUtils.mkdir_p("/projects/foo")
121
122
  Dir.chdir("/projects/foo")
122
123
  File.open("Cloudfile", 'w') {|f| f.write("foo-staging:\n") }
124
+ $stdout.stub(:puts)
123
125
  end
124
126
 
125
127
  it "should ensure user has logged in" do
@@ -161,6 +163,7 @@ describe Shelly::CLI::Backup do
161
163
  @client.stub(:database_backup).and_return({"filename" => "better.tar.gz", "size" => 12345, "kind" => "postgre"})
162
164
  @client.stub(:restore_backup).and_return({"filename" => "better.tar.gz", "size" => 12345, "kind" => "postgre"})
163
165
  $stdout.stub(:puts)
166
+ $stdout.stub(:print)
164
167
  end
165
168
 
166
169
  it "should ensure user has logged in" do
@@ -36,6 +36,7 @@ Tasks:
36
36
  shelly login [EMAIL] # Log into Shelly Cloud
37
37
  shelly logout # Logout from Shelly Cloud
38
38
  shelly logs # Show latest application logs
39
+ shelly open # Open application page in browser
39
40
  shelly rake TASK # Run rake task
40
41
  shelly redeploy # Redeploy application
41
42
  shelly register [EMAIL] # Register new account
@@ -740,7 +741,8 @@ We have been notified about it. We will be adding new resources shortly")
740
741
 
741
742
  describe "#ip" do
742
743
  before do
743
- File.open("Cloudfile", 'w') {|f| f.write("foo-production:\n") }
744
+ File.open("Cloudfile", 'w') { |f| f.write("foo-production:\n") }
745
+ @app = Shelly::App.new("foo-staging")
744
746
  @main.stub(:logged_in?).and_return(true)
745
747
  end
746
748
 
@@ -1251,4 +1253,29 @@ We have been notified about it. We will be adding new resources shortly")
1251
1253
  end
1252
1254
  end
1253
1255
  end
1256
+
1257
+ describe "#open" do
1258
+ before do
1259
+ @user = Shelly::User.new
1260
+ @client.stub(:token).and_return("abc")
1261
+ @app = Shelly::App.new("foo-production")
1262
+ @app.stub(:open)
1263
+ Shelly::App.stub(:new).and_return(@app)
1264
+ FileUtils.mkdir_p("/projects/foo")
1265
+ Dir.chdir("/projects/foo")
1266
+ File.open("Cloudfile", 'w') { |f| f.write("foo-production:\n") }
1267
+ end
1268
+
1269
+ # multiple_clouds is tested in main_spec.rb in describe "#start" block
1270
+ it "should ensure multiple_clouds check" do
1271
+ @client.stub(:open)
1272
+ @main.should_receive(:multiple_clouds).and_return(@app)
1273
+ invoke(@main, :open)
1274
+ end
1275
+
1276
+ it "should open app" do
1277
+ @app.should_receive(:open)
1278
+ invoke(@main, :open)
1279
+ end
1280
+ end
1254
1281
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.58
4
+ version: 0.0.59
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: 2012-04-04 00:00:00.000000000Z
12
+ date: 2012-04-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70136640534580 !ruby/object:Gem::Requirement
16
+ requirement: &70160047626140 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 2.8.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70136640534580
24
+ version_requirements: *70160047626140
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70136640534160 !ruby/object:Gem::Requirement
27
+ requirement: &70160047625720 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70136640534160
35
+ version_requirements: *70160047625720
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: guard
38
- requirement: &70136640533680 !ruby/object:Gem::Requirement
38
+ requirement: &70160047625260 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70136640533680
46
+ version_requirements: *70160047625260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: guard-rspec
49
- requirement: &70136640533080 !ruby/object:Gem::Requirement
49
+ requirement: &70160047624840 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70136640533080
57
+ version_requirements: *70160047624840
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: simplecov
60
- requirement: &70136640532460 !ruby/object:Gem::Requirement
60
+ requirement: &70160047624420 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70136640532460
68
+ version_requirements: *70160047624420
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ruby_gntp
71
- requirement: &70136640531740 !ruby/object:Gem::Requirement
71
+ requirement: &70160047623960 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70136640531740
79
+ version_requirements: *70160047623960
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rb-fsevent
82
- requirement: &70136640531120 !ruby/object:Gem::Requirement
82
+ requirement: &70160047623540 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70136640531120
90
+ version_requirements: *70160047623540
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: fakefs
93
- requirement: &70136640530600 !ruby/object:Gem::Requirement
93
+ requirement: &70160047623120 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70136640530600
101
+ version_requirements: *70160047623120
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: fakeweb
104
- requirement: &70136640530160 !ruby/object:Gem::Requirement
104
+ requirement: &70160047622700 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,21 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70136640530160
112
+ version_requirements: *70160047622700
113
+ - !ruby/object:Gem::Dependency
114
+ name: launchy
115
+ requirement: &70160047622280 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *70160047622280
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: wijet-thor
115
- requirement: &70136640529620 !ruby/object:Gem::Requirement
126
+ requirement: &70160047621780 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ~>
@@ -120,10 +131,10 @@ dependencies:
120
131
  version: 0.14.7
121
132
  type: :runtime
122
133
  prerelease: false
123
- version_requirements: *70136640529620
134
+ version_requirements: *70160047621780
124
135
  - !ruby/object:Gem::Dependency
125
136
  name: rest-client
126
- requirement: &70136640529180 !ruby/object:Gem::Requirement
137
+ requirement: &70160047621360 !ruby/object:Gem::Requirement
127
138
  none: false
128
139
  requirements:
129
140
  - - ! '>='
@@ -131,10 +142,10 @@ dependencies:
131
142
  version: '0'
132
143
  type: :runtime
133
144
  prerelease: false
134
- version_requirements: *70136640529180
145
+ version_requirements: *70160047621360
135
146
  - !ruby/object:Gem::Dependency
136
147
  name: json
137
- requirement: &70136640528720 !ruby/object:Gem::Requirement
148
+ requirement: &70160047620900 !ruby/object:Gem::Requirement
138
149
  none: false
139
150
  requirements:
140
151
  - - ! '>='
@@ -142,10 +153,10 @@ dependencies:
142
153
  version: '0'
143
154
  type: :runtime
144
155
  prerelease: false
145
- version_requirements: *70136640528720
156
+ version_requirements: *70160047620900
146
157
  - !ruby/object:Gem::Dependency
147
158
  name: progressbar
148
- requirement: &70136640528300 !ruby/object:Gem::Requirement
159
+ requirement: &70160047620480 !ruby/object:Gem::Requirement
149
160
  none: false
150
161
  requirements:
151
162
  - - ! '>='
@@ -153,7 +164,7 @@ dependencies:
153
164
  version: '0'
154
165
  type: :runtime
155
166
  prerelease: false
156
- version_requirements: *70136640528300
167
+ version_requirements: *70160047620480
157
168
  description: Tool for managing applications and clouds at shellycloud.com
158
169
  email:
159
170
  - support@shellycloud.com
@@ -231,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
231
242
  version: '0'
232
243
  requirements: []
233
244
  rubyforge_project: shelly
234
- rubygems_version: 1.8.10
245
+ rubygems_version: 1.8.17
235
246
  signing_key:
236
247
  specification_version: 3
237
248
  summary: Shelly Cloud command line tool