pox_paginate 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ == 0.2.2
2
+ * Support for RBX
3
+ * Create empty RemoteCollection when xml response is blank (Patch submitted by klacointe)
4
+ * Added jruby development dependancies to the gemspec
5
+
1
6
  == 0.2.0
2
7
  * Rails 3.0.0 compatibility
3
8
  * jRuby support with jdom
data/Gemfile CHANGED
@@ -1,19 +1,19 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'activeresource', '~> 3.0.0'
4
- gem 'activesupport', '~> 3.0.0'
3
+ gem 'activeresource', '~> 3.0.1'
4
+ gem 'activesupport', '~> 3.0.1'
5
5
  gem 'will_paginate', '~> 3.0.pre2'
6
6
 
7
7
  group :test do
8
- gem 'activerecord', '~> 3.0.0'
9
- gem 'rspec', '~> 2.0.0.beta.20'
8
+ gem 'activerecord', '~> 3.0.1'
9
+ gem 'rspec', '~> 2.0.0'
10
+ gem 'nokogiri', '~> 1.4.3.1'
10
11
  platforms :jruby do
11
12
  gem 'jdbc-sqlite3', '~> 3.6.3.054'
12
13
  gem 'activerecord-jdbcsqlite3-adapter', '~> 0.9.7'
13
14
  end
14
15
  platforms :ruby do
15
16
  gem 'sqlite3-ruby', '~> 1.3.1'
16
- gem 'nokogiri', '~> 1.4.3.1'
17
- gem 'libxml-ruby', '~> 1.1.4'
17
+ gem 'libxml-ruby', '~> 1.1.4' unless Object.const_defined?('RUBY_ENGINE') && RUBY_ENGINE =~ /rbx/
18
18
  end
19
19
  end
@@ -78,3 +78,4 @@ If your patch is accepted, we will add you to the 'Contributors' section of the
78
78
  * {Sidu Ponnappa}[http://github.com/kaiwren]
79
79
  * {Niranjan Paranjape}[http://github.com/niranjan]
80
80
  * {Jean-Denis Vauguet}[http://github.com/chikamichi]
81
+
data/Rakefile CHANGED
@@ -1,8 +1,6 @@
1
1
  puts "Building on Ruby #{RUBY_VERSION}, #{RUBY_RELEASE_DATE}, #{RUBY_PLATFORM}"
2
2
 
3
- require 'rubygems'
4
- gem 'activesupport', '~> 3.0.0'
5
- gem 'rspec', '~> 2.0.0.beta.20'
3
+ require "rubygems"
6
4
 
7
5
  require 'rake'
8
6
  require 'rspec'
@@ -13,6 +11,9 @@ $:.unshift File.expand_path("../lib", __FILE__)
13
11
  desc 'Default: run spec tests.'
14
12
  task :default => 'rspec:unit'
15
13
 
14
+ desc 'Cruise task'
15
+ task :cruise => 'rspec:unit'
16
+
16
17
  namespace :rspec do
17
18
  desc "Run all unit specs"
18
19
  RSpec::Core::RakeTask.new(:unit) do |task|
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -7,10 +7,6 @@
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
- require "bundler"
12
- Bundler.setup
13
-
14
10
  require 'active_resource'
15
11
  require 'active_support'
16
12
  require 'active_support/core_ext'
@@ -4,14 +4,19 @@ module PoxPaginate
4
4
  def self.included(mod)
5
5
  mod.module_eval do
6
6
  def decode_with_pagination_support(xml)
7
- deserialised_xml = decode_without_pagination_support(xml)
8
- root_attributes = ::ActiveSupport::XmlMini.root_node_attributes(xml)
9
- if root_attributes['type'] == "array" && root_attributes['current_page']
10
- RemoteCollection.create(root_attributes['current_page'], root_attributes['per_page'], root_attributes['total_entries']) do |pager|
11
- pager.replace deserialised_xml
7
+ unless xml.blank?
8
+ deserialised_xml = decode_without_pagination_support(xml)
9
+ root_attributes = ::ActiveSupport::XmlMini.root_node_attributes(xml)
10
+ if root_attributes['type'] == "array" && root_attributes['current_page']
11
+ RemoteCollection.create(root_attributes['current_page'], root_attributes['per_page'], root_attributes['total_entries']) do |pager|
12
+ pager.replace deserialised_xml
13
+ end
14
+ else
15
+ deserialised_xml
12
16
  end
13
17
  else
14
- deserialised_xml
18
+ RemoteCollection.create(1, 1, 0) do |pager|
19
+ end
15
20
  end
16
21
  end
17
22
  alias_method_chain :decode, :pagination_support
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{pox_paginate}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Sidu Ponnappa", "Niranjan Paranjape"]
12
- s.date = %q{2010-09-14}
12
+ s.date = %q{2010-11-26}
13
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
14
  s.email = %q{opensource@c42.in}
15
15
  s.extra_rdoc_files = [
@@ -22,7 +22,6 @@ Gem::Specification.new do |s|
22
22
  "README.rdoc",
23
23
  "Rakefile",
24
24
  "VERSION",
25
- "cruise_config.rb",
26
25
  "lib/pox_paginate.rb",
27
26
  "lib/pox_paginate/active_resource.rb",
28
27
  "lib/pox_paginate/active_resource/xml_format.rb",
@@ -52,12 +51,12 @@ Gem::Specification.new do |s|
52
51
  s.rubygems_version = %q{1.3.7}
53
52
  s.summary = %q{Transparent support for pagination using WillPaginate with POX (Plain Old Xml) and ActiveResource}
54
53
  s.test_files = [
55
- "spec/db/migrate/001_create_oogas.rb",
56
- "spec/pox_paginate/active_resource/xml_format_spec.rb",
57
- "spec/pox_paginate/active_support/core_hash_ext_spec.rb",
54
+ "spec/spec_helper.rb",
58
55
  "spec/pox_paginate/will_paginate/collection_extensions_spec.rb",
59
56
  "spec/pox_paginate/xml_mini_spec.rb",
60
- "spec/spec_helper.rb"
57
+ "spec/pox_paginate/active_resource/xml_format_spec.rb",
58
+ "spec/pox_paginate/active_support/core_hash_ext_spec.rb",
59
+ "spec/db/migrate/001_create_oogas.rb"
61
60
  ]
62
61
 
63
62
  if s.respond_to? :specification_version then
@@ -73,6 +72,8 @@ Gem::Specification.new do |s|
73
72
  s.add_development_dependency(%q<sqlite3-ruby>, ["~> 1.3.1"])
74
73
  s.add_development_dependency(%q<nokogiri>, ["~> 1.4.3.1"])
75
74
  s.add_development_dependency(%q<libxml-ruby>, ["~> 1.1.4"])
75
+ s.add_development_dependency(%q<jdbc-sqlite3>, ['~> 3.6.3.054'])
76
+ s.add_development_dependency(%q<activerecord-jdbcsqlite3-adapter>, ['~> 0.9.7'])
76
77
  else
77
78
  s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
78
79
  s.add_dependency(%q<activeresource>, ["~> 3.0.0"])
@@ -8,6 +8,12 @@ describe PoxPaginate::ActiveResource::XmlFormat do
8
8
  collection = ActiveResource::Formats::XmlFormat.decode(paginated_xml(DateTime.parse('2010-02-06T21:09:48+05:30')))
9
9
  collection.should be_a(PoxPaginate::RemoteCollection)
10
10
  end
11
+
12
+ it "should accept empty response" do
13
+ ::ActiveSupport::XmlMini.backend = deserialiser
14
+ collection = ActiveResource::Formats::XmlFormat.decode("")
15
+ collection.should be_a(PoxPaginate::RemoteCollection)
16
+ end
11
17
  end
12
18
  end
13
19
  end
@@ -1,8 +1,8 @@
1
1
  require 'rubygems'
2
- require 'pp'
2
+ require "pox_paginate"
3
+
3
4
  require 'rspec'
4
5
 
5
- require "pox_paginate"
6
6
 
7
7
  require 'active_record'
8
8
  require 'will_paginate/finders/active_record'
@@ -57,5 +57,8 @@ EOXML
57
57
  end
58
58
 
59
59
  def xml_backends
60
- RUBY_PLATFORM =~ /java/ ? %w(REXML JDOM) : %w(REXML LibXML Nokogiri)
60
+ backends = ['Nokogiri','REXML']
61
+ backends << 'LibXML' unless (RUBY_PLATFORM =~ /java/ || (Object.const_defined?('RUBY_ENGINE') && RUBY_ENGINE =~ /rbx/))
62
+ backends << 'JDOM' if RUBY_PLATFORM =~ /java/
63
+ backends
61
64
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pox_paginate
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sidu Ponnappa
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-14 00:00:00 +05:30
19
+ date: 2010-11-26 00:00:00 +05:30
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -150,6 +150,39 @@ dependencies:
150
150
  version: 1.1.4
151
151
  type: :development
152
152
  version_requirements: *id008
153
+ - !ruby/object:Gem::Dependency
154
+ name: jdbc-sqlite3
155
+ prerelease: false
156
+ requirement: &id009 !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ~>
160
+ - !ruby/object:Gem::Version
161
+ hash: 47
162
+ segments:
163
+ - 3
164
+ - 6
165
+ - 3
166
+ - 54
167
+ version: 3.6.3.054
168
+ type: :development
169
+ version_requirements: *id009
170
+ - !ruby/object:Gem::Dependency
171
+ name: activerecord-jdbcsqlite3-adapter
172
+ prerelease: false
173
+ requirement: &id010 !ruby/object:Gem::Requirement
174
+ none: false
175
+ requirements:
176
+ - - ~>
177
+ - !ruby/object:Gem::Version
178
+ hash: 53
179
+ segments:
180
+ - 0
181
+ - 9
182
+ - 7
183
+ version: 0.9.7
184
+ type: :development
185
+ version_requirements: *id010
153
186
  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).
154
187
  email: opensource@c42.in
155
188
  executables: []
@@ -165,7 +198,6 @@ files:
165
198
  - README.rdoc
166
199
  - Rakefile
167
200
  - VERSION
168
- - cruise_config.rb
169
201
  - lib/pox_paginate.rb
170
202
  - lib/pox_paginate/active_resource.rb
171
203
  - lib/pox_paginate/active_resource/xml_format.rb
@@ -223,9 +255,9 @@ signing_key:
223
255
  specification_version: 3
224
256
  summary: Transparent support for pagination using WillPaginate with POX (Plain Old Xml) and ActiveResource
225
257
  test_files:
226
- - spec/db/migrate/001_create_oogas.rb
227
- - spec/pox_paginate/active_resource/xml_format_spec.rb
228
- - spec/pox_paginate/active_support/core_hash_ext_spec.rb
258
+ - spec/spec_helper.rb
229
259
  - spec/pox_paginate/will_paginate/collection_extensions_spec.rb
230
260
  - spec/pox_paginate/xml_mini_spec.rb
231
- - spec/spec_helper.rb
261
+ - spec/pox_paginate/active_resource/xml_format_spec.rb
262
+ - spec/pox_paginate/active_support/core_hash_ext_spec.rb
263
+ - spec/db/migrate/001_create_oogas.rb
@@ -1,3 +0,0 @@
1
- Project.configure do |project|
2
- project.build_command = 'bundle install && rake'
3
- end