midas-g_named_scope_filters 1.0.0
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/Manifest.txt +15 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +102 -0
- data/Rakefile +30 -0
- data/g_named_scope_filters.gemspec +44 -0
- data/lib/g_named_scope_filters.rb +12 -0
- data/lib/g_named_scope_filters/view_helpers.rb +145 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/g_named_scope_filters_spec.rb +11 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/tasks/rspec.rake +21 -0
- metadata +111 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
g_named_scope_filters.gemspec
|
7
|
+
lib/g_named_scope_filters.rb
|
8
|
+
lib/g_named_scope_filters/view_helpers.rb
|
9
|
+
script/console
|
10
|
+
script/destroy
|
11
|
+
script/generate
|
12
|
+
spec/g_named_scope_filters_spec.rb
|
13
|
+
spec/spec.opts
|
14
|
+
spec/spec_helper.rb
|
15
|
+
tasks/rspec.rake
|
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
= g_named_scope_filters
|
2
|
+
|
3
|
+
http://github.com/midas/g_named_scope_filters/tree/master
|
4
|
+
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
This is an unordered list of filters that use named scopes within an ActiveRecord model
|
9
|
+
to filter a list. It is not tied to a table or list specifically as it simply manipulates the url, resulting
|
10
|
+
in a manipulation of any collection (list, table, etc.) it may be coupled with.
|
11
|
+
|
12
|
+
|
13
|
+
== FEATURES
|
14
|
+
|
15
|
+
* Generates unordered list of links that will filter based on defined named scopes in an ActiveRecord model
|
16
|
+
|
17
|
+
|
18
|
+
== PLANNED FEATURES
|
19
|
+
|
20
|
+
* Automatically use all named scopes defined in model if :only or :except options are not used
|
21
|
+
* Obey the :except option if :only option not present
|
22
|
+
|
23
|
+
|
24
|
+
== REQUIREMENTS:
|
25
|
+
|
26
|
+
* Rails >= 2.2.0
|
27
|
+
* Guilded >= 0.0.8 (http://github.com/midas/guilded/tree/master)
|
28
|
+
|
29
|
+
|
30
|
+
== INSTALL:
|
31
|
+
|
32
|
+
sudo gem install midas-g_named_scope_filters
|
33
|
+
|
34
|
+
In your Rails environment.rb file:
|
35
|
+
|
36
|
+
config.gem 'midas-g_named_scope_filters', :version => '1.0.0', :lib => 'g_named_scope_filters', :source => 'http://gems.github.com'
|
37
|
+
|
38
|
+
|
39
|
+
== USAGE:
|
40
|
+
|
41
|
+
Model:
|
42
|
+
|
43
|
+
class Item < ActiveRecord::Base
|
44
|
+
named_scope :recent, lambda { { :conditions => [ "date_of_offense BETWEEN ? AND ?",
|
45
|
+
31.days.ago.utc, Time.zone.now.end_of_day.utc ] } }
|
46
|
+
named_scope :inactive, :conditions => { :is_active => false }
|
47
|
+
end
|
48
|
+
|
49
|
+
View:
|
50
|
+
<%= g_named_scope_filters Item, :only => [:recent, :inactive], :scoped_by => @account, :include_count => true,
|
51
|
+
:id => 'item_filters' %>
|
52
|
+
|
53
|
+
You currently must use the :only option to specify which named scopes to use. It is planned to use all named scopes if
|
54
|
+
:only or :except are not present, however it is not yet implemented.
|
55
|
+
|
56
|
+
Results in:
|
57
|
+
|
58
|
+
<ul id="doc-filters" class="filters">
|
59
|
+
<li>
|
60
|
+
<a class="selected" href="/accounts/2/items">
|
61
|
+
All
|
62
|
+
<span>2</span>
|
63
|
+
</a>
|
64
|
+
</li>
|
65
|
+
<li>
|
66
|
+
<a class="" href="/accounts/2/items?filter=recent">
|
67
|
+
Recent
|
68
|
+
<span>1</span>
|
69
|
+
</a>
|
70
|
+
</li>
|
71
|
+
<li>
|
72
|
+
<a class="" href="/accounts/2/items?filter=inactive">
|
73
|
+
Inactive
|
74
|
+
<span>0</span>
|
75
|
+
</a>
|
76
|
+
</li>
|
77
|
+
</ul>
|
78
|
+
|
79
|
+
== LICENSE:
|
80
|
+
|
81
|
+
(The MIT License)
|
82
|
+
|
83
|
+
Copyright (c) 2009 C. Jason Harrelson (midas)
|
84
|
+
|
85
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
86
|
+
a copy of this software and associated documentation files (the
|
87
|
+
'Software'), to deal in the Software without restriction, including
|
88
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
89
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
90
|
+
permit persons to whom the Software is furnished to do so, subject to
|
91
|
+
the following conditions:
|
92
|
+
|
93
|
+
The above copyright notice and this permission notice shall be
|
94
|
+
included in all copies or substantial portions of the Software.
|
95
|
+
|
96
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
97
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
98
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
99
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
100
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
101
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
102
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
+
require File.dirname(__FILE__) + '/lib/g_named_scope_filters'
|
3
|
+
|
4
|
+
# Generate all the Rake tasks
|
5
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
+
$hoe = Hoe.new('g_named_scope_filters', GNamedScopeFilters::VERSION) do |p|
|
7
|
+
p.developer('C. Jason Harrelson (midas)', 'jason@lookforwardenterprises.com')
|
8
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
+
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
|
+
p.rubyforge_name = p.name # TODO this is default value
|
11
|
+
# p.extra_deps = [
|
12
|
+
# ['activesupport','>= 2.0.2'],
|
13
|
+
# ]
|
14
|
+
p.extra_dev_deps = [
|
15
|
+
['newgem', ">= #{::Newgem::VERSION}"],
|
16
|
+
['rails', ">= 2.2.0"],
|
17
|
+
['midas-guilded', ">=0.0.6"]
|
18
|
+
]
|
19
|
+
|
20
|
+
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
21
|
+
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
22
|
+
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
23
|
+
p.rsync_args = '-av --delete --ignore-errors'
|
24
|
+
end
|
25
|
+
|
26
|
+
require 'newgem/tasks' # load /tasks/*.rake
|
27
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
28
|
+
|
29
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
30
|
+
# task :default => [:spec, :features]
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{g_named_scope_filters}
|
5
|
+
s.version = "1.0.0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["C. Jason Harrelson (midas)"]
|
9
|
+
s.date = %q{2009-03-12}
|
10
|
+
s.description = %q{This is an unordered list of filters that use named scopes within an ActiveRecord model to filter a list. It is not tied to a table or list specifically as it simply manipulates the url, resulting in a manipulation of any collection (list, table, etc.) it may be coupled with.}
|
11
|
+
s.email = ["jason@lookforwardenterprises.com"]
|
12
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
|
13
|
+
s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "g_named_scope_filters.gemspec", "lib/g_named_scope_filters.rb", "lib/g_named_scope_filters/view_helpers.rb", "script/console", "script/destroy", "script/generate", "spec/g_named_scope_filters_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://github.com/midas/g_named_scope_filters/tree/master}
|
16
|
+
s.post_install_message = %q{PostInstall.txt}
|
17
|
+
s.rdoc_options = ["--main", "README.rdoc"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{g_named_scope_filters}
|
20
|
+
s.rubygems_version = %q{1.3.1}
|
21
|
+
s.summary = %q{This is an unordered list of filters that use named scopes within an ActiveRecord model to filter a list}
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 2
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_development_dependency(%q<newgem>, [">= 1.2.3"])
|
29
|
+
s.add_development_dependency(%q<rails>, [">= 2.2.0"])
|
30
|
+
s.add_development_dependency(%q<midas-guilded>, [">= 0.0.6"])
|
31
|
+
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<newgem>, [">= 1.2.3"])
|
34
|
+
s.add_dependency(%q<rails>, [">= 2.2.0"])
|
35
|
+
s.add_dependency(%q<midas-guilded>, [">= 0.0.6"])
|
36
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
37
|
+
end
|
38
|
+
else
|
39
|
+
s.add_dependency(%q<newgem>, [">= 1.2.3"])
|
40
|
+
s.add_dependency(%q<rails>, [">= 2.2.0"])
|
41
|
+
s.add_dependency(%q<midas-guilded>, [">= 0.0.6"])
|
42
|
+
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
require 'g_named_scope_filters/view_helpers'
|
5
|
+
|
6
|
+
module GNamedScopeFilters
|
7
|
+
VERSION = '1.0.0'
|
8
|
+
end
|
9
|
+
|
10
|
+
if defined?( ActionView::Base )
|
11
|
+
ActionView::Base.send( :include, GNamedScopeFilters::ViewHelpers ) unless ActionView::Base.include?( GNamedScopeFilters::ViewHelpers )
|
12
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
module GNamedScopeFilters
|
2
|
+
module ViewHelpers
|
3
|
+
|
4
|
+
# Guilded component. This is an unordered list of filters that use named scopes within an ActiveRecord model
|
5
|
+
# to filter a list. It is not tied to a table or list specifically as it simply manipulates the url, resulting
|
6
|
+
# in a manipulation of a list or table.
|
7
|
+
#
|
8
|
+
# *parameters*
|
9
|
+
# :ar_obj_col_or_class:: The ActiveRecord object, collection or class to make the filters from. Warning:
|
10
|
+
# if you use anything but the class and the collection or object comes up nil or empty, then you will
|
11
|
+
# not have filters renderred. The prefferred way is to use the class unless you cannot due to dynamic reasons.
|
12
|
+
#
|
13
|
+
# *options*
|
14
|
+
# :id:: (Required) This will be the id of the ul returned that wraps the filters.
|
15
|
+
# :class:: This will be the id of the ul returned that wraps the filters. Defaults to 'filters.'
|
16
|
+
# :selected_class:: This will be the class that is used to show whih filter is selected. Defaults to 'selected.'
|
17
|
+
# :only:: This is the filters to include. Can be an array or string (for one filter).
|
18
|
+
# :include_count:: True if you would like a span created within each filter list item containg the count for
|
19
|
+
# items in that filter.
|
20
|
+
# :scoped_by:: This is the ActiveRecord object that this list is scoped by. For instance, if an account
|
21
|
+
# has many users and this is the user list for said acccount, then you would use :scoped_by => @account.
|
22
|
+
# This will scope the user list with filter to that account. It will also change the path helper from
|
23
|
+
# users_path to account_users_path, unless you overrode the path helper with :list_path_helper.
|
24
|
+
# :list_path_helper:: This is a string or symbol for the list path helper to use. You will need to override
|
25
|
+
# if your object is namespaced.
|
26
|
+
# :polymorphic:: A string representing the name of the type to use if the current type is just a polymorphic
|
27
|
+
# association table, etc. For instance
|
28
|
+
#
|
29
|
+
def g_named_scope_filters( ar_obj_col_or_class, *args )
|
30
|
+
options = args.extract_options!
|
31
|
+
options.merge! :class => "filters" unless options.include?( :class )
|
32
|
+
options.merge! :selected_class => "selected" unless options.include?( :selected_class )
|
33
|
+
options.merge! :exclude_css => true, :exclude_js => true
|
34
|
+
|
35
|
+
if options[:only]
|
36
|
+
if options[:only].is_a?( String ) || options[:only].is_a?( Symbol )
|
37
|
+
filters = Array.new << options[:only]
|
38
|
+
else
|
39
|
+
filters = options[:only]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
options[:filters] = filters
|
43
|
+
|
44
|
+
scoped_by = options.delete( :scoped_by )
|
45
|
+
polymorphic_type = options.delete( :polymorphic_type ).to_s if options.has_key?( :polymorphic_type )
|
46
|
+
polymorphic_as = options.delete( :polymorphic_as ).to_s if options.has_key?( :polymorphic_as )
|
47
|
+
|
48
|
+
raise "You must provide the 'polymorphic_as' option if you provide the 'polymorphic_type' option." if polymorphic_type && !polymorphic_as
|
49
|
+
|
50
|
+
Guilded::Guilder.instance.add( :named_scope_filters, options )
|
51
|
+
|
52
|
+
# Resolve the class of the ActiveRecord descendant type
|
53
|
+
if ar_obj_col_or_class.is_a?( Array )
|
54
|
+
return '' if ar_obj_col_or_class.empty?
|
55
|
+
klass = ar_obj_col_or_class[0].class
|
56
|
+
elsif ar_obj_col_or_class.is_a?( Class )
|
57
|
+
klass = ar_obj_col_or_class
|
58
|
+
elsif ar_obj_col_or_class.is_a?( ActiveRecord::Base )
|
59
|
+
klass = ar_obj_col_or_class.class
|
60
|
+
else
|
61
|
+
throw 'You must provide either an ActiveRecord object, collection or type in order to generate filters.'
|
62
|
+
end
|
63
|
+
|
64
|
+
if options[:list_path_helper]
|
65
|
+
list_path_helper = options[:list_path_helper].to_s
|
66
|
+
elsif scoped_by
|
67
|
+
list_path_helper = "#{scoped_by.class.to_s.underscore}_#{klass.to_s.tableize}_path"
|
68
|
+
else
|
69
|
+
list_path_helper = "#{klass.to_s.tableize}_path"
|
70
|
+
end
|
71
|
+
|
72
|
+
html = ''
|
73
|
+
|
74
|
+
return html if filters.empty?
|
75
|
+
|
76
|
+
html << "<ul id=\"#{options[:id].to_s}\" class=\"#{options[:class].to_s}\">"
|
77
|
+
|
78
|
+
# Handle the all filter
|
79
|
+
link_text = "All"
|
80
|
+
|
81
|
+
if options[:include_count]
|
82
|
+
if scoped_by
|
83
|
+
if polymorphic_type
|
84
|
+
poly_scoped_finder = polymorphic_type.to_s.tableize
|
85
|
+
link_text << " <span>#{scoped_by.send( poly_scoped_finder.to_sym ).count}</span>"
|
86
|
+
else
|
87
|
+
scoped_finder = klass.to_s.tableize
|
88
|
+
link_text << " <span>#{scoped_by.send( scoped_finder.to_sym ).count}</span>"
|
89
|
+
end
|
90
|
+
else
|
91
|
+
link_text << " <span>#{klass.count}</span>"
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
filter_options = {}
|
96
|
+
filter_options.merge!( :order => params[:order] ) if params[:order]
|
97
|
+
|
98
|
+
html << "<li>"
|
99
|
+
html << link_to( link_text, @controller.send( list_path_helper, filter_options ),
|
100
|
+
:class => "#{params[:filter].nil? ? options[:selected_class] : ''}" )
|
101
|
+
|
102
|
+
filters.each do |filter|
|
103
|
+
throw "You must define a named scope of '#{filter.to_s}' in order to render a named scope filter for it" unless klass.respond_to?( filter.to_sym )
|
104
|
+
link_text = filter.to_s.humanize
|
105
|
+
|
106
|
+
if options[:include_count]
|
107
|
+
|
108
|
+
if scoped_by
|
109
|
+
|
110
|
+
scoped_finder = klass.to_s.tableize if scoped_finder.nil? || scoped_finder.empty?
|
111
|
+
|
112
|
+
if polymorphic_type
|
113
|
+
|
114
|
+
# If there is a named scope finder defined on the root klass that can get the
|
115
|
+
# polymorpic assocaited objects, the use it
|
116
|
+
if klass.respond_to?( poly_scoped_finder )
|
117
|
+
link_text << " <span>#{scoped_by.send( scoped_finder.to_sym ).send( poly_scoped_finder.to_sym ).send( filter.to_sym ).count}</span>"
|
118
|
+
else #otherwise, just use a AR's find
|
119
|
+
link_text << " <span>#{scoped_by.send( scoped_finder.to_sym ).send( filter.to_sym ).find(:all, :conditions => { "#{polymorphic_as}_type".to_sym => polymorphic_type } ).size}</span>"
|
120
|
+
end
|
121
|
+
|
122
|
+
else
|
123
|
+
link_text << " <span>#{scoped_by.send( scoped_finder.to_sym ).send( filter.to_sym ).count}</span>"
|
124
|
+
end
|
125
|
+
|
126
|
+
else
|
127
|
+
link_text << " <span>#{klass.send( filter.to_sym ).count}</span>"
|
128
|
+
end
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
filter_options.merge!( :filter => filter )
|
133
|
+
|
134
|
+
html << "<li>"
|
135
|
+
html << link_to( link_text, @controller.send( list_path_helper, filter_options ),
|
136
|
+
:class => "#{params[:filter] == filter.to_s ? options[:selected_class] : ''}" )
|
137
|
+
html << "</li>"
|
138
|
+
end
|
139
|
+
|
140
|
+
html << "</ul>"
|
141
|
+
html
|
142
|
+
end
|
143
|
+
|
144
|
+
end
|
145
|
+
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/g_named_scope_filters.rb'}"
|
9
|
+
puts "Loading g_named_scope_filters 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/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new do |t|
|
19
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: midas-g_named_scope_filters
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- C. Jason Harrelson (midas)
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-12 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: newgem
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rails
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.2.0
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: midas-guilded
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.0.6
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: hoe
|
47
|
+
type: :development
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.8.0
|
54
|
+
version:
|
55
|
+
description: This is an unordered list of filters that use named scopes within an ActiveRecord model to filter a list. It is not tied to a table or list specifically as it simply manipulates the url, resulting in a manipulation of any collection (list, table, etc.) it may be coupled with.
|
56
|
+
email:
|
57
|
+
- jason@lookforwardenterprises.com
|
58
|
+
executables: []
|
59
|
+
|
60
|
+
extensions: []
|
61
|
+
|
62
|
+
extra_rdoc_files:
|
63
|
+
- History.txt
|
64
|
+
- Manifest.txt
|
65
|
+
- PostInstall.txt
|
66
|
+
- README.rdoc
|
67
|
+
files:
|
68
|
+
- History.txt
|
69
|
+
- Manifest.txt
|
70
|
+
- PostInstall.txt
|
71
|
+
- README.rdoc
|
72
|
+
- Rakefile
|
73
|
+
- g_named_scope_filters.gemspec
|
74
|
+
- lib/g_named_scope_filters.rb
|
75
|
+
- lib/g_named_scope_filters/view_helpers.rb
|
76
|
+
- script/console
|
77
|
+
- script/destroy
|
78
|
+
- script/generate
|
79
|
+
- spec/g_named_scope_filters_spec.rb
|
80
|
+
- spec/spec.opts
|
81
|
+
- spec/spec_helper.rb
|
82
|
+
- tasks/rspec.rake
|
83
|
+
has_rdoc: true
|
84
|
+
homepage: http://github.com/midas/g_named_scope_filters/tree/master
|
85
|
+
post_install_message: PostInstall.txt
|
86
|
+
rdoc_options:
|
87
|
+
- --main
|
88
|
+
- README.rdoc
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: "0"
|
96
|
+
version:
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: "0"
|
102
|
+
version:
|
103
|
+
requirements: []
|
104
|
+
|
105
|
+
rubyforge_project: g_named_scope_filters
|
106
|
+
rubygems_version: 1.2.0
|
107
|
+
signing_key:
|
108
|
+
specification_version: 2
|
109
|
+
summary: This is an unordered list of filters that use named scopes within an ActiveRecord model to filter a list
|
110
|
+
test_files: []
|
111
|
+
|