Permalink
Browse files

now requires cells-4.0.0.

  • Loading branch information...
1 parent 7a3f488 commit c69b2791406d5f319ef61ee81e0f4f8cf8dc8a97 @apotonick apotonick committed Jun 6, 2010
Showing with 15 additions and 26 deletions.
  1. +6 −4 README.rdoc
  2. +1 −1 Rakefile
  3. +4 −3 lib/cell/sinatra.rb
  4. +2 −3 lib/cells-sinatra.rb
  5. +0 −8 lib/cells.rb
  6. +1 −1 lib/cells/sinatra.rb
  7. +0 −5 test/sinatra_test.rb
  8. +1 −1 test/test_helper.rb
View
@@ -1,20 +1,22 @@
= Sinatra Cells
-_View Components for Sinatra_
+<em>View Components for Sinatra</em>
== Introduction
Cells are object-oriented view components for your MVC-apps. They provide a decent way for encapsulating logic
-and rendering and thus help in creating reusable widgets.
+and rendering - thus helping in creating reusable widgets.
For a detailed discussion on cells see http://github.com/apotonick/cells
== Usage
Rendering cells in your Sinatra app is easy.
- MyApp < Sinatra::Base
- helpers Cells::Sinatra
+ require 'cells-sinatra'
+
+ MyApp < Sinatra::Base
+ helpers Cells::Sinatra
get "/" do
@top_posts = render_cell(:post, :top10)
View
@@ -65,7 +65,7 @@ begin
spec.files = FileList["[A-Z]*", File.join(*%w[{lib} ** *]).to_s]
spec.add_dependency 'activesupport', '>= 2.3.0'
- spec.add_dependency 'cells', '>= 3.4.0'
+ spec.add_dependency 'cells', '>= 4.0.0'
end
Jeweler::GemcutterTasks.new
View
@@ -1,8 +1,9 @@
module Cell
- class Sinatra < AbstractBase ### TODO: derive from Cell::Base.
+ class Sinatra
# Sinatra::Templates introduces two dependencies:
- # - it accesses @template_cache
- # - invokes methods #settings
+ # - it accesses @template_cache
+ # - invokes methods #settings
+ include ::Cell::BaseMethods # from the cells gem.
include ::Sinatra::Templates
alias_method :render_template, :render
delegate :settings, :to => :controller
View
@@ -2,10 +2,9 @@
require 'active_support'
-gem 'cells', '= 3.4.0'
-require 'cells'
-require 'cell/abstract_base' ### FIXME: let cells handle that!
+gem 'cells', '= 4.0.0'
+require 'cell/base_methods'
require 'sinatra/base'
require 'cells/sinatra'
require 'cell/sinatra'
View
@@ -1,8 +0,0 @@
-require 'rubygems'
-
-gem 'cells', '= 3.4.0'
-
-module Cells
-end
-
-require 'cells/sinatra'
View
@@ -18,7 +18,7 @@ module Sinatra
#
# would render the state +top10+ of the +PostCell+.
def render_cell(name, state, opts={})
- ::Cell::AbstractBase.render_cell_for(self, name, state, opts)
+ ::Cell::Sinatra.render_cell_for(self, name, state, opts)
end
end
end
View
@@ -1,5 +0,0 @@
-require File.join(File.dirname(__FILE__), 'test_helper')
-
-class SinatraTest < ActiveSupport::TestCase
-
-end
View
@@ -13,7 +13,7 @@
class ActiveSupport::TestCase
def cell(name, opts={})
- ::Cell::AbstractBase.create_cell_for(@controller, name, opts)
+ ::Cell::Sinatra.create_cell_for(@controller, name, opts)
end
def render_cell(name, state, opts={}) ### FIXME.

0 comments on commit c69b279

Please sign in to comment.