shelly 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.2 / 2013-02-01
2
+
3
+ * Changes reflecting improved API
4
+
1
5
  ## 0.2.1 / 2013-01-17
2
6
 
3
7
  * [improvement] Show redeploy authors in `shelly deploys list`
data/lib/shelly/app.rb CHANGED
@@ -194,12 +194,8 @@ module Shelly
194
194
  attributes["state"]
195
195
  end
196
196
 
197
- def trial?
198
- !!attributes["trial"]
199
- end
200
-
201
197
  def credit
202
- attributes["credit"]
198
+ attributes["organization"]["credit"].to_f
203
199
  end
204
200
 
205
201
  def self.inside_git_repository?
@@ -211,7 +207,7 @@ module Shelly
211
207
  end
212
208
 
213
209
  def edit_billing_url
214
- "#{shelly.shellyapp_url}/organizations/#{attributes["organization_name"]}/edit"
210
+ "#{shelly.shellyapp_url}/organizations/#{organization}/edit"
215
211
  end
216
212
 
217
213
  def open
@@ -109,10 +109,10 @@ module Shelly
109
109
 
110
110
  say "Creating Cloudfile", :green
111
111
  app.create_cloudfile
112
- if app.trial?
112
+ if app.credit > 0
113
113
  say_new_line
114
114
  say "Billing information", :green
115
- say "Cloud created with #{app.credit} Euro credit."
115
+ say "Cloud created with #{app.credit.to_i} Euro credit."
116
116
  say "Remember to provide billing details before trial ends."
117
117
  say app.edit_billing_url
118
118
  end
@@ -1,3 +1,3 @@
1
1
  module Shelly
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -133,8 +133,9 @@ describe Shelly::App do
133
133
  before do
134
134
  @response = {"web_server_ip" => "192.0.2.1",
135
135
  "state" => "running",
136
- "trial" => true,
137
- "credit" => 23.0,
136
+ "organization" => {
137
+ "credit" => 23.0
138
+ },
138
139
  "git_info" => {
139
140
  "deployed_commit_message" => "Commit message",
140
141
  "deployed_commit_sha" => "52e65ed2d085eaae560cdb81b2b56a7d76",
@@ -143,17 +144,6 @@ describe Shelly::App do
143
144
  @client.stub(:app).and_return(@response)
144
145
  end
145
146
 
146
- describe "#trial?" do
147
- it "should return true if app is trial" do
148
- @app.should be_trial
149
- end
150
-
151
- it "should return false if app is not trial" do
152
- @client.stub(:app).and_return("trial" => false)
153
- @app.should_not be_trial
154
- end
155
- end
156
-
157
147
  describe "#credit" do
158
148
  it "should return freecredit that app has" do
159
149
  @app.credit.should == 23.0
@@ -328,7 +318,7 @@ describe Shelly::App do
328
318
 
329
319
  describe "#edit_billing_url" do
330
320
  it "should return link to edit billing page for app" do
331
- @app.stub(:attributes).and_return({"organization_name" => "example"})
321
+ @app.stub(:organization).and_return("example")
332
322
  @app.edit_billing_url.should == "http://shellyapp.example.com/organizations/example/edit"
333
323
  end
334
324
  end
@@ -291,7 +291,7 @@ describe Shelly::CLI::Main do
291
291
  Shelly::App.stub(:inside_git_repository?).and_return(true)
292
292
  Shelly::App.stub(:new).and_return(@app)
293
293
  @client.stub(:token).and_return("abc")
294
- @app.stub(:attributes).and_return({"trial" => false})
294
+ @app.stub(:attributes).and_return({"organization" => {"credit" => 0}})
295
295
  @app.stub(:git_remote_exist?).and_return(false)
296
296
  @main.stub(:check => true)
297
297
  @main.stub(:ask_for_organization)
@@ -409,8 +409,9 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository\e[0m
409
409
  end
410
410
  end
411
411
 
412
- it "should create the app on shelly cloud and show trial information" do
413
- @app.stub(:attributes).and_return({"trial" => true, "credit" => 40, "organization_name" => "example"})
412
+ it "should create the app on shelly cloud and show credit information" do
413
+ @app.stub(:attributes).and_return("organization" => {"credit" => "40"})
414
+ @app.stub(:organization).and_return("example")
414
415
  @client.stub(:shellyapp_url).and_return("http://example.com")
415
416
  @app.should_receive(:create)
416
417
  $stdout.should_receive(:puts).with(green "Billing information")
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.2.1
4
+ version: 0.2.2
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-17 00:00:00.000000000 Z
12
+ date: 2013-02-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -317,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
317
317
  version: '0'
318
318
  segments:
319
319
  - 0
320
- hash: -2251539392438831574
320
+ hash: -3756892082399267901
321
321
  required_rubygems_version: !ruby/object:Gem::Requirement
322
322
  none: false
323
323
  requirements:
@@ -326,10 +326,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
326
  version: '0'
327
327
  segments:
328
328
  - 0
329
- hash: -2251539392438831574
329
+ hash: -3756892082399267901
330
330
  requirements: []
331
331
  rubyforge_project: shelly
332
- rubygems_version: 1.8.24
332
+ rubygems_version: 1.8.25
333
333
  signing_key:
334
334
  specification_version: 3
335
335
  summary: Shelly Cloud command line tool