middleman-data_source 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f92c547722c3acc8279689d9f9b03f9bd22501fb
|
4
|
+
data.tar.gz: 7c597e7a910b1fa2226131e2791d52b2783b8512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ad2e9d4c9ee45e674f37a784da7eb9b5f3082b3d15f59e81f4d9085a1e6819819f14eb4256c92ad85a76b3c8ad0a19c713fd0dedaf398f53a252cd6d3d9f384
|
7
|
+
data.tar.gz: 642a9856acd83198fd44920d3a71d3b627dda1f64884eac09960b988fba9743b7e4ab161cead01220fd612e98cbd1a5a54b0e8b02e3e009c777da7e834309ce9
|
data/changelog.md
CHANGED
@@ -12,11 +12,10 @@ module Middleman
|
|
12
12
|
@_rack_app ||= ::Rack::Test::Session.new( ::Rack::MockSession.new( options.rack_app ) )
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
# ]
|
15
|
+
def initialize app, options_hash={}, &block
|
16
|
+
super app, options_hash, &block
|
18
17
|
|
19
|
-
|
18
|
+
app_inst = app.inst
|
20
19
|
remote_datas = if options.files.respond_to? :keys
|
21
20
|
options.files
|
22
21
|
else
|
@@ -31,13 +30,13 @@ module Middleman
|
|
31
30
|
basename = File.basename parts.pop, extension
|
32
31
|
|
33
32
|
if parts.empty?
|
34
|
-
original_callback =
|
35
|
-
|
33
|
+
original_callback = app_inst.data.callbacks[basename]
|
34
|
+
app_inst.data.callbacks[basename] = Proc.new do
|
36
35
|
attempt_merge_then_enhance decode_data(remote_file, extension), original_callback
|
37
36
|
end
|
38
37
|
else
|
39
|
-
original_callback =
|
40
|
-
|
38
|
+
original_callback = app_inst.data.callbacks[parts.first]
|
39
|
+
app_inst.data.callbacks[parts.first] = Proc.new do
|
41
40
|
built_data = { basename => decode_data(remote_file, extension) }
|
42
41
|
parts[1..-1].reverse.each do |part|
|
43
42
|
built_data = { part => built_data }
|
@@ -105,4 +105,11 @@ describe Middleman::DataSource::Extension do
|
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
+
it "allows for imediate use in config once defined" do
|
109
|
+
Given.fixture 'imediate_use'
|
110
|
+
@mm = Middleman::Fixture.app
|
111
|
+
|
112
|
+
expect( @mm.remote_data ).to match_array [{"item"=>"one"},{"item"=>"two"}]
|
113
|
+
end
|
114
|
+
|
108
115
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-data_source
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Sloan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: middleman
|
@@ -54,6 +54,7 @@ files:
|
|
54
54
|
- spec/fixtures/base/config.rb
|
55
55
|
- spec/fixtures/borrower/config.rb
|
56
56
|
- spec/fixtures/files_as_hash/config.rb
|
57
|
+
- spec/fixtures/imediate_use/config.rb
|
57
58
|
- spec/fixtures/multiple_instances/config.rb
|
58
59
|
- spec/fixtures/unsupported_extension/config.rb
|
59
60
|
- spec/lib/middleman-data_source_spec.rb
|
@@ -91,6 +92,7 @@ test_files:
|
|
91
92
|
- spec/fixtures/base/config.rb
|
92
93
|
- spec/fixtures/borrower/config.rb
|
93
94
|
- spec/fixtures/files_as_hash/config.rb
|
95
|
+
- spec/fixtures/imediate_use/config.rb
|
94
96
|
- spec/fixtures/multiple_instances/config.rb
|
95
97
|
- spec/fixtures/unsupported_extension/config.rb
|
96
98
|
- spec/lib/middleman/data_source/extension_spec.rb
|