easypartials 0.0.1
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/History.txt +3 -0
- data/MIT-LICENSE +20 -0
- data/Manifest.txt +17 -0
- data/PostInstall.txt +2 -0
- data/README.rdoc +63 -0
- data/Rakefile +22 -0
- data/TODO +6 -0
- data/init.rb +2 -0
- data/install.rb +1 -0
- data/lib/easypartials.rb +40 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/tasks/easypartials_tasks.rake +4 -0
- data/test/test_easypartials.rb +11 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +1 -0
- metadata +88 -0
data/History.txt
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 [name of plugin creator]
|
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/Manifest.txt
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
History.txt
|
2
|
+
MIT-LICENSE
|
3
|
+
Manifest.txt
|
4
|
+
PostInstall.txt
|
5
|
+
README.rdoc
|
6
|
+
Rakefile
|
7
|
+
TODO
|
8
|
+
init.rb
|
9
|
+
install.rb
|
10
|
+
lib/easypartials.rb
|
11
|
+
script/console
|
12
|
+
script/destroy
|
13
|
+
script/generate
|
14
|
+
tasks/easypartials_tasks.rake
|
15
|
+
test/test_easypartials.rb
|
16
|
+
test/test_helper.rb
|
17
|
+
uninstall.rb
|
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
= easypartials
|
2
|
+
|
3
|
+
* http://github.com/noahgibbs/easypartials
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
EasyPartials are a way to make partials in Rails even easier! This is
|
8
|
+
taken from a blog post by Mike Stone at
|
9
|
+
"http://smellsblue.blogspot.com/2009/11/easy-partials-in-rails.html".
|
10
|
+
|
11
|
+
== FEATURES/PROBLEMS:
|
12
|
+
|
13
|
+
* Allows easy partial invocation syntax, with simpler local variable passing
|
14
|
+
* Allows a shared directory for partials
|
15
|
+
|
16
|
+
== SYNOPSIS:
|
17
|
+
|
18
|
+
<% _my_partial :var => "123" do %>
|
19
|
+
<p>
|
20
|
+
Some block content.
|
21
|
+
</p>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
The above would render a partial (as with <%= render :partial =>
|
25
|
+
"my_partial" %>), with the local variable "var" set to "123", and the
|
26
|
+
local variable "body" set to the paragraph "some block content", HTML
|
27
|
+
tags included.
|
28
|
+
|
29
|
+
Note that you need to use <% rather than <%=.
|
30
|
+
|
31
|
+
== REQUIREMENTS:
|
32
|
+
|
33
|
+
You'll need a recent-ish version of Rails. You'll also need hoe and
|
34
|
+
newgem, but you get them automatically when you install easypartials.
|
35
|
+
|
36
|
+
== INSTALL:
|
37
|
+
|
38
|
+
sudo gem install easypartials
|
39
|
+
|
40
|
+
== LICENSE:
|
41
|
+
|
42
|
+
(The MIT License)
|
43
|
+
|
44
|
+
Copyright (c) 2009 Noah Gibbs and Mike Stone
|
45
|
+
|
46
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
47
|
+
a copy of this software and associated documentation files (the
|
48
|
+
'Software'), to deal in the Software without restriction, including
|
49
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
50
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
51
|
+
permit persons to whom the Software is furnished to do so, subject to
|
52
|
+
the following conditions:
|
53
|
+
|
54
|
+
The above copyright notice and this permission notice shall be
|
55
|
+
included in all copies or substantial portions of the Software.
|
56
|
+
|
57
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
58
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
59
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
60
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
61
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
62
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
63
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/easypartials'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
# Hoe.plugin :website
|
9
|
+
# Hoe.plugin :cucumberfeatures
|
10
|
+
|
11
|
+
# Generate all the Rake tasks
|
12
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
13
|
+
$hoe = Hoe.spec 'easypartials' do
|
14
|
+
self.developer 'Noah Gibbs', 'noah_gibbs (AT) yahoo dawt com'
|
15
|
+
self.post_install_message = 'PostInstall.txt'
|
16
|
+
self.rubyforge_name = self.name
|
17
|
+
# self.extra_deps = [['activesupport','>= 2.0.2']]
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'newgem/tasks'
|
22
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
data/TODO
ADDED
data/init.rb
ADDED
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
data/lib/easypartials.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
module Easypartials
|
5
|
+
VERSION = '0.0.1'
|
6
|
+
end
|
7
|
+
|
8
|
+
module ApplicationHelper
|
9
|
+
alias_method :method_missing_without_easy_partials, :method_missing
|
10
|
+
|
11
|
+
def method_missing_with_easy_partials(method_name, *args, &block)
|
12
|
+
method_str = method_name.to_s
|
13
|
+
|
14
|
+
if method_str =~ /^_.+$/
|
15
|
+
partial_name = method_str[/^_(.+)$/, 1]
|
16
|
+
|
17
|
+
begin
|
18
|
+
concat_partial partial_name, *args, &block
|
19
|
+
rescue ActionView::MissingTemplate
|
20
|
+
partial_name = "shared/#{partial_name}"
|
21
|
+
concat_partial partial_name, *args, &block
|
22
|
+
end
|
23
|
+
else
|
24
|
+
method_missing_without_easy_partials method_name, *args, &block
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
alias_method :method_missing, :method_missing_with_easy_partials
|
29
|
+
|
30
|
+
# Concat the given partial.
|
31
|
+
def concat_partial(partial_name, options = {}, &block)
|
32
|
+
unless block.nil?
|
33
|
+
options.merge! :body => capture(&block)
|
34
|
+
end
|
35
|
+
|
36
|
+
content = render :partial => partial_name, :locals => options
|
37
|
+
concat content
|
38
|
+
nil
|
39
|
+
end
|
40
|
+
end
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/cheaptoad.rb'}"
|
9
|
+
puts "Loading cheaptoad gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/test/test_helper.rb
ADDED
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: easypartials
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Noah Gibbs
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-11-08 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.3
|
24
|
+
version:
|
25
|
+
description: |-
|
26
|
+
EasyPartials are a way to make partials in Rails even easier! This is
|
27
|
+
taken from a blog post by Mike Stone at
|
28
|
+
"http://smellsblue.blogspot.com/2009/11/easy-partials-in-rails.html".
|
29
|
+
email:
|
30
|
+
- noah_gibbs (AT) yahoo dawt com
|
31
|
+
executables: []
|
32
|
+
|
33
|
+
extensions: []
|
34
|
+
|
35
|
+
extra_rdoc_files:
|
36
|
+
- History.txt
|
37
|
+
- Manifest.txt
|
38
|
+
- PostInstall.txt
|
39
|
+
files:
|
40
|
+
- History.txt
|
41
|
+
- MIT-LICENSE
|
42
|
+
- Manifest.txt
|
43
|
+
- PostInstall.txt
|
44
|
+
- README.rdoc
|
45
|
+
- Rakefile
|
46
|
+
- TODO
|
47
|
+
- init.rb
|
48
|
+
- install.rb
|
49
|
+
- lib/easypartials.rb
|
50
|
+
- script/console
|
51
|
+
- script/destroy
|
52
|
+
- script/generate
|
53
|
+
- tasks/easypartials_tasks.rake
|
54
|
+
- test/test_easypartials.rb
|
55
|
+
- test/test_helper.rb
|
56
|
+
- uninstall.rb
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: http://github.com/noahgibbs/easypartials
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message: PostInstall.txt
|
62
|
+
rdoc_options:
|
63
|
+
- --main
|
64
|
+
- README.rdoc
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
version:
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
version:
|
79
|
+
requirements: []
|
80
|
+
|
81
|
+
rubyforge_project: easypartials
|
82
|
+
rubygems_version: 1.3.5
|
83
|
+
signing_key:
|
84
|
+
specification_version: 3
|
85
|
+
summary: EasyPartials are a way to make partials in Rails even easier! This is taken from a blog post by Mike Stone at "http://smellsblue.blogspot.com/2009/11/easy-partials-in-rails.html".
|
86
|
+
test_files:
|
87
|
+
- test/test_easypartials.rb
|
88
|
+
- test/test_helper.rb
|