lib/caboodle/kits/tumblr/tumblr.rb in caboodle-0.2.14 vs lib/caboodle/kits/tumblr/tumblr.rb in caboodle-0.2.15

- old
+ new

@@ -1,44 +1,36 @@ gem "tumblr-rb" require 'tumblr' -module Caboodle - class Tumblr < Caboodle::Kit - description "Includes a tumblr.com account" - - helpers do - def semantic_date post - date = Date.parse(post.date) - a = [] - a << "slug-#{post.slug}" - a << "y#{date.year}" - a << "m#{date.month}" - a << "d#{date.day}" - a.join(" ") - end +class Caboodle::Tumblr < Caboodle::Kit + description "Includes a tumblr.com account" + + helpers do + def semantic_date post + date = Date.parse(post.date) + a = [] + a << "slug-#{post.slug}" + a << "y#{date.year}" + a << "m#{date.month}" + a << "d#{date.day}" + a.join(" ") end - - required [:tumblr_email, :tumblr_password, :tumblr_sitename] - - menu "Tumblr", "/tumblr" do - puts "Get tumblr" - tumblr = ::Tumblr::Reader.new(Caboodle::Site.tumblr_email,Caboodle::Site.tumblr_password) - req = tumblr.read(Caboodle::Site.tumblr_sitename, {:num=>10}).perform_sleepily - puts req.inspect - posts = ::Tumblr::Reader.get_posts(req) - puts posts.inspect - - #posts = tumblr.get_posts(result) - haml :tumblr, :locals => { :posts => posts } - end - - get "/tumblr/page/:page" do - tumblr = ::Tumblr::Reader.new(Caboodle::Site.tumblr_email,Caboodle::Site.tumblr_password) - result - posts = tumblr.get_posts() - haml :tumblr, :locals => { :posts => posts } - end - - add_sass ["tumblr"] - end + + required [:tumblr_email, :tumblr_password, :tumblr_sitename] + + menu "Tumblr" do + tumblr = ::Tumblr::Reader.new(Caboodle::Site.tumblr_email,Caboodle::Site.tumblr_password) + req = tumblr.read(Caboodle::Site.tumblr_sitename, {:num=>10}).perform_sleepily + posts = ::Tumblr::Reader.get_posts(req) + haml :tumblr, :locals => { :posts => posts } + end + + get "/tumblr/page/:page" do + tumblr = ::Tumblr::Reader.new(Caboodle::Site.tumblr_email,Caboodle::Site.tumblr_password) + posts = tumblr.get_posts() + haml :tumblr, :locals => { :posts => posts } + end + + add_sass ["tumblr"] + end \ No newline at end of file