usmu 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/.travis.yml +3 -0
  4. data/CHANGELOG.md +21 -0
  5. data/Gemfile +7 -0
  6. data/Guardfile +7 -7
  7. data/README.md +5 -1
  8. data/Rakefile +16 -5
  9. data/lib/usmu.rb +3 -1
  10. data/lib/usmu/configuration.rb +25 -13
  11. data/lib/usmu/deployment.rb +12 -0
  12. data/lib/usmu/deployment/directory_diff.rb +64 -0
  13. data/lib/usmu/deployment/remote_file_interface.rb +25 -0
  14. data/lib/usmu/plugin.rb +5 -1
  15. data/lib/usmu/template/layout.rb +24 -17
  16. data/lib/usmu/version.rb +1 -1
  17. data/{test/spec → spec}/acceptance/full_site_build.feature +2 -2
  18. data/{test/spec → spec}/acceptance/steps/full_site_build_steps.rb +0 -0
  19. data/spec/configuration_spec.rb +257 -0
  20. data/spec/deployment/directory_diff_spec.rb +126 -0
  21. data/{test/spec → spec}/mock/usmu/mock_plugin.rb +0 -0
  22. data/spec/mock/usmu/mock_remote_files.rb +19 -0
  23. data/{test/spec → spec}/plugin/core_spec.rb +0 -0
  24. data/{test/spec → spec}/plugin_spec.rb +0 -0
  25. data/{test/spec → spec}/site_generator_spec.rb +1 -1
  26. data/{test/spec → spec}/spec_helper.rb +18 -4
  27. data/{test/spec → spec}/support/shared_layout.rb +0 -0
  28. data/{test/spec → spec}/template/layout_spec.rb +1 -1
  29. data/{test/spec → spec}/template/page_spec.rb +0 -0
  30. data/{test/spec → spec}/template/static_file_spec.rb +2 -2
  31. data/{test/spec → spec}/ui/console_spec.rb +4 -4
  32. data/{test/expected-site → test-site/content}/.dotfiletest.txt +0 -0
  33. data/{test/site → test-site}/content/css/_partial.scss +0 -0
  34. data/{test/site → test-site}/content/css/app.scss +0 -0
  35. data/{test/site → test-site}/content/default.md +0 -0
  36. data/{test/site → test-site}/content/embedded.md +0 -0
  37. data/{test/site → test-site}/content/embedded.meta.yml +0 -0
  38. data/{test/site → test-site}/content/index.md +0 -0
  39. data/{test/site → test-site}/content/index.meta.yml +0 -0
  40. data/{test/site → test-site}/content/posts/test-post.md +0 -0
  41. data/{test/expected-site → test-site/content}/robots.txt +0 -0
  42. data/{test/site/content → test-site/expected-site}/.dotfiletest.txt +0 -0
  43. data/{test → test-site}/expected-site/css/app.css +0 -0
  44. data/{test → test-site}/expected-site/default.html +0 -0
  45. data/{test → test-site}/expected-site/embedded.html +0 -0
  46. data/{test → test-site}/expected-site/index.html +0 -0
  47. data/{test → test-site}/expected-site/posts/test-post.html +0 -0
  48. data/{test/site/content → test-site/expected-site}/robots.txt +0 -0
  49. data/{test/site → test-site}/includes/footer.meta.yml +0 -0
  50. data/{test/site → test-site}/includes/footer.slim +0 -0
  51. data/{test/site → test-site}/layouts/embedded.meta.yml +0 -0
  52. data/{test/site → test-site}/layouts/embedded.slim +0 -0
  53. data/{test/site → test-site}/layouts/html.slim +0 -0
  54. data/{test/site → test-site}/usmu.yml +0 -0
  55. data/usmu-jruby.gemspec +1 -0
  56. data/usmu.gemspec +1 -2
  57. metadata +73 -105
  58. data/.cane +0 -4
  59. data/.simplecov +0 -4
  60. data/test/spec/configuration_spec.rb +0 -176
@@ -20,7 +20,7 @@ RSpec.describe Usmu::Template::Layout do
20
20
  it 'should not allow circular references with #find_layout' do
21
21
  # This will also get tested during the acceptance tests, though we test here explicitly to help aid narrow where
22
22
  # the bug actually is.
23
- configuration = Usmu::Configuration.from_file('test/site/usmu.yml')
23
+ configuration = Usmu::Configuration.from_file('test-site/usmu.yml')
24
24
  layout = Usmu::Template::Layout.new(configuration, 'html.slim')
25
25
  end
26
26
 
@@ -4,12 +4,12 @@ require 'usmu/template/static_file'
4
4
  RSpec.describe Usmu::Template::StaticFile do
5
5
  it_behaves_like 'a renderable file'
6
6
 
7
- let(:configuration) { Usmu::Configuration.from_file('test/site/usmu.yml') }
7
+ let(:configuration) { Usmu::Configuration.from_file('test-site/usmu.yml') }
8
8
 
9
9
  it 'uses the \'source\' folder' do
10
10
  file = Usmu::Template::StaticFile.new(configuration, 'robots.txt')
11
11
  rendered = file.render
12
- expect(rendered).to eq(File.read('test/expected-site/robots.txt'))
12
+ expect(rendered).to eq(File.read('test-site/expected-site/robots.txt'))
13
13
  end
14
14
 
15
15
  it 'has an input path' do
@@ -5,21 +5,21 @@ Usmu.disable_stdout_logging
5
5
  RSpec.describe Usmu::Ui::Console do
6
6
  it 'supports --quiet' do
7
7
  expect(Usmu).to receive(:quiet_logging)
8
- Usmu::Ui::Console.new(%w{--quiet --config test/site/usmu.yml})
8
+ Usmu::Ui::Console.new(%w{--quiet --config test-site/usmu.yml})
9
9
  end
10
10
 
11
11
  it 'supports --log' do
12
12
  expect(Usmu).to receive(:add_file_logger).with('test.log')
13
- Usmu::Ui::Console.new(%w{--log test.log --config test/site/usmu.yml})
13
+ Usmu::Ui::Console.new(%w{--log test.log --config test-site/usmu.yml})
14
14
  end
15
15
 
16
16
  it 'supports --verbose' do
17
17
  expect(Usmu).to receive(:verbose_logging)
18
- Usmu::Ui::Console.new(%w{--verbose --config test/site/usmu.yml})
18
+ Usmu::Ui::Console.new(%w{--verbose --config test-site/usmu.yml})
19
19
  end
20
20
 
21
21
  it '#load_configuration returns a configuration' do
22
- config = Usmu::Ui::Console.new(%w{--config test/site/usmu.yml}).load_configuration('test/site/usmu.yml')
22
+ config = Usmu::Ui::Console.new(%w{--config test-site/usmu.yml}).load_configuration('test-site/usmu.yml')
23
23
  expect(config.class.name).to eq('Usmu::Configuration')
24
24
  end
25
25
  end
File without changes
@@ -39,4 +39,5 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency 'guard-rspec', '~> 4.3'
40
40
  spec.add_development_dependency 'turnip', '~> 1.2'
41
41
  spec.add_development_dependency 'sass', '~> 3.4'
42
+ spec.add_development_dependency 'timeout', '~> 0.0'
42
43
  end
@@ -33,11 +33,10 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rake', '~> 10.0'
34
34
  spec.add_development_dependency 'rspec', '~> 3.1'
35
35
  spec.add_development_dependency 'yard', '~> 0.8'
36
- spec.add_development_dependency 'cane', '~> 2.6'
37
- spec.add_development_dependency 'simplecov', '~> 0.9'
38
36
  spec.add_development_dependency 'guard', '~> 2.8'
39
37
  spec.add_development_dependency 'guard-rspec', '~> 4.3'
40
38
  spec.add_development_dependency 'libnotify', '~> 0.9'
41
39
  spec.add_development_dependency 'turnip', '~> 1.2'
42
40
  spec.add_development_dependency 'sass', '~> 3.4'
41
+ spec.add_development_dependency 'timeout', '~> 0.0'
43
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usmu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Scharley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-04 00:00:00.000000000 Z
11
+ date: 2015-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slim
@@ -156,34 +156,6 @@ dependencies:
156
156
  - - "~>"
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0.8'
159
- - !ruby/object:Gem::Dependency
160
- name: cane
161
- requirement: !ruby/object:Gem::Requirement
162
- requirements:
163
- - - "~>"
164
- - !ruby/object:Gem::Version
165
- version: '2.6'
166
- type: :development
167
- prerelease: false
168
- version_requirements: !ruby/object:Gem::Requirement
169
- requirements:
170
- - - "~>"
171
- - !ruby/object:Gem::Version
172
- version: '2.6'
173
- - !ruby/object:Gem::Dependency
174
- name: simplecov
175
- requirement: !ruby/object:Gem::Requirement
176
- requirements:
177
- - - "~>"
178
- - !ruby/object:Gem::Version
179
- version: '0.9'
180
- type: :development
181
- prerelease: false
182
- version_requirements: !ruby/object:Gem::Requirement
183
- requirements:
184
- - - "~>"
185
- - !ruby/object:Gem::Version
186
- version: '0.9'
187
159
  - !ruby/object:Gem::Dependency
188
160
  name: guard
189
161
  requirement: !ruby/object:Gem::Requirement
@@ -254,6 +226,20 @@ dependencies:
254
226
  - - "~>"
255
227
  - !ruby/object:Gem::Version
256
228
  version: '3.4'
229
+ - !ruby/object:Gem::Dependency
230
+ name: timeout
231
+ requirement: !ruby/object:Gem::Requirement
232
+ requirements:
233
+ - - "~>"
234
+ - !ruby/object:Gem::Version
235
+ version: '0.0'
236
+ type: :development
237
+ prerelease: false
238
+ version_requirements: !ruby/object:Gem::Requirement
239
+ requirements:
240
+ - - "~>"
241
+ - !ruby/object:Gem::Version
242
+ version: '0.0'
257
243
  description: |2
258
244
  Usmu is a static site generator built in Ruby that leverages the Tilt API to support many different template
259
245
  engines. It supports local generation but is designed to be used with the web-based editor.
@@ -264,10 +250,8 @@ executables:
264
250
  extensions: []
265
251
  extra_rdoc_files: []
266
252
  files:
267
- - ".cane"
268
253
  - ".gitignore"
269
254
  - ".rspec"
270
- - ".simplecov"
271
255
  - ".travis.yml"
272
256
  - ".yardopts"
273
257
  - CHANGELOG.md
@@ -281,6 +265,9 @@ files:
281
265
  - bin/usmu
282
266
  - lib/usmu.rb
283
267
  - lib/usmu/configuration.rb
268
+ - lib/usmu/deployment.rb
269
+ - lib/usmu/deployment/directory_diff.rb
270
+ - lib/usmu/deployment/remote_file_interface.rb
284
271
  - lib/usmu/plugin.rb
285
272
  - lib/usmu/plugin/core.rb
286
273
  - lib/usmu/plugin/core_hooks.rb
@@ -298,42 +285,44 @@ files:
298
285
  - share/init-site/layouts/html.slim
299
286
  - share/init-site/source/index.md
300
287
  - share/init-site/usmu.yml
301
- - test/expected-site/.dotfiletest.txt
302
- - test/expected-site/css/app.css
303
- - test/expected-site/default.html
304
- - test/expected-site/embedded.html
305
- - test/expected-site/index.html
306
- - test/expected-site/posts/test-post.html
307
- - test/expected-site/robots.txt
308
- - test/site/content/.dotfiletest.txt
309
- - test/site/content/css/_partial.scss
310
- - test/site/content/css/app.scss
311
- - test/site/content/default.md
312
- - test/site/content/embedded.md
313
- - test/site/content/embedded.meta.yml
314
- - test/site/content/index.md
315
- - test/site/content/index.meta.yml
316
- - test/site/content/posts/test-post.md
317
- - test/site/content/robots.txt
318
- - test/site/includes/footer.meta.yml
319
- - test/site/includes/footer.slim
320
- - test/site/layouts/embedded.meta.yml
321
- - test/site/layouts/embedded.slim
322
- - test/site/layouts/html.slim
323
- - test/site/usmu.yml
324
- - test/spec/acceptance/full_site_build.feature
325
- - test/spec/acceptance/steps/full_site_build_steps.rb
326
- - test/spec/configuration_spec.rb
327
- - test/spec/mock/usmu/mock_plugin.rb
328
- - test/spec/plugin/core_spec.rb
329
- - test/spec/plugin_spec.rb
330
- - test/spec/site_generator_spec.rb
331
- - test/spec/spec_helper.rb
332
- - test/spec/support/shared_layout.rb
333
- - test/spec/template/layout_spec.rb
334
- - test/spec/template/page_spec.rb
335
- - test/spec/template/static_file_spec.rb
336
- - test/spec/ui/console_spec.rb
288
+ - spec/acceptance/full_site_build.feature
289
+ - spec/acceptance/steps/full_site_build_steps.rb
290
+ - spec/configuration_spec.rb
291
+ - spec/deployment/directory_diff_spec.rb
292
+ - spec/mock/usmu/mock_plugin.rb
293
+ - spec/mock/usmu/mock_remote_files.rb
294
+ - spec/plugin/core_spec.rb
295
+ - spec/plugin_spec.rb
296
+ - spec/site_generator_spec.rb
297
+ - spec/spec_helper.rb
298
+ - spec/support/shared_layout.rb
299
+ - spec/template/layout_spec.rb
300
+ - spec/template/page_spec.rb
301
+ - spec/template/static_file_spec.rb
302
+ - spec/ui/console_spec.rb
303
+ - test-site/content/.dotfiletest.txt
304
+ - test-site/content/css/_partial.scss
305
+ - test-site/content/css/app.scss
306
+ - test-site/content/default.md
307
+ - test-site/content/embedded.md
308
+ - test-site/content/embedded.meta.yml
309
+ - test-site/content/index.md
310
+ - test-site/content/index.meta.yml
311
+ - test-site/content/posts/test-post.md
312
+ - test-site/content/robots.txt
313
+ - test-site/expected-site/.dotfiletest.txt
314
+ - test-site/expected-site/css/app.css
315
+ - test-site/expected-site/default.html
316
+ - test-site/expected-site/embedded.html
317
+ - test-site/expected-site/index.html
318
+ - test-site/expected-site/posts/test-post.html
319
+ - test-site/expected-site/robots.txt
320
+ - test-site/includes/footer.meta.yml
321
+ - test-site/includes/footer.slim
322
+ - test-site/layouts/embedded.meta.yml
323
+ - test-site/layouts/embedded.slim
324
+ - test-site/layouts/html.slim
325
+ - test-site/usmu.yml
337
326
  - usmu-jruby.gemspec
338
327
  - usmu.gemspec
339
328
  homepage: https://github.com/usmu/usmu
@@ -356,45 +345,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
345
  version: '0'
357
346
  requirements: []
358
347
  rubyforge_project:
359
- rubygems_version: 2.2.2
348
+ rubygems_version: 2.4.5
360
349
  signing_key:
361
350
  specification_version: 4
362
351
  summary: A static site generator with a web-based frontend for editing.
363
352
  test_files:
364
- - test/expected-site/.dotfiletest.txt
365
- - test/expected-site/css/app.css
366
- - test/expected-site/default.html
367
- - test/expected-site/embedded.html
368
- - test/expected-site/index.html
369
- - test/expected-site/posts/test-post.html
370
- - test/expected-site/robots.txt
371
- - test/site/content/.dotfiletest.txt
372
- - test/site/content/css/_partial.scss
373
- - test/site/content/css/app.scss
374
- - test/site/content/default.md
375
- - test/site/content/embedded.md
376
- - test/site/content/embedded.meta.yml
377
- - test/site/content/index.md
378
- - test/site/content/index.meta.yml
379
- - test/site/content/posts/test-post.md
380
- - test/site/content/robots.txt
381
- - test/site/includes/footer.meta.yml
382
- - test/site/includes/footer.slim
383
- - test/site/layouts/embedded.meta.yml
384
- - test/site/layouts/embedded.slim
385
- - test/site/layouts/html.slim
386
- - test/site/usmu.yml
387
- - test/spec/acceptance/full_site_build.feature
388
- - test/spec/acceptance/steps/full_site_build_steps.rb
389
- - test/spec/configuration_spec.rb
390
- - test/spec/mock/usmu/mock_plugin.rb
391
- - test/spec/plugin/core_spec.rb
392
- - test/spec/plugin_spec.rb
393
- - test/spec/site_generator_spec.rb
394
- - test/spec/spec_helper.rb
395
- - test/spec/support/shared_layout.rb
396
- - test/spec/template/layout_spec.rb
397
- - test/spec/template/page_spec.rb
398
- - test/spec/template/static_file_spec.rb
399
- - test/spec/ui/console_spec.rb
353
+ - spec/acceptance/full_site_build.feature
354
+ - spec/acceptance/steps/full_site_build_steps.rb
355
+ - spec/configuration_spec.rb
356
+ - spec/deployment/directory_diff_spec.rb
357
+ - spec/mock/usmu/mock_plugin.rb
358
+ - spec/mock/usmu/mock_remote_files.rb
359
+ - spec/plugin/core_spec.rb
360
+ - spec/plugin_spec.rb
361
+ - spec/site_generator_spec.rb
362
+ - spec/spec_helper.rb
363
+ - spec/support/shared_layout.rb
364
+ - spec/template/layout_spec.rb
365
+ - spec/template/page_spec.rb
366
+ - spec/template/static_file_spec.rb
367
+ - spec/ui/console_spec.rb
400
368
  has_rdoc:
data/.cane DELETED
@@ -1,4 +0,0 @@
1
- --color
2
- --max-violations 0
3
- --style-measure 120
4
- --abc-exclude Usmu::Layout#initialize
data/.simplecov DELETED
@@ -1,4 +0,0 @@
1
- SimpleCov.start do
2
- coverage_dir 'test/coverage'
3
- add_filter 'test/'
4
- end
@@ -1,176 +0,0 @@
1
- require 'usmu/configuration'
2
-
3
- RSpec.describe Usmu::Configuration do
4
- context 'should prepend configuration folder' do
5
- before do
6
- hash = {
7
- 'source' => 'source',
8
- 'destination' => 'destination',
9
- 'layouts' => 'templates',
10
- 'includes' => 'includes',
11
- }
12
- @configuration = Usmu::Configuration.from_hash(hash, 'test/usmu.yaml')
13
- end
14
-
15
- it 'to source' do
16
- expect(@configuration.source_path).to eq('test/source')
17
- end
18
-
19
- it 'to destination' do
20
- expect(@configuration.destination_path).to eq('test/destination')
21
- end
22
-
23
- it 'to layouts' do
24
- expect(@configuration.layouts_path).to eq('test/templates')
25
- end
26
-
27
- it 'to includes' do
28
- expect(@configuration.includes_path).to eq('test/includes')
29
- end
30
- end
31
-
32
- context 'should have a default path' do
33
- before do
34
- hash = {}
35
- @configuration = Usmu::Configuration.from_hash(hash)
36
- end
37
-
38
- it 'for source' do
39
- expect(@configuration.source_path).to eq('src')
40
- end
41
-
42
- it 'for destination' do
43
- expect(@configuration.destination_path).to eq('site')
44
- end
45
-
46
- it 'for layouts' do
47
- expect(@configuration.layouts_path).to eq('layouts')
48
- end
49
-
50
- it 'for includes' do
51
- expect(@configuration.includes_path).to eq('includes')
52
- end
53
- end
54
-
55
- it 'should have a list of source files' do
56
- @configuration = Usmu::Configuration.from_hash({})
57
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/test.md))
58
- expect(@configuration.source_files).to eq(%w(index.md test.md))
59
- end
60
-
61
- it 'should ignore metadata files in the source folder' do
62
- @configuration = Usmu::Configuration.from_hash({})
63
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/index.meta.yml src/test.md))
64
- expect(@configuration.source_files).to eq(%w(index.md test.md))
65
- end
66
-
67
- it 'should have a list of layouts files' do
68
- @configuration = Usmu::Configuration.from_hash({})
69
- allow(Dir).to receive(:'[]').with('layouts/**/{*,.??*}').and_return(%w(layouts/html.slim layouts/page.slim))
70
- expect(@configuration.layouts_files).to eq(%w(html.slim page.slim))
71
- end
72
-
73
- it 'should ignore metadata files in the layouts folder' do
74
- @configuration = Usmu::Configuration.from_hash({})
75
- allow(Dir).to receive(:'[]').with('layouts/**/{*,.??*}').and_return(%w(layouts/html.slim layouts/html.meta.yml layouts/page.slim))
76
- expect(@configuration.layouts_files).to eq(%w(html.slim page.slim))
77
- end
78
-
79
- it 'should have a list of includes files' do
80
- @configuration = Usmu::Configuration.from_hash({})
81
- allow(Dir).to receive(:'[]').with('includes/**/{*,.??*}').and_return(%w(includes/footer.slim))
82
- expect(@configuration.includes_files).to eq(%w(footer.slim))
83
- end
84
-
85
- it 'should ignore metadata files in the includes folder' do
86
- @configuration = Usmu::Configuration.from_hash({})
87
- allow(Dir).to receive(:'[]').with('includes/**/{*,.??*}').and_return(%w(includes/footer.slim includes/footer.meta.yml))
88
- expect(@configuration.includes_files).to eq(%w(footer.slim))
89
- end
90
-
91
- it 'should remember arbitrary configuration' do
92
- configuration = Usmu::Configuration.from_hash({:test => 'foo'})
93
- expect(configuration[:test]).to eq('foo')
94
- end
95
-
96
- context 'should exclude files from source' do
97
- it 'as specified' do
98
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['foo.md']})
99
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/foo.md))
100
- expect(@configuration.source_files).to eq(%w(index.md))
101
- end
102
-
103
- it 'in ignored folders if trailing "/" is used' do
104
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['test/']})
105
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/test/foo/test.md src/test/foo.md))
106
- expect(@configuration.source_files).to eq(%w(index.md))
107
- end
108
-
109
- it 'and honor *' do
110
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['*/foo.md']})
111
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/test/foo/foo.md src/test/foo.md))
112
- expect(@configuration.source_files).to eq(%w(index.md test/foo/foo.md))
113
- end
114
-
115
- it 'and * ignores folders without a trailing /' do
116
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['*']})
117
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/test/foo.md src/test.md))
118
- expect(@configuration.source_files).to eq(%w(test/foo.md))
119
- end
120
-
121
- it 'and honor **' do
122
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['**/foo.md']})
123
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/test/foo/foo.md src/test/foo.md))
124
- expect(@configuration.source_files).to eq(%w(index.md))
125
- end
126
-
127
- it 'and honor []' do
128
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['[ab].md']})
129
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/a.md src/b.md))
130
- expect(@configuration.source_files).to eq(%w(index.md))
131
- end
132
-
133
- # FNM_EXTGLOB is supported from MRI 2.0 onwards. We also support the 1.9.3 ABI for JRuby and Rubinius sake. Only
134
- # run this test if it's possible for it to pass.
135
- if defined?(File::FNM_EXTGLOB)
136
- it 'and honor {a,b}' do
137
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['{a,b}.md']})
138
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/a.md src/b.md))
139
- expect(@configuration.source_files).to eq(%w(index.md))
140
- end
141
- end
142
-
143
- it 'and honor \\ as an escape' do
144
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['\*.md']})
145
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/*.md))
146
- expect(@configuration.source_files).to eq(%w(index.md))
147
- end
148
-
149
- it 'and honor ?' do
150
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['?.md']})
151
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/a.md src/b.md))
152
- expect(@configuration.source_files).to eq(%w(index.md))
153
- end
154
-
155
- it 'and ignore files inside folders specified via globs with trailing "/"' do
156
- @configuration = Usmu::Configuration.from_hash({'exclude' => ['test/*/']})
157
- allow(Dir).to receive(:'[]').with('src/**/{*,.??*}').and_return(%w(src/index.md src/test/foo/foo.md src/test/foo.md))
158
- expect(@configuration.source_files).to eq(%w(index.md test/foo.md))
159
- end
160
- end
161
-
162
- it 'should allow indexing the configuration file' do
163
- configuration = Usmu::Configuration.from_hash({test: 'foo'})
164
- expect(configuration[:test]).to eq('foo')
165
- end
166
-
167
- it 'should allow indexing the configuration file with a default value' do
168
- configuration = Usmu::Configuration.from_hash({test: 'foo'})
169
- expect(configuration[:bar, default: 'baz']).to eq('baz')
170
- end
171
-
172
- it 'should allow indexing the configuration file using a path of indices' do
173
- configuration = Usmu::Configuration.from_hash({test: {bar: 'foo'}})
174
- expect(configuration[:test, :bar]).to eq('foo')
175
- end
176
- end