shelly 0.3.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTBkYWQ5MTBjMzM5ODk3NzA2MjUxNmI1YmYxNjFkYjQ5ZDA3YmIzMA==
4
+ MTBiNDgwNzhlNDdhZGU5YmY3MjQ3YTUwNTJmNjY0YTEyMTA4YTlkNA==
5
5
  data.tar.gz: !binary |-
6
- ZDEyM2ZiYzNhNjJjYWUwMmMxMjEzNWIzZDk3ZjI2NjEyMGUwN2RiMg==
6
+ NWQ3NTdjZGY4ZTFiNjgwMTQ2Y2FiMzYwYmNmMzRkMDcxZjA5ZGMwNQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NDYyMGIzMDdhMDFkNTEzNjk0MzUyNjlkYTU5ZjViYjkzZTM4ZmVmN2E1OGNk
10
- MmQwYjg5MDQ3MTVmMGRiZDFlMGFkNDhmNmMzMTdmZjc1ZWU0NTcyMTQ0NDE0
11
- MDI1NWRlYjJiYTVkODcyODFkM2YxNWU1YzU5NmJlMzJjM2Q2ZjI=
9
+ YTczNTdhMjljZjEyY2ZiZDcyMDM0ODUxMDY5ZTZlYmE5YjQ0YjBlMGRlNTNj
10
+ OTFmYzc1MzAzOGRhYzgxMDM2NWVhN2YwNzViMjljOTljMmFmMTY4MDQ0MzU3
11
+ MzU3MWQ1NGFhOWUzMDg3NmNhZmZiNmFmMTFiMjY1NzUxNTk1MDk=
12
12
  data.tar.gz: !binary |-
13
- ODk0MDZkZjRiOWIwYWM5YzNmNGU3YjU5MDZmYzE2OWJiYjc4ZTg4OWE2NjFk
14
- MDQ3MWI3M2VhOGIwYmE4ODc1ODJlODk1M2ExZmQ1YzgxM2ZmZjNkNDliYzJh
15
- MGFjYTg4NDkxMjcwZjgxMmM2NTdkMWJmM2I1ZmQ2ZDNiNzY3ZDA=
13
+ MjA4ZjQyODRhYjRjYjIzZGUwNjczM2QyMTM4MTY4NTBlYWVmM2FlNTQ4NmFk
14
+ YjBiYWFhOTdkNTljOTNmODc3ZmZjNTBlMzU1YTU3MWVhNWMyNDExYjZmYzVj
15
+ Y2VhNzY1ODZiYTAzZTA4MmY0NzkyYzQyNDQyNmY2OTRhMWIwOGE=
data/.travis.yml CHANGED
@@ -8,4 +8,5 @@ rvm:
8
8
  - jruby-19mode
9
9
  notifications:
10
10
  email:
11
- - devs@shellycloud.com
11
+ recipients:
12
+ - devs@shellycloud.com
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.3.1 / 2013-06-28
2
+
3
+ * [feature] `shelly database reset` reset PostgreSQL or MongoDB database, also possible to use with `shelly backup import DB_KIND dump --reset` option
4
+ * [improvement] Puma starting/stopping output shows up in deployment logs
5
+ * [improvement] Affects all commands using ssh connection:
6
+ * `shelly backup import` works when deployment failed
7
+ * `shelly dbconsole` works if database was configured
8
+ * `shelly files *` works if virutal server was at least configured
9
+
1
10
  ## 0.3.0 / 2013-06-23
2
11
 
3
12
  * [improvement] API key is now stored in .netrc
data/lib/shelly/app.rb CHANGED
@@ -130,7 +130,11 @@ module Shelly
130
130
 
131
131
  def import_database(kind, filename, server)
132
132
  ssh(:command => "import_database #{kind.downcase} #{filename}",
133
- :server => server)
133
+ :server => server, :type => :db_server)
134
+ end
135
+
136
+ def reset_database(kind)
137
+ ssh(:command => "reset_database #{kind.downcase}", :type => :db_server)
134
138
  end
135
139
 
136
140
  def request_backup(kinds)
@@ -197,7 +201,7 @@ module Shelly
197
201
  end
198
202
 
199
203
  def dbconsole
200
- ssh(:command => "dbconsole")
204
+ ssh(:command => "dbconsole", :type => :db_server)
201
205
  end
202
206
 
203
207
  def attributes
@@ -253,19 +257,26 @@ module Shelly
253
257
  end
254
258
 
255
259
  def list_files(path)
256
- ssh(:command => "ls -l /srv/glusterfs/disk/#{path}")
260
+ ssh(:command => "ls -l #{persistent_disk}/#{path}", :type => :server)
257
261
  end
258
262
 
259
263
  def upload(source)
260
- console_connection.tap do |conn|
261
- rsync(source, "#{conn['host']}:/srv/glusterfs/disk")
264
+ server_connection.tap do |conn|
265
+ rsync(source, "#{conn['host']}:#{persistent_disk}", conn)
266
+ end
267
+ end
268
+
269
+ def upload_database(source)
270
+ db_server_connection.tap do |conn|
271
+ rsync(source, "#{conn['host']}:#{persistent_disk}", conn)
262
272
  end
263
273
  end
264
274
 
265
275
  def download(relative_source, destination)
266
- conn = console_connection
267
- source = File.join("#{conn['host']}:/srv/glusterfs/disk", relative_source)
268
- rsync(source, destination)
276
+ server_connection.tap do |conn|
277
+ source = File.join("#{conn['host']}:#{persistent_disk}", relative_source)
278
+ rsync(source, destination, conn)
279
+ end
269
280
  end
270
281
 
271
282
  def delete_file(remote_path)
@@ -341,6 +352,10 @@ module Shelly
341
352
  self.environment = response["environment"]
342
353
  end
343
354
 
355
+ def persistent_disk
356
+ "/home/#{code_name}/disk"
357
+ end
358
+
344
359
  def jruby?
345
360
  RUBY_PLATFORM == 'java'
346
361
  end
@@ -354,17 +369,39 @@ module Shelly
354
369
  shelly.console(code_name, server)
355
370
  end
356
371
 
372
+ # Returns first configured virtual server
373
+ def server_connection
374
+ shelly.configured_server(code_name)
375
+ end
376
+
377
+ # Returns first configured virtual server with database
378
+ def db_server_connection(server = nil)
379
+ shelly.configured_db_server(code_name, server)
380
+ end
381
+
382
+ def connection(options)
383
+ case options[:type]
384
+ when :console
385
+ console_connection(options[:server])
386
+ when :server
387
+ server_connection
388
+ when :db_server
389
+ db_server_connection(options[:server])
390
+ end
391
+ end
392
+
357
393
  def ssh(options = {})
358
- conn = console_connection(options[:server])
394
+ options[:type] = :console unless options[:type]
395
+ conn = connection(options)
359
396
  system "ssh #{ssh_options(conn)} -t #{conn['host']} #{options[:command]}"
360
397
  end
361
398
 
362
- def ssh_options(conn = console_connection)
399
+ def ssh_options(conn)
363
400
  "-o StrictHostKeyChecking=no -p #{conn['port']} -l #{conn['user']}"
364
401
  end
365
402
 
366
- def rsync(source, destination)
367
- system "rsync -avz -e 'ssh #{ssh_options}' --progress #{source} #{destination}"
403
+ def rsync(source, destination, conn)
404
+ system "rsync -avz -e 'ssh #{ssh_options(conn)}' --progress #{source} #{destination}"
368
405
  end
369
406
  end
370
407
  end
@@ -105,20 +105,34 @@ module Shelly
105
105
  KIND - Database kind. Possible values are: postgresql or mongodb
106
106
  FILENAME - Database dump file or directory (mongodb)
107
107
  }
108
+ method_option :reset, :type => :boolean, :aliases => "-r",
109
+ :desc => "Reset database before importing from file"
108
110
  def import(kind, filename)
109
111
  app = multiple_clouds(options[:cloud], "backup import KIND FILENAME")
110
112
  unless ::File.exist?(filename)
111
113
  say_error "File #{filename} doesn't exist"
112
114
  end
113
- say "You are about import #{kind} database for cloud #{app} to state from file #{filename}"
114
- ask_to_import_database
115
+ if options[:reset]
116
+ say_warning "You are about to reset database #{kind} for cloud #{app}"
117
+ say_warning "Next, database will be restored to state from file #{filename}"
118
+ question = "I want to reset and import the database from dump (yes/no):"
119
+ say_new_line
120
+ yes?(question) ? app.reset_database(kind) : say_error("Canceled")
121
+ else
122
+ say_warning "You are about to import #{kind} database for cloud #{app} to state from file #{filename}"
123
+ question = "I want to import the database from dump (yes/no):"
124
+ say_new_line
125
+ say_error "Canceled" unless yes?(question)
126
+ end
115
127
  archive = compress(filename)
116
128
  say "Uploading #{archive}", :green
117
- connection = app.upload(archive)
129
+ connection = app.upload_database(archive)
118
130
  say "Uploading done", :green
119
131
  say "Importing database", :green
120
132
  app.import_database(kind, archive, connection["server"])
121
133
  say "Database imported successfully", :green
134
+ rescue Client::ConflictException => e
135
+ say_error e[:message]
122
136
  end
123
137
 
124
138
  no_tasks do
@@ -0,0 +1,26 @@
1
+ require "shelly/cli/command"
2
+ require "time"
3
+
4
+ module Shelly
5
+ module CLI
6
+ class Database < Command
7
+ namespace :database
8
+ include Helpers
9
+ before_hook :logged_in?, :only => [:reset]
10
+ class_option :cloud, :type => :string, :aliases => "-c", :desc => "Specify cloud"
11
+
12
+ desc "reset KIND", "Reset database"
13
+ long_desc %{
14
+ Removes all objects from the database
15
+ KIND - Database kind. Possible values are: postgresql or mongodb
16
+ }
17
+ def reset(kind)
18
+ app = multiple_clouds(options[:cloud], "database reset")
19
+ say "You are about to reset database #{kind} for cloud #{app}"
20
+ say "All database objects and data will be removed"
21
+ ask_to_reset_database
22
+ app.reset_database(kind)
23
+ end
24
+ end
25
+ end
26
+ end
@@ -57,6 +57,9 @@ module Shelly
57
57
  if content["thin_restart"]
58
58
  say("Starting thin", :green); say(content["thin_restart"])
59
59
  end
60
+ if content["puma_restart"]
61
+ say("Starting puma", :green); say(content["puma_restart"])
62
+ end
60
63
  rescue Client::NotFoundException => e
61
64
  raise unless e.resource == :log
62
65
  say_error "Log not found, list all deploy logs using `shelly deploys list --cloud=#{app.code_name}`"
@@ -3,6 +3,7 @@ require "shelly/cli/command"
3
3
  require "shelly/cli/user"
4
4
  require "shelly/cli/backup"
5
5
  require "shelly/cli/deploy"
6
+ require "shelly/cli/database"
6
7
  require "shelly/cli/config"
7
8
  require "shelly/cli/file"
8
9
  require "shelly/cli/organization"
@@ -13,6 +14,7 @@ module Shelly
13
14
  class Main < Command
14
15
  register_subcommand(User, "user", "user <command>", "Manage collaborators")
15
16
  register_subcommand(Backup, "backup", "backup <command>", "Manage database backups")
17
+ register_subcommand(Database, "database", "database <command>", "Manage databases")
16
18
  register_subcommand(Deploy, "deploy", "deploy <command>", "View deploy logs")
17
19
  register_subcommand(Config, "config", "config <command>", "Manage application configuration files")
18
20
  register_subcommand(File, "file", "file <command>", "Upload and download files to and from persistent storage")
@@ -339,7 +341,7 @@ Wait until cloud is in 'turned off' state and try again.}
339
341
  app = multiple_clouds(options[:cloud], "dbconsole")
340
342
  app.dbconsole
341
343
  rescue Client::ConflictException
342
- say_error "Cloud #{app} is not running. Cannot run dbconsole."
344
+ say_error "Cloud #{app} wasn't deployed properly. Can not run dbconsole."
343
345
  end
344
346
 
345
347
  desc "redeploy", "Redeploy application"
@@ -37,4 +37,12 @@ class Shelly::Client
37
37
  def console(code_name, server = nil)
38
38
  get("/apps/#{code_name}/console", {:server => server})
39
39
  end
40
+
41
+ def configured_server(code_name)
42
+ get("/apps/#{code_name}/configured_server")
43
+ end
44
+
45
+ def configured_db_server(code_name, server = nil)
46
+ get("/apps/#{code_name}/configured_db_server", {:server => server})
47
+ end
40
48
  end
@@ -19,6 +19,10 @@ module Shelly
19
19
  exit 1 if options[:with_exit]
20
20
  end
21
21
 
22
+ def say_warning(message)
23
+ say message, :yellow
24
+ end
25
+
22
26
  def ask_for_email(options = {})
23
27
  options = {:guess_email => true}.merge(options)
24
28
  email_question = options[:guess_email] && !User.guess_email.blank? ? "Email (#{User.guess_email} - default):" : "Email:"
@@ -50,6 +54,11 @@ module Shelly
50
54
  end
51
55
  end
52
56
 
57
+ def ask_to_reset_database
58
+ reset_database_question = "I want to reset the database (yes/no):"
59
+ exit 1 unless yes?(reset_database_question)
60
+ end
61
+
53
62
  def inside_git_repository?
54
63
  unless App.inside_git_repository?
55
64
  say_error %q{Current directory is not a git repository.
@@ -67,11 +76,6 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository}
67
76
  say_new_line say_error "Canceled" unless yes?(question)
68
77
  end
69
78
 
70
- def ask_to_import_database
71
- question = "I want to import the database (yes/no):"
72
- say_new_line say_error "Canceled" unless yes?(question)
73
- end
74
-
75
79
  def logged_in?
76
80
  user = Shelly::User.new
77
81
  user.authorize!
@@ -126,7 +130,7 @@ More info at http://git-scm.com/book/en/Git-Basics-Getting-a-Git-Repository}
126
130
  end
127
131
 
128
132
  def yellow(string)
129
- "\e[0;33m#{string}\e[0m"
133
+ "\e[33m#{string}\e[0m"
130
134
  end
131
135
 
132
136
  def print_check(check, success_message, failure_message, options = {})
@@ -1,3 +1,3 @@
1
1
  module Shelly
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/spec/helpers.rb CHANGED
@@ -17,7 +17,7 @@ module RSpec
17
17
  end
18
18
 
19
19
  def yellow(string)
20
- "\e[0;33m#{string}\e[0m"
20
+ "\e[33m#{string}\e[0m"
21
21
  end
22
22
 
23
23
  def hooks(model, method)
@@ -300,7 +300,7 @@ describe Shelly::App do
300
300
 
301
301
  describe "#dbconsole" do
302
302
  it "should return result of dbconsole" do
303
- @client.stub(:console).and_return(
303
+ @client.stub(:configured_db_server).and_return(
304
304
  {"host" => "console.example.com", "port" => "40010", "user" => "foo"})
305
305
  @app.should_receive(:system).with("ssh -o StrictHostKeyChecking=no -p 40010 -l foo -t console.example.com dbconsole")
306
306
  @app.dbconsole
@@ -348,25 +348,26 @@ describe Shelly::App do
348
348
 
349
349
  describe "#list_files" do
350
350
  it "should list files for given subpath in disk" do
351
- @app.should_receive(:ssh).with(:command => "ls -l /srv/glusterfs/disk/foo")
351
+ @app.should_receive(:ssh).with(:command => "ls -l /home/foo-staging/disk/foo",
352
+ :type => :server)
352
353
  @app.list_files("foo")
353
354
  end
354
355
  end
355
356
 
356
357
  describe "#upload" do
357
358
  it "should run rsync with proper parameters" do
358
- @client.stub(:console).and_return(
359
+ @client.stub(:configured_server).and_return(
359
360
  {"host" => "console.example.com", "port" => "40010", "user" => "foo"})
360
- @app.should_receive(:system).with("rsync -avz -e 'ssh -o StrictHostKeyChecking=no -p 40010 -l foo' --progress /path console.example.com:/srv/glusterfs/disk")
361
+ @app.should_receive(:system).with("rsync -avz -e 'ssh -o StrictHostKeyChecking=no -p 40010 -l foo' --progress /path console.example.com:/home/foo-staging/disk")
361
362
  @app.upload("/path")
362
363
  end
363
364
  end
364
365
 
365
366
  describe "#download" do
366
367
  it "should run rsync with proper parameters" do
367
- @client.stub(:console).and_return(
368
+ @client.stub(:configured_server).and_return(
368
369
  {"host" => "console.example.com", "port" => "40010", "user" => "foo"})
369
- @app.should_receive(:system).with("rsync -avz -e 'ssh -o StrictHostKeyChecking=no -p 40010 -l foo' --progress console.example.com:/srv/glusterfs/disk/. /tmp")
370
+ @app.should_receive(:system).with("rsync -avz -e 'ssh -o StrictHostKeyChecking=no -p 40010 -l foo' --progress console.example.com:/home/foo-staging/disk/. /tmp")
370
371
  @app.download(".", "/tmp")
371
372
  end
372
373
  end
@@ -264,7 +264,7 @@ describe Shelly::CLI::Backup do
264
264
  describe "#import" do
265
265
  before do
266
266
  FileUtils.touch("dump.sql")
267
- @app.stub(:upload => {"server" => "app1"}, :ssh => nil)
267
+ @app.stub(:upload_database => {"server" => "app1"}, :ssh => nil)
268
268
  @backup.stub(:system)
269
269
  $stdout.stub(:puts)
270
270
  $stdout.stub(:print)
@@ -284,7 +284,7 @@ describe Shelly::CLI::Backup do
284
284
  end
285
285
 
286
286
  it "should upload compressed file" do
287
- @app.should_receive(:upload).with("dump.sql-1370879705.tar.bz2")
287
+ @app.should_receive(:upload_database).with("dump.sql-1370879705.tar.bz2")
288
288
  $stdout.should_receive(:puts).with(green "Uploading dump.sql-1370879705.tar.bz2")
289
289
  fake_stdin(["yes"]) do
290
290
  invoke(@backup, :import, "postgresql", "dump.sql")
@@ -293,7 +293,7 @@ describe Shelly::CLI::Backup do
293
293
 
294
294
  it "should import given database from uploaded file" do
295
295
  @app.should_receive(:ssh).with(:command => "import_database postgresql dump.sql-1370879705.tar.bz2",
296
- :server => "app1")
296
+ :server => "app1", :type => :db_server)
297
297
  $stdout.should_receive(:puts).with(green "Importing database")
298
298
  fake_stdin(["yes"]) do
299
299
  invoke(@backup, :import, "PostgreSQL", "dump.sql")
@@ -302,8 +302,8 @@ describe Shelly::CLI::Backup do
302
302
 
303
303
  context "on answering no" do
304
304
  it "should cancel database import" do
305
- $stdout.should_receive(:puts).with("You are about import postgresql database for cloud foo-staging to state from file dump.sql")
306
- $stdout.should_receive(:print).with("I want to import the database (yes/no): ")
305
+ $stdout.should_receive(:puts).with(yellow "You are about to import postgresql database for cloud foo-staging to state from file dump.sql")
306
+ $stdout.should_receive(:print).with("I want to import the database from dump (yes/no): ")
307
307
  $stdout.should_receive(:puts).with(red "Canceled")
308
308
  lambda {
309
309
  fake_stdin(["no"]) do
@@ -324,5 +324,18 @@ describe Shelly::CLI::Backup do
324
324
  }.should raise_error(SystemExit)
325
325
  end
326
326
  end
327
+
328
+ context "with --reset option" do
329
+ it "should reset database first" do
330
+ @backup.options = {:cloud => "foo-staging", :reset => true}
331
+ @app.should_receive(:reset_database).with("postgresql")
332
+ @app.should_receive(:ssh).with(:command => "import_database postgresql dump.sql-1370879705.tar.bz2",
333
+ :server => "app1", :type => :db_server)
334
+ $stdout.should_receive(:puts).with(green "Importing database")
335
+ fake_stdin(["yes"]) do
336
+ invoke(@backup, :import, "postgresql", "dump.sql")
337
+ end
338
+ end
339
+ end
327
340
  end
328
341
  end
@@ -0,0 +1,33 @@
1
+ require "spec_helper"
2
+ require "shelly/cli/database"
3
+
4
+ describe Shelly::CLI::Database do
5
+ before do
6
+ @database = Shelly::CLI::Database.new
7
+ Shelly::CLI::Database.stub(:new).and_return(@database)
8
+ $stdout.stub(:puts)
9
+ $stdout.stub(:print)
10
+ @client = mock
11
+ Shelly::Client.stub(:new).and_return(@client)
12
+ @client.stub(:authorize!)
13
+ @client.stub(:console)
14
+ @app = mock(:to_s => "foo-staging")
15
+ Shelly::App.stub(:new).and_return(@app)
16
+ File.open("Cloudfile", 'w') {|f| f.write("foo-staging:\n") }
17
+ end
18
+
19
+ describe "#reset" do
20
+ it "should ensure user has logged in" do
21
+ hooks(@database, :reset).should include(:logged_in?)
22
+ end
23
+
24
+ it "should reset given database via SSH" do
25
+ $stdout.should_receive(:puts).with("You are about to reset database Mongodb for cloud foo-staging")
26
+ $stdout.should_receive(:puts).with("All database objects and data will be removed")
27
+ @app.should_receive(:reset_database).with("Mongodb")
28
+ fake_stdin(["yes"]) do
29
+ invoke(@database, :reset, "Mongodb")
30
+ end
31
+ end
32
+ end
33
+ end
@@ -100,13 +100,15 @@ describe Shelly::CLI::Deploy do
100
100
  $stdout.should_receive(:puts).with("sidekiq workers")
101
101
  $stdout.should_receive(:puts).with(green "Starting thin")
102
102
  $stdout.should_receive(:puts).with("thins up and running")
103
+ $stdout.should_receive(:puts).with(green "Starting puma")
104
+ $stdout.should_receive(:puts).with("pumas up and running")
103
105
  end
104
106
 
105
107
  def response
106
108
  {"created_at" => "2011-12-12 at 14:14:59", "bundle_install" => "Installing gems",
107
109
  "whenever" => "Looking up schedule.rb", "thin_restart" => "thins up and running",
108
- "delayed_job" => "delayed jobs", "sidekiq" => "sidekiq workers",
109
- "callbacks" => "rake db:migrate"}
110
+ "puma_restart" => "pumas up and running", "delayed_job" => "delayed jobs",
111
+ "sidekiq" => "sidekiq workers", "callbacks" => "rake db:migrate"}
110
112
  end
111
113
  end
112
114
 
@@ -28,7 +28,7 @@ describe Shelly::CLI::File do
28
28
 
29
29
  context "cloud is not running" do
30
30
  it "should display error" do
31
- @client.stub(:console).and_raise(Shelly::Client::ConflictException)
31
+ @client.stub(:configured_server).and_raise(Shelly::Client::ConflictException)
32
32
  $stdout.should_receive(:puts).with(red "Cloud foo-production is not running. Cannot list files.")
33
33
  lambda {
34
34
  invoke(@cli_files, :list, "some/path")
@@ -59,7 +59,7 @@ describe Shelly::CLI::File do
59
59
 
60
60
  context "cloud is not running" do
61
61
  it "should display error" do
62
- @client.stub(:console).and_raise(Shelly::Client::ConflictException)
62
+ @client.stub(:configured_server).and_raise(Shelly::Client::ConflictException)
63
63
  $stdout.should_receive(:puts).with(red "Cloud foo-production is not running. Cannot upload files.")
64
64
  lambda {
65
65
  invoke(@cli_files, :upload, "some/path")
@@ -35,6 +35,7 @@ describe Shelly::CLI::Main do
35
35
  out.should include("shelly check # Check if application fulfills Shelly Cloud requirements")
36
36
  out.should include("shelly config <command> # Manage application configuration files")
37
37
  out.should include("shelly console # Open application console")
38
+ out.should include("shelly database <command> # Manage databases")
38
39
  out.should include("shelly dbconsole # Run rails dbconsole")
39
40
  out.should include("shelly delete # Delete the cloud")
40
41
  out.should include("shelly deploy <command> # View deploy logs")
@@ -1413,8 +1414,8 @@ Wait until cloud is in 'turned off' state and try again.")
1413
1414
 
1414
1415
  context "Instances are not running" do
1415
1416
  it "should display error" do
1416
- @client.stub(:console).and_raise(Shelly::Client::ConflictException)
1417
- $stdout.should_receive(:puts).with(red "Cloud foo-production is not running. Cannot run dbconsole.")
1417
+ @client.stub(:configured_db_server).and_raise(Shelly::Client::ConflictException)
1418
+ $stdout.should_receive(:puts).with(red "Cloud foo-production wasn't deployed properly. Can not run dbconsole.")
1418
1419
  lambda {
1419
1420
  invoke(@main, :dbconsole)
1420
1421
  }.should raise_error(SystemExit)
@@ -3,16 +3,16 @@ require "shelly/cli/organization"
3
3
 
4
4
  describe Shelly::CLI::Organization do
5
5
  before do
6
- FileUtils.stub(:chmod)
7
- @organization = Shelly::CLI::Organization.new
8
- Shelly::CLI::Organization.stub(:new).and_return(@organization)
9
- @client = mock
10
- Shelly::Client.stub(:new).and_return(@client)
11
- $stdout.stub(:puts)
12
- $stdout.stub(:print)
13
- @client.stub(:authorize!)
14
- FileUtils.mkdir_p("/projects/foo")
15
- Dir.chdir("/projects/foo")
6
+ FileUtils.stub(:chmod)
7
+ @organization = Shelly::CLI::Organization.new
8
+ Shelly::CLI::Organization.stub(:new).and_return(@organization)
9
+ @client = mock
10
+ Shelly::Client.stub(:new).and_return(@client)
11
+ $stdout.stub(:puts)
12
+ $stdout.stub(:print)
13
+ @client.stub(:authorize!)
14
+ FileUtils.mkdir_p("/projects/foo")
15
+ Dir.chdir("/projects/foo")
16
16
  end
17
17
 
18
18
  describe "#list" do
metadata CHANGED
@@ -1,225 +1,225 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shelly Cloud team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-23 00:00:00.000000000 Z
11
+ date: 2013-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: rspec
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - ~>
17
18
  - !ruby/object:Gem::Version
18
19
  version: 2.11.0
20
+ type: :development
21
+ prerelease: false
19
22
  version_requirements: !ruby/object:Gem::Requirement
20
23
  requirements:
21
24
  - - ~>
22
25
  - !ruby/object:Gem::Version
23
26
  version: 2.11.0
24
- type: :development
25
- prerelease: false
26
- name: rspec
27
27
  - !ruby/object:Gem::Dependency
28
+ name: rake
28
29
  requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - ! '>='
31
32
  - !ruby/object:Gem::Version
32
33
  version: '0'
34
+ type: :development
35
+ prerelease: false
33
36
  version_requirements: !ruby/object:Gem::Requirement
34
37
  requirements:
35
38
  - - ! '>='
36
39
  - !ruby/object:Gem::Version
37
40
  version: '0'
38
- type: :development
39
- prerelease: false
40
- name: rake
41
41
  - !ruby/object:Gem::Dependency
42
+ name: guard
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
45
  - - ! '>='
45
46
  - !ruby/object:Gem::Version
46
47
  version: '0'
48
+ type: :development
49
+ prerelease: false
47
50
  version_requirements: !ruby/object:Gem::Requirement
48
51
  requirements:
49
52
  - - ! '>='
50
53
  - !ruby/object:Gem::Version
51
54
  version: '0'
52
- type: :development
53
- prerelease: false
54
- name: guard
55
55
  - !ruby/object:Gem::Dependency
56
+ name: guard-rspec
56
57
  requirement: !ruby/object:Gem::Requirement
57
58
  requirements:
58
59
  - - ! '>='
59
60
  - !ruby/object:Gem::Version
60
61
  version: '0'
62
+ type: :development
63
+ prerelease: false
61
64
  version_requirements: !ruby/object:Gem::Requirement
62
65
  requirements:
63
66
  - - ! '>='
64
67
  - !ruby/object:Gem::Version
65
68
  version: '0'
66
- type: :development
67
- prerelease: false
68
- name: guard-rspec
69
69
  - !ruby/object:Gem::Dependency
70
+ name: simplecov
70
71
  requirement: !ruby/object:Gem::Requirement
71
72
  requirements:
72
73
  - - ! '>='
73
74
  - !ruby/object:Gem::Version
74
75
  version: '0'
76
+ type: :development
77
+ prerelease: false
75
78
  version_requirements: !ruby/object:Gem::Requirement
76
79
  requirements:
77
80
  - - ! '>='
78
81
  - !ruby/object:Gem::Version
79
82
  version: '0'
80
- type: :development
81
- prerelease: false
82
- name: simplecov
83
83
  - !ruby/object:Gem::Dependency
84
+ name: ruby_gntp
84
85
  requirement: !ruby/object:Gem::Requirement
85
86
  requirements:
86
87
  - - ! '>='
87
88
  - !ruby/object:Gem::Version
88
89
  version: '0'
90
+ type: :development
91
+ prerelease: false
89
92
  version_requirements: !ruby/object:Gem::Requirement
90
93
  requirements:
91
94
  - - ! '>='
92
95
  - !ruby/object:Gem::Version
93
96
  version: '0'
94
- type: :development
95
- prerelease: false
96
- name: ruby_gntp
97
97
  - !ruby/object:Gem::Dependency
98
+ name: rb-fsevent
98
99
  requirement: !ruby/object:Gem::Requirement
99
100
  requirements:
100
101
  - - ! '>='
101
102
  - !ruby/object:Gem::Version
102
103
  version: '0'
104
+ type: :development
105
+ prerelease: false
103
106
  version_requirements: !ruby/object:Gem::Requirement
104
107
  requirements:
105
108
  - - ! '>='
106
109
  - !ruby/object:Gem::Version
107
110
  version: '0'
108
- type: :development
109
- prerelease: false
110
- name: rb-fsevent
111
111
  - !ruby/object:Gem::Dependency
112
+ name: fakefs
112
113
  requirement: !ruby/object:Gem::Requirement
113
114
  requirements:
114
115
  - - ! '>='
115
116
  - !ruby/object:Gem::Version
116
117
  version: '0'
118
+ type: :development
119
+ prerelease: false
117
120
  version_requirements: !ruby/object:Gem::Requirement
118
121
  requirements:
119
122
  - - ! '>='
120
123
  - !ruby/object:Gem::Version
121
124
  version: '0'
122
- type: :development
123
- prerelease: false
124
- name: fakefs
125
125
  - !ruby/object:Gem::Dependency
126
+ name: fakeweb
126
127
  requirement: !ruby/object:Gem::Requirement
127
128
  requirements:
128
129
  - - ! '>='
129
130
  - !ruby/object:Gem::Version
130
131
  version: '0'
132
+ type: :development
133
+ prerelease: false
131
134
  version_requirements: !ruby/object:Gem::Requirement
132
135
  requirements:
133
136
  - - ! '>='
134
137
  - !ruby/object:Gem::Version
135
138
  version: '0'
136
- type: :development
137
- prerelease: false
138
- name: fakeweb
139
139
  - !ruby/object:Gem::Dependency
140
+ name: wijet-thor
140
141
  requirement: !ruby/object:Gem::Requirement
141
142
  requirements:
142
143
  - - ~>
143
144
  - !ruby/object:Gem::Version
144
145
  version: 0.14.9
146
+ type: :runtime
147
+ prerelease: false
145
148
  version_requirements: !ruby/object:Gem::Requirement
146
149
  requirements:
147
150
  - - ~>
148
151
  - !ruby/object:Gem::Version
149
152
  version: 0.14.9
150
- type: :runtime
151
- prerelease: false
152
- name: wijet-thor
153
153
  - !ruby/object:Gem::Dependency
154
+ name: rest-client
154
155
  requirement: !ruby/object:Gem::Requirement
155
156
  requirements:
156
157
  - - ! '>='
157
158
  - !ruby/object:Gem::Version
158
159
  version: '0'
160
+ type: :runtime
161
+ prerelease: false
159
162
  version_requirements: !ruby/object:Gem::Requirement
160
163
  requirements:
161
164
  - - ! '>='
162
165
  - !ruby/object:Gem::Version
163
166
  version: '0'
164
- type: :runtime
165
- prerelease: false
166
- name: rest-client
167
167
  - !ruby/object:Gem::Dependency
168
+ name: json
168
169
  requirement: !ruby/object:Gem::Requirement
169
170
  requirements:
170
171
  - - ! '>='
171
172
  - !ruby/object:Gem::Version
172
173
  version: '0'
174
+ type: :runtime
175
+ prerelease: false
173
176
  version_requirements: !ruby/object:Gem::Requirement
174
177
  requirements:
175
178
  - - ! '>='
176
179
  - !ruby/object:Gem::Version
177
180
  version: '0'
178
- type: :runtime
179
- prerelease: false
180
- name: json
181
181
  - !ruby/object:Gem::Dependency
182
+ name: progressbar
182
183
  requirement: !ruby/object:Gem::Requirement
183
184
  requirements:
184
185
  - - ! '>='
185
186
  - !ruby/object:Gem::Version
186
187
  version: '0'
188
+ type: :runtime
189
+ prerelease: false
187
190
  version_requirements: !ruby/object:Gem::Requirement
188
191
  requirements:
189
192
  - - ! '>='
190
193
  - !ruby/object:Gem::Version
191
194
  version: '0'
192
- type: :runtime
193
- prerelease: false
194
- name: progressbar
195
195
  - !ruby/object:Gem::Dependency
196
+ name: launchy
196
197
  requirement: !ruby/object:Gem::Requirement
197
198
  requirements:
198
199
  - - ! '>='
199
200
  - !ruby/object:Gem::Version
200
201
  version: '0'
202
+ type: :runtime
203
+ prerelease: false
201
204
  version_requirements: !ruby/object:Gem::Requirement
202
205
  requirements:
203
206
  - - ! '>='
204
207
  - !ruby/object:Gem::Version
205
208
  version: '0'
206
- type: :runtime
207
- prerelease: false
208
- name: launchy
209
209
  - !ruby/object:Gem::Dependency
210
+ name: netrc
210
211
  requirement: !ruby/object:Gem::Requirement
211
212
  requirements:
212
213
  - - ! '>='
213
214
  - !ruby/object:Gem::Version
214
215
  version: '0'
216
+ type: :runtime
217
+ prerelease: false
215
218
  version_requirements: !ruby/object:Gem::Requirement
216
219
  requirements:
217
220
  - - ! '>='
218
221
  - !ruby/object:Gem::Version
219
222
  version: '0'
220
- type: :runtime
221
- prerelease: false
222
- name: netrc
223
223
  description: Tool for managing applications and clouds at shellycloud.com
224
224
  email:
225
225
  - devs@shellycloud.com
@@ -245,6 +245,7 @@ files:
245
245
  - lib/shelly/cli/backup.rb
246
246
  - lib/shelly/cli/command.rb
247
247
  - lib/shelly/cli/config.rb
248
+ - lib/shelly/cli/database.rb
248
249
  - lib/shelly/cli/deploy.rb
249
250
  - lib/shelly/cli/file.rb
250
251
  - lib/shelly/cli/logs.rb
@@ -286,6 +287,7 @@ files:
286
287
  - spec/shelly/backup_spec.rb
287
288
  - spec/shelly/cli/backup_spec.rb
288
289
  - spec/shelly/cli/config_spec.rb
290
+ - spec/shelly/cli/database_spec.rb
289
291
  - spec/shelly/cli/deploy_spec.rb
290
292
  - spec/shelly/cli/file_spec.rb
291
293
  - spec/shelly/cli/logs_spec.rb
@@ -332,6 +334,7 @@ test_files:
332
334
  - spec/shelly/backup_spec.rb
333
335
  - spec/shelly/cli/backup_spec.rb
334
336
  - spec/shelly/cli/config_spec.rb
337
+ - spec/shelly/cli/database_spec.rb
335
338
  - spec/shelly/cli/deploy_spec.rb
336
339
  - spec/shelly/cli/file_spec.rb
337
340
  - spec/shelly/cli/logs_spec.rb