shelly 0.1.27 → 0.1.28
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +6 -0
- data/lib/shelly/cli/config.rb +10 -10
- data/lib/shelly/cli/{deploys.rb → deploy.rb} +4 -4
- data/lib/shelly/cli/{files.rb → file.rb} +4 -4
- data/lib/shelly/cli/main.rb +7 -9
- data/lib/shelly/cli/user.rb +3 -3
- data/lib/shelly/version.rb +1 -1
- data/lib/thor/basic.rb +0 -2
- data/lib/thor/thor.rb +6 -0
- data/spec/shelly/cli/{deploys_spec.rb → deploy_spec.rb} +4 -4
- data/spec/shelly/cli/{files_spec.rb → file_spec.rb} +3 -3
- data/spec/shelly/cli/main_spec.rb +23 -23
- metadata +8 -8
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.1.28 / 2012-09-21
|
2
|
+
|
3
|
+
* [feature] Singular form of all subcommands with possibility to invoke them with plural form
|
4
|
+
|
5
|
+
```shelly user list``` and ```shelly users list``` works the same
|
6
|
+
|
1
7
|
## 0.1.27 / 2012-09-12
|
2
8
|
|
3
9
|
* [bug] shelly check - wrong method for retrieving databases from Cloudfile
|
data/lib/shelly/cli/config.rb
CHANGED
@@ -3,7 +3,7 @@ require "shelly/cli/command"
|
|
3
3
|
module Shelly
|
4
4
|
module CLI
|
5
5
|
class Config < Command
|
6
|
-
|
6
|
+
namespace :config
|
7
7
|
include Helpers
|
8
8
|
|
9
9
|
before_hook :logged_in?, :only => [:list, :show, :create, :new, :edit, :update, :delete]
|
@@ -11,7 +11,7 @@ module Shelly
|
|
11
11
|
|
12
12
|
desc "list", "List configuration files"
|
13
13
|
def list
|
14
|
-
app = multiple_clouds(options[:cloud], "list")
|
14
|
+
app = multiple_clouds(options[:cloud], "config list")
|
15
15
|
configs = app.configs
|
16
16
|
unless configs.empty?
|
17
17
|
say "Configuration files for #{app}", :green
|
@@ -34,7 +34,7 @@ module Shelly
|
|
34
34
|
|
35
35
|
desc "show PATH", "View configuration file"
|
36
36
|
def show(path)
|
37
|
-
app = multiple_clouds(options[:cloud], "show #{path}")
|
37
|
+
app = multiple_clouds(options[:cloud], "config show #{path}")
|
38
38
|
config = app.config(path)
|
39
39
|
say "Content of #{config["path"]}:", :green
|
40
40
|
say config["content"]
|
@@ -62,7 +62,7 @@ module Shelly
|
|
62
62
|
desc "edit PATH", "Edit configuration file"
|
63
63
|
def edit(path = nil)
|
64
64
|
say_error "No configuration file specified" unless path
|
65
|
-
app = multiple_clouds(options[:cloud], "edit #{path}")
|
65
|
+
app = multiple_clouds(options[:cloud], "config edit #{path}")
|
66
66
|
config = app.config(path)
|
67
67
|
content = open_editor(config["path"], config["content"])
|
68
68
|
app.update_config(path, content)
|
@@ -80,7 +80,7 @@ module Shelly
|
|
80
80
|
|
81
81
|
desc "delete PATH", "Delete configuration file"
|
82
82
|
def delete(path)
|
83
|
-
app = multiple_clouds(options[:cloud], "delete #{path}")
|
83
|
+
app = multiple_clouds(options[:cloud], "config delete #{path}")
|
84
84
|
answer = yes?("Are you sure you want to delete 'path' (yes/no): ")
|
85
85
|
if answer
|
86
86
|
app.delete_config(path)
|
@@ -105,17 +105,17 @@ module Shelly
|
|
105
105
|
def open_editor(path, output = "")
|
106
106
|
filename = "shelly-edit-"
|
107
107
|
0.upto(20) { filename += rand(9).to_s }
|
108
|
-
filename << File.extname(path)
|
109
|
-
filename = File.join(Dir.tmpdir, filename)
|
110
|
-
tf = File.open(filename, "w")
|
108
|
+
filename << ::File.extname(path)
|
109
|
+
filename = ::File.join(Dir.tmpdir, filename)
|
110
|
+
tf = ::File.open(filename, "w")
|
111
111
|
tf.sync = true
|
112
112
|
tf.puts output
|
113
113
|
tf.close
|
114
114
|
no_editor unless system("#{ENV['EDITOR']} #{tf.path}")
|
115
|
-
tf = File.open(filename, "r")
|
115
|
+
tf = ::File.open(filename, "r")
|
116
116
|
output = tf.gets(nil)
|
117
117
|
tf.close
|
118
|
-
File.unlink(filename)
|
118
|
+
::File.unlink(filename)
|
119
119
|
output
|
120
120
|
end
|
121
121
|
|
@@ -3,8 +3,8 @@ require "time"
|
|
3
3
|
|
4
4
|
module Shelly
|
5
5
|
module CLI
|
6
|
-
class
|
7
|
-
namespace :
|
6
|
+
class Deploy < Command
|
7
|
+
namespace :deploy
|
8
8
|
include Helpers
|
9
9
|
|
10
10
|
before_hook :logged_in?, :only => [:list, :show]
|
@@ -12,7 +12,7 @@ module Shelly
|
|
12
12
|
|
13
13
|
desc "list", "Lists deploy logs"
|
14
14
|
def list
|
15
|
-
app = multiple_clouds(options[:cloud], "
|
15
|
+
app = multiple_clouds(options[:cloud], "deploy list")
|
16
16
|
logs = app.deploy_logs
|
17
17
|
unless logs.empty?
|
18
18
|
say "Available deploy logs", :green
|
@@ -33,7 +33,7 @@ module Shelly
|
|
33
33
|
desc "show LOG", "Show specific deploy log"
|
34
34
|
def show(log = nil)
|
35
35
|
specify_log(log)
|
36
|
-
app = multiple_clouds(options[:cloud], "
|
36
|
+
app = multiple_clouds(options[:cloud], "deploy show #{log}")
|
37
37
|
content = app.deploy_log(log)
|
38
38
|
say "Log for deploy done on #{content["created_at"]}", :green
|
39
39
|
if content["bundle_install"]
|
@@ -2,8 +2,8 @@ require "shelly/cli/command"
|
|
2
2
|
|
3
3
|
module Shelly
|
4
4
|
module CLI
|
5
|
-
class
|
6
|
-
namespace :
|
5
|
+
class File < Command
|
6
|
+
namespace :file
|
7
7
|
include Helpers
|
8
8
|
|
9
9
|
before_hook :logged_in?, :only => [:upload, :download]
|
@@ -12,7 +12,7 @@ module Shelly
|
|
12
12
|
|
13
13
|
desc "upload PATH", "Upload files to persistent data storage"
|
14
14
|
def upload(path)
|
15
|
-
app = multiple_clouds(options[:cloud], "upload #{path}")
|
15
|
+
app = multiple_clouds(options[:cloud], "file upload #{path}")
|
16
16
|
app.upload(path)
|
17
17
|
rescue Client::ConflictException
|
18
18
|
say_error "Cloud #{app} is not running. Cannot upload files."
|
@@ -25,7 +25,7 @@ module Shelly
|
|
25
25
|
DEST_PATH - optional destination where files should be saved. By default is current working directory.
|
26
26
|
}
|
27
27
|
def download(relative_source = ".", destination = ".")
|
28
|
-
app = multiple_clouds(options[:cloud], "download #{relative_source} #{destination}")
|
28
|
+
app = multiple_clouds(options[:cloud], "file download #{relative_source} #{destination}")
|
29
29
|
app.download(relative_source, destination)
|
30
30
|
rescue Client::ConflictException
|
31
31
|
say_error "Cloud #{app} is not running. Cannot download files."
|
data/lib/shelly/cli/main.rb
CHANGED
@@ -2,20 +2,18 @@
|
|
2
2
|
require "shelly/cli/command"
|
3
3
|
require "shelly/cli/user"
|
4
4
|
require "shelly/cli/backup"
|
5
|
-
require "shelly/cli/
|
5
|
+
require "shelly/cli/deploy"
|
6
6
|
require "shelly/cli/config"
|
7
|
-
require "shelly/cli/
|
7
|
+
require "shelly/cli/file"
|
8
8
|
|
9
9
|
module Shelly
|
10
10
|
module CLI
|
11
11
|
class Main < Command
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
register(Config, "config", "config <command>", "Manage application configuration files")
|
18
|
-
register(Files, "files", "files <command>", "Upload and download files to and from persistent storage")
|
12
|
+
register_subcommand(User, "user", "user <command>", "Manage collaborators")
|
13
|
+
register_subcommand(Backup, "backup", "backup <command>", "Manage database backups")
|
14
|
+
register_subcommand(Deploy, "deploy", "deploy <command>", "View deploy logs")
|
15
|
+
register_subcommand(Config, "config", "config <command>", "Manage application configuration files")
|
16
|
+
register_subcommand(File, "file", "file <command>", "Upload and download files to and from persistent storage")
|
19
17
|
|
20
18
|
check_unknown_options!(:except => :rake)
|
21
19
|
|
data/lib/shelly/cli/user.rb
CHANGED
@@ -11,7 +11,7 @@ module Shelly
|
|
11
11
|
|
12
12
|
desc "list", "List users with access to clouds defined in Cloudfile"
|
13
13
|
def list
|
14
|
-
app = multiple_clouds(options[:cloud], "list")
|
14
|
+
app = multiple_clouds(options[:cloud], "user list")
|
15
15
|
say "Cloud #{app}:"
|
16
16
|
app.active_collaborations.each { |c| say " #{c["email"]}" }
|
17
17
|
app.inactive_collaborations.each { |c|
|
@@ -21,7 +21,7 @@ module Shelly
|
|
21
21
|
desc "add [EMAIL]", "Add new developer to clouds defined in Cloudfile"
|
22
22
|
def add(email = nil)
|
23
23
|
user = Shelly::User.new
|
24
|
-
app = multiple_clouds(options[:cloud], "add")
|
24
|
+
app = multiple_clouds(options[:cloud], "user add")
|
25
25
|
user_email = email || ask_for_email({:guess_email => false})
|
26
26
|
user.send_invitation(app.to_s, user_email)
|
27
27
|
say "Sending invitation to #{user_email} to work on #{app}", :green
|
@@ -37,7 +37,7 @@ module Shelly
|
|
37
37
|
desc "delete [EMAIL]", "Remove developer from clouds defined in Cloudfile"
|
38
38
|
def delete(email = nil)
|
39
39
|
user = Shelly::User.new
|
40
|
-
app = multiple_clouds(options[:cloud], "delete")
|
40
|
+
app = multiple_clouds(options[:cloud], "user delete")
|
41
41
|
user_email = email || ask_for_email({:guess_email => false})
|
42
42
|
user.delete_collaboration(app.to_s, user_email)
|
43
43
|
say "User #{user_email} deleted from cloud #{app}"
|
data/lib/shelly/version.rb
CHANGED
data/lib/thor/basic.rb
CHANGED
data/lib/thor/thor.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
class Thor
|
2
2
|
class << self
|
3
|
+
def register_subcommand(klass, subcommand, usage, description, options = {})
|
4
|
+
register(klass, subcommand, usage, description, options)
|
5
|
+
# This could be done with ActiveSupport::Inflector module but is this necessary?
|
6
|
+
register(klass, subcommand + "s", usage, description, :hide => true)
|
7
|
+
end
|
8
|
+
|
3
9
|
def before_hook(method, options = {})
|
4
10
|
@hook = {} unless @hook
|
5
11
|
@hook[method] = options
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "shelly/cli/
|
2
|
+
require "shelly/cli/deploy"
|
3
3
|
|
4
|
-
describe Shelly::CLI::
|
4
|
+
describe Shelly::CLI::Deploy do
|
5
5
|
before do
|
6
6
|
FileUtils.stub(:chmod)
|
7
|
-
@deploys = Shelly::CLI::
|
8
|
-
Shelly::CLI::
|
7
|
+
@deploys = Shelly::CLI::Deploy.new
|
8
|
+
Shelly::CLI::Deploy.stub(:new).and_return(@deploys)
|
9
9
|
@client = mock
|
10
10
|
Shelly::Client.stub(:new).and_return(@client)
|
11
11
|
$stdout.stub(:puts)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
require "shelly/cli/
|
2
|
+
require "shelly/cli/file"
|
3
3
|
|
4
|
-
describe Shelly::CLI::
|
4
|
+
describe Shelly::CLI::File do
|
5
5
|
before do
|
6
6
|
FileUtils.stub(:chmod)
|
7
|
-
@cli_files = Shelly::CLI::
|
7
|
+
@cli_files = Shelly::CLI::File.new
|
8
8
|
@client = mock
|
9
9
|
Shelly::Client.stub(:new).and_return(@client)
|
10
10
|
@client.stub(:token).and_return("abc")
|
@@ -27,29 +27,29 @@ describe Shelly::CLI::Main do
|
|
27
27
|
it "should display available commands" do
|
28
28
|
out = IO.popen("bin/shelly --debug").read.strip
|
29
29
|
out.should include("Tasks:")
|
30
|
-
out.should include("shelly add
|
31
|
-
out.should include("shelly backup <command>
|
32
|
-
out.should include("shelly check
|
33
|
-
out.should include("shelly config <command>
|
34
|
-
out.should include("shelly console
|
35
|
-
out.should include("shelly dbconsole
|
36
|
-
out.should include("shelly delete
|
37
|
-
out.should include("shelly
|
38
|
-
out.should include("shelly
|
39
|
-
out.should include("shelly help [TASK]
|
40
|
-
out.should include("shelly info
|
41
|
-
out.should include("shelly list
|
42
|
-
out.should include("shelly login [EMAIL]
|
43
|
-
out.should include("shelly logout
|
44
|
-
out.should include("shelly logs
|
45
|
-
out.should include("shelly open
|
46
|
-
out.should include("shelly rake TASK
|
47
|
-
out.should include("shelly redeploy
|
48
|
-
out.should include("shelly register [EMAIL]
|
49
|
-
out.should include("shelly setup
|
50
|
-
out.should include("shelly start
|
51
|
-
out.should include("shelly stop
|
52
|
-
out.should include("shelly user <command>
|
30
|
+
out.should include("shelly add # Add a new cloud")
|
31
|
+
out.should include("shelly backup <command> # Manage database backups")
|
32
|
+
out.should include("shelly check # Check if application fulfills Shelly Cloud requirements")
|
33
|
+
out.should include("shelly config <command> # Manage application configuration files")
|
34
|
+
out.should include("shelly console # Open application console")
|
35
|
+
out.should include("shelly dbconsole # Run rails dbconsole")
|
36
|
+
out.should include("shelly delete # Delete the cloud")
|
37
|
+
out.should include("shelly deploy <command> # View deploy logs")
|
38
|
+
out.should include("shelly file <command> # Upload and download files to and from persistent storage")
|
39
|
+
out.should include("shelly help [TASK] # Describe available tasks or one specific task")
|
40
|
+
out.should include("shelly info # Show basic information about cloud")
|
41
|
+
out.should include("shelly list # List available clouds")
|
42
|
+
out.should include("shelly login [EMAIL] # Log into Shelly Cloud")
|
43
|
+
out.should include("shelly logout # Logout from Shelly Cloud")
|
44
|
+
out.should include("shelly logs # Show latest application logs")
|
45
|
+
out.should include("shelly open # Open application page in browser")
|
46
|
+
out.should include("shelly rake TASK # Run rake task")
|
47
|
+
out.should include("shelly redeploy # Redeploy application")
|
48
|
+
out.should include("shelly register [EMAIL] # Register new account")
|
49
|
+
out.should include("shelly setup # Set up git remotes for deployment on Shelly Cloud")
|
50
|
+
out.should include("shelly start # Start the cloud")
|
51
|
+
out.should include("shelly stop # Shutdown the cloud")
|
52
|
+
out.should include("shelly user <command> # Manage collaborators")
|
53
53
|
out.should include("Options")
|
54
54
|
out.should include("[--debug] # Show debug information")
|
55
55
|
out.should include("-h, [--help] # Describe available tasks or one specific task")
|
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.1.
|
4
|
+
version: 0.1.28
|
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: 2012-09-
|
12
|
+
date: 2012-09-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -292,8 +292,8 @@ files:
|
|
292
292
|
- lib/shelly/cli/backup.rb
|
293
293
|
- lib/shelly/cli/command.rb
|
294
294
|
- lib/shelly/cli/config.rb
|
295
|
-
- lib/shelly/cli/
|
296
|
-
- lib/shelly/cli/
|
295
|
+
- lib/shelly/cli/deploy.rb
|
296
|
+
- lib/shelly/cli/file.rb
|
297
297
|
- lib/shelly/cli/main.rb
|
298
298
|
- lib/shelly/cli/runner.rb
|
299
299
|
- lib/shelly/cli/user.rb
|
@@ -318,8 +318,8 @@ files:
|
|
318
318
|
- spec/shelly/backup_spec.rb
|
319
319
|
- spec/shelly/cli/backup_spec.rb
|
320
320
|
- spec/shelly/cli/config_spec.rb
|
321
|
-
- spec/shelly/cli/
|
322
|
-
- spec/shelly/cli/
|
321
|
+
- spec/shelly/cli/deploy_spec.rb
|
322
|
+
- spec/shelly/cli/file_spec.rb
|
323
323
|
- spec/shelly/cli/main_spec.rb
|
324
324
|
- spec/shelly/cli/runner_spec.rb
|
325
325
|
- spec/shelly/cli/user_spec.rb
|
@@ -362,8 +362,8 @@ test_files:
|
|
362
362
|
- spec/shelly/backup_spec.rb
|
363
363
|
- spec/shelly/cli/backup_spec.rb
|
364
364
|
- spec/shelly/cli/config_spec.rb
|
365
|
-
- spec/shelly/cli/
|
366
|
-
- spec/shelly/cli/
|
365
|
+
- spec/shelly/cli/deploy_spec.rb
|
366
|
+
- spec/shelly/cli/file_spec.rb
|
367
367
|
- spec/shelly/cli/main_spec.rb
|
368
368
|
- spec/shelly/cli/runner_spec.rb
|
369
369
|
- spec/shelly/cli/user_spec.rb
|