fierce 0.1.2 → 0.1.3
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/lib/fierce/presenter_finder.rb +6 -12
- data/lib/fierce/version.rb +1 -1
- data/spec/presenter_finder_spec.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aedff8993a377777fc09ce941eb0cbf8028b8e4e
|
|
4
|
+
data.tar.gz: c183353ee1667ca03923c440edde27ec496c93bd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 26b61ccc729797c468390278457f896a8fc7851665510d5e870ee0dec845173759e766fac7214daa6e5acb59811189cd1020e3107da850a89062be20eb96f803
|
|
7
|
+
data.tar.gz: cdd47caeef578092e5bb001e91070849f8a5d9ec4f5228030624debd864522ded6e285374f962b0631c3ab56344a26e67fa68d469d20f86054b8b180947bc9e4
|
|
@@ -6,33 +6,27 @@ module Fierce
|
|
|
6
6
|
@path = path
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
def root
|
|
10
|
-
Rails.root.to_s
|
|
11
|
-
end
|
|
12
|
-
|
|
13
9
|
def file_path(base_path)
|
|
14
10
|
"#{base_path}/#{path}.rb"
|
|
15
11
|
end
|
|
16
12
|
|
|
17
|
-
def
|
|
13
|
+
def found_base_path
|
|
18
14
|
@found = Fierce.paths.map do |base_path|
|
|
19
15
|
base_path if File.exist?(file_path(base_path))
|
|
20
16
|
end.compact.first
|
|
21
17
|
end
|
|
22
18
|
|
|
23
19
|
def perform
|
|
24
|
-
presenter_class if
|
|
20
|
+
presenter_class if found_base_path
|
|
25
21
|
end
|
|
26
22
|
|
|
27
23
|
def path_to_classify
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.gsub('/app', '')
|
|
31
|
-
.gsub(/\.rb$/, '') + "/#{path}"
|
|
24
|
+
top_module = found_base_path.split('/').last
|
|
25
|
+
"#{top_module}/#{path}"
|
|
32
26
|
end
|
|
33
27
|
|
|
34
|
-
def presenter_class
|
|
35
|
-
require file_path(
|
|
28
|
+
def presenter_class
|
|
29
|
+
require file_path(found_base_path)
|
|
36
30
|
path_to_classify.classify.constantize
|
|
37
31
|
end
|
|
38
32
|
end
|
data/lib/fierce/version.rb
CHANGED
|
@@ -2,8 +2,8 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
describe Fierce::PresenterFinder do
|
|
4
4
|
let(:fixture_presenter_path) { File.dirname(__FILE__) + "/custom_presenters" }
|
|
5
|
+
|
|
5
6
|
before do
|
|
6
|
-
Rails.stub(:root).and_return(File.dirname(__FILE__))
|
|
7
7
|
Fierce.clear_paths
|
|
8
8
|
Fierce.add_path(fixture_presenter_path)
|
|
9
9
|
end
|
|
@@ -18,4 +18,4 @@ describe Fierce::PresenterFinder do
|
|
|
18
18
|
it "return the class" do
|
|
19
19
|
finder.perform.should == CustomPresenters::Home::Index
|
|
20
20
|
end
|
|
21
|
-
end
|
|
21
|
+
end
|