binder_core 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/binder_core/file_context.rb +0 -2
- data/lib/binder_core/folder_context.rb +3 -2
- data/lib/binder_core/parser.rb +3 -1
- data/lib/binder_core/parsers/folder_parser.rb +2 -1
- data/lib/binder_core/version.rb +1 -1
- data/spec/binder_core/config_spec.rb +3 -4
- data/spec/binder_core/folder_context_spec.rb +4 -4
- metadata +2 -2
@@ -8,6 +8,7 @@ module BinderCore
|
|
8
8
|
@route = []
|
9
9
|
@assets = []
|
10
10
|
@params = {}
|
11
|
+
@data = {}
|
11
12
|
end
|
12
13
|
|
13
14
|
def raw
|
@@ -31,9 +32,9 @@ module BinderCore
|
|
31
32
|
end
|
32
33
|
|
33
34
|
parsed_file = Scanner.scan file_config
|
34
|
-
|
35
|
+
unless parsed_file.data.nil? then add_data_from( parsed_file ) end
|
35
36
|
end
|
36
|
-
@data = expand_single_keys @data
|
37
|
+
@data = expand_single_keys @data
|
37
38
|
raw
|
38
39
|
end
|
39
40
|
|
data/lib/binder_core/parser.rb
CHANGED
@@ -73,9 +73,11 @@ module BinderCore
|
|
73
73
|
#
|
74
74
|
# On the other hand, assets ARE automatically added to the binder asset bucket when created.
|
75
75
|
#
|
76
|
+
# This returns an empty hash if no data is added from the contents of this folder
|
77
|
+
#
|
76
78
|
def descend(&config)
|
77
79
|
config ||= lambda { |c| }
|
78
|
-
raw = @context.descend
|
80
|
+
raw = @context.descend(&config)
|
79
81
|
raw[:data]
|
80
82
|
end
|
81
83
|
end
|
data/lib/binder_core/version.rb
CHANGED
@@ -5,6 +5,7 @@ describe BinderCore::Config do
|
|
5
5
|
let(:context) { BinderCore::FolderContext.new }
|
6
6
|
let(:config) { BinderCore::Config.new context }
|
7
7
|
let(:mockcontext) { double("ContextMock") }
|
8
|
+
let(:parsr) { Class.new }
|
8
9
|
|
9
10
|
it "should set the path of the contexts dir object" do
|
10
11
|
config.set_path BINDER_DEFAULT_DIR
|
@@ -27,8 +28,7 @@ describe BinderCore::Config do
|
|
27
28
|
|
28
29
|
it "should create a definition, add it to the front of the parser list and return it" do
|
29
30
|
config.set_parsers []
|
30
|
-
|
31
|
-
defn = config.add_parser Parsr do |fcnxt|
|
31
|
+
defn = config.add_parser parsr do |fcnxt|
|
32
32
|
true
|
33
33
|
end
|
34
34
|
context.parsers.first.should == defn
|
@@ -36,8 +36,7 @@ describe BinderCore::Config do
|
|
36
36
|
|
37
37
|
it "should create a definition, add it to the front of the rule list and return it" do
|
38
38
|
config.set_rules []
|
39
|
-
|
40
|
-
defn = config.add_rule Parsr do |fcnxt|
|
39
|
+
defn = config.add_rule parsr do |fcnxt|
|
41
40
|
true
|
42
41
|
end
|
43
42
|
context.rules.first.should == defn
|
@@ -12,7 +12,7 @@ describe BinderCore::FolderContext do
|
|
12
12
|
it { should respond_to(:console) }
|
13
13
|
it { should respond_to(:console=) }
|
14
14
|
it { should respond_to(:data) }
|
15
|
-
it { subject.data.should
|
15
|
+
it { subject.data.should == {} }
|
16
16
|
it { should respond_to(:route) }
|
17
17
|
it { subject.route.should == [] }
|
18
18
|
it { should respond_to(:params) }
|
@@ -39,7 +39,7 @@ describe BinderCore::FolderContext do
|
|
39
39
|
let(:file_list) { ["test.txt"] }
|
40
40
|
let(:file) { double("FileRefMock", :files => file_list, :path => "some/path", ) }
|
41
41
|
let(:console) { double("ConsoleMock", :continue? => true) }
|
42
|
-
let(:file_context) { double("MockFileContext").as_null_object }
|
42
|
+
let(:file_context) { double("MockFileContext", :name => "somename").as_null_object }
|
43
43
|
|
44
44
|
before(:each) do
|
45
45
|
context.file = file
|
@@ -76,14 +76,14 @@ describe BinderCore::FolderContext do
|
|
76
76
|
|
77
77
|
BinderCore::Scanner.should_receive(:scan) do |cbl|
|
78
78
|
cbl.call config
|
79
|
-
|
79
|
+
file_context
|
80
80
|
end
|
81
81
|
context.parse_files
|
82
82
|
end
|
83
83
|
|
84
84
|
it "should add data from the returned parsed file context" do
|
85
85
|
context.should_receive(:add_data_from).with(file_context)
|
86
|
-
file_context.should_receive(:data).and_return({})
|
86
|
+
file_context.should_receive(:data).and_return({:mock => "value"})
|
87
87
|
BinderCore::Scanner.should_receive(:scan).and_return(file_context)
|
88
88
|
context.parse_files
|
89
89
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: binder_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
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-
|
12
|
+
date: 2013-03-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|