Skip to content

Commit

Permalink
Small things, more administrative than anything.
Browse files Browse the repository at this point in the history
Hoe.
  • Loading branch information
nowk committed Feb 14, 2010
1 parent 7ff0d3c commit d1c4849
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 31 deletions.
6 changes: 5 additions & 1 deletion Gemfile
@@ -1,4 +1,8 @@

only :test do
gem 'sinatra', '0.9.4'
gem 'sinatra', '>= 0.9.4'
# these should be installed on your testing location
#gem 'rack-test', '>= 0.5.2'
#gem 'rspec', '>= 1.2.8'
#gem 'webrat', '>= 0.7.0'
end
36 changes: 12 additions & 24 deletions README.md → README.rdoc
@@ -1,13 +1,10 @@
Sinatra::Pagin*
=
= Sinatra::Pagin*

**Small utility to process paginated urls without modifying the mapped paths in your Sinatra app**
Small utility to process paginated urls without modifying the mapped paths in your Sinatra app

***
== Usage, _if you actually want to use this..._

### Usage, *if you actually want to use this...*

To install, just grab the git, then require in your [Sinatra][0] app
To install, just grab the git, then require in your Sinatra (http://www.sinatrarb.com/) app

require 'lib/sinatra/pagin' # or wherever you install this ultimately

Expand Down Expand Up @@ -35,7 +32,7 @@ Without changing those paths, you can run a paginated url.
http://example.org/a/pathed/path/page/45
# => get "/a/pathed/path"

Use the helper method *`page`* to get the provide page number.
Use the helper method +`page`+ to get the provide page number.

http://example.org/page/2

Expand All @@ -45,7 +42,7 @@ Use the helper method *`page`* to get the provide page number.

# => hello world, you asked for page 2

*`page`* returns 1 as a default.
+`page`+ returns 1 as a default.

It also supports `.:format` in your path.

Expand All @@ -57,27 +54,21 @@ It also supports `.:format` in your path.
# => path_info == /a/pathed/path.js
# => page == 45

***

### TODO
=== TODO

- Maybe gemspec
- Fix whatever breaks along the way.
- Whatever else...

***

### Resources
=== Resources

- [Checked with Integrity][1]
- Checked with Integrity (http://ci.damncarousel.com/sintra-pagin)

***

### License
== License

The MIT License

Copyright (c) 2010 Yung Hwa Kwon
Copyright (c) 2010 Yung Hwa Kwon (yung.kwon@nowk.net)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -95,7 +86,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE

[0]: http://www.sinatrarb.com/
[1]: http://ci.damncarousel.com/sintra-pagin
THE SOFTWARE
28 changes: 26 additions & 2 deletions Rakefile
@@ -1,12 +1,36 @@
require 'rubygems'
require 'hoe'

Hoe.plugin :gemcutter
Hoe.plugin :clean
Hoe.plugin :git

Hoe.spec 'sinatra-pagin' do
developer('Yung H Kwon', 'yung.kwon@example.com')

extra_deps << ['sinatra', '>= 0.9.4']
extra_dev_deps = [
['rack-test', '>= 0.5.2'],
['rspec', '>= 1.2.8'],
['webrat', '>= 0.7.0']
]

# self.rubyforge_name = 'nowk-sinatra-pagin' # if different than 'sinatra-pagin'
self.readme_file = 'README.rdoc'
self.history_file = 'History.txt'
self.test_globs = 'spec/*_spec.rb'
self.version = '0.0.1'
end

#

begin
require 'spec'
require 'spec/rake/spectask'

task :default => :spec

task :spec do
namespace :spec do
Spec::Rake::SpecTask.new do |t|
#t.ruby_opts = ['-rtest/unit']
t.spec_files = FileList['spec/*_spec.rb']
Expand All @@ -25,7 +49,7 @@ begin
end

rescue LoadError
puts "RSpec required. To install Rspec, please run sudo gem install rspec."
puts "I <3 Rspec, or any good testing unit for that matter."
puts "RSpec required. To install Rspec, please run sudo gem install rspec."
end

4 changes: 1 addition & 3 deletions spec/pagin_spec.rb
@@ -1,6 +1,4 @@
require File.join(File.dirname(__FILE__), 'spec_helper')
require 'sinatra'
require File.join(File.dirname(__FILE__), '..', 'lib', 'sinatra/pagin')
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

class MyTestApp < Sinatra::Base
set :environment, :test
Expand Down
1 change: 1 addition & 0 deletions spec/spec.opts
@@ -0,0 +1 @@
--color
7 changes: 6 additions & 1 deletion spec/spec_helper.rb
@@ -1,6 +1,11 @@
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'spec'
require 'sinatra'
require 'sinatra/pagin'
require 'rack/test'
require 'spec'
require 'spec/autorun'
require "webrat"
#require 'mocha'

Expand Down

0 comments on commit d1c4849

Please sign in to comment.