shelly 0.1.25 → 0.1.26

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,4 +1,8 @@
1
- ## 0.1.25 / 2012-09-11
1
+ ## 0.1.26 / 2012-09-11
2
+
3
+ * [bug] Fixes -c/--cloud option bug in previous version
4
+
5
+ ## 0.1.25 / 2012-09-11 - yanked
2
6
 
3
7
  * [feature] `shelly check` checks gems based on Cloudfile
4
8
  * [bug] Show 10 recent backups in `backup list` command, instead of the oldest
data/Guardfile ADDED
@@ -0,0 +1,6 @@
1
+ guard 'rspec', :cli => '--color --format doc' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch('lib/shelly/helpers.rb') { "spec" }
4
+ watch(%r{^lib/shelly/(.+)\.rb$}) { |m| "spec/shelly/#{m[1]}_spec.rb" }
5
+ watch('spec/spec_helper.rb') { "spec" }
6
+ end
data/README.md CHANGED
@@ -13,3 +13,7 @@
13
13
  ## Running tests
14
14
 
15
15
  bundle exec rake
16
+
17
+ or
18
+
19
+ guard
@@ -33,7 +33,7 @@ module Shelly
33
33
 
34
34
  say "Available backups:", :green
35
35
  say_new_line
36
- print_table(to_display, :indent => 2)
36
+ print_table(to_display, :ident => 2)
37
37
  else
38
38
  say "No database backups available"
39
39
  end
@@ -4,6 +4,7 @@ require "thor/thor"
4
4
  require "thor/group"
5
5
  require "thor/options"
6
6
  require "thor/arguments"
7
+ require "thor/basic"
7
8
 
8
9
  module Shelly
9
10
  module CLI
@@ -19,6 +19,7 @@ module Shelly
19
19
 
20
20
  check_unknown_options!(:except => :rake)
21
21
 
22
+ # FIXME: it should be possible to pass single symbol, instead of one element array
22
23
  before_hook :logged_in?, :only => [:add, :status, :list, :start, :stop, :logs, :delete, :info, :ip, :logout, :execute, :rake, :setup, :console, :dbconsole]
23
24
  before_hook :inside_git_repository?, :only => [:add, :setup, :check]
24
25
 
@@ -133,7 +134,7 @@ module Shelly
133
134
  end
134
135
  [app["code_name"], "| #{state.humanize}#{msg}"]
135
136
  end
136
- print_table(apps_table, :indent => 2)
137
+ print_table(apps_table, :ident => 2)
137
138
  else
138
139
  say "You have no clouds yet", :green
139
140
  end
@@ -148,21 +149,21 @@ module Shelly
148
149
  " (deployment log: `shelly deploys show last -c #{app}`)"
149
150
  end
150
151
  say "Cloud #{app}:", msg.present? ? :red : :green
151
- print_wrapped "State: #{app.state}#{msg}", :indent => 2
152
+ print_wrapped "State: #{app.state}#{msg}", :ident => 2
152
153
  say_new_line
153
- print_wrapped "Deployed commit sha: #{app.git_info["deployed_commit_sha"]}", :indent => 2
154
- print_wrapped "Deployed commit message: #{app.git_info["deployed_commit_message"]}", :indent => 2
155
- print_wrapped "Deployed by: #{app.git_info["deployed_push_author"]}", :indent => 2
154
+ print_wrapped "Deployed commit sha: #{app.git_info["deployed_commit_sha"]}", :ident => 2
155
+ print_wrapped "Deployed commit message: #{app.git_info["deployed_commit_message"]}", :ident => 2
156
+ print_wrapped "Deployed by: #{app.git_info["deployed_push_author"]}", :ident => 2
156
157
  say_new_line
157
- print_wrapped "Repository URL: #{app.git_info["repository_url"]}", :indent => 2
158
- print_wrapped "Web server IP: #{app.web_server_ip}", :indent => 2
158
+ print_wrapped "Repository URL: #{app.git_info["repository_url"]}", :ident => 2
159
+ print_wrapped "Web server IP: #{app.web_server_ip}", :ident => 2
159
160
  say_new_line
160
161
  if app.statistics.present?
161
- print_wrapped "Statistics:", :indent => 2
162
+ print_wrapped "Statistics:", :ident => 2
162
163
  app.statistics.each do |stat|
163
- print_wrapped "#{stat['name']}:", :indent => 4
164
- print_wrapped "Load average: 1m: #{stat['load']['avg01']}, 5m: #{stat['load']['avg05']}, 15m: #{stat['load']['avg15']}", :indent => 6
165
- print_wrapped "CPU: #{stat['cpu']['wait']}%, MEM: #{stat['memory']['percent']}%, SWAP: #{stat['swap']['percent']}%", :indent => 6
164
+ print_wrapped "#{stat['name']}:", :ident => 4
165
+ print_wrapped "Load average: 1m: #{stat['load']['avg01']}, 5m: #{stat['load']['avg05']}, 15m: #{stat['load']['avg15']}", :ident => 6
166
+ print_wrapped "CPU: #{stat['cpu']['wait']}%, MEM: #{stat['memory']['percent']}%, SWAP: #{stat['swap']['percent']}%", :ident => 6
166
167
  end
167
168
  end
168
169
  rescue Client::GatewayTimeoutException
@@ -429,10 +430,6 @@ We have been notified about it. We will be adding new resources shortly}
429
430
  end
430
431
  end
431
432
 
432
- print_check(!structure.gem?("mysql") && !structure.gem?("mysql2"),"",
433
- "mysql driver present in the Gemfile (not supported on Shelly Cloud)",
434
- :show_fulfilled => false)
435
-
436
433
  if structure.valid?
437
434
  if verbose
438
435
  say "\nGreat! Your application is ready to run on Shelly Cloud"
@@ -1,3 +1,3 @@
1
1
  module Shelly
2
- VERSION = "0.1.25"
2
+ VERSION = "0.1.26"
3
3
  end
data/lib/thor/basic.rb ADDED
@@ -0,0 +1,9 @@
1
+ class Thor
2
+ module Shell
3
+
4
+ def print_wrapped(*args)
5
+ shell.print_wrapped(*args)
6
+ end
7
+
8
+ end
9
+ end
data/lib/thor/options.rb CHANGED
@@ -1,10 +1,11 @@
1
1
  class Thor
2
2
  class Options < Arguments
3
+
3
4
  def check_unknown!
4
- unknown = @extra.select { |str| str =~ /^--?(?:(?!--).)*$/ }
5
5
  raise UnknownArgumentError, "shelly: unrecognized option '#{@unknown.join(', ')}'\n" +
6
6
  "Usage: shelly [COMMAND]... [OPTIONS]\n" +
7
- "Try 'shelly --help' for more information" unless unknown.empty?
7
+ "Try 'shelly --help' for more information" unless @unknown.empty?
8
8
  end
9
+
9
10
  end
10
11
  end
data/lib/thor/thor.rb CHANGED
@@ -2,7 +2,7 @@ class Thor
2
2
  class << self
3
3
  def before_hook(method, options = {})
4
4
  @hook = {} unless @hook
5
- @hook[method] = {:only => Array(options[:only])}
5
+ @hook[method] = options
6
6
  end
7
7
 
8
8
  def hooks
@@ -28,46 +28,12 @@ class Thor
28
28
  rescue Thor::Error => e
29
29
  ENV["THOR_DEBUG"] == "1" ? (raise e) : config[:shell].error(e.message)
30
30
  exit(1) if exit_on_failure?
31
- rescue Errno::EPIPE
32
- # This happens if a thor task is piped to something like `head`,
33
- # which closes the pipe when it's done reading. This will also
34
- # mean that if the pipe is closed, further unnecessary
35
- # computation will not occur.
36
- exit(0)
37
31
  end
38
32
 
39
- # We overwrite this method so namespace is shown
33
+ # We overwrite this method so namespace is show
40
34
  # shelly *backup* restore FILENAME
41
- def handle_argument_error(task, error, arity = nil)
42
- banner = self.banner(task, nil, self.to_s != 'Shelly::CLI::Main')
43
- raise InvocationError, "#{task.name.inspect} was called incorrectly. Call as `#{banner}`"
44
- end
45
-
46
- protected
47
- # this has to overwritten so that in tests args are passed correctly
48
- # only change is the commented line
49
- # its for some edge cases when boolean options are passed in some
50
- # strange order
51
- def dispatch(meth, given_args, given_opts, config) #:nodoc:
52
- meth ||= retrieve_task_name(given_args)
53
- task = all_tasks[normalize_task_name(meth)]
54
-
55
- if task
56
- args, opts = Thor::Options.split(given_args)
57
- else
58
- args, opts = given_args, nil
59
- task = Thor::DynamicTask.new(meth)
60
- end
61
-
62
- opts = given_opts || opts || []
63
- config.merge!(:current_task => task, :task_options => task.options)
64
-
65
- instance = new(args, opts, config)
66
- yield instance if block_given?
67
- # args = instance.args
68
- trailing = args[Range.new(arguments.size, -1)]
69
-
70
- instance.invoke_task(task, trailing || [])
35
+ def handle_argument_error(task, error)
36
+ raise InvocationError, "#{task.name.inspect} was called incorrectly. Call as #{self.banner(task, nil, self.to_s != 'Shelly::CLI::Main').inspect}."
71
37
  end
72
38
  end
73
39
  end
data/shelly.gemspec CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |s|
14
14
  s.rubyforge_project = "shelly"
15
15
  s.add_development_dependency "rspec", "~> 2.11.0"
16
16
  s.add_development_dependency "rake"
17
+ s.add_development_dependency "guard"
18
+ s.add_development_dependency "guard-rspec"
17
19
  s.add_development_dependency "simplecov"
18
20
  if RUBY_PLATFORM =~ /darwin/
19
21
  s.add_development_dependency "ruby_gntp"
@@ -21,7 +23,7 @@ Gem::Specification.new do |s|
21
23
  end
22
24
  s.add_development_dependency "fakefs"
23
25
  s.add_development_dependency "fakeweb"
24
- s.add_runtime_dependency "thor", "~> 0.15.4"
26
+ s.add_runtime_dependency "wijet-thor", "~> 0.14.7"
25
27
  s.add_runtime_dependency "rest-client"
26
28
  s.add_runtime_dependency "json"
27
29
  s.add_runtime_dependency "progressbar"
@@ -29,6 +29,7 @@ describe Shelly::CLI::Files do
29
29
 
30
30
  it "should exit if rsync isn't installed" do
31
31
  FakeFS::File.stub(:executable?).and_return(false)
32
+
32
33
  $stdout.should_receive(:puts).with(red "You need to install rsync in order to upload and download files")
33
34
  lambda { invoke(@cli_files, :upload, "some/path") }.should raise_error(SystemExit)
34
35
  end
@@ -1402,20 +1402,6 @@ We have been notified about it. We will be adding new resources shortly")
1402
1402
  end
1403
1403
  end
1404
1404
 
1405
- context "when mysql gem exists" do
1406
- it "should show that mysql gem is not supported by Shelly Cloud" do
1407
- Bundler::Definition.stub_chain(:build, :specs, :map).and_return(["mysql"])
1408
- $stdout.should_receive(:puts).with(" #{red("✗")} mysql driver present in the Gemfile (not supported on Shelly Cloud)")
1409
- invoke(@main, :check)
1410
- end
1411
-
1412
- it "should show that mysql2 gem is not supported by Shelly Cloud" do
1413
- Bundler::Definition.stub_chain(:build, :specs, :map).and_return(["mysql2"])
1414
- $stdout.should_receive(:puts).with(" #{red("✗")} mysql driver present in the Gemfile (not supported on Shelly Cloud)")
1415
- invoke(@main, :check)
1416
- end
1417
- end
1418
-
1419
1405
  context "when bundler raise error" do
1420
1406
  it "should display error message" do
1421
1407
  exception = Bundler::BundlerError.new('Bundler error')
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.25
4
+ version: 0.1.26
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -43,6 +43,38 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: guard
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: guard-rspec
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
46
78
  - !ruby/object:Gem::Dependency
47
79
  name: simplecov
48
80
  requirement: !ruby/object:Gem::Requirement
@@ -124,13 +156,13 @@ dependencies:
124
156
  - !ruby/object:Gem::Version
125
157
  version: '0'
126
158
  - !ruby/object:Gem::Dependency
127
- name: thor
159
+ name: wijet-thor
128
160
  requirement: !ruby/object:Gem::Requirement
129
161
  none: false
130
162
  requirements:
131
163
  - - ~>
132
164
  - !ruby/object:Gem::Version
133
- version: 0.15.4
165
+ version: 0.14.7
134
166
  type: :runtime
135
167
  prerelease: false
136
168
  version_requirements: !ruby/object:Gem::Requirement
@@ -138,7 +170,7 @@ dependencies:
138
170
  requirements:
139
171
  - - ~>
140
172
  - !ruby/object:Gem::Version
141
- version: 0.15.4
173
+ version: 0.14.7
142
174
  - !ruby/object:Gem::Dependency
143
175
  name: rest-client
144
176
  requirement: !ruby/object:Gem::Requirement
@@ -247,6 +279,7 @@ files:
247
279
  - .travis.yml
248
280
  - CHANGELOG.md
249
281
  - Gemfile
282
+ - Guardfile
250
283
  - README.md
251
284
  - Rakefile
252
285
  - bin/shelly
@@ -274,6 +307,7 @@ files:
274
307
  - lib/shelly/user.rb
275
308
  - lib/shelly/version.rb
276
309
  - lib/thor/arguments.rb
310
+ - lib/thor/basic.rb
277
311
  - lib/thor/options.rb
278
312
  - lib/thor/thor.rb
279
313
  - scrolls/shellycloud.rb