pox_paginate 0.1.1 → 0.2.0.beta0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'activeresource', '~> 3.0.0.rc2'
4
+ gem 'activesupport', '~> 3.0.0.rc2'
5
+ gem 'will_paginate', '~> 3.0.pre2'
6
+ group :test do
7
+ gem 'activerecord', '~> 3.0.0.rc2'
8
+ gem 'rspec', '~> 2.0.0.beta.20'
9
+ gem 'sqlite3-ruby', '~> 1.3.1'
10
+ gem 'nokogiri', '~> 1.4.3.1'
11
+ gem 'libxml-ruby', '~> 1.1.4'
12
+ end
data/README.rdoc CHANGED
@@ -57,4 +57,23 @@ PoxPaginate will kick in if pagination related attributes are present on the roo
57
57
 
58
58
  === Note
59
59
  * PoxPaginate currently overrides the Hash.from_xml method to fix a bug in Rails that is documented in this {Lighthouse ticket}[https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3217-parsing-an-xml-file-with-multiple-records-and-extra-attributes-besides-type-fails]
60
- * PoxPaginate must needs be installed on both the client and the server Rails instance
60
+ * PoxPaginate must needs be installed on both the client and the server Rails instance
61
+
62
+ == Continuous Itegration
63
+
64
+ You can find the link to the pox_paginate CI build over at the C42 Engineering {open source}[http://c42.in/open_source] page.
65
+
66
+ == How to contribute
67
+
68
+ * Create an {issue}[http://github.com/c42/pox_paginate/issues] describing what you're adding (or fixing)
69
+ * Fork pox_paginate
70
+ * Make your changes, including specs, with the issue number in the commit message
71
+ * Run the build (running rake should do it) to make sure everything is all right
72
+ * Send us a pull request
73
+
74
+ If your patch is accepted, we will add you to the 'Contributors' section of the README.
75
+
76
+ == Contributors
77
+
78
+ * {Sidu Ponnappa}[http://github.com/kaiwren]
79
+ * {Niranjan Paranjape}[http://github.com/niranjan]
data/Rakefile CHANGED
@@ -1,17 +1,22 @@
1
+ puts "Building on Ruby #{RUBY_VERSION}, #{RUBY_RELEASE_DATE}, #{RUBY_PLATFORM}"
2
+
1
3
  require 'rubygems'
2
- gem 'activesupport', '~> 2.3.5'
3
- gem 'rspec', '~> 1.3.0'
4
+ gem 'activesupport', '~> 3.0.0.rc2'
5
+ gem 'rspec', '~> 2.0.0.beta.20'
6
+
7
+ require 'rake'
8
+ require 'rspec'
9
+ require 'rspec/core/rake_task'
4
10
 
5
- require 'spec'
6
- require 'spec/rake/spectask'
11
+ $:.unshift File.expand_path("../lib", __FILE__)
7
12
 
8
13
  desc 'Default: run spec tests.'
9
- task :default => 'spec:unit'
14
+ task :default => 'rspec:unit'
10
15
 
11
- namespace :spec do
16
+ namespace :rspec do
12
17
  desc "Run all unit specs"
13
- Spec::Rake::SpecTask.new(:unit) do |task|
14
- task.spec_files = FileList['spec/pox_paginate/**/*_spec.rb']
18
+ RSpec::Core::RakeTask.new(:unit) do |task|
19
+ task.pattern = 'spec/pox_paginate/**/*_spec.rb'
15
20
  end
16
21
  end
17
22
 
@@ -29,11 +34,15 @@ begin
29
34
  gemspec.files.exclude *['.gitignore']
30
35
 
31
36
  gemspec.test_files.exclude *['.gitignore']
32
- gemspec.add_dependency('activesupport', '~> 2.3.5')
33
- gemspec.add_dependency('activeresource', '~> 2.3.5')
34
- gemspec.add_dependency('will_paginate', '~> 2.3.12')
35
- gemspec.add_development_dependency('rspec', '~> 1.3.0')
36
- gemspec.add_development_dependency('activerecord', '~> 2.3.5')
37
+ gemspec.add_dependency('activesupport', '~> 3.0.0.rc2')
38
+ gemspec.add_dependency('activeresource', '~> 3.0.0.rc2')
39
+ gemspec.add_dependency('will_paginate', '~> 3.0.pre2')
40
+ gemspec.add_development_dependency('rspec', '~> 2.0.0.beta.20')
41
+ gemspec.add_development_dependency('activerecord', '~> 3.0.0.rc2')
42
+ gemspec.add_development_dependency('sqlite3-ruby', '~> 1.3.1')
43
+ gemspec.add_development_dependency('nokogiri', '~> 1.4.3.1')
44
+ gemspec.add_development_dependency('libxml-ruby', '~> 1.1.4')
45
+
37
46
  end
38
47
 
39
48
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0.beta0
data/cruise_config.rb ADDED
@@ -0,0 +1,3 @@
1
+ Project.configure do |project|
2
+ project.build_command = 'bundle install && rake'
3
+ end
@@ -1,25 +1,22 @@
1
- module PoxPaginate
2
- module ActiveSupport
3
- module CoreHashExt
4
- def self.included(mod)
5
- mod.module_eval do
6
- alias_method :from_xml_without_extension, :from_xml
7
- def from_xml(xml)
8
- typecast_xml_value(unrename_keys(remove_pagination_attributes(::ActiveSupport::XmlMini.parse(xml))))
9
- end
1
+ class Hash
10
2
 
11
- def remove_pagination_attributes(deserialized_xml)
12
- if deserialized_xml.values.size == 1 && deserialized_xml.values.first['type'] == 'array'
13
- clone = deserialized_xml.clone
14
- clone.values.first.delete 'per_page'
15
- clone.values.first.delete 'current_page'
16
- clone.values.first.delete 'total_entries'
17
- return clone
18
- end
19
- deserialized_xml
20
- end
21
- end
22
- end
3
+ class << self
4
+ alias_method :from_xml_without_extension, :from_xml
5
+ end
6
+
7
+ def self.from_xml(xml)
8
+ typecast_xml_value(unrename_keys(remove_pagination_attributes(::ActiveSupport::XmlMini.parse(xml))))
9
+ end
10
+
11
+ def self.remove_pagination_attributes(deserialized_xml)
12
+ if deserialized_xml.values.size == 1 && deserialized_xml.values.first['type'] == 'array'
13
+ clone = deserialized_xml.clone
14
+ clone.values.first.delete 'per_page'
15
+ clone.values.first.delete 'current_page'
16
+ clone.values.first.delete 'total_entries'
17
+ return clone
23
18
  end
19
+ deserialized_xml
24
20
  end
21
+
25
22
  end
@@ -4,5 +4,3 @@ module PoxPaginate
4
4
  end
5
5
 
6
6
  require "#{PoxPaginate::Root}/pox_paginate/active_support/core_hash_ext"
7
-
8
- ActiveSupport::CoreExtensions::Hash::Conversions::ClassMethods.send :include, PoxPaginate::ActiveSupport::CoreHashExt
data/lib/pox_paginate.rb CHANGED
@@ -7,12 +7,15 @@
7
7
  # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8
8
  # See the License for the specific language governing permissions and limitations under the License.
9
9
 
10
- require 'rubygems'
11
- gem 'activeresource', '~> 2.3.5'
12
- gem 'activesupport', '~> 2.3.5'
10
+ require "rubygems"
11
+ require "bundler"
12
+ Bundler.setup
13
+
13
14
  require 'active_resource'
14
15
  require 'active_support'
15
- require 'will_paginate'
16
+ require 'active_support/core_ext'
17
+ require 'will_paginate/collection'
18
+ require 'will_paginate/finders/active_resource'
16
19
 
17
20
  module PoxPaginate
18
21
  Root = File.dirname(__FILE__)
@@ -0,0 +1,95 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{pox_paginate}
8
+ s.version = "0.2.0.beta0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Sidu Ponnappa", "Niranjan Paranjape"]
12
+ s.date = %q{2010-08-27}
13
+ s.description = %q{Transparent support for pagination using WillPaginate with POX (Plain Old Xml) and ActiveResource. This gem is based on C42 Engineering's experience building largish distributed systems consisting of multiple Rails apps integrated over POX (Plain Old XML).}
14
+ s.email = %q{opensource@c42.in}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ "CHANGELOG",
20
+ "Gemfile",
21
+ "README.rdoc",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "cruise_config.rb",
25
+ "lib/pox_paginate.rb",
26
+ "lib/pox_paginate/active_resource.rb",
27
+ "lib/pox_paginate/active_resource/xml_format.rb",
28
+ "lib/pox_paginate/active_support.rb",
29
+ "lib/pox_paginate/active_support/core_hash_ext.rb",
30
+ "lib/pox_paginate/remote_collection.rb",
31
+ "lib/pox_paginate/will_paginate.rb",
32
+ "lib/pox_paginate/will_paginate/collection_extensions.rb",
33
+ "lib/pox_paginate/xml_mini.rb",
34
+ "lib/pox_paginate/xml_mini/jdom.rb",
35
+ "lib/pox_paginate/xml_mini/libxml.rb",
36
+ "lib/pox_paginate/xml_mini/nokogiri.rb",
37
+ "lib/pox_paginate/xml_mini/rexml.rb",
38
+ "pox_paginate.gemspec",
39
+ "spec/config/database.yml",
40
+ "spec/db/migrate/001_create_oogas.rb",
41
+ "spec/pox_paginate/active_resource/xml_format_spec.rb",
42
+ "spec/pox_paginate/active_support/core_hash_ext_spec.rb",
43
+ "spec/pox_paginate/will_paginate/collection_extensions_spec.rb",
44
+ "spec/pox_paginate/xml_mini_spec.rb",
45
+ "spec/spec_helper.rb"
46
+ ]
47
+ s.homepage = %q{http://c42.in/open_source}
48
+ s.rdoc_options = ["--charset=UTF-8"]
49
+ s.require_paths = ["lib"]
50
+ s.rubygems_version = %q{1.3.7}
51
+ s.summary = %q{Transparent support for pagination using WillPaginate with POX (Plain Old Xml) and ActiveResource}
52
+ s.test_files = [
53
+ "spec/db/migrate/001_create_oogas.rb",
54
+ "spec/pox_paginate/active_resource/xml_format_spec.rb",
55
+ "spec/pox_paginate/active_support/core_hash_ext_spec.rb",
56
+ "spec/pox_paginate/will_paginate/collection_extensions_spec.rb",
57
+ "spec/pox_paginate/xml_mini_spec.rb",
58
+ "spec/spec_helper.rb"
59
+ ]
60
+
61
+ if s.respond_to? :specification_version then
62
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
63
+ s.specification_version = 3
64
+
65
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
66
+ s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0.rc2"])
67
+ s.add_runtime_dependency(%q<activeresource>, ["~> 3.0.0.rc2"])
68
+ s.add_runtime_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
69
+ s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
70
+ s.add_development_dependency(%q<activerecord>, ["~> 3.0.0.rc2"])
71
+ s.add_development_dependency(%q<sqlite3-ruby>, ["~> 1.3.1"])
72
+ s.add_development_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
73
+ s.add_development_dependency(%q<libxml-ruby>, ["~> 1.1.4"])
74
+ else
75
+ s.add_dependency(%q<activesupport>, ["~> 3.0.0.rc2"])
76
+ s.add_dependency(%q<activeresource>, ["~> 3.0.0.rc2"])
77
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
78
+ s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
79
+ s.add_dependency(%q<activerecord>, ["~> 3.0.0.rc2"])
80
+ s.add_dependency(%q<sqlite3-ruby>, ["~> 1.3.1"])
81
+ s.add_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
82
+ s.add_dependency(%q<libxml-ruby>, ["~> 1.1.4"])
83
+ end
84
+ else
85
+ s.add_dependency(%q<activesupport>, ["~> 3.0.0.rc2"])
86
+ s.add_dependency(%q<activeresource>, ["~> 3.0.0.rc2"])
87
+ s.add_dependency(%q<will_paginate>, ["~> 3.0.pre2"])
88
+ s.add_dependency(%q<rspec>, ["~> 2.0.0.beta.20"])
89
+ s.add_dependency(%q<activerecord>, ["~> 3.0.0.rc2"])
90
+ s.add_dependency(%q<sqlite3-ruby>, ["~> 1.3.1"])
91
+ s.add_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
92
+ s.add_dependency(%q<libxml-ruby>, ["~> 1.1.4"])
93
+ end
94
+ end
95
+
@@ -1,6 +1,6 @@
1
1
  require File.dirname(__FILE__) + '/../../spec_helper'
2
2
 
3
- describe PoxPaginate::ActiveSupport::CoreHashExt do
3
+ describe Hash do
4
4
 
5
5
  it 'should from_xml ignores any root attributes other than type' do
6
6
  Hash.from_xml(paginated_xml(@date)).should == {"oogas"=>[
data/spec/spec_helper.rb CHANGED
@@ -1,18 +1,17 @@
1
1
  require 'rubygems'
2
- gem 'rspec', '~> 1.3.0'
3
- gem 'activerecord', '~> 2.3.5'
4
- gem 'activeresource', '~> 2.3.5'
5
-
6
2
  require 'pp'
7
- require 'spec'
8
- require 'active_record'
3
+ require 'rspec'
9
4
 
10
- require File.expand_path(File.dirname(__FILE__) + "/../lib/pox_paginate")
5
+ require "pox_paginate"
6
+
7
+ require 'active_record'
8
+ require 'will_paginate/finders/active_record'
11
9
 
12
10
  ActiveRecord::Base.establish_connection(YAML::load(File.open(File.dirname(__FILE__) + '/config/database.yml')))
13
11
  ActiveRecord::Base.logger = Logger.new(File.open(File.dirname(__FILE__) + '/../log/test.log', 'a'))
14
12
  ActiveRecord::Migrator.up(File.dirname(__FILE__) + '/db/migrate')
15
- WillPaginate.enable_activerecord
13
+
14
+ WillPaginate::Finders::ActiveRecord.enable!
16
15
 
17
16
  class Ooga < ActiveRecord::Base
18
17
  end
metadata CHANGED
@@ -1,12 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pox_paginate
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ hash: -1848230052
5
+ prerelease: true
5
6
  segments:
6
7
  - 0
7
- - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ - 0
10
+ - beta0
11
+ version: 0.2.0.beta0
10
12
  platform: ruby
11
13
  authors:
12
14
  - Sidu Ponnappa
@@ -15,79 +17,143 @@ autorequire:
15
17
  bindir: bin
16
18
  cert_chain: []
17
19
 
18
- date: 2010-07-29 00:00:00 +05:30
20
+ date: 2010-08-27 00:00:00 +05:30
19
21
  default_executable:
20
22
  dependencies:
21
23
  - !ruby/object:Gem::Dependency
22
24
  name: activesupport
23
25
  prerelease: false
24
26
  requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
25
28
  requirements:
26
29
  - - ~>
27
30
  - !ruby/object:Gem::Version
31
+ hash: 977940607
28
32
  segments:
29
- - 2
30
33
  - 3
31
- - 5
32
- version: 2.3.5
34
+ - 0
35
+ - 0
36
+ - rc2
37
+ version: 3.0.0.rc2
33
38
  type: :runtime
34
39
  version_requirements: *id001
35
40
  - !ruby/object:Gem::Dependency
36
41
  name: activeresource
37
42
  prerelease: false
38
43
  requirement: &id002 !ruby/object:Gem::Requirement
44
+ none: false
39
45
  requirements:
40
46
  - - ~>
41
47
  - !ruby/object:Gem::Version
48
+ hash: 977940607
42
49
  segments:
43
- - 2
44
50
  - 3
45
- - 5
46
- version: 2.3.5
51
+ - 0
52
+ - 0
53
+ - rc2
54
+ version: 3.0.0.rc2
47
55
  type: :runtime
48
56
  version_requirements: *id002
49
57
  - !ruby/object:Gem::Dependency
50
58
  name: will_paginate
51
59
  prerelease: false
52
60
  requirement: &id003 !ruby/object:Gem::Requirement
61
+ none: false
53
62
  requirements:
54
63
  - - ~>
55
64
  - !ruby/object:Gem::Version
65
+ hash: -1876988247
56
66
  segments:
57
- - 2
58
67
  - 3
59
- - 12
60
- version: 2.3.12
68
+ - 0
69
+ - pre2
70
+ version: 3.0.pre2
61
71
  type: :runtime
62
72
  version_requirements: *id003
63
73
  - !ruby/object:Gem::Dependency
64
74
  name: rspec
65
75
  prerelease: false
66
76
  requirement: &id004 !ruby/object:Gem::Requirement
77
+ none: false
67
78
  requirements:
68
79
  - - ~>
69
80
  - !ruby/object:Gem::Version
81
+ hash: 62196427
70
82
  segments:
71
- - 1
72
- - 3
83
+ - 2
73
84
  - 0
74
- version: 1.3.0
85
+ - 0
86
+ - beta
87
+ - 20
88
+ version: 2.0.0.beta.20
75
89
  type: :development
76
90
  version_requirements: *id004
77
91
  - !ruby/object:Gem::Dependency
78
92
  name: activerecord
79
93
  prerelease: false
80
94
  requirement: &id005 !ruby/object:Gem::Requirement
95
+ none: false
81
96
  requirements:
82
97
  - - ~>
83
98
  - !ruby/object:Gem::Version
99
+ hash: 977940607
84
100
  segments:
85
- - 2
86
101
  - 3
87
- - 5
88
- version: 2.3.5
102
+ - 0
103
+ - 0
104
+ - rc2
105
+ version: 3.0.0.rc2
89
106
  type: :development
90
107
  version_requirements: *id005
108
+ - !ruby/object:Gem::Dependency
109
+ name: sqlite3-ruby
110
+ prerelease: false
111
+ requirement: &id006 !ruby/object:Gem::Requirement
112
+ none: false
113
+ requirements:
114
+ - - ~>
115
+ - !ruby/object:Gem::Version
116
+ hash: 25
117
+ segments:
118
+ - 1
119
+ - 3
120
+ - 1
121
+ version: 1.3.1
122
+ type: :development
123
+ version_requirements: *id006
124
+ - !ruby/object:Gem::Dependency
125
+ name: nokogiri
126
+ prerelease: false
127
+ requirement: &id007 !ruby/object:Gem::Requirement
128
+ none: false
129
+ requirements:
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ hash: 113
133
+ segments:
134
+ - 1
135
+ - 4
136
+ - 3
137
+ - 1
138
+ version: 1.4.3.1
139
+ type: :development
140
+ version_requirements: *id007
141
+ - !ruby/object:Gem::Dependency
142
+ name: libxml-ruby
143
+ prerelease: false
144
+ requirement: &id008 !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ~>
148
+ - !ruby/object:Gem::Version
149
+ hash: 27
150
+ segments:
151
+ - 1
152
+ - 1
153
+ - 4
154
+ version: 1.1.4
155
+ type: :development
156
+ version_requirements: *id008
91
157
  description: Transparent support for pagination using WillPaginate with POX (Plain Old Xml) and ActiveResource. This gem is based on C42 Engineering's experience building largish distributed systems consisting of multiple Rails apps integrated over POX (Plain Old XML).
92
158
  email: opensource@c42.in
93
159
  executables: []
@@ -98,9 +164,11 @@ extra_rdoc_files:
98
164
  - README.rdoc
99
165
  files:
100
166
  - CHANGELOG
167
+ - Gemfile
101
168
  - README.rdoc
102
169
  - Rakefile
103
170
  - VERSION
171
+ - cruise_config.rb
104
172
  - lib/pox_paginate.rb
105
173
  - lib/pox_paginate/active_resource.rb
106
174
  - lib/pox_paginate/active_resource/xml_format.rb
@@ -114,6 +182,7 @@ files:
114
182
  - lib/pox_paginate/xml_mini/libxml.rb
115
183
  - lib/pox_paginate/xml_mini/nokogiri.rb
116
184
  - lib/pox_paginate/xml_mini/rexml.rb
185
+ - pox_paginate.gemspec
117
186
  - spec/config/database.yml
118
187
  - spec/db/migrate/001_create_oogas.rb
119
188
  - spec/pox_paginate/active_resource/xml_format_spec.rb
@@ -131,23 +200,29 @@ rdoc_options:
131
200
  require_paths:
132
201
  - lib
133
202
  required_ruby_version: !ruby/object:Gem::Requirement
203
+ none: false
134
204
  requirements:
135
205
  - - ">="
136
206
  - !ruby/object:Gem::Version
207
+ hash: 3
137
208
  segments:
138
209
  - 0
139
210
  version: "0"
140
211
  required_rubygems_version: !ruby/object:Gem::Requirement
212
+ none: false
141
213
  requirements:
142
- - - ">="
214
+ - - ">"
143
215
  - !ruby/object:Gem::Version
216
+ hash: 25
144
217
  segments:
145
- - 0
146
- version: "0"
218
+ - 1
219
+ - 3
220
+ - 1
221
+ version: 1.3.1
147
222
  requirements: []
148
223
 
149
224
  rubyforge_project:
150
- rubygems_version: 1.3.6
225
+ rubygems_version: 1.3.7
151
226
  signing_key:
152
227
  specification_version: 3
153
228
  summary: Transparent support for pagination using WillPaginate with POX (Plain Old Xml) and ActiveResource