orthorings 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -1
- data/VERSION +1 -1
- data/lib/orthor/category.rb +2 -2
- data/lib/orthor/collections.rb +8 -4
- data/lib/orthor/query.rb +7 -0
- data/lib/orthor/site.rb +2 -2
- data/lib/orthorings.rb +2 -1
- data/orthorings.gemspec +3 -2
- data/spec/orthor/dsl_spec.rb +40 -2
- metadata +3 -2
data/README.markdown
CHANGED
@@ -11,7 +11,7 @@ The 2 main things you can do with Orthorings are:
|
|
11
11
|
|
12
12
|
As a gem (from gemcutter.org)
|
13
13
|
|
14
|
-
|
14
|
+
gem install orthorings
|
15
15
|
|
16
16
|
## Configuration
|
17
17
|
|
@@ -46,6 +46,8 @@ Here is some example usage (more docs to come, this is still a WIP and some aspe
|
|
46
46
|
static_page "/about-us", "About Us" do
|
47
47
|
view "public/about_us"
|
48
48
|
end
|
49
|
+
|
50
|
+
query "/latest-news"
|
49
51
|
|
50
52
|
category "/writings" do
|
51
53
|
keywords "lets, do, some, seo"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/orthor/category.rb
CHANGED
@@ -5,7 +5,7 @@ module Orthor
|
|
5
5
|
dsl_accessor :page_path
|
6
6
|
|
7
7
|
def initialize(path, category_name, &block)
|
8
|
-
@feeds, @categories, @pages, @static_pages = [], [], [], []
|
8
|
+
@feeds, @categories, @pages, @static_pages, @queries = [], [], [], [], []
|
9
9
|
super path, category_name, &block
|
10
10
|
end
|
11
11
|
|
@@ -13,4 +13,4 @@ module Orthor
|
|
13
13
|
Orthorings.category(@id)
|
14
14
|
end
|
15
15
|
end
|
16
|
-
end
|
16
|
+
end
|
data/lib/orthor/collections.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Orthor
|
2
2
|
module Collections
|
3
|
-
attr_accessor :feeds, :categories, :pages, :static_pages
|
3
|
+
attr_accessor :feeds, :categories, :pages, :static_pages, :queries
|
4
4
|
|
5
5
|
def feed(path, name = nil, &block)
|
6
6
|
feeds << Orthor::Feed.new(path, name, &block)
|
@@ -17,10 +17,14 @@ module Orthor
|
|
17
17
|
def static_page(path, name = nil, &block)
|
18
18
|
static_pages << Orthor::StaticPage.new(path, name, &block)
|
19
19
|
end
|
20
|
+
|
21
|
+
def query(path, name = nil, &block)
|
22
|
+
queries << Orthor::Query.new(path, name, &block)
|
23
|
+
end
|
20
24
|
|
21
25
|
def resources
|
22
|
-
return [] unless @feeds && @pages && @static_pages && @categories
|
23
|
-
(@feeds + @pages + @static_pages + @categories + @categories.collect { |category| category.resources }).flatten
|
26
|
+
return [] unless @feeds && @pages && @static_pages && @categories && @queries
|
27
|
+
((@feeds + @pages + @static_pages + @categories + @queries) + @categories.collect { |category| category.resources }).flatten
|
24
28
|
end
|
25
29
|
end
|
26
|
-
end
|
30
|
+
end
|
data/lib/orthor/query.rb
ADDED
data/lib/orthor/site.rb
CHANGED
@@ -8,7 +8,7 @@ module Orthor
|
|
8
8
|
dsl_accessor :layout
|
9
9
|
|
10
10
|
def define(&block)
|
11
|
-
@feeds, @categories, @pages, @static_pages = [], [], [], []
|
11
|
+
@feeds, @categories, @pages, @static_pages, @queries = [], [], [], [], []
|
12
12
|
layout(:orthor_layout)
|
13
13
|
cache_for 0
|
14
14
|
keywords ""
|
@@ -26,4 +26,4 @@ module Orthor
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
data/lib/orthorings.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
Dir[File.dirname(__FILE__) + '/core_ext/*.rb'].each { |e| require e }
|
2
|
-
%w(orthor/http_caching orthor/meta_data orthor/collections orthor/site orthor/object orthor/category orthor/feed orthor/page orthor/static_page).each { |r| require File.join(File.dirname(__FILE__), r) }
|
2
|
+
%w(orthor/http_caching orthor/meta_data orthor/collections orthor/site orthor/object orthor/category orthor/feed orthor/page orthor/static_page orthor/query).each { |r| require File.join(File.dirname(__FILE__), r) }
|
3
|
+
|
3
4
|
require File.join(File.dirname(__FILE__), 'orthorings')
|
4
5
|
require File.join(File.dirname(__FILE__), 'orthor_helper')
|
5
6
|
require 'moneta'
|
data/orthorings.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{orthorings}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Anthony Langhorne"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-04-04}
|
13
13
|
s.email = %q{anthony@orthor.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
"lib/orthor/meta_data.rb",
|
33
33
|
"lib/orthor/object.rb",
|
34
34
|
"lib/orthor/page.rb",
|
35
|
+
"lib/orthor/query.rb",
|
35
36
|
"lib/orthor/site.rb",
|
36
37
|
"lib/orthor/static_page.rb",
|
37
38
|
"lib/orthor_helper.rb",
|
data/spec/orthor/dsl_spec.rb
CHANGED
@@ -17,7 +17,7 @@ describe Orthor::Site, "orthor site dsl" do
|
|
17
17
|
Orthor::Site.layout.should == :application
|
18
18
|
end
|
19
19
|
|
20
|
-
[ :categories, :feeds, :pages, :static_pages ].each do |collection|
|
20
|
+
[ :categories, :feeds, :pages, :static_pages, :queries ].each do |collection|
|
21
21
|
it "should have a #{collection} array" do
|
22
22
|
Orthor::Site.send(collection).should == []
|
23
23
|
end
|
@@ -43,6 +43,10 @@ describe Orthor::Site, "orthor site dsl" do
|
|
43
43
|
before(:all) do
|
44
44
|
Orthor::Site.define do
|
45
45
|
page "/", "Home"
|
46
|
+
|
47
|
+
query "/news" do
|
48
|
+
id "latest-news"
|
49
|
+
end
|
46
50
|
|
47
51
|
category "/writings" do
|
48
52
|
page "/writings/why", "Why we write"
|
@@ -51,6 +55,10 @@ describe Orthor::Site, "orthor site dsl" do
|
|
51
55
|
id "our-writings"
|
52
56
|
name "Our Writings"
|
53
57
|
end
|
58
|
+
|
59
|
+
query "/latest" do
|
60
|
+
id "latest-article"
|
61
|
+
end
|
54
62
|
|
55
63
|
category "/writings/announcements" do
|
56
64
|
page "/3rd-level", "3rd level"
|
@@ -63,10 +71,12 @@ describe Orthor::Site, "orthor site dsl" do
|
|
63
71
|
@page_1 = Orthor::Site.pages.first
|
64
72
|
@page_2 = @category_1.pages.first
|
65
73
|
@page_3 = @category_2.pages.first
|
74
|
+
@query = Orthor::Site.queries.first
|
75
|
+
@query_1 = @category_1.queries.first
|
66
76
|
end
|
67
77
|
|
68
78
|
it 'should return all resources defined in the dsl' do
|
69
|
-
Orthor::Site.resources.length.should ==
|
79
|
+
Orthor::Site.resources.length.should == 8
|
70
80
|
|
71
81
|
Orthor::Site.resources.should include(@category_1)
|
72
82
|
Orthor::Site.resources.should include(@category_2)
|
@@ -74,6 +84,8 @@ describe Orthor::Site, "orthor site dsl" do
|
|
74
84
|
Orthor::Site.resources.should include(@page_1)
|
75
85
|
Orthor::Site.resources.should include(@page_2)
|
76
86
|
Orthor::Site.resources.should include(@page_3)
|
87
|
+
Orthor::Site.resources.should include(@query)
|
88
|
+
Orthor::Site.resources.should include(@query_1)
|
77
89
|
end
|
78
90
|
end
|
79
91
|
|
@@ -206,6 +218,32 @@ describe Orthor::Site, "orthor site dsl" do
|
|
206
218
|
@page_3.id.should == "homepage"
|
207
219
|
end
|
208
220
|
end
|
221
|
+
|
222
|
+
describe "queries" do
|
223
|
+
before(:all) do
|
224
|
+
Orthor::Site.define do
|
225
|
+
query "/news" do
|
226
|
+
id "news"
|
227
|
+
end
|
228
|
+
|
229
|
+
query "/latest-release"
|
230
|
+
end
|
231
|
+
@query_1 = Orthor::Site.queries.first
|
232
|
+
@query_2 = Orthor::Site.queries.last
|
233
|
+
end
|
234
|
+
|
235
|
+
it "should support multiple queries" do
|
236
|
+
Orthor::Site.queries.length.should == 2
|
237
|
+
end
|
238
|
+
|
239
|
+
it "should support setting a query id" do
|
240
|
+
@query_1.id.should == "news"
|
241
|
+
end
|
242
|
+
|
243
|
+
it "should infer id from path when none is given" do
|
244
|
+
@query_2.id.should == "latest-release"
|
245
|
+
end
|
246
|
+
end
|
209
247
|
|
210
248
|
describe "feeds" do
|
211
249
|
before(:all) do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthorings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Langhorne
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-04-04 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/orthor/meta_data.rb
|
49
49
|
- lib/orthor/object.rb
|
50
50
|
- lib/orthor/page.rb
|
51
|
+
- lib/orthor/query.rb
|
51
52
|
- lib/orthor/site.rb
|
52
53
|
- lib/orthor/static_page.rb
|
53
54
|
- lib/orthor_helper.rb
|