Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add gemspec file. change rake manifest to auto-update the gemspec. ge…

…t rid of rubyforge release task
  • Loading branch information...
commit 3334327b6a6ab8f46e29f88c59449f8ba4583833 1 parent 9616603
Mislav Marohnić mislav authored
Showing with 83 additions and 68 deletions.
  1. +13 −0 CHANGELOG
  2. +37 −37 README.rdoc
  3. +12 −31 Rakefile
  4. +21 −0 will_paginate.gemspec
13 CHANGELOG
View
@@ -1,3 +1,16 @@
+== 2.2.3, released 2008-04-26
+
+* will_paginate gem is no longer published on RubyForge, but on
+ gems.github.com:
+
+ gem sources -a http://gems.github.com/ (you only need to do this once)
+ gem install mislav-will_paginate
+
+* extract reusable pagination testing stuff into WillPaginate::View
+* rethink the page URL construction mechanizm to be more bulletproof when
+ combined with custom routing for page parameter
+* test that anchor parameter can be used in pagination links
+
== 2.2.2, released 2008-04-21
* Add support for page parameter in custom routes like "/foo/page/2"
74 README.rdoc
View
@@ -11,8 +11,8 @@ can.
Some resources to get you started:
-* Your mind reels with questions? Join our Google
- group[http://groups.google.com/group/will_paginate].
+* Your mind reels with questions? Join our
+ {Google group}[http://groups.google.com/group/will_paginate].
* The will_paginate project page: http://github.com/mislav/will_paginate
* How to report bugs: http://github.com/mislav/will_paginate/wikis/report-bugs
* Ryan Bates made an awesome screencast[http://railscasts.com/episodes/51],
@@ -20,35 +20,34 @@ Some resources to get you started:
== Installation
-Previously, the plugin was available on the following SVN location:
+The recommended way is that you get the gem:
- svn://errtheblog.com/svn/plugins/will_paginate
+ # add GitHub to your local list of gem sources:
+ gem sources -a http://gems.github.com/
+
+ # install the gem:
+ gem install mislav-will_paginate
-In February 2008, it moved to GitHub to be tracked with git version control.
-The SVN repo continued to have updates for some time, but now it doesn't.
-
-You should switch to using the gem:
-
- gem install will_paginate
-
-After that, you can remove the plugin from your application and add
-a simple require to the end of config/environment.rb:
+After that you don't need the will_paginate <i>plugin</i> in your Rails
+application anymore. Just add a simple require to the end of
+"config/environment.rb":
+ gem 'mislav-will_paginate', '~> 2.2'
require 'will_paginate'
-That's it, just remember to install the gem on all machines that
-you are deploying to.
+That's it. Remember to install the gem on <b>all</b> machines that you are
+deploying to.
<i>There are extensive
-installation[http://github.com/mislav/will_paginate/wikis/installation]
-instructions on the wiki[http://github.com/mislav/will_paginate/wikis].</i>
+{installation instructions}[http://github.com/mislav/will_paginate/wikis/installation]
+on {the wiki}[http://github.com/mislav/will_paginate/wikis].</i>
== Example usage
Use a paginate finder in the controller:
- @posts = Post.paginate_by_board_id @board.id, :page => params[:page], :order => 'updated_at DESC'
+ @posts = Post.paginate_by_board_id @board.id, :page => params[:page], :order => 'updated_at DESC'
Yeah, +paginate+ works just like +find+ -- it just doesn't fetch all the
records. Don't forget to tell it which page you want, or it will complain!
@@ -57,7 +56,7 @@ Read more on WillPaginate::Finder::ClassMethods.
Render the posts in your view like you would normally do. When you need to render
pagination, just stick this in:
- <%= will_paginate @posts %>
+ <%= will_paginate @posts %>
You're done. (Copy and paste the example fancy CSS styles from the bottom.) You
can find the option list at WillPaginate::ViewHelpers.
@@ -65,36 +64,36 @@ can find the option list at WillPaginate::ViewHelpers.
How does it know how much items to fetch per page? It asks your model by calling
its <tt>per_page</tt> class method. You can define it like this:
- class Post < ActiveRecord::Base
- cattr_reader :per_page
- @@per_page = 50
- end
+ class Post < ActiveRecord::Base
+ cattr_reader :per_page
+ @@per_page = 50
+ end
... or like this:
- class Post < ActiveRecord::Base
- def self.per_page
- 50
- end
+ class Post < ActiveRecord::Base
+ def self.per_page
+ 50
end
+ end
... or don't worry about it at all. WillPaginate defines it to be <b>30</b> by default.
But you can always specify the count explicitly when calling +paginate+:
- @posts = Post.paginate :page => params[:page], :per_page => 50
+ @posts = Post.paginate :page => params[:page], :per_page => 50
The +paginate+ finder wraps the original finder and returns your resultset that now has
some new properties. You can use the collection as you would with any ActiveRecord
resultset. WillPaginate view helpers also need that object to be able to render pagination:
- <ol>
- <% for post in @posts -%>
- <li>Render `post` in some nice way.</li>
- <% end -%>
- </ol>
+ <ol>
+ <% for post in @posts -%>
+ <li>Render `post` in some nice way.</li>
+ <% end -%>
+ </ol>
- <p>Now let's render us some pagination!</p>
- <%= will_paginate @posts %>
+ <p>Now let's render us some pagination!</p>
+ <%= will_paginate @posts %>
More detailed documentation:
@@ -131,5 +130,6 @@ More reading about pagination as design pattern:
* Pagination on Yahoo Design Pattern Library:
http://developer.yahoo.com/ypatterns/parent.php?pattern=pagination
-Want to discuss, request features, ask questions? Join the Google group:
-http://groups.google.com/group/will_paginate
+Want to discuss, request features, ask questions? Join the
+{Google group}[http://groups.google.com/group/will_paginate].
+
43 Rakefile
View
@@ -73,7 +73,9 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
end
task :manifest do
- list = Dir['**/*']
+ list = Dir['**/*'].sort
+ spec_file = Dir['*.gemspec'].first
+ list -= [spec_file]
File.read('.gitignore').each_line do |glob|
glob = glob.chomp.sub(/^\//, '')
@@ -81,37 +83,16 @@ task :manifest do
list -= Dir["#{glob}/**/*"] if File.directory?(glob) and !File.symlink?(glob)
puts "excluding #{glob}"
end
-
- File.open('.manifest', 'w') do |file|
- file.write list.sort.join("\n")
- end
-end
-desc 'Package and upload the release to rubyforge.'
-task :release do
- require 'yaml'
- require 'rubyforge'
-
- meta = YAML::load open('.gemified')
- version = meta[:version]
-
- v = ENV['VERSION'] or abort "Must supply VERSION=x.y.z"
- abort "Version doesn't match #{version}" if v != version
-
- gem = "#{meta[:name]}-#{version}.gem"
- project = meta[:rubyforge_project]
-
- rf = RubyForge.new
- puts "Logging in to RubyForge"
- rf.login
-
- c = rf.userconfig
- c['release_notes'] = meta[:summary]
- c['release_changes'] = File.read('CHANGELOG').split(/^== .+\n/)[1].strip
- c['preformatted'] = true
-
- puts "Releasing #{meta[:name]} #{version}"
- rf.add_release project, project, version, gem
+ spec = File.read spec_file
+ spec.gsub! /^(\s* s.(test_)?files \s* = \s* )( \[ [^\]]* \] | %w\( [^)]* \) )/mx do
+ assignment = $1
+ bunch = $2 ? list.grep(/^test\//) : list
+ '%s%%w(%s)' % [assignment, bunch.join(' ')]
+ end
+
+ File.open(spec_file, 'w') {|f| f << spec }
+ File.open('.manifest', 'w') {|f| f << list.join("\n") }
end
task :examples do
21 will_paginate.gemspec
View
@@ -0,0 +1,21 @@
+Gem::Specification.new do |s|
+ s.name = 'will_paginate'
+ s.version = '2.2.3'
+ s.date = '2008-04-26'
+
+ s.summary = "Most awesome pagination solution for Rails"
+ s.description = "The will_paginate library provides a simple, yet powerful and extensible API for ActiveRecord pagination and rendering of pagination links in ActionView templates."
+
+ s.authors = ['Mislav Marohnić', 'PJ Hyett']
+ s.email = 'mislav.marohnic@gmail.com'
+ s.homepage = 'http://github.com/mislav/will_paginate/wikis'
+
+ s.has_rdoc = true
+ s.rdoc_options = ['--main', 'README.rdoc']
+ s.rdoc_options << '--inline-source' << '--charset=UTF-8'
+ s.extra_rdoc_files = ['README.rdoc', 'LICENSE', 'CHANGELOG']
+ # s.add_dependency 'actionpack', ['>= 1.13.6']
+
+ s.files = %w(CHANGELOG LICENSE README.rdoc Rakefile examples examples/apple-circle.gif examples/index.haml examples/index.html examples/pagination.css examples/pagination.sass init.rb lib lib/will_paginate lib/will_paginate.rb lib/will_paginate/array.rb lib/will_paginate/collection.rb lib/will_paginate/core_ext.rb lib/will_paginate/finder.rb lib/will_paginate/named_scope.rb lib/will_paginate/named_scope_patch.rb lib/will_paginate/version.rb lib/will_paginate/view_helpers.rb test test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/view_test.rb)
+ s.test_files = %w(test/boot.rb test/collection_test.rb test/console test/database.yml test/finder_test.rb test/fixtures test/fixtures/admin.rb test/fixtures/developer.rb test/fixtures/developers_projects.yml test/fixtures/project.rb test/fixtures/projects.yml test/fixtures/replies.yml test/fixtures/reply.rb test/fixtures/schema.rb test/fixtures/topic.rb test/fixtures/topics.yml test/fixtures/user.rb test/fixtures/users.yml test/helper.rb test/lib test/lib/activerecord_test_case.rb test/lib/activerecord_test_connector.rb test/lib/load_fixtures.rb test/lib/view_test_process.rb test/view_test.rb)
+end
Please sign in to comment.
Something went wrong with that request. Please try again.