Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make middleman configuration helpers actually work :D

  • Loading branch information...
commit 743e49e40a6328a8bf5c242edddc7c25752b2ef3 1 parent 38389ba
@jasonwebster authored
View
4 LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2012 Jason Webster
+Copyright (c) 2012 Jason Webster, MetaLab Design Ltd.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
14 lib/middleman/features/tumblargh.rb
@@ -1,11 +1,14 @@
require 'rack/tumblargh'
module Middleman::Features::Tumblargh
+
class << self
- def registered(app, options={})
- app.extend ClassMethods
- app.use Rack::Tumblargh
+ def registered(app)
+ options = {}
+ app.set(:tumblr_options, options)
+ app.extend(ClassMethods)
+ app.use(Rack::Tumblargh, options)
end
alias :included :registered
@@ -15,7 +18,12 @@ def tumblr_api_key=(key)
Tumblargh::API::set_api_key(key)
end
+ def tumblr_blog=(blog=nil)
+ tumblr_options[:blog] = blog
+ end
+
alias_method :set_tumblr_api_key, :tumblr_api_key=
+ alias_method :set_tumblr_blog, :tumblr_blog=
end
end
View
6 lib/rack/tumblargh.rb
@@ -4,8 +4,12 @@ class Tumblargh
def initialize(app, options={})
@app = app
+ @options = options
+ @options[:blog] = 'staff.tumblr.com' if @options[:blog].nil?
end
+ attr_reader :options
+
def call(env)
status, headers, response = @app.call(env)
@@ -32,7 +36,7 @@ def should_parse?(status, headers)
end
def render(content)
- Tumblargh::render_html(content.first, 'willw.tumblr.com')
+ Tumblargh::render_html(content.first, options[:blog])
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.