binder_core 0.1.0 → 0.1.1

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.
@@ -20,9 +20,7 @@ module BinderCore
20
20
 
21
21
  def register_asset( new_asset )
22
22
  new_asset.route = @route.dup
23
-
24
23
  new_asset.base_url = console.defaults( :base_asset_url )
25
-
26
24
  @assets << new_asset
27
25
  new_asset
28
26
  end
@@ -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
- if parsed_file.data then add_data_from( parsed_file ) end
35
+ unless parsed_file.data.nil? then add_data_from( parsed_file ) end
35
36
  end
36
- @data = expand_single_keys @data unless @data.nil?
37
+ @data = expand_single_keys @data
37
38
  raw
38
39
  end
39
40
 
@@ -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 &config
80
+ raw = @context.descend(&config)
79
81
  raw[:data]
80
82
  end
81
83
  end
@@ -1,7 +1,8 @@
1
1
  module BinderCore
2
2
  class FolderParser < BinderCore::Parser
3
3
  def parse
4
- add descend
4
+ contence = descend
5
+ add contence unless contence.empty?
5
6
  end
6
7
  end
7
8
  end
@@ -1,3 +1,3 @@
1
1
  module BinderCore
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -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
- Parsr = Class.new
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
- Parsr = Class.new
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 be_nil }
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
- context
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.0
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-01-23 00:00:00.000000000 Z
12
+ date: 2013-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec