shelly 0.2.8 → 0.2.9

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.2.9 / 2013-03-14
2
+
3
+ * [feature] Added force option (skip confirmation question) for `shelly file delete`
4
+
1
5
  ## 0.2.8 / 2013-03-12
2
6
 
3
7
  * Requires newer version of wijet-thor
@@ -31,13 +31,17 @@ module Shelly
31
31
  say_error "Cloud #{app} is not running. Cannot download files."
32
32
  end
33
33
 
34
+ method_option :force, :type => :boolean, :aliases => "-f",
35
+ :desc => "Skip confirmation question"
34
36
  desc "delete PATH", "Delete files from persistent data storage"
35
37
  def delete(path)
36
38
  app = multiple_clouds(options[:cloud], "file delete #{path}")
37
39
 
38
- question = "Do you want to permanently delete #{path} (yes/no):"
39
- delete_files = ask(question)
40
- exit 1 unless delete_files == "yes"
40
+ unless options[:force]
41
+ question = "Do you want to permanently delete #{path} (yes/no):"
42
+ delete_files = ask(question)
43
+ exit 1 unless delete_files == "yes"
44
+ end
41
45
 
42
46
  app.delete_file(path)
43
47
  rescue Client::ConflictException
@@ -1,3 +1,3 @@
1
1
  module Shelly
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -5,6 +5,7 @@ describe Shelly::CLI::File do
5
5
  before do
6
6
  FileUtils.stub(:chmod)
7
7
  @cli_files = Shelly::CLI::File.new
8
+ Shelly::CLI::File.stub(:new).and_return(@cli_files)
8
9
  @client = mock
9
10
  Shelly::Client.stub(:new).and_return(@client)
10
11
  @client.stub(:token).and_return("abc")
@@ -75,27 +76,37 @@ describe Shelly::CLI::File do
75
76
  hooks(@cli_files, :download).should include(:logged_in?)
76
77
  end
77
78
 
78
- it "should ask about delete application parts" do
79
- $stdout.should_receive(:print).with("Do you want to permanently delete some/path (yes/no): ")
80
- fake_stdin(["yes"]) do
79
+ context "with --force option" do
80
+ it "should delete files without confirmation" do
81
+ @cli_files.options = {:force => true}
82
+ @app.should_receive(:delete_file).with("some/path")
81
83
  invoke(@cli_files, :delete, "some/path")
82
84
  end
83
85
  end
84
86
 
85
- it "should delete files" do
86
- @app.should_receive(:delete_file).with("some/path")
87
- fake_stdin(["yes"]) do
88
- invoke(@cli_files, :delete, "some/path")
87
+ context "without --force option" do
88
+ it "should ask about delete application parts" do
89
+ $stdout.should_receive(:print).with("Do you want to permanently delete some/path (yes/no): ")
90
+ fake_stdin(["yes"]) do
91
+ invoke(@cli_files, :delete, "some/path")
92
+ end
89
93
  end
90
- end
91
94
 
92
- it "should return exit 1 when user doesn't type 'yes'" do
93
- @app.should_not_receive(:delete_file)
94
- lambda{
95
- fake_stdin(["no"]) do
95
+ it "should delete files" do
96
+ @app.should_receive(:delete_file).with("some/path")
97
+ fake_stdin(["yes"]) do
96
98
  invoke(@cli_files, :delete, "some/path")
97
99
  end
98
- }.should raise_error(SystemExit)
100
+ end
101
+
102
+ it "should return exit 1 when user doesn't type 'yes'" do
103
+ @app.should_not_receive(:delete_file)
104
+ lambda{
105
+ fake_stdin(["no"]) do
106
+ invoke(@cli_files, :delete, "some/path")
107
+ end
108
+ }.should raise_error(SystemExit)
109
+ end
99
110
  end
100
111
  end
101
112
  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.2.8
4
+ version: 0.2.9
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-03-12 00:00:00.000000000 Z
12
+ date: 2013-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -91,38 +91,6 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
- - !ruby/object:Gem::Dependency
95
- name: ruby_gntp
96
- requirement: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ! '>='
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
- requirements:
107
- - - ! '>='
108
- - !ruby/object:Gem::Version
109
- version: '0'
110
- - !ruby/object:Gem::Dependency
111
- name: rb-fsevent
112
- requirement: !ruby/object:Gem::Requirement
113
- none: false
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
- requirements:
123
- - - ! '>='
124
- - !ruby/object:Gem::Version
125
- version: '0'
126
94
  - !ruby/object:Gem::Dependency
127
95
  name: fakefs
128
96
  requirement: !ruby/object:Gem::Requirement
@@ -317,7 +285,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
317
285
  version: '0'
318
286
  segments:
319
287
  - 0
320
- hash: -3129673927878389756
288
+ hash: -2937366910932237187
321
289
  required_rubygems_version: !ruby/object:Gem::Requirement
322
290
  none: false
323
291
  requirements:
@@ -326,32 +294,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
326
294
  version: '0'
327
295
  segments:
328
296
  - 0
329
- hash: -3129673927878389756
297
+ hash: -2937366910932237187
330
298
  requirements: []
331
299
  rubyforge_project: shelly
332
- rubygems_version: 1.8.25
300
+ rubygems_version: 1.8.24
333
301
  signing_key:
334
302
  specification_version: 3
335
303
  summary: Shelly Cloud command line tool
336
- test_files:
337
- - spec/helpers.rb
338
- - spec/input_faker.rb
339
- - spec/shelly/app_spec.rb
340
- - spec/shelly/backup_spec.rb
341
- - spec/shelly/cli/backup_spec.rb
342
- - spec/shelly/cli/config_spec.rb
343
- - spec/shelly/cli/deploy_spec.rb
344
- - spec/shelly/cli/file_spec.rb
345
- - spec/shelly/cli/main_spec.rb
346
- - spec/shelly/cli/organization_spec.rb
347
- - spec/shelly/cli/runner_spec.rb
348
- - spec/shelly/cli/user_spec.rb
349
- - spec/shelly/client_spec.rb
350
- - spec/shelly/cloudfile_spec.rb
351
- - spec/shelly/download_progress_bar_spec.rb
352
- - spec/shelly/model_spec.rb
353
- - spec/shelly/organization_spec.rb
354
- - spec/shelly/structure_validator_spec.rb
355
- - spec/shelly/user_spec.rb
356
- - spec/spec_helper.rb
357
- - spec/thor/options_spec.rb
304
+ test_files: []