searchable_record 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +6 -0
- data/MIT-LICENSE.txt +19 -0
- data/{Manifest → Manifest.txt} +5 -4
- data/README.rdoc +10 -30
- data/Rakefile +36 -26
- data/lib/searchable_record.rb +6 -2
- data/lib/searchable_record/meta.rb +3 -0
- data/lib/searchable_record/util.rb +4 -4
- data/spec/core_spec.rb +2 -3
- data/spec/spec_helper.rb +7 -0
- data/spec/util_spec.rb +3 -3
- metadata +37 -21
- data/lib/searchable_record/version.rb +0 -11
- data/searchable_record.gemspec +0 -34
- data/spec/searchable_record_spec_helper.rb +0 -11
data/CHANGELOG.rdoc
CHANGED
data/MIT-LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2008-2009 Tuomas Kareinen.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
THE SOFTWARE.
|
data/{Manifest → Manifest.txt}
RENAMED
@@ -1,11 +1,12 @@
|
|
1
1
|
CHANGELOG.rdoc
|
2
|
+
lib/searchable_record.rb
|
2
3
|
lib/searchable_record/core.rb
|
4
|
+
lib/searchable_record/meta.rb
|
3
5
|
lib/searchable_record/util.rb
|
4
|
-
|
5
|
-
lib/searchable_record.rb
|
6
|
+
MIT-LICENSE.txt
|
6
7
|
Rakefile
|
7
8
|
README.rdoc
|
8
9
|
spec/core_spec.rb
|
9
|
-
spec/
|
10
|
+
spec/spec_helper.rb
|
10
11
|
spec/util_spec.rb
|
11
|
-
Manifest
|
12
|
+
Manifest.txt
|
data/README.rdoc
CHANGED
@@ -13,6 +13,8 @@ to the class that includes it. The method is a front-end to
|
|
13
13
|
given rules and calls <tt>find</tt> accordingly, returning the results of
|
14
14
|
<tt>find</tt>.
|
15
15
|
|
16
|
+
The plugin is compatible with both Ruby 1.8 and 1.9.
|
17
|
+
|
16
18
|
== A usage example
|
17
19
|
|
18
20
|
The following example, although a bit contrived, allows the client to
|
@@ -114,25 +116,22 @@ details.
|
|
114
116
|
|
115
117
|
== Installation
|
116
118
|
|
117
|
-
|
118
|
-
the
|
119
|
-
line:
|
119
|
+
The plugin is available as a RubyGem from RubyForge[http://rubyforge.org/]. In
|
120
|
+
order to install the gem for a Rails application, edit the
|
121
|
+
<tt>environment.rb</tt> file of the application to contain the following line:
|
120
122
|
|
121
123
|
config.gem "searchable_record"
|
122
124
|
|
123
125
|
(This requires Rails version 2.1 or above.)
|
124
126
|
|
125
|
-
Then install the gem
|
127
|
+
Then install the gem:
|
126
128
|
|
127
129
|
$ rake gems:install
|
128
|
-
|
129
|
-
...or with the <tt>gem</tt> tool:
|
130
|
-
|
131
|
-
$ gem install searchable_record
|
130
|
+
$ rake gems:unpack
|
132
131
|
|
133
132
|
Use git to get the source code for modifications and hacks:
|
134
133
|
|
135
|
-
$ git clone git://
|
134
|
+
$ git clone git://github.com/tuomas/searchable_record.git
|
136
135
|
|
137
136
|
== Contacting
|
138
137
|
|
@@ -141,24 +140,5 @@ com >.
|
|
141
140
|
|
142
141
|
== Legal notes
|
143
142
|
|
144
|
-
|
145
|
-
|
146
|
-
Copyright (c) 2008, 2009 Tuomas Kareinen
|
147
|
-
|
148
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
149
|
-
of this software and associated documentation files (the "Software"), to
|
150
|
-
deal in the Software without restriction, including without limitation the
|
151
|
-
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
152
|
-
sell copies of the Software, and to permit persons to whom the Software is
|
153
|
-
furnished to do so, subject to the following conditions:
|
154
|
-
|
155
|
-
The above copyright notice and this permission notice shall be included in
|
156
|
-
all copies or substantial portions of the Software.
|
157
|
-
|
158
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
159
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
160
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
161
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
162
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
163
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
164
|
-
IN THE SOFTWARE.
|
143
|
+
Copyright (c) 2008-2009 Tuomas Kareinen. See MIT-LICENSE.txt in this
|
144
|
+
directory.
|
data/Rakefile
CHANGED
@@ -1,39 +1,49 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
|
2
|
+
|
1
3
|
require "rubygems"
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
p.url = "http://searchable-rec.rubyforge.org/searchable_record/"
|
14
|
-
p.summary =<<-END
|
4
|
+
|
5
|
+
full_name = "SearchableRecord"
|
6
|
+
package_name = "searchable_record"
|
7
|
+
require "#{package_name}"
|
8
|
+
version = SearchableRecord::VERSION
|
9
|
+
|
10
|
+
require "hoe"
|
11
|
+
Hoe.spec package_name do
|
12
|
+
self.url = "http://searchable-rec.rubyforge.org/searchable_record/"
|
13
|
+
self.summary = "A Rails plugin that helps parsing query parameters from URLs"
|
14
|
+
self.description = <<-END
|
15
15
|
SearchableRecord is a small Ruby on Rails plugin that makes the parsing of
|
16
16
|
query parameters from URLs easy for resources, allowing the requester to
|
17
17
|
control the items (records) shown in the resource's representation.
|
18
18
|
END
|
19
|
-
p.runtime_dependencies = %w(activesupport)
|
20
|
-
p.ignore_pattern = "release-script.txt"
|
21
|
-
p.rdoc_pattern = ["*.rdoc", "lib/**/*.rb"]
|
22
|
-
end
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
developer "Tuomas Kareinen", "tkareine@gmail.com"
|
21
|
+
|
22
|
+
self.extra_deps << ["activesupport", ">= 2.1.0"]
|
23
|
+
|
24
|
+
self.readme_file = "README.rdoc"
|
25
|
+
self.history_file = "CHANGELOG.rdoc"
|
26
|
+
self.extra_rdoc_files = FileList["*.rdoc"].to_a
|
27
|
+
self.spec_extras = {
|
28
|
+
:rdoc_options => [
|
29
|
+
"--title", "#{full_name} #{version}",
|
30
|
+
"--main", "README.rdoc",
|
31
|
+
"--exclude", "spec",
|
32
|
+
"--line-numbers"
|
33
|
+
]
|
34
|
+
}
|
35
|
+
|
36
|
+
self.rubyforge_name = "searchable-rec"
|
37
|
+
|
38
|
+
self.rspec_options = ["--colour --format progress --loadby mtime"]
|
29
39
|
end
|
30
40
|
|
31
|
-
desc "Find code smells
|
41
|
+
desc "Find code smells"
|
32
42
|
task :roodi do
|
33
|
-
sh
|
43
|
+
sh %{roodi "**/*.rb"}
|
34
44
|
end
|
35
45
|
|
36
|
-
desc "Search unfinished parts of source code
|
46
|
+
desc "Search unfinished parts of source code"
|
37
47
|
task :todo do
|
38
|
-
FileList["**/*.rb"].egrep
|
48
|
+
FileList["**/*.rb", "**/*.rdoc", "**/*.txt"].egrep /(TODO|FIXME)/
|
39
49
|
end
|
data/lib/searchable_record.rb
CHANGED
@@ -17,11 +17,11 @@ module SearchableRecord
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.parse_positive_int(str)
|
20
|
-
|
21
|
-
if
|
22
|
-
|
20
|
+
value = str.to_i
|
21
|
+
if value > 0 # nil.to_i == 0
|
22
|
+
value
|
23
23
|
else
|
24
|
-
|
24
|
+
nil
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
data/spec/core_spec.rb
CHANGED
data/spec/spec_helper.rb
ADDED
data/spec/util_spec.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require "util"
|
1
|
+
require "spec_helper"
|
3
2
|
|
4
3
|
include SearchableRecord
|
5
4
|
|
6
|
-
describe Util do
|
5
|
+
describe SearchableRecord::Util do
|
6
|
+
|
7
7
|
it "should parse positive integers" do
|
8
8
|
Util.parse_positive_int("1").should == 1
|
9
9
|
Util.parse_positive_int("1sdfgsdf").should == 1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: searchable_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tuomas Kareinen
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-25 01:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,44 +20,60 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
23
|
+
version: 2.1.0
|
24
24
|
version:
|
25
|
-
|
26
|
-
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.3.3
|
34
|
+
version:
|
35
|
+
description: |
|
36
|
+
SearchableRecord is a small Ruby on Rails plugin that makes the parsing of
|
37
|
+
query parameters from URLs easy for resources, allowing the requester to
|
38
|
+
control the items (records) shown in the resource's representation.
|
39
|
+
|
40
|
+
email:
|
41
|
+
- tkareine@gmail.com
|
27
42
|
executables: []
|
28
43
|
|
29
44
|
extensions: []
|
30
45
|
|
31
46
|
extra_rdoc_files:
|
47
|
+
- MIT-LICENSE.txt
|
48
|
+
- Manifest.txt
|
32
49
|
- CHANGELOG.rdoc
|
33
|
-
- lib/searchable_record/core.rb
|
34
|
-
- lib/searchable_record/util.rb
|
35
|
-
- lib/searchable_record/version.rb
|
36
|
-
- lib/searchable_record.rb
|
37
50
|
- README.rdoc
|
38
51
|
files:
|
39
52
|
- CHANGELOG.rdoc
|
53
|
+
- lib/searchable_record.rb
|
40
54
|
- lib/searchable_record/core.rb
|
55
|
+
- lib/searchable_record/meta.rb
|
41
56
|
- lib/searchable_record/util.rb
|
42
|
-
-
|
43
|
-
- lib/searchable_record.rb
|
57
|
+
- MIT-LICENSE.txt
|
44
58
|
- Rakefile
|
45
59
|
- README.rdoc
|
46
60
|
- spec/core_spec.rb
|
47
|
-
- spec/
|
61
|
+
- spec/spec_helper.rb
|
48
62
|
- spec/util_spec.rb
|
49
|
-
- Manifest
|
50
|
-
- searchable_record.gemspec
|
63
|
+
- Manifest.txt
|
51
64
|
has_rdoc: true
|
52
65
|
homepage: http://searchable-rec.rubyforge.org/searchable_record/
|
66
|
+
licenses: []
|
67
|
+
|
53
68
|
post_install_message:
|
54
69
|
rdoc_options:
|
55
|
-
- --line-numbers
|
56
|
-
- --inline-source
|
57
70
|
- --title
|
58
|
-
-
|
71
|
+
- SearchableRecord 0.0.6
|
59
72
|
- --main
|
60
73
|
- README.rdoc
|
74
|
+
- --exclude
|
75
|
+
- spec
|
76
|
+
- --line-numbers
|
61
77
|
require_paths:
|
62
78
|
- lib
|
63
79
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -70,14 +86,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
86
|
requirements:
|
71
87
|
- - ">="
|
72
88
|
- !ruby/object:Gem::Version
|
73
|
-
version: "
|
89
|
+
version: "0"
|
74
90
|
version:
|
75
91
|
requirements: []
|
76
92
|
|
77
93
|
rubyforge_project: searchable-rec
|
78
|
-
rubygems_version: 1.3.
|
94
|
+
rubygems_version: 1.3.5
|
79
95
|
signing_key:
|
80
|
-
specification_version:
|
81
|
-
summary:
|
96
|
+
specification_version: 3
|
97
|
+
summary: A Rails plugin that helps parsing query parameters from URLs
|
82
98
|
test_files: []
|
83
99
|
|
data/searchable_record.gemspec
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{searchable_record}
|
5
|
-
s.version = "0.0.5"
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Tuomas Kareinen"]
|
9
|
-
s.date = %q{2009-02-05}
|
10
|
-
s.description = %q{SearchableRecord is a small Ruby on Rails plugin that makes the parsing of query parameters from URLs easy for resources, allowing the requester to control the items (records) shown in the resource's representation.}
|
11
|
-
s.email = %q{tkareine@gmail.com}
|
12
|
-
s.extra_rdoc_files = ["CHANGELOG.rdoc", "lib/searchable_record/core.rb", "lib/searchable_record/util.rb", "lib/searchable_record/version.rb", "lib/searchable_record.rb", "README.rdoc"]
|
13
|
-
s.files = ["CHANGELOG.rdoc", "lib/searchable_record/core.rb", "lib/searchable_record/util.rb", "lib/searchable_record/version.rb", "lib/searchable_record.rb", "Rakefile", "README.rdoc", "spec/core_spec.rb", "spec/searchable_record_spec_helper.rb", "spec/util_spec.rb", "Manifest", "searchable_record.gemspec"]
|
14
|
-
s.has_rdoc = true
|
15
|
-
s.homepage = %q{http://searchable-rec.rubyforge.org/searchable_record/}
|
16
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Searchable_record", "--main", "README.rdoc"]
|
17
|
-
s.require_paths = ["lib"]
|
18
|
-
s.rubyforge_project = %q{searchable-rec}
|
19
|
-
s.rubygems_version = %q{1.3.1}
|
20
|
-
s.summary = %q{SearchableRecord is a small Ruby on Rails plugin that makes the parsing of query parameters from URLs easy for resources, allowing the requester to control the items (records) shown in the resource's representation.}
|
21
|
-
|
22
|
-
if s.respond_to? :specification_version then
|
23
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
-
s.specification_version = 2
|
25
|
-
|
26
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
28
|
-
else
|
29
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
30
|
-
end
|
31
|
-
else
|
32
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
33
|
-
end
|
34
|
-
end
|