thorero-parts 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README +4 -0
- data/Rakefile +65 -0
- data/TODO +5 -0
- data/lib/merb-parts.rb +4 -0
- data/lib/merb-parts/merbtasks.rb +6 -0
- data/lib/merb-parts/mixins/parts_mixin.rb +42 -0
- data/lib/merb-parts/mixins/web_controller.rb +67 -0
- data/lib/merb-parts/part_controller.rb +94 -0
- data/spec/fixtures/controllers/main.rb +33 -0
- data/spec/fixtures/parts/done_part.rb +4 -0
- data/spec/fixtures/parts/todo_part.rb +30 -0
- data/spec/fixtures/parts/views/layout/todo_part.html.erb +3 -0
- data/spec/fixtures/parts/views/layout/todo_part.xml.erb +3 -0
- data/spec/fixtures/parts/views/todo_part/formatted_output.html.erb +1 -0
- data/spec/fixtures/parts/views/todo_part/formatted_output.js.erb +1 -0
- data/spec/fixtures/parts/views/todo_part/formatted_output.xml.erb +1 -0
- data/spec/fixtures/parts/views/todo_part/list.html.erb +3 -0
- data/spec/fixtures/parts/views/todo_part/part_with_params.html.erb +3 -0
- data/spec/fixtures/views/main/part_within_view.html.erb +1 -0
- data/spec/merb-parts_spec.rb +84 -0
- data/spec/spec_helper.rb +12 -0
- metadata +95 -0
data/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2008 YOUR NAME
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake/gempackagetask'
|
|
3
|
+
require "extlib"
|
|
4
|
+
require 'merb-core/tasks/merb_rake_helper'
|
|
5
|
+
require "spec/rake/spectask"
|
|
6
|
+
|
|
7
|
+
##############################################################################
|
|
8
|
+
# Package && release
|
|
9
|
+
##############################################################################
|
|
10
|
+
RUBY_FORGE_PROJECT = "thorero"
|
|
11
|
+
PROJECT_URL = "http://merbivore.com"
|
|
12
|
+
PROJECT_SUMMARY = "Merb More: Merb plugin that provides Part Controllers."
|
|
13
|
+
PROJECT_DESCRIPTION = PROJECT_SUMMARY
|
|
14
|
+
|
|
15
|
+
GEM_AUTHOR = "Daniel Neighman"
|
|
16
|
+
GEM_EMAIL = "has.sox@gmail.com"
|
|
17
|
+
|
|
18
|
+
GEM_NAME = "thorero-parts"
|
|
19
|
+
PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
|
|
20
|
+
GEM_VERSION = (Merb::MORE_VERSION rescue "0.9.4") + PKG_BUILD
|
|
21
|
+
|
|
22
|
+
RELEASE_NAME = "REL #{GEM_VERSION}"
|
|
23
|
+
|
|
24
|
+
require "extlib/tasks/release"
|
|
25
|
+
|
|
26
|
+
spec = Gem::Specification.new do |s|
|
|
27
|
+
s.rubyforge_project = RUBY_FORGE_PROJECT
|
|
28
|
+
s.name = GEM_NAME
|
|
29
|
+
s.version = GEM_VERSION
|
|
30
|
+
s.platform = Gem::Platform::RUBY
|
|
31
|
+
s.has_rdoc = true
|
|
32
|
+
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
|
33
|
+
s.summary = PROJECT_SUMMARY
|
|
34
|
+
s.description = PROJECT_DESCRIPTION
|
|
35
|
+
s.author = GEM_AUTHOR
|
|
36
|
+
s.email = GEM_EMAIL
|
|
37
|
+
s.homepage = PROJECT_URL
|
|
38
|
+
s.add_dependency('merb-core', '>= 0.9.4')
|
|
39
|
+
s.require_path = 'lib'
|
|
40
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec,merb_generators}/**/*")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
|
44
|
+
pkg.gem_spec = spec
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
desc "Install the gem"
|
|
48
|
+
task :install => [:package] do
|
|
49
|
+
sh %{#{sudo} gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION} --no-update-sources}
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
namespace :jruby do
|
|
53
|
+
|
|
54
|
+
desc "Run :package and install the resulting .gem with jruby"
|
|
55
|
+
task :install => :package do
|
|
56
|
+
sh %{#{sudo} jruby -S gem install #{install_home} pkg/#{GEM_NAME}-#{GEM_VERSION}.gem --no-rdoc --no-ri}
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
desc "Run all specs"
|
|
62
|
+
Spec::Rake::SpecTask.new("specs") do |t|
|
|
63
|
+
t.spec_opts = ["--format", "specdoc", "--colour"]
|
|
64
|
+
t.spec_files = Dir["spec/**/*_spec.rb"].sort
|
|
65
|
+
end
|
data/TODO
ADDED
data/lib/merb-parts.rb
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Merb
|
|
2
|
+
module PartsMixin
|
|
3
|
+
|
|
4
|
+
# Dispatches a PartController.
|
|
5
|
+
# ==== Parameters
|
|
6
|
+
# opts<Hash>:: A Hash of Options. (see below)
|
|
7
|
+
#
|
|
8
|
+
# ==== Options
|
|
9
|
+
# An option hash has two parts.
|
|
10
|
+
# 1. keys that are Merb::PartControllers with values that are action names (as symbols)
|
|
11
|
+
# 2. key value pairs that will become available in the PartController as params merged
|
|
12
|
+
# with the web controllers params
|
|
13
|
+
#
|
|
14
|
+
# ==== Example
|
|
15
|
+
# Calling a part controller
|
|
16
|
+
# {{{
|
|
17
|
+
# part TodoPart => :list
|
|
18
|
+
# }}}
|
|
19
|
+
#
|
|
20
|
+
# Calling a part with additional options
|
|
21
|
+
# {{{
|
|
22
|
+
# part TodoPart => :list, :limit => 20, :user => current_user
|
|
23
|
+
# }}}
|
|
24
|
+
#
|
|
25
|
+
# ==== Returns
|
|
26
|
+
# Returns the result of the PartControllers action, which is a string.
|
|
27
|
+
def part(opts = {})
|
|
28
|
+
# Extract any params out that may have been specified
|
|
29
|
+
klasses, opts = opts.partition do |k,v|
|
|
30
|
+
k.respond_to?(:ancestors) && k.ancestors.include?(Merb::PartController)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
opts = Hash[*(opts.flatten)]
|
|
34
|
+
|
|
35
|
+
res = klasses.inject([]) do |memo,(klass,action)|
|
|
36
|
+
memo << klass.new(self, opts)._dispatch(action)
|
|
37
|
+
end
|
|
38
|
+
res.size == 1 ? res[0] : res
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Includes files into the class to allow it to minimally delegates to a web controller
|
|
2
|
+
module Merb
|
|
3
|
+
module Mixins
|
|
4
|
+
module WebController
|
|
5
|
+
|
|
6
|
+
def self.included(base)
|
|
7
|
+
[:content_type, :web_controller].each do |attr|
|
|
8
|
+
base.send(:attr_accessor, attr)
|
|
9
|
+
end
|
|
10
|
+
base.send(:include, InstanceMethods)
|
|
11
|
+
base.send(:extend, ClassMethods)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
module InstanceMethods
|
|
15
|
+
def request
|
|
16
|
+
@web_controller.request
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def cookies
|
|
20
|
+
@web_controller.cookies
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def headers
|
|
24
|
+
@web_controller.headers
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def session
|
|
28
|
+
@web_controller.session
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def response
|
|
32
|
+
@web_controller.response
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def route
|
|
36
|
+
request.route
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def url(name, rparams={})
|
|
40
|
+
Merb::Router.generate(name, rparams,
|
|
41
|
+
{ :controller => @web_controller.controller_name,
|
|
42
|
+
:action => @web_controller.action_name,
|
|
43
|
+
:format => params[:format]
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
private
|
|
49
|
+
# This method is here to overwrite the one in the general_controller mixin
|
|
50
|
+
# The method ensures that when a url is generated with a hash, it contains a controller
|
|
51
|
+
def get_controller_for_url_generation(opts)
|
|
52
|
+
controller = opts[:controller] || @web_controller.params[:controller]
|
|
53
|
+
raise "No Controller Specified for url()" unless controller
|
|
54
|
+
controller
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
module ClassMethods
|
|
60
|
+
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
end # WebController
|
|
66
|
+
end # Mixins
|
|
67
|
+
end # Merb
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
require File.join(File.dirname(__FILE__), "mixins", "web_controller")
|
|
2
|
+
module Merb
|
|
3
|
+
|
|
4
|
+
# A Merb::PartController is a light weight way to share logic and templates
|
|
5
|
+
# amongst controllers.
|
|
6
|
+
# Merb::PartControllers work just like Merb::controller.
|
|
7
|
+
# There is a filter stack, layouts (if needed) all the render functions,
|
|
8
|
+
# and url generation.
|
|
9
|
+
#
|
|
10
|
+
# Cookies, params, and even the request object are shared with the web controller
|
|
11
|
+
class PartController < AbstractController
|
|
12
|
+
include Merb::Mixins::WebController
|
|
13
|
+
|
|
14
|
+
attr_reader :params
|
|
15
|
+
|
|
16
|
+
cattr_accessor :_subclasses
|
|
17
|
+
self._subclasses = Set.new
|
|
18
|
+
|
|
19
|
+
# ==== Returns
|
|
20
|
+
# Array[Class]:: Classes that inherit from Merb::PartController.
|
|
21
|
+
def self.subclasses_list() _subclasses end
|
|
22
|
+
|
|
23
|
+
# ==== Parameters
|
|
24
|
+
# action<~to_s>:: The name of the action that will be rendered.
|
|
25
|
+
# type<~to_s>::
|
|
26
|
+
# The mime-type of the template that will be rendered. Defaults to html.
|
|
27
|
+
# controller<~to_s>::
|
|
28
|
+
# The name of the controller that will be rendered. Defaults to
|
|
29
|
+
# controller_name.
|
|
30
|
+
#
|
|
31
|
+
# ==== Returns
|
|
32
|
+
# String:: The template location, i.e. ":controller/:action.:type".
|
|
33
|
+
def _template_location(action, type = :html, controller = controller_name)
|
|
34
|
+
"#{controller}/#{action}.#{type}"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# The location to look for a template and mime-type. This is overridden
|
|
38
|
+
# from AbstractController, which defines a version of this that does not
|
|
39
|
+
# involve mime-types.
|
|
40
|
+
#
|
|
41
|
+
# ==== Parameters
|
|
42
|
+
# template<String>::
|
|
43
|
+
# The absolute path to a template - without mime and template extension.
|
|
44
|
+
# The mime-type extension is optional - it will be appended from the
|
|
45
|
+
# current content type if it hasn't been added already.
|
|
46
|
+
# type<~to_s>::
|
|
47
|
+
# The mime-type of the template that will be rendered. Defaults to nil.
|
|
48
|
+
#
|
|
49
|
+
# @public
|
|
50
|
+
def _absolute_template_location(template, type)
|
|
51
|
+
template.match(/\.#{type.to_s.escape_regexp}$/) ? template : "#{template}.#{type}"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Sets the template root to the default parts view directory.
|
|
55
|
+
#
|
|
56
|
+
# ==== Parameters
|
|
57
|
+
# klass<Class>::
|
|
58
|
+
# The Merb::PartController inheriting from the base class.
|
|
59
|
+
def self.inherited(klass)
|
|
60
|
+
_subclasses << klass.to_s
|
|
61
|
+
super
|
|
62
|
+
klass._template_root = Merb.dir_for(:part) / "views" unless self._template_root
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# ==== Parameters
|
|
66
|
+
# web_controller<Merb::Controller>:: The controller calling this part.
|
|
67
|
+
# opts<Hash>:: Additional options for this part.
|
|
68
|
+
def initialize(web_controller, opts = {})
|
|
69
|
+
@web_controller = web_controller
|
|
70
|
+
@params = @web_controller.params.dup
|
|
71
|
+
@params.merge!(opts) unless opts.empty?
|
|
72
|
+
super
|
|
73
|
+
@content_type = @web_controller.content_type
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# ==== Parameters
|
|
77
|
+
# action<~to_s>:: An action to dispatch to. Defaults to :to_s.
|
|
78
|
+
#
|
|
79
|
+
# ==== Returns
|
|
80
|
+
# String:: The part body.
|
|
81
|
+
def _dispatch(action=:to_s)
|
|
82
|
+
self.action_name = action
|
|
83
|
+
super(action)
|
|
84
|
+
@body
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Send any methods that are missing back up to the web controller
|
|
88
|
+
# Patched to set partial locals on the web controller
|
|
89
|
+
def method_missing(sym, *args, &blk)
|
|
90
|
+
@web_controller.instance_variable_set(:@_merb_partial_locals, @_merb_partial_locals)
|
|
91
|
+
@web_controller.send(sym, *args, &blk)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
class Main < Merb::Controller
|
|
2
|
+
self._template_root = File.dirname(__FILE__) / ".." / "views"
|
|
3
|
+
|
|
4
|
+
def index
|
|
5
|
+
part TodoPart => :list
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def index2
|
|
9
|
+
part TodoPart => :one
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def index3
|
|
13
|
+
part(TodoPart => :one) + part(TodoPart => :list)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def index4
|
|
17
|
+
provides :xml, :js
|
|
18
|
+
part(TodoPart => :formatted_output)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def part_with_params
|
|
22
|
+
part(TodoPart => :part_with_params, :my_param => "my_value")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def part_within_view
|
|
26
|
+
render
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def parth_with_absolute_template
|
|
30
|
+
part(TodoPart => :parth_with_absolute_template)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class TodoPart < Merb::PartController
|
|
2
|
+
self._template_root = File.expand_path(File.join(File.dirname(__FILE__), "views"))
|
|
3
|
+
|
|
4
|
+
before :load_todos
|
|
5
|
+
|
|
6
|
+
def list
|
|
7
|
+
render
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def one
|
|
11
|
+
render :list, :layout => false
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def load_todos
|
|
15
|
+
@todos = ["Do this", "Do that", 'Do the other thing']
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def formatted_output
|
|
19
|
+
render
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def part_with_params
|
|
23
|
+
render
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def parth_with_absolute_template
|
|
27
|
+
render :template => File.expand_path(self._template_root) / 'todo_part' / 'formatted_output'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
part_html_format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
part_js_format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
part_xml_format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= part TodoPart => :one %>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "A Merb PartController" do
|
|
4
|
+
|
|
5
|
+
before(:each) do
|
|
6
|
+
Merb::Router.prepare do |r|
|
|
7
|
+
r.default_routes
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it "should render a part template with no layout" do
|
|
12
|
+
controller = dispatch_to(Main, :index2)
|
|
13
|
+
controller.body.should ==
|
|
14
|
+
"TODOPART\nDo this|Do that|Do the other thing\nTODOPART"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it "should render a part template with it's own layout" do
|
|
18
|
+
controller = dispatch_to(Main, :index)
|
|
19
|
+
controller.body.should ==
|
|
20
|
+
"TODOLAYOUT\nTODOPART\nDo this|Do that|Do the other thing\nTODOPART\nTODOLAYOUT"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it "should render multiple parts if more then one part is passed in" do
|
|
24
|
+
controller = dispatch_to(Main, :index3)
|
|
25
|
+
controller.body.should ==
|
|
26
|
+
"TODOPART\nDo this|Do that|Do the other thing\nTODOPART" +
|
|
27
|
+
"TODOLAYOUT\nTODOPART\nDo this|Do that|Do the other thing\nTODOPART\nTODOLAYOUT"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it "should render the html format by default to the controller that set it" do
|
|
31
|
+
controller = dispatch_to(Main, :index4)
|
|
32
|
+
controller.body.should match(/part_html_format/m)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "should render the xml format according to the controller" do
|
|
36
|
+
controller = dispatch_to(Main, :index4, {:format => 'xml'} )
|
|
37
|
+
controller.body.should match(/part_xml_format/m)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it "should render the js format according to the controller" do
|
|
41
|
+
controller = dispatch_to(Main, :index4, :format => 'js')
|
|
42
|
+
controller.body.should match(/part_js_format/m)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "should provide params when calling a part" do
|
|
46
|
+
controller = dispatch_to(Main, :part_with_params)
|
|
47
|
+
controller.body.should match( /my_param = my_value/)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it "should render from inside a view" do
|
|
51
|
+
controller = dispatch_to(Main, :part_within_view)
|
|
52
|
+
controller.body.should match( /Do this/)
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it "should render a template from an absolute path" do
|
|
56
|
+
controller = dispatch_to(Main, :parth_with_absolute_template)
|
|
57
|
+
controller.body.should match(/part_html_format/m)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe "A Merb Part Controller with urls" do
|
|
63
|
+
|
|
64
|
+
def new_url_controller(route, params = {:action => 'show', :controller => 'Test'})
|
|
65
|
+
@controller = dispatch_to(Main, :index)
|
|
66
|
+
TodoPart.new(@controller)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "should use the web_controllers type if no controller is specified" do
|
|
70
|
+
c = new_url_controller(@default_route, :controller => "my_controller")
|
|
71
|
+
the_url = c.url(:action => "bar")
|
|
72
|
+
the_url.should == "/main/bar"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
describe "A Merb Part Controller inheriting from another Part Controller" do
|
|
78
|
+
|
|
79
|
+
it "should inherit the _template_root" do
|
|
80
|
+
TodoPart._template_root.should == File.expand_path(File.dirname(__FILE__) / 'fixtures' / 'parts' / 'views')
|
|
81
|
+
TodoPart._template_root.should == DonePart._template_root
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require "merb-core"
|
|
3
|
+
require File.join( File.dirname(__FILE__), "..", "lib", "merb-parts" )
|
|
4
|
+
|
|
5
|
+
# Require the fixtures
|
|
6
|
+
Dir[File.join(File.dirname(__FILE__), "fixtures", "*/**.rb")].each{|f| require f }
|
|
7
|
+
|
|
8
|
+
Merb.start :environment => 'test'
|
|
9
|
+
|
|
10
|
+
Spec::Runner.configure do |config|
|
|
11
|
+
config.include Merb::Test::RequestHelper
|
|
12
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: thorero-parts
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.9.4
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Daniel Neighman
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
|
|
12
|
+
date: 2008-08-02 00:00:00 +03:00
|
|
13
|
+
default_executable:
|
|
14
|
+
dependencies:
|
|
15
|
+
- !ruby/object:Gem::Dependency
|
|
16
|
+
name: merb-core
|
|
17
|
+
type: :runtime
|
|
18
|
+
version_requirement:
|
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
20
|
+
requirements:
|
|
21
|
+
- - ">="
|
|
22
|
+
- !ruby/object:Gem::Version
|
|
23
|
+
version: 0.9.4
|
|
24
|
+
version:
|
|
25
|
+
description: "Merb More: Merb plugin that provides Part Controllers."
|
|
26
|
+
email: has.sox@gmail.com
|
|
27
|
+
executables: []
|
|
28
|
+
|
|
29
|
+
extensions: []
|
|
30
|
+
|
|
31
|
+
extra_rdoc_files:
|
|
32
|
+
- README
|
|
33
|
+
- LICENSE
|
|
34
|
+
- TODO
|
|
35
|
+
files:
|
|
36
|
+
- LICENSE
|
|
37
|
+
- README
|
|
38
|
+
- Rakefile
|
|
39
|
+
- TODO
|
|
40
|
+
- lib/merb-parts
|
|
41
|
+
- lib/merb-parts/merbtasks.rb
|
|
42
|
+
- lib/merb-parts/mixins
|
|
43
|
+
- lib/merb-parts/mixins/parts_mixin.rb
|
|
44
|
+
- lib/merb-parts/mixins/web_controller.rb
|
|
45
|
+
- lib/merb-parts/part_controller.rb
|
|
46
|
+
- lib/merb-parts.rb
|
|
47
|
+
- spec/fixtures
|
|
48
|
+
- spec/fixtures/controllers
|
|
49
|
+
- spec/fixtures/controllers/main.rb
|
|
50
|
+
- spec/fixtures/parts
|
|
51
|
+
- spec/fixtures/parts/done_part.rb
|
|
52
|
+
- spec/fixtures/parts/todo_part.rb
|
|
53
|
+
- spec/fixtures/parts/views
|
|
54
|
+
- spec/fixtures/parts/views/layout
|
|
55
|
+
- spec/fixtures/parts/views/layout/todo_part.html.erb
|
|
56
|
+
- spec/fixtures/parts/views/layout/todo_part.xml.erb
|
|
57
|
+
- spec/fixtures/parts/views/todo_part
|
|
58
|
+
- spec/fixtures/parts/views/todo_part/formatted_output.html.erb
|
|
59
|
+
- spec/fixtures/parts/views/todo_part/formatted_output.js.erb
|
|
60
|
+
- spec/fixtures/parts/views/todo_part/formatted_output.xml.erb
|
|
61
|
+
- spec/fixtures/parts/views/todo_part/list.html.erb
|
|
62
|
+
- spec/fixtures/parts/views/todo_part/part_with_params.html.erb
|
|
63
|
+
- spec/fixtures/views
|
|
64
|
+
- spec/fixtures/views/main
|
|
65
|
+
- spec/fixtures/views/main/part_within_view.html.erb
|
|
66
|
+
- spec/merb-parts_spec.rb
|
|
67
|
+
- spec/spec_helper.rb
|
|
68
|
+
has_rdoc: true
|
|
69
|
+
homepage: http://merbivore.com
|
|
70
|
+
post_install_message:
|
|
71
|
+
rdoc_options: []
|
|
72
|
+
|
|
73
|
+
require_paths:
|
|
74
|
+
- lib
|
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: "0"
|
|
80
|
+
version:
|
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
|
+
requirements:
|
|
83
|
+
- - ">="
|
|
84
|
+
- !ruby/object:Gem::Version
|
|
85
|
+
version: "0"
|
|
86
|
+
version:
|
|
87
|
+
requirements: []
|
|
88
|
+
|
|
89
|
+
rubyforge_project: thorero
|
|
90
|
+
rubygems_version: 1.2.0
|
|
91
|
+
signing_key:
|
|
92
|
+
specification_version: 2
|
|
93
|
+
summary: "Merb More: Merb plugin that provides Part Controllers."
|
|
94
|
+
test_files: []
|
|
95
|
+
|