orthor 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.
data/README.md CHANGED
@@ -11,11 +11,11 @@ The Orthor gem is used to fetch and display your content from orthor.com
11
11
  Add the below to a file and require it:
12
12
 
13
13
  Orthor.setup do
14
- account "orthor" # your orthor account id
14
+ site "orthor" # your orthor site/account id
15
15
  caching :basic_file, 300, :path => "tmp/" # cache content in tmp/ for 5 mins
16
16
  end
17
17
 
18
- You can specify any Moneta cache store you like, e.g. basic_file, memcache etc. The (optional) second argument is cache expiry in seconds, you can provide any initialize options required by your cache store as the 3rd arg.
18
+ You can specify any Moneta cache store you like, e.g. basic_file, memory, memcache etc. The (optional) second argument is cache expiry in seconds, you can provide any initialize options required by your cache store as the 3rd arg.
19
19
 
20
20
  ## Usage
21
21
 
@@ -63,6 +63,10 @@ class Orthor
63
63
  self.account_id = id
64
64
  end
65
65
 
66
+ def self.site(id)
67
+ self.account_id = id
68
+ end
69
+
66
70
  def self.setup(&block)
67
71
  raise ArgumentError unless block_given?
68
72
  self.cache = false # default
@@ -35,6 +35,8 @@ class Orthor
35
35
 
36
36
  private
37
37
  def self.parse(item, template_name_or_mapping)
38
+ return "" if item == ""
39
+
38
40
  # ensure we're dealing with an array
39
41
  unless item.is_a?(Array)
40
42
  if item["type"] == "category"
@@ -61,8 +63,9 @@ class Orthor
61
63
  end
62
64
  end
63
65
  end.join("")
66
+ rescue Orthor::Templates::Unknown => e
67
+ raise e
64
68
  rescue => e
65
- raise e if e.is_a?(Orthor::Templates::Unknown)
66
69
  return ""
67
70
  end
68
71
 
@@ -75,6 +75,12 @@ describe Orthor::Templates do
75
75
  end
76
76
  end
77
77
 
78
+ describe "parsing an empty result" do
79
+ it "should return an empty string" do
80
+ Orthor.render("", :blurb).should == ""
81
+ end
82
+ end
83
+
78
84
  describe "a content query" do
79
85
  it "should render the template for each item" do
80
86
  Orthor.query("query", :brief).should == %!<h2>User Manual updated</h2><h2>Account event tracking</h2><h2>Tutorials have been updated</h2>!
@@ -38,6 +38,18 @@ describe Orthor do
38
38
  end
39
39
  end
40
40
 
41
+ describe "site config" do
42
+ before(:all) do
43
+ Orthor.setup do
44
+ site "bob"
45
+ end
46
+ end
47
+
48
+ it "should use the site id as the account id" do
49
+ Orthor.account_id.should == "bob"
50
+ end
51
+ end
52
+
41
53
  describe "getting" do
42
54
  before(:all) do
43
55
  Orthor.setup do
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 2
9
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Anthony Langhorne