usmu 0.3.1-java → 0.3.2-java
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -2
- data/.travis.yml +3 -0
- data/CHANGELOG.md +21 -0
- data/Gemfile +7 -0
- data/Guardfile +7 -7
- data/README.md +5 -1
- data/Rakefile +16 -5
- data/lib/usmu.rb +3 -1
- data/lib/usmu/configuration.rb +25 -13
- data/lib/usmu/deployment.rb +12 -0
- data/lib/usmu/deployment/directory_diff.rb +64 -0
- data/lib/usmu/deployment/remote_file_interface.rb +25 -0
- data/lib/usmu/plugin.rb +5 -1
- data/lib/usmu/template/layout.rb +24 -17
- data/lib/usmu/version.rb +1 -1
- data/{test/spec → spec}/acceptance/full_site_build.feature +2 -2
- data/{test/spec → spec}/acceptance/steps/full_site_build_steps.rb +0 -0
- data/spec/configuration_spec.rb +257 -0
- data/spec/deployment/directory_diff_spec.rb +126 -0
- data/{test/spec → spec}/mock/usmu/mock_plugin.rb +0 -0
- data/spec/mock/usmu/mock_remote_files.rb +19 -0
- data/{test/spec → spec}/plugin/core_spec.rb +0 -0
- data/{test/spec → spec}/plugin_spec.rb +0 -0
- data/{test/spec → spec}/site_generator_spec.rb +1 -1
- data/{test/spec → spec}/spec_helper.rb +18 -4
- data/{test/spec → spec}/support/shared_layout.rb +0 -0
- data/{test/spec → spec}/template/layout_spec.rb +1 -1
- data/{test/spec → spec}/template/page_spec.rb +0 -0
- data/{test/spec → spec}/template/static_file_spec.rb +2 -2
- data/{test/spec → spec}/ui/console_spec.rb +4 -4
- data/{test/expected-site → test-site/content}/.dotfiletest.txt +0 -0
- data/{test/site → test-site}/content/css/_partial.scss +0 -0
- data/{test/site → test-site}/content/css/app.scss +0 -0
- data/{test/site → test-site}/content/default.md +0 -0
- data/{test/site → test-site}/content/embedded.md +0 -0
- data/{test/site → test-site}/content/embedded.meta.yml +0 -0
- data/{test/site → test-site}/content/index.md +0 -0
- data/{test/site → test-site}/content/index.meta.yml +0 -0
- data/{test/site → test-site}/content/posts/test-post.md +0 -0
- data/{test/expected-site → test-site/content}/robots.txt +0 -0
- data/{test/site/content → test-site/expected-site}/.dotfiletest.txt +0 -0
- data/{test → test-site}/expected-site/css/app.css +0 -0
- data/{test → test-site}/expected-site/default.html +0 -0
- data/{test → test-site}/expected-site/embedded.html +0 -0
- data/{test → test-site}/expected-site/index.html +0 -0
- data/{test → test-site}/expected-site/posts/test-post.html +0 -0
- data/{test/site/content → test-site/expected-site}/robots.txt +0 -0
- data/{test/site → test-site}/includes/footer.meta.yml +0 -0
- data/{test/site → test-site}/includes/footer.slim +0 -0
- data/{test/site → test-site}/layouts/embedded.meta.yml +0 -0
- data/{test/site → test-site}/layouts/embedded.slim +0 -0
- data/{test/site → test-site}/layouts/html.slim +0 -0
- data/{test/site → test-site}/usmu.yml +0 -0
- data/usmu-jruby.gemspec +1 -0
- data/usmu.gemspec +1 -2
- metadata +73 -77
- data/.cane +0 -4
- data/.simplecov +0 -4
- data/test/spec/configuration_spec.rb +0 -176
File without changes
|
@@ -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
|
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
|
|
File without changes
|
@@ -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
|
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
|
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
|
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
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/usmu-jruby.gemspec
CHANGED
data/usmu.gemspec
CHANGED
@@ -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.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Matthew Scharley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slim
|
@@ -234,6 +234,20 @@ dependencies:
|
|
234
234
|
- - "~>"
|
235
235
|
- !ruby/object:Gem::Version
|
236
236
|
version: '3.4'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: timeout
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '0.0'
|
244
|
+
type: :development
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '0.0'
|
237
251
|
description: |2
|
238
252
|
Usmu is a static site generator built in Ruby that leverages the Tilt API to support many different template
|
239
253
|
engines. It supports local generation but is designed to be used with the web-based editor.
|
@@ -244,10 +258,8 @@ executables:
|
|
244
258
|
extensions: []
|
245
259
|
extra_rdoc_files: []
|
246
260
|
files:
|
247
|
-
- ".cane"
|
248
261
|
- ".gitignore"
|
249
262
|
- ".rspec"
|
250
|
-
- ".simplecov"
|
251
263
|
- ".travis.yml"
|
252
264
|
- ".yardopts"
|
253
265
|
- CHANGELOG.md
|
@@ -261,6 +273,9 @@ files:
|
|
261
273
|
- bin/usmu
|
262
274
|
- lib/usmu.rb
|
263
275
|
- lib/usmu/configuration.rb
|
276
|
+
- lib/usmu/deployment.rb
|
277
|
+
- lib/usmu/deployment/directory_diff.rb
|
278
|
+
- lib/usmu/deployment/remote_file_interface.rb
|
264
279
|
- lib/usmu/plugin.rb
|
265
280
|
- lib/usmu/plugin/core.rb
|
266
281
|
- lib/usmu/plugin/core_hooks.rb
|
@@ -278,42 +293,44 @@ files:
|
|
278
293
|
- share/init-site/layouts/html.slim
|
279
294
|
- share/init-site/source/index.md
|
280
295
|
- share/init-site/usmu.yml
|
281
|
-
-
|
282
|
-
-
|
283
|
-
-
|
284
|
-
-
|
285
|
-
-
|
286
|
-
-
|
287
|
-
-
|
288
|
-
-
|
289
|
-
-
|
290
|
-
-
|
291
|
-
-
|
292
|
-
-
|
293
|
-
-
|
294
|
-
-
|
295
|
-
-
|
296
|
-
- test
|
297
|
-
- test
|
298
|
-
- test
|
299
|
-
- test
|
300
|
-
- test
|
301
|
-
- test
|
302
|
-
- test
|
303
|
-
- test
|
304
|
-
- test/
|
305
|
-
- test/
|
306
|
-
- test/
|
307
|
-
- test/
|
308
|
-
- test/
|
309
|
-
- test/
|
310
|
-
- test/
|
311
|
-
- test/
|
312
|
-
- test/
|
313
|
-
- test/
|
314
|
-
- test/
|
315
|
-
- test/
|
316
|
-
- test/
|
296
|
+
- spec/acceptance/full_site_build.feature
|
297
|
+
- spec/acceptance/steps/full_site_build_steps.rb
|
298
|
+
- spec/configuration_spec.rb
|
299
|
+
- spec/deployment/directory_diff_spec.rb
|
300
|
+
- spec/mock/usmu/mock_plugin.rb
|
301
|
+
- spec/mock/usmu/mock_remote_files.rb
|
302
|
+
- spec/plugin/core_spec.rb
|
303
|
+
- spec/plugin_spec.rb
|
304
|
+
- spec/site_generator_spec.rb
|
305
|
+
- spec/spec_helper.rb
|
306
|
+
- spec/support/shared_layout.rb
|
307
|
+
- spec/template/layout_spec.rb
|
308
|
+
- spec/template/page_spec.rb
|
309
|
+
- spec/template/static_file_spec.rb
|
310
|
+
- spec/ui/console_spec.rb
|
311
|
+
- test-site/content/.dotfiletest.txt
|
312
|
+
- test-site/content/css/_partial.scss
|
313
|
+
- test-site/content/css/app.scss
|
314
|
+
- test-site/content/default.md
|
315
|
+
- test-site/content/embedded.md
|
316
|
+
- test-site/content/embedded.meta.yml
|
317
|
+
- test-site/content/index.md
|
318
|
+
- test-site/content/index.meta.yml
|
319
|
+
- test-site/content/posts/test-post.md
|
320
|
+
- test-site/content/robots.txt
|
321
|
+
- test-site/expected-site/.dotfiletest.txt
|
322
|
+
- test-site/expected-site/css/app.css
|
323
|
+
- test-site/expected-site/default.html
|
324
|
+
- test-site/expected-site/embedded.html
|
325
|
+
- test-site/expected-site/index.html
|
326
|
+
- test-site/expected-site/posts/test-post.html
|
327
|
+
- test-site/expected-site/robots.txt
|
328
|
+
- test-site/includes/footer.meta.yml
|
329
|
+
- test-site/includes/footer.slim
|
330
|
+
- test-site/layouts/embedded.meta.yml
|
331
|
+
- test-site/layouts/embedded.slim
|
332
|
+
- test-site/layouts/html.slim
|
333
|
+
- test-site/usmu.yml
|
317
334
|
- usmu-jruby.gemspec
|
318
335
|
- usmu.gemspec
|
319
336
|
homepage: https://github.com/usmu/usmu
|
@@ -336,45 +353,24 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
336
353
|
version: '0'
|
337
354
|
requirements: []
|
338
355
|
rubyforge_project:
|
339
|
-
rubygems_version: 2.
|
356
|
+
rubygems_version: 2.4.5
|
340
357
|
signing_key:
|
341
358
|
specification_version: 4
|
342
359
|
summary: A static site generator with a web-based frontend for editing.
|
343
360
|
test_files:
|
344
|
-
-
|
345
|
-
-
|
346
|
-
-
|
347
|
-
-
|
348
|
-
-
|
349
|
-
-
|
350
|
-
-
|
351
|
-
-
|
352
|
-
-
|
353
|
-
-
|
354
|
-
-
|
355
|
-
-
|
356
|
-
-
|
357
|
-
-
|
358
|
-
-
|
359
|
-
- test/site/content/posts/test-post.md
|
360
|
-
- test/site/content/robots.txt
|
361
|
-
- test/site/includes/footer.meta.yml
|
362
|
-
- test/site/includes/footer.slim
|
363
|
-
- test/site/layouts/embedded.meta.yml
|
364
|
-
- test/site/layouts/embedded.slim
|
365
|
-
- test/site/layouts/html.slim
|
366
|
-
- test/site/usmu.yml
|
367
|
-
- test/spec/acceptance/full_site_build.feature
|
368
|
-
- test/spec/acceptance/steps/full_site_build_steps.rb
|
369
|
-
- test/spec/configuration_spec.rb
|
370
|
-
- test/spec/mock/usmu/mock_plugin.rb
|
371
|
-
- test/spec/plugin/core_spec.rb
|
372
|
-
- test/spec/plugin_spec.rb
|
373
|
-
- test/spec/site_generator_spec.rb
|
374
|
-
- test/spec/spec_helper.rb
|
375
|
-
- test/spec/support/shared_layout.rb
|
376
|
-
- test/spec/template/layout_spec.rb
|
377
|
-
- test/spec/template/page_spec.rb
|
378
|
-
- test/spec/template/static_file_spec.rb
|
379
|
-
- test/spec/ui/console_spec.rb
|
361
|
+
- spec/acceptance/full_site_build.feature
|
362
|
+
- spec/acceptance/steps/full_site_build_steps.rb
|
363
|
+
- spec/configuration_spec.rb
|
364
|
+
- spec/deployment/directory_diff_spec.rb
|
365
|
+
- spec/mock/usmu/mock_plugin.rb
|
366
|
+
- spec/mock/usmu/mock_remote_files.rb
|
367
|
+
- spec/plugin/core_spec.rb
|
368
|
+
- spec/plugin_spec.rb
|
369
|
+
- spec/site_generator_spec.rb
|
370
|
+
- spec/spec_helper.rb
|
371
|
+
- spec/support/shared_layout.rb
|
372
|
+
- spec/template/layout_spec.rb
|
373
|
+
- spec/template/page_spec.rb
|
374
|
+
- spec/template/static_file_spec.rb
|
375
|
+
- spec/ui/console_spec.rb
|
380
376
|
has_rdoc:
|
data/.cane
DELETED
data/.simplecov
DELETED
@@ -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
|