orthorings 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,63 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe Orthor::Templates do
4
+ before(:all) do
5
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/content_items/homepage.json",
6
+ :body => File.join(SPEC_DIR, 'resources', 'homepage.json'))
7
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/queries/latest-news-items.json",
8
+ :body => File.join(SPEC_DIR, 'resources', 'latest-news-items.json'))
9
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/categories/news.json",
10
+ :body => File.join(SPEC_DIR, 'resources', 'news.json'))
11
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/content_items/missing.json",
12
+ :body => "")
13
+
14
+ Orthorings.setup do
15
+ account_id "orthor"
16
+ end
17
+ end
18
+
19
+ describe "with no content returned" do
20
+ it "should return an empty string" do
21
+ Orthorings.content("missing").should be_empty
22
+ end
23
+ end
24
+
25
+ describe "should use custom {{}} replacement for rendering" do
26
+ before(:all) do
27
+ Orthor::Templates.define do
28
+ template :basic, %!<h2>{{title}}</h2><div class="content">{{Content}}</div>!
29
+ template :brief, %!<h2>{{title}}</h2>!
30
+ template :blurb, %!<div>{{Content.blurb}}</div>!
31
+ end
32
+ end
33
+
34
+ describe "a content item" do
35
+ it "should display content using the named template" do
36
+ Orthorings.content("homepage", :basic).should == %!<h2>What is Orthor</h2><div class="content"><h2>So what is Orthor really??</h2></div>!
37
+ end
38
+
39
+ it "should respect given template name" do
40
+ Orthorings.content("homepage", :brief).should == %!<h2>What is Orthor</h2>!
41
+ end
42
+
43
+ describe "blurb" do
44
+ it "should truncate some of the text, strip html and add ..." do
45
+ Orthorings.content("homepage", :blurb).should == "<div>So what is Orthor really??...</div>"
46
+ end
47
+ end
48
+ end
49
+
50
+ describe "a content query" do
51
+ it "should render the template for each item" do
52
+ Orthorings.query("latest-news-items", :brief).should == %!<h2>User Manual updated</h2><h2>Account event tracking</h2><h2>Tutorials have been updated</h2>!
53
+ end
54
+ end
55
+
56
+ describe "a category" do
57
+ it "should render the template for each item" do
58
+ Orthorings.category("news", :brief).should == %!<h2>User Manual updated</h2><h2>Account event tracking</h2><h2>Tutorials have been updated</h2><h2>Content Queries have landed in Orthor</h2>!
59
+ end
60
+ end
61
+ end
62
+ end
63
+
@@ -2,59 +2,54 @@ require File.dirname(__FILE__) + '/spec_helper'
2
2
 
3
3
  describe OrthorHelper do
4
4
  include OrthorHelper
5
-
5
+
6
6
  describe 'default meta tag handling' do
7
7
  before(:all) do
8
8
  Orthor::Site.define do
9
9
  keywords "site keywords"
10
10
  description "site description"
11
- end
11
+ end
12
12
  end
13
-
13
+
14
14
  it 'should return a meta tag for keywords' do
15
15
  keywords.should == %Q(<meta content="site keywords" name="keywords" />)
16
16
  end
17
-
17
+
18
18
  it 'should return a meta tag for description' do
19
19
  description.should == %Q(<meta content="site description" name="description" />)
20
20
  end
21
-
21
+
22
22
  it 'should use @meta_keywords when exists' do
23
23
  @meta_keywords = "asdf"
24
24
  keywords.should == %Q(<meta content="asdf" name="keywords" />)
25
25
  end
26
-
26
+
27
27
  it 'should use @meta_description when exists' do
28
28
  @meta_description = "asdf"
29
29
  description.should == %Q(<meta content="asdf" name="description" />)
30
30
  end
31
31
  end
32
-
32
+
33
33
  describe 'feed links' do
34
34
  before(:all) do
35
35
  Orthor::Site.define do
36
36
  keywords "site keywords"
37
37
  description "site description"
38
38
 
39
- feed "/news.rss" do
40
- name "News"
41
- end
42
-
39
+ feed "/news.rss", :name => "News"
43
40
  category "/writings" do
44
- feed "/writings.rss" do
45
- id "our-writings"
46
- name "Writings"
47
- end
41
+ feed "/writings.rss", :id => "our-writings",
42
+ :name => "Writings"
48
43
  end
49
- end
44
+ end
50
45
  @feed_2 = Orthor::Site.categories.first.feeds.first
51
46
  @feed = Orthor::Site.feeds.first
52
47
  end
53
-
48
+
54
49
  it 'should generate a list of link tags rss feeds' do
55
50
  orthor_feed_tags.should == %Q(<link rel="alternate" type="application/rss+xml" title="News" href="/news.rss" />)
56
51
  end
57
-
52
+
58
53
  it 'should generate additional links when @orthor_feeds is set' do
59
54
  @orthor_feeds = [ @feed_2 ]
60
55
  orthor_feed_tags.should == %Q(<link rel="alternate" type="application/rss+xml" title="News" href="/news.rss" /><link rel="alternate" type="application/rss+xml" title="Writings" href="/writings.rss" />)
@@ -3,27 +3,33 @@ require 'moneta/memory'
3
3
 
4
4
  describe Orthorings, "fetching content" do
5
5
  before(:all) do
6
- FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/content_items/homepage.html", :body => File.join(SPEC_DIR, 'resources', 'homepage.html'))
7
- FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/queries/latest-news-items.html", :body => File.join(SPEC_DIR, 'resources', 'latest-news-items.html'))
8
- FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/categories/news.html", :body => File.join(SPEC_DIR, 'resources', 'news.html'))
9
-
6
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/content_items/homepage.json", :body => File.join(SPEC_DIR, 'resources', 'homepage.json'))
7
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/queries/latest-news-items.json", :body => File.join(SPEC_DIR, 'resources', 'latest-news-items.json'))
8
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/categories/news.json", :body => File.join(SPEC_DIR, 'resources', 'news.json'))
9
+
10
10
  Orthorings.setup do
11
11
  account_id "orthor"
12
12
  end
13
13
  end
14
-
14
+
15
+ it "should parse the returned json into a hash/array" do
16
+ Orthorings.content("homepage").should be_a(Hash)
17
+ Orthorings.query("latest-news-items").should be_an(Array)
18
+ Orthorings.category("news").should be_a(Hash)
19
+ end
20
+
15
21
  it 'should be able to fetch content items' do
16
- Orthorings.content("homepage").include?("<h2>So what is Orthor anyway?</h2>").should be_true
22
+ Orthorings.content("homepage").to_s.should include("<h2>So what is Orthor really??</h2>")
17
23
  end
18
-
24
+
19
25
  it 'should be able to fetch queries' do
20
- Orthorings.query("latest-news-items").include?("Comparisons to traditional Content Management").should be_true
26
+ Orthorings.query("latest-news-items").to_s.should include("big overhaul with increased documentation for lots of")
21
27
  end
22
-
28
+
23
29
  it 'should be able to fetch categories' do
24
- Orthorings.category("news").include?("<h2>Orthor's Features </h2>").should be_true
30
+ Orthorings.category("news").to_s.should include("The User Manual has recently had a big overhaul")
25
31
  end
26
-
32
+
27
33
  it 'should not cache content if no config is given' do
28
34
  Orthorings.cache.should == false
29
35
  end
@@ -31,25 +37,25 @@ end
31
37
 
32
38
  describe Orthorings, "caching content" do
33
39
  before(:all) do
34
- FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/content_items/homepage.html", :body => File.join(SPEC_DIR, 'resources', 'homepage.html'))
35
- FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/queries/latest-news-items.html", :body => File.join(SPEC_DIR, 'resources', 'latest-news-items.html'))
36
- FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/categories/news.html", :body => File.join(SPEC_DIR, 'resources', 'news.html'))
37
-
38
- Orthorings.setup do
40
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/content_items/homepage.json", :body => File.join(SPEC_DIR, 'resources', 'homepage.json'))
41
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/queries/latest-news-items.json", :body => File.join(SPEC_DIR, 'resources', 'latest-news-items.json'))
42
+ FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/categories/news.json", :body => File.join(SPEC_DIR, 'resources', 'news.json'))
43
+
44
+ Orthorings.setup do
39
45
  account_id "orthor"
40
46
  caching :memory
41
47
  end
42
48
  end
43
-
49
+
44
50
  it 'expiry should default to 300 seconds if none is given' do
45
51
  Orthorings.cache_expiry.should == 300
46
52
  end
47
-
53
+
48
54
  it 'should add content to the cache after requests' do
49
55
  Orthorings.cache["homepage"].should be_empty
50
56
  Orthorings.content("homepage")
51
57
  Orthorings.cache["homepage"].should_not be_empty
52
-
58
+
53
59
  Orthorings.should_not_receive(:cache_content)
54
60
  Orthorings.content("homepage")
55
61
  end
@@ -0,0 +1 @@
1
+ {"type":"content","public_id":"what-is-orthor","category":{"public_id":"content-pages","link":"http://content.orthor.com/orthor-demo/categories/content-pages.json","title":"Content Pages"},"Content":"<h2>So what is Orthor really??</h2>","template":"Text Block","created_at":"April 06, 2010","updater":{"email":"demo@orthor.com","firstname":"demo","lastname":"demo"},"updated_at":"April 26, 2010","author":{"email":"demo@orthor.com","firstname":"demo","lastname":"demo"},"title":"What is Orthor"}
@@ -0,0 +1 @@
1
+ [{"type":"content","public_id":"user-manual-updated","Content":"The User Manual has recently had a big overhaul with increased documentation for lots of Orthor's great features, including Content Queries, RSS Feeds, Custom CSS and more!","url":"http://www.orthor.com/manual","created_at":"April 06, 2010","template":"Brief News Item","title":"User Manual updated","category":{"public_id":"news","link":"http://content.orthor.com/orthor-demo/categories/news.json","title":"News"},"updated_at":"April 06, 2010","author":{"firstname":"demo","lastname":"demo","email":"demo@orthor.com"}},{"type":"content","public_id":"account-event-tracking","Content":"All accounts now have access to event tracking, use this to gain a snapshot of what everyone in your account has been doing, for example, what were the latest items to get published, edited, created etc. Login to check it out.","url":"http://www.orthor.com/login","created_at":"April 06, 2010","template":"Brief News Item","title":"Account event tracking","category":{"public_id":"news","link":"http://content.orthor.com/orthor-demo/categories/news.json","title":"News"},"updated_at":"April 06, 2010","author":{"firstname":"demo","lastname":"demo","email":"demo@orthor.com"}},{"type":"content","public_id":"tutorials-have-been-updated","Content":"We've recently made the tutorials section of the site public, stay tuned for some more language examples + increased detail of the existing languages. ","url":"http://www.orthor.com/tutorials","created_at":"April 06, 2010","template":"Brief News Item","title":"Tutorials have been updated","category":{"public_id":"news","link":"http://content.orthor.com/orthor-demo/categories/news.json","title":"News"},"updated_at":"April 06, 2010","author":{"firstname":"demo","lastname":"demo","email":"demo@orthor.com"}}]
@@ -0,0 +1 @@
1
+ {"type":"category","public_id":"news","children":[{"public_id":"media-releases","link":"http://content.orthor.com/orthor-demo/categories/media-releases.json","title":"Media Releases"},{"public_id":"quarterly-results","link":"http://content.orthor.com/orthor-demo/categories/quarterly-results.json","title":"Quarterly Results"}],"link":"http://content.orthor.com/orthor-demo/categories/news.json","title":"News","content":[{"type":"content","public_id":"user-manual-updated","Content":"The User Manual has recently had a big overhaul with increased documentation for lots of Orthor's great features, including Content Queries, RSS Feeds, Custom CSS and more!","url":"http://www.orthor.com/manual","created_at":"April 06, 2010","template":"Brief News Item","title":"User Manual updated","category":{"public_id":"news","link":"http://content.orthor.com/orthor-demo/categories/news.json","title":"News"},"updated_at":"April 06, 2010","author":{"firstname":"demo","lastname":"demo","email":"demo@orthor.com"}},{"type":"content","public_id":"account-event-tracking","Content":"All accounts now have access to event tracking, use this to gain a snapshot of what everyone in your account has been doing, for example, what were the latest items to get published, edited, created etc. Login to check it out.","url":"http://www.orthor.com/login","created_at":"April 06, 2010","template":"Brief News Item","title":"Account event tracking","category":{"public_id":"news","link":"http://content.orthor.com/orthor-demo/categories/news.json","title":"News"},"updated_at":"April 06, 2010","author":{"firstname":"demo","lastname":"demo","email":"demo@orthor.com"}},{"type":"content","public_id":"tutorials-have-been-updated","Content":"We've recently made the tutorials section of the site public, stay tuned for some more language examples + increased detail of the existing languages. ","url":"http://www.orthor.com/tutorials","created_at":"April 06, 2010","template":"Brief News Item","title":"Tutorials have been updated","category":{"public_id":"news","link":"http://content.orthor.com/orthor-demo/categories/news.json","title":"News"},"updated_at":"April 06, 2010","author":{"firstname":"demo","lastname":"demo","email":"demo@orthor.com"}},{"type":"content","public_id":"content-queries-have-landed-in-orthor","Content":"Content Queries are a powerful way to query all of your content at once. Some examples uses of content queries: Latest news items, Products on Sale or Featured Media releases.\r\n","url":"http://www.orthor.com/manual/content_queries","created_at":"April 04, 2010","template":"Brief News Item","title":"Content Queries have landed in Orthor","category":{"public_id":"news","link":"http://content.orthor.com/orthor-demo/categories/news.json","title":"News"},"updater":{"firstname":"demo","lastname":"demo","email":"demo@orthor.com"},"updated_at":"April 06, 2010","author":{"firstname":"demo","lastname":"demo","email":"demo@orthor.com"}}]}
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orthorings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 4
8
+ - 0
9
+ version: 0.4.0
5
10
  platform: ruby
6
11
  authors:
7
12
  - Anthony Langhorne
@@ -9,19 +14,35 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-04-25 00:00:00 +10:00
17
+ date: 2010-06-06 00:00:00 +10:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: moneta
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - "="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ - 6
30
+ - 0
23
31
  version: 0.6.0
24
- version:
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: json
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :runtime
45
+ version_requirements: *id002
25
46
  description:
26
47
  email: anthony@orthor.com
27
48
  executables: []
@@ -51,16 +72,18 @@ files:
51
72
  - lib/orthor/query.rb
52
73
  - lib/orthor/site.rb
53
74
  - lib/orthor/static_page.rb
75
+ - lib/orthor/templates.rb
54
76
  - lib/orthor_helper.rb
55
77
  - lib/orthorings.rb
56
78
  - lib/sinatra/orthor.rb
57
79
  - orthorings.gemspec
58
80
  - spec/orthor/dsl_spec.rb
81
+ - spec/orthor/templates_spec.rb
59
82
  - spec/orthor_helper_spec.rb
60
83
  - spec/orthorings_spec.rb
61
- - spec/resources/homepage.html
62
- - spec/resources/latest-news-items.html
63
- - spec/resources/news.html
84
+ - spec/resources/homepage.json
85
+ - spec/resources/latest-news-items.json
86
+ - spec/resources/news.json
64
87
  - spec/sinatra/orthor_spec.rb
65
88
  - spec/spec.opts
66
89
  - spec/spec_helper.rb
@@ -77,23 +100,26 @@ required_ruby_version: !ruby/object:Gem::Requirement
77
100
  requirements:
78
101
  - - ">="
79
102
  - !ruby/object:Gem::Version
103
+ segments:
104
+ - 0
80
105
  version: "0"
81
- version:
82
106
  required_rubygems_version: !ruby/object:Gem::Requirement
83
107
  requirements:
84
108
  - - ">="
85
109
  - !ruby/object:Gem::Version
110
+ segments:
111
+ - 0
86
112
  version: "0"
87
- version:
88
113
  requirements: []
89
114
 
90
115
  rubyforge_project:
91
- rubygems_version: 1.3.5
116
+ rubygems_version: 1.3.6
92
117
  signing_key:
93
118
  specification_version: 3
94
- summary: Orthorings is a gem for displaying content from orthor.com
119
+ summary: A gem for displaying content from orthor.com
95
120
  test_files:
96
121
  - spec/orthor/dsl_spec.rb
122
+ - spec/orthor/templates_spec.rb
97
123
  - spec/orthor_helper_spec.rb
98
124
  - spec/orthorings_spec.rb
99
125
  - spec/sinatra/orthor_spec.rb
@@ -1,11 +0,0 @@
1
- <h2>So what is Orthor anyway?</h2>
2
- <p>Orthor is a web content management system that requires no additional software installation!. You can get up and running in a matter of minutes. Orthor is built to be reliable, priced to be affordable and above all - it's real easy to use. Designed from the ground up to fit the Software as a Service model, Orthor gives you all the tools you need to manage content on your new or existing site.</p>
3
- <p>With Orthor you dont have to install complicated software or buy any hardware</p>
4
- <p>&nbsp;</p>
5
- <h2>Comparisons to Traditional Content Management</h2>
6
- <p>Jarrod has recently written a great overview of how Orthor contrasts to existing Content management systems, its a great <a href="http://blog.orthor.com/2009/06/15/comparisons-to-traditional-content-management/" title="Orthor - Simple content management">overview</a>.</p>
7
- <p>With all the growth and change in this market many CMS products still follow the principle of &lsquo;complete ownership&lsquo;. This principle mandates that the CMS will control the life cycle of each page, asset, and content item presented on your site. This results in you having to define content types, presentation templates, navigational structures inside of the CMS. You may also need to force your development staff (or development agency) to build custom site functions using technologies that the CMS vendor tells you to. For me that is way too much control to hand over to someone else (but then again maybe Im just a control freak).</p>
8
-
9
- <p>It is on this point of &lsquo;complete control&lsquo; that Orthor strays from the pack. We do not attempt to own your site and we certainly don&rsquo;t dictate how you go about building your custom functions. Orthor focuses completely on only managing the content that is presented on your site. To put it more simply, you control the web pages and Orthor controls the content that is presented on those pages.</p>
10
- <p>Read the whole post <a href="http://blog.orthor.com/2009/06/15/comparisons-to-traditional-content-management/" title="Orthor - Simple content management">here</a></p>
11
- <p>&nbsp;</p>
@@ -1 +0,0 @@
1
- <div><a href="http://blog.orthor.com/2009/06/15/comparisons-to-traditional-content-management/" title="Comparisons to traditional Content Management">Comparisons to traditional Content Management</a></div><div><a href="http://blog.orthor.com/2009/06/21/orthors-features/" title="Orthor's Features">Orthor's Features</a></div><div><a href="http://blog.orthor.com/2009/06/29/we-are-live/" title="Orthor is live and accepting signups!">Orthor is live and accepting signups!</a></div>
@@ -1,5 +0,0 @@
1
- <h2>Orthor's Features </h2><div><p>So today I thought we should take a quick tour of Orthor&rsquo;s features. In a series of upcoming posts I will explain each feature in more detail and present ideas and suggestions how each can be used to benefit you. If you have read previous posts you&rsquo;ll have picked up that Orthor is built with a single purpose, &lsquo;<em>to manage your content and not your site</em>&lsquo;. That means you wont find any fancy features to alter site navigation, add sub-sites, build custom forms etc. All Orthor&rsquo;s features are specific to creating, managing, publishing and retrieving content.</p>
2
- <p>Read the whole article <a href="http://blog.orthor.com/2009/06/21/orthors-features/">here</a>.</p>
3
- </div><h2>Orthor is live and accepting signups! </h2><div><p>Just a quick note to announce that we are now officially live. All our plans are now available <a href="https://orthor.com/pricing_signup" title="Orthor subscription plans">here</a>. This marks a small milestone for us in getting Orthor up and running. We can now move onto implementing some more great features that we have on our road map.</p> </div><h2>Comparisons to traditional Content Management </h2><div><p>Over the last five plus years it seems that a new CMS has popped into the scene on an almost daily basis. The CMS market is completely saturated with products and services, so much so that it is quite an ordeal to select one. I firmly believe that a saturated market is a good thing for the consumer, just look at the amount of choice you have. Regardless of what web technology underpins your organization, what your budget constraints are, what your in-house skills are there is bound to be a CMS out there for you</p>
4
-
5
- <p>Read the whole article <a href="http://blog.orthor.com/2009/06/15/comparisons-to-traditional-content-management/">here</a>.</p> </div>