orthorings 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -3
- data/VERSION +1 -1
- data/lib/orthorings.rb +5 -3
- data/orthorings.gemspec +2 -2
- data/spec/orthor/dsl_spec.rb +10 -0
- data/spec/orthorings_spec.rb +5 -5
- metadata +2 -2
data/README.markdown
CHANGED
@@ -17,9 +17,9 @@ As a gem (from gemcutter.org)
|
|
17
17
|
|
18
18
|
Add a new file (e.g. orthor_config.rb) with the something like the below to your startup directory (e.g. in Rails config/initializers)
|
19
19
|
|
20
|
-
Orthorings.setup do
|
21
|
-
|
22
|
-
|
20
|
+
Orthorings.setup do
|
21
|
+
account_id "orthor"
|
22
|
+
caching :memory, 300, {}
|
23
23
|
end
|
24
24
|
|
25
25
|
You can specify any Moneta cache class as the first argument to config.caching, the second argument is expiry time in seconds. The third is any additional arguments you want passed to the cache class on initialize.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/orthorings.rb
CHANGED
@@ -8,7 +8,8 @@ class Orthorings
|
|
8
8
|
require 'net/http'
|
9
9
|
|
10
10
|
class << self
|
11
|
-
|
11
|
+
dsl_accessor :account_id
|
12
|
+
attr_accessor :cache, :cache_expiry
|
12
13
|
|
13
14
|
def content(id)
|
14
15
|
get_content(id, "http://content.orthor.com/#{@account_id}/content_items/#{id}.html")
|
@@ -33,10 +34,11 @@ class Orthorings
|
|
33
34
|
@cache_expiry = expiry
|
34
35
|
end
|
35
36
|
|
36
|
-
def setup
|
37
|
+
def setup(&block)
|
38
|
+
raise "Block required" unless block_given?
|
37
39
|
@cache = false # default
|
38
40
|
|
39
|
-
|
41
|
+
class_eval &block
|
40
42
|
|
41
43
|
raise "No orthor account id given... Please add one to your Orthorings setup block" if Orthorings.account_id.nil?
|
42
44
|
ActionView::Base.send(:include, OrthorHelper) if defined?(ActionView::Base) && !ActionView::Base.include?(OrthorHelper)
|
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.1.
|
8
|
+
s.version = "0.1.3"
|
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{2009-
|
12
|
+
s.date = %q{2009-10-07}
|
13
13
|
s.email = %q{anthony@orthor.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
data/spec/orthor/dsl_spec.rb
CHANGED
@@ -244,6 +244,8 @@ describe Orthor::Site, "orthor site dsl" do
|
|
244
244
|
static_page "/" do
|
245
245
|
name "Home"
|
246
246
|
cache_for 3600
|
247
|
+
action :blah
|
248
|
+
controller :asdf
|
247
249
|
end
|
248
250
|
end
|
249
251
|
@page_1 = Orthor::Site.static_pages[0]
|
@@ -254,6 +256,14 @@ describe Orthor::Site, "orthor site dsl" do
|
|
254
256
|
it 'should support multiple pages' do
|
255
257
|
Orthor::Site.static_pages.length.should == 3
|
256
258
|
end
|
259
|
+
|
260
|
+
it 'should support setting action' do
|
261
|
+
@page_3.action.should == :blah
|
262
|
+
end
|
263
|
+
|
264
|
+
it 'should support setting controller' do
|
265
|
+
@page_3.controller.should == :asdf
|
266
|
+
end
|
257
267
|
|
258
268
|
it 'should support specifying pages with or without a block' do
|
259
269
|
@page_1.name.should == "About us"
|
data/spec/orthorings_spec.rb
CHANGED
@@ -7,8 +7,8 @@ describe Orthorings, "fetching content" do
|
|
7
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
8
|
FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/categories/news.html", :body => File.join(SPEC_DIR, 'resources', 'news.html'))
|
9
9
|
|
10
|
-
Orthorings.setup do
|
11
|
-
|
10
|
+
Orthorings.setup do
|
11
|
+
account_id "orthor"
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
@@ -35,9 +35,9 @@ describe Orthorings, "caching content" do
|
|
35
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
36
|
FakeWeb.register_uri(:get, "http://content.orthor.com/orthor/categories/news.html", :body => File.join(SPEC_DIR, 'resources', 'news.html'))
|
37
37
|
|
38
|
-
Orthorings.setup do
|
39
|
-
|
40
|
-
|
38
|
+
Orthorings.setup do
|
39
|
+
account_id "orthor"
|
40
|
+
caching :memory
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
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.1.
|
4
|
+
version: 0.1.3
|
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: 2009-
|
12
|
+
date: 2009-10-07 00:00:00 +11:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|