smallcage 0.2.4 → 0.2.5

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.
Files changed (67) hide show
  1. data/.gitignore +1 -0
  2. data/.rubocop.yml +8 -0
  3. data/.travis.yml +1 -1
  4. data/Gemfile +16 -5
  5. data/Guardfile +4 -0
  6. data/History.rdoc +9 -5
  7. data/README.rdoc +3 -3
  8. data/Rakefile +1 -1
  9. data/bin/smc +4 -12
  10. data/lib/smallcage.rb +4 -1
  11. data/lib/smallcage/anonymous_loader.rb +32 -0
  12. data/lib/smallcage/application.rb +4 -5
  13. data/lib/smallcage/commands/auto.rb +16 -17
  14. data/lib/smallcage/commands/base.rb +4 -5
  15. data/lib/smallcage/commands/clean.rb +5 -5
  16. data/lib/smallcage/commands/export.rb +5 -5
  17. data/lib/smallcage/commands/import.rb +25 -27
  18. data/lib/smallcage/commands/manifest.rb +4 -4
  19. data/lib/smallcage/commands/server.rb +4 -4
  20. data/lib/smallcage/commands/update.rb +4 -5
  21. data/lib/smallcage/commands/uri.rb +3 -5
  22. data/lib/smallcage/document_path.rb +6 -9
  23. data/lib/smallcage/http_server.rb +9 -10
  24. data/lib/smallcage/loader.rb +19 -49
  25. data/lib/smallcage/misc.rb +1 -1
  26. data/lib/smallcage/renderer.rb +1 -1
  27. data/lib/smallcage/resources/auto.html +7 -7
  28. data/lib/smallcage/runner.rb +6 -6
  29. data/lib/smallcage/update_list.rb +2 -3
  30. data/lib/smallcage/version.rb +1 -1
  31. data/project/base/_smc/helpers/base_helper.rb +8 -9
  32. data/project/bluecloth/_smc/helpers/blue_cloth_helper.rb +2 -3
  33. data/project/cache/_smc/filters/cache_filter.rb +10 -12
  34. data/project/cache/_smc/rakelib/cache.rake +7 -8
  35. data/project/gdata/_smc/rakelib/gdata.rake +3 -5
  36. data/project/lang/_smc/helpers/lang_helper.rb +3 -3
  37. data/project/news/_smc/helpers/news_helper.rb +3 -4
  38. data/project/nkf/_smc/filters/nkf_filter.rb +6 -6
  39. data/project/nkf/_smc/helpers/nkf_helper.rb +8 -9
  40. data/project/rake/_smc/rakelib/svn.rake +5 -6
  41. data/project/redcloth/_smc/helpers/red_cloth_helper.rb +3 -3
  42. data/project/standard/_smc/helpers/menu_helper.rb +4 -5
  43. data/project/standard/_smc/templates/redirect.rhtml +1 -1
  44. data/spec/data/anonymous_loader/1/error1.rb +1 -0
  45. data/spec/data/anonymous_loader/1/error2.rb +1 -0
  46. data/spec/data/anonymous_loader/1/test1.rb +1 -0
  47. data/spec/data/anonymous_loader/1/test2.rb +1 -0
  48. data/spec/lib/smallcage/anonymous_loader_spec.rb +37 -0
  49. data/spec/lib/smallcage/application_spec.rb +271 -0
  50. data/spec/{smallcage → lib/smallcage}/commands/auto_spec.rb +0 -0
  51. data/spec/{export_spec.rb → lib/smallcage/commands/export_spec.rb} +8 -10
  52. data/spec/{import_spec.rb → lib/smallcage/commands/import_spec.rb} +5 -6
  53. data/spec/{manifest_spec.rb → lib/smallcage/commands/manifest_spec.rb} +4 -3
  54. data/spec/{smallcage → lib/smallcage}/commands/server_spec.rb +0 -0
  55. data/spec/{update_spec.rb → lib/smallcage/commands/update_spec.rb} +15 -19
  56. data/spec/{uri_spec.rb → lib/smallcage/commands/uri_spec.rb} +3 -4
  57. data/spec/{document_path_spec.rb → lib/smallcage/document_path_spec.rb} +19 -31
  58. data/spec/{loader_spec.rb → lib/smallcage/loader_spec.rb} +16 -18
  59. data/spec/lib/smallcage/misc_spec.rb +18 -0
  60. data/spec/{update_list_spec.rb → lib/smallcage/update_list_spec.rb} +18 -21
  61. data/spec/{smallcage_spec.rb → lib/smallcage_spec.rb} +1 -1
  62. data/spec/spec_helper.rb +5 -4
  63. metadata +85 -55
  64. checksums.yaml +0 -7
  65. data/Gemfile.lock +0 -32
  66. data/spec/misc_spec.rb +0 -25
  67. data/spec/smallcage/application_spec.rb +0 -271
@@ -6,5 +6,5 @@ describe "smallcage" do
6
6
  it "show version" do
7
7
  # puts "------- version:" + SmallCage::VERSION
8
8
  end
9
-
9
+
10
10
  end
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,11 @@
1
- if RUBY_VERSION >= "1.9.0"
1
+ if RUBY_VERSION >= '1.9.3'
2
2
  require 'simplecov'
3
3
  SimpleCov.start do
4
- add_filter "spec"
4
+ add_filter 'spec'
5
5
  end
6
6
  end
7
7
 
8
- # required to execute rcov rake task.
9
- require "rspec/core"
8
+ SPEC_DATA_DIR = File.join(File.dirname(__FILE__), 'data')
10
9
 
10
+ # required to execute rcov rake task.
11
+ require 'rspec/core'
metadata CHANGED
@@ -1,34 +1,42 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: smallcage
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.4
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 5
10
+ version: 0.2.5
5
11
  platform: ruby
6
- authors:
12
+ authors:
7
13
  - SAITO Toshihiro
8
14
  - gommmmmm
9
15
  - KOSEKI Kengo
10
16
  autorequire:
11
17
  bindir: bin
12
18
  cert_chain: []
13
- date: 2014-01-06 00:00:00.000000000 Z
19
+
20
+ date: 2014-03-08 00:00:00 +09:00
21
+ default_executable:
14
22
  dependencies: []
15
- description: SmallCage is a simple, but powerful website generator. It converts content
16
- and template files, which has common elements in a website, to a plain, static website.
17
- No database, no application container, and no repeat in many pages is needed. You
18
- can keep your site well with very little work.
19
- email:
23
+
24
+ description: SmallCage is a simple, but powerful website generator. It converts content and template files, which has common elements in a website, to a plain, static website. No database, no application container, and no repeat in many pages is needed. You can keep your site well with very little work.
25
+ email:
20
26
  - smallcage@googlegroups.com
21
- executables:
27
+ executables:
22
28
  - smc
23
- extensions:
29
+ extensions:
24
30
  - ext/mkrf_conf.rb
25
31
  extra_rdoc_files: []
26
- files:
32
+
33
+ files:
27
34
  - .gitignore
28
35
  - .rspec
36
+ - .rubocop.yml
29
37
  - .travis.yml
30
38
  - Gemfile
31
- - Gemfile.lock
39
+ - Guardfile
32
40
  - History.rdoc
33
41
  - License.txt
34
42
  - README.rdoc
@@ -36,6 +44,7 @@ files:
36
44
  - bin/smc
37
45
  - ext/mkrf_conf.rb
38
46
  - lib/smallcage.rb
47
+ - lib/smallcage/anonymous_loader.rb
39
48
  - lib/smallcage/application.rb
40
49
  - lib/smallcage/commands/auto.rb
41
50
  - lib/smallcage/commands/base.rb
@@ -116,6 +125,10 @@ files:
116
125
  - project/tutorial2/tutorial2/priorities.txt.smc
117
126
  - project/tutorial2/tutorial2/vars.txt.smc
118
127
  - smallcage.gemspec
128
+ - spec/data/anonymous_loader/1/error1.rb
129
+ - spec/data/anonymous_loader/1/error2.rb
130
+ - spec/data/anonymous_loader/1/test1.rb
131
+ - spec/data/anonymous_loader/1/test2.rb
119
132
  - spec/data/htdocs1/_dir.smc
120
133
  - spec/data/htdocs1/_smc/.gitignore
121
134
  - spec/data/htdocs1/_smc/filters/filters.yml
@@ -142,44 +155,60 @@ files:
142
155
  - spec/data/multifiles/index.html.smc
143
156
  - spec/data/multifiles/items/index.html.smc
144
157
  - spec/data/updatelists/list1.yml
145
- - spec/document_path_spec.rb
146
- - spec/export_spec.rb
147
- - spec/import_spec.rb
148
- - spec/loader_spec.rb
149
- - spec/manifest_spec.rb
150
- - spec/misc_spec.rb
151
- - spec/smallcage/application_spec.rb
152
- - spec/smallcage/commands/auto_spec.rb
153
- - spec/smallcage/commands/server_spec.rb
154
- - spec/smallcage_spec.rb
158
+ - spec/lib/smallcage/anonymous_loader_spec.rb
159
+ - spec/lib/smallcage/application_spec.rb
160
+ - spec/lib/smallcage/commands/auto_spec.rb
161
+ - spec/lib/smallcage/commands/export_spec.rb
162
+ - spec/lib/smallcage/commands/import_spec.rb
163
+ - spec/lib/smallcage/commands/manifest_spec.rb
164
+ - spec/lib/smallcage/commands/server_spec.rb
165
+ - spec/lib/smallcage/commands/update_spec.rb
166
+ - spec/lib/smallcage/commands/uri_spec.rb
167
+ - spec/lib/smallcage/document_path_spec.rb
168
+ - spec/lib/smallcage/loader_spec.rb
169
+ - spec/lib/smallcage/misc_spec.rb
170
+ - spec/lib/smallcage/update_list_spec.rb
171
+ - spec/lib/smallcage_spec.rb
155
172
  - spec/spec_helper.rb
156
- - spec/update_list_spec.rb
157
- - spec/update_spec.rb
158
- - spec/uri_spec.rb
173
+ has_rdoc: true
159
174
  homepage: http://www.smallcage.org
160
175
  licenses: []
161
- metadata: {}
176
+
162
177
  post_install_message:
163
178
  rdoc_options: []
164
- require_paths:
179
+
180
+ require_paths:
165
181
  - lib
166
- required_ruby_version: !ruby/object:Gem::Requirement
167
- requirements:
168
- - - '>='
169
- - !ruby/object:Gem::Version
170
- version: '0'
171
- required_rubygems_version: !ruby/object:Gem::Requirement
172
- requirements:
173
- - - '>='
174
- - !ruby/object:Gem::Version
175
- version: '0'
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ none: false
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ hash: 3
188
+ segments:
189
+ - 0
190
+ version: "0"
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ none: false
193
+ requirements:
194
+ - - ">="
195
+ - !ruby/object:Gem::Version
196
+ hash: 3
197
+ segments:
198
+ - 0
199
+ version: "0"
176
200
  requirements: []
201
+
177
202
  rubyforge_project:
178
- rubygems_version: 2.0.14
203
+ rubygems_version: 1.6.2
179
204
  signing_key:
180
- specification_version: 4
205
+ specification_version: 3
181
206
  summary: a simple website generator
182
- test_files:
207
+ test_files:
208
+ - spec/data/anonymous_loader/1/error1.rb
209
+ - spec/data/anonymous_loader/1/error2.rb
210
+ - spec/data/anonymous_loader/1/test1.rb
211
+ - spec/data/anonymous_loader/1/test2.rb
183
212
  - spec/data/htdocs1/_dir.smc
184
213
  - spec/data/htdocs1/_smc/.gitignore
185
214
  - spec/data/htdocs1/_smc/filters/filters.yml
@@ -206,17 +235,18 @@ test_files:
206
235
  - spec/data/multifiles/index.html.smc
207
236
  - spec/data/multifiles/items/index.html.smc
208
237
  - spec/data/updatelists/list1.yml
209
- - spec/document_path_spec.rb
210
- - spec/export_spec.rb
211
- - spec/import_spec.rb
212
- - spec/loader_spec.rb
213
- - spec/manifest_spec.rb
214
- - spec/misc_spec.rb
215
- - spec/smallcage/application_spec.rb
216
- - spec/smallcage/commands/auto_spec.rb
217
- - spec/smallcage/commands/server_spec.rb
218
- - spec/smallcage_spec.rb
238
+ - spec/lib/smallcage/anonymous_loader_spec.rb
239
+ - spec/lib/smallcage/application_spec.rb
240
+ - spec/lib/smallcage/commands/auto_spec.rb
241
+ - spec/lib/smallcage/commands/export_spec.rb
242
+ - spec/lib/smallcage/commands/import_spec.rb
243
+ - spec/lib/smallcage/commands/manifest_spec.rb
244
+ - spec/lib/smallcage/commands/server_spec.rb
245
+ - spec/lib/smallcage/commands/update_spec.rb
246
+ - spec/lib/smallcage/commands/uri_spec.rb
247
+ - spec/lib/smallcage/document_path_spec.rb
248
+ - spec/lib/smallcage/loader_spec.rb
249
+ - spec/lib/smallcage/misc_spec.rb
250
+ - spec/lib/smallcage/update_list_spec.rb
251
+ - spec/lib/smallcage_spec.rb
219
252
  - spec/spec_helper.rb
220
- - spec/update_list_spec.rb
221
- - spec/update_spec.rb
222
- - spec/uri_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: f24d43ad677982a42a7f5907c8546df0cb653642
4
- data.tar.gz: 7f9356084a5e6a3c4e68883e3be78ba7374a6c39
5
- SHA512:
6
- metadata.gz: dc9e6a097c1156d80cdbfb07950a4d3f7811f9255ce2b366aef604fbf2065a5483979498d4fbc21716aa067df124a2eca2daeb5f99af214d49403f820522ad41
7
- data.tar.gz: 4798d0500f6281ebc18a0a6ac0f1af91adb03971c785ed759fa57b7526bea722775c0e75c8179e793f1b904f038aabc9f63108360add07cc25c0c5779692d75c
data/Gemfile.lock DELETED
@@ -1,32 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- diff-lcs (1.2.5)
5
- docile (1.1.1)
6
- multi_json (1.8.2)
7
- rake (10.1.1)
8
- rcov (1.0.0)
9
- rspec (2.14.1)
10
- rspec-core (~> 2.14.0)
11
- rspec-expectations (~> 2.14.0)
12
- rspec-mocks (~> 2.14.0)
13
- rspec-core (2.14.7)
14
- rspec-expectations (2.14.4)
15
- diff-lcs (>= 1.1.3, < 2.0)
16
- rspec-mocks (2.14.4)
17
- simplecov (0.8.2)
18
- docile (~> 1.1.0)
19
- multi_json
20
- simplecov-html (~> 0.8.0)
21
- simplecov-html (0.8.0)
22
- syck (1.0.1)
23
-
24
- PLATFORMS
25
- ruby
26
-
27
- DEPENDENCIES
28
- rake
29
- rcov
30
- rspec
31
- simplecov
32
- syck
data/spec/misc_spec.rb DELETED
@@ -1,25 +0,0 @@
1
- require 'spec_helper.rb'
2
- require 'smallcage'
3
-
4
- describe "misc" do
5
-
6
- it "should camelize String" do
7
- s = "smallcage"
8
- s.camelize.should == "Smallcage"
9
-
10
- s = "abc_def_ghi"
11
- s.camelize.should == "AbcDefGhi"
12
-
13
- s = ""
14
- s.camelize.should == ""
15
- end
16
-
17
- it "should camelize with first character in lower case" do
18
- s = "smallcage"
19
- s.camelize(false).should == "smallcage"
20
-
21
- s = "abc_def_ghi"
22
- s.camelize(false).should == "abcDefGhi"
23
- end
24
-
25
- end
@@ -1,271 +0,0 @@
1
- require 'spec_helper.rb'
2
- require 'smallcage'
3
-
4
- describe SmallCage::Application do
5
-
6
- def capture_result
7
- status = nil
8
- result = nil
9
- tmpout = StringIO.new
10
- tmperr = StringIO.new
11
- original_out, $stdout = $stdout, tmpout
12
- original_err, $stderr = $stderr, tmperr
13
- begin
14
- result = yield
15
- rescue SystemExit => e
16
- status = e.status
17
- ensure
18
- $stdout = original_out
19
- $stderr = original_err
20
- end
21
-
22
- return {
23
- :exit => status,
24
- :result => result,
25
- :stdout => tmpout.string,
26
- :stderr => tmperr.string
27
- }
28
- end
29
-
30
- before(:each) do
31
- @target = SmallCage::Application.new
32
- end
33
-
34
- it "should parse update command" do
35
- options = @target.parse_options(["update", "."])
36
- options.should == { :path => ".", :command => :update, :quiet => false }
37
-
38
- options = @target.parse_options(["up", "."])
39
- options.should == { :path => ".", :command => :update, :quiet => false }
40
- end
41
-
42
- it "should parse clean command" do
43
- options = @target.parse_options(["clean", "."])
44
- options.should == { :path => ".", :command => :clean, :quiet => false }
45
- end
46
-
47
- it "should parse server command" do
48
- options = @target.parse_options(["server", "."])
49
- options.should == { :path => ".", :command => :server, :quiet => false, :port => 8080 } # num
50
-
51
- options = @target.parse_options(["sv", ".", "8080"])
52
- options.should == { :path => ".", :command => :server, :quiet => false, :port => 8080 } # string
53
- end
54
-
55
- it "should accept only number port" do
56
- result = capture_result { @target.parse_options(["server", ".", "pot"]) }
57
- result[:exit].should == 1
58
- result[:stdout].should be_empty
59
- result[:stderr].should == "illegal port number: pot\n"
60
- end
61
-
62
- it "should not accept port 0" do
63
- result = capture_result { @target.parse_options(["server", ".", "0"]) }
64
- result[:exit].should == 1
65
- result[:stdout].should be_empty
66
- result[:stderr].should == "illegal port number: 0\n"
67
- end
68
-
69
- it "should parse auto command" do
70
- options = @target.parse_options(["auto", "."])
71
- options.should == { :path => ".", :command => :auto, :port => nil, :bell => false, :quiet => false }
72
-
73
- options = @target.parse_options(["au", ".", "8080"])
74
- options.should == { :path => ".", :command => :auto, :port => 8080, :bell => false, :quiet => false }
75
- end
76
-
77
- it "should parse import command" do
78
- options = @target.parse_options(["import", "base", "."])
79
- options.should == { :command => :import, :from => "base", :to => ".", :quiet => false }
80
-
81
- options = @target.parse_options(["import"])
82
- options.should == { :command => :import, :from => "default", :to => ".", :quiet => false }
83
- end
84
-
85
- it "should parse export command" do
86
- options = @target.parse_options(["export", ".", "path"])
87
- options.should == { :command => :export, :path => ".", :out => "path", :quiet => false }
88
-
89
- options = @target.parse_options(["export"])
90
- options.should == { :command => :export, :path => ".", :out => nil, :quiet => false }
91
- end
92
-
93
- it "should parse uri command" do
94
- options = @target.parse_options(["uri", "./path/to/target"])
95
- options.should == { :command => :uri, :path => "./path/to/target", :quiet => false }
96
-
97
- options = @target.parse_options(["uri"])
98
- options.should == { :command => :uri, :path => ".", :quiet => false }
99
- end
100
-
101
- it "should parse manifest command" do
102
- options = @target.parse_options(["manifest", "./path/to/target"])
103
- options.should == { :command => :manifest, :path => "./path/to/target", :quiet => false }
104
-
105
- options = @target.parse_options(["manifest"])
106
- options.should == { :command => :manifest, :path => ".", :quiet => false }
107
- end
108
-
109
- it "should exit 1 if command is empty" do
110
- result = capture_result { @target.parse_options([]) }
111
- result[:exit].should == 1
112
- result[:stdout].should =~ /\AUsage:/
113
- result[:stdout].should =~ /^Subcommands are:/
114
- result[:stderr].should be_empty
115
- end
116
-
117
- it "should show help" do
118
- result = capture_result { @target.parse_options(["help"]) }
119
- result[:exit].should == 0
120
- result[:stdout].should =~ /\AUsage:/
121
- result[:stdout].should =~ /^Subcommands are:/
122
- result[:stderr].should be_empty
123
- end
124
-
125
- it "should show help if the arguments include --help" do
126
- result = capture_result { @target.parse_options(["--help", "update"]) }
127
- result[:exit].should == 0
128
- result[:stdout].should =~ /\AUsage:/
129
- result[:stdout].should =~ /^Subcommands are:/
130
- result[:stderr].should be_empty
131
- end
132
-
133
- it "should show subcommand help" do
134
- result = capture_result { @target.parse_options(["help", "update"]) }
135
- result[:exit].should == 0
136
- result[:stdout].should =~ /\AUsage: smc update \[path\]/
137
- result[:stderr].should be_empty
138
- end
139
-
140
- it "should exit if the command is unknown" do
141
- result = capture_result { @target.parse_options(["xxxx"]) }
142
- result[:exit].should == 1
143
- result[:stdout].should be_empty
144
- result[:stderr].should == "no such subcommand: xxxx\n"
145
- end
146
-
147
- it "should show version" do
148
- result = capture_result { @target.parse_options(["--version", "update"]) }
149
- result[:exit].should == 0
150
- result[:stdout].should =~ /\ASmallCage \d+\.\d+\.\d+ - /
151
- result[:stderr].should be_empty
152
- end
153
-
154
- it "should exit when subcommand is empty" do
155
- result = capture_result { @target.parse_options(["", "--version"]) }
156
- result[:exit].should == 1
157
- result[:stdout].should =~ /\AUsage:/
158
- result[:stdout].should =~ /^Subcommands are:/
159
- result[:stderr].should be_empty
160
- end
161
-
162
- it "should ignore subcommand with --version option" do
163
- result = capture_result { @target.parse_options(["help", "--version"]) }
164
- result[:exit].should == 0
165
- result[:stdout].should =~ /\ASmallCage \d+\.\d+\.\d+ - /
166
- result[:stderr].should be_empty
167
- end
168
-
169
- it "should ignore subcommand with -v option" do
170
- result = capture_result { @target.parse_options(["help", "-v"]) }
171
- result[:exit].should == 0
172
- result[:stdout].should =~ /\ASmallCage \d+\.\d+\.\d+ - /
173
- result[:stderr].should be_empty
174
- end
175
-
176
- it "should ignore subcommand with --help option" do
177
- result = capture_result { @target.parse_options(["update", "--help"]) }
178
- result[:exit].should == 0
179
- result[:stdout].should =~ /\AUsage: smc update \[path\] \[options\]/
180
- result[:stderr].should be_empty
181
- end
182
-
183
- it "should ignore subcommand with -h option" do
184
- result = capture_result { @target.parse_options(["update", "-h"]) }
185
- result[:exit].should == 0
186
- result[:stdout].should =~ /\AUsage: smc update \[path\] \[options\]/
187
- result[:stderr].should be_empty
188
- end
189
-
190
- it "should exit with unknown main option --QQQ" do
191
- result = capture_result { @target.parse_options(["--QQQ"]) }
192
- result[:exit].should == 1
193
- result[:stdout].should be_empty
194
- result[:stderr].should == "invalid option: --QQQ\n"
195
- end
196
-
197
- it "should exit with unknown sub option --QQQ" do
198
- result = capture_result { @target.parse_options(["update", "--QQQ"]) }
199
- result[:exit].should == 1
200
- result[:stdout].should be_empty
201
- result[:stderr].should == "invalid option: --QQQ\n"
202
- end
203
-
204
- it "should accept auto command --bell option" do
205
- result = capture_result { @target.parse_options(["auto", "--bell"]) }
206
- result[:exit].should == nil
207
- result[:stdout].should be_empty
208
- result[:stderr].should be_empty
209
- result[:result].should == {
210
- :command => :auto,
211
- :port => nil,
212
- :path => ".",
213
- :bell => true,
214
- :quiet => false,
215
- }
216
- end
217
-
218
- it "should set bell option false as default" do
219
- result = capture_result { @target.parse_options(["auto"]) }
220
- result[:exit].should == nil
221
- result[:stdout].should be_empty
222
- result[:stderr].should be_empty
223
- result[:result].should == {
224
- :command => :auto,
225
- :port => nil,
226
- :path => ".",
227
- :bell => false,
228
- :quiet => false,
229
- }
230
- end
231
-
232
- it "should accept --quiet option" do
233
- result = capture_result { @target.parse_options(["--quiet", "update"]) }
234
- result[:exit].should == nil
235
- result[:stdout].should be_empty
236
- result[:stderr].should be_empty
237
- result[:result].should == {
238
- :command => :update,
239
- :path => ".",
240
- :quiet => true,
241
- }
242
- end
243
-
244
- it "should accept --quiet option after subcommand" do
245
- result = capture_result { @target.parse_options(["update", "--quiet"]) }
246
- result[:exit].should == nil
247
- result[:stdout].should be_empty
248
- result[:stderr].should be_empty
249
- result[:result].should == {
250
- :command => :update,
251
- :path => ".",
252
- :quiet => true,
253
- }
254
- end
255
-
256
- it "should accept --quiet option before and after subcommand" do
257
- opts = ["--quiet", "auto", "--quiet", "path", "--bell", "80"]
258
- result = capture_result { @target.parse_options(opts) }
259
- result[:exit].should == nil
260
- result[:stdout].should be_empty
261
- result[:stderr].should be_empty
262
- result[:result].should == {
263
- :command => :auto,
264
- :path => "path",
265
- :port => 80,
266
- :bell => true,
267
- :quiet => true,
268
- }
269
- end
270
-
271
- end