zooplankton 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +68 -0
- data/Rakefile +1 -0
- data/lib/zooplankton.rb +4 -0
- data/lib/zooplankton/version.rb +3 -0
- data/spec/spec_helper.rb +25 -0
- data/zooplankton.gemspec +25 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c7d6e26e86c416d4baed08ac30d7f6c1d8517eee
|
4
|
+
data.tar.gz: a23f33cd1c35d09be545df0bb7384c11a01f16e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0590bdb30fa2aaa10c01c9b11cae283f00369463896353d5b52183045acfaf4d046c6d5371d516cfef6677f8f2984462f82208899aa6de187b78fc675eef635a
|
7
|
+
data.tar.gz: e991454e719c1d54978a1bbbe0bd5197448144d32bddfcb32d0f7ec03eeb160318e01ee52a13dfd0cf123e386673103c08221cc74f6400a17b274dafe87135f8
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Ben Hamill
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Zooplankton
|
2
|
+
|
3
|
+
Zooplankton is a library for helping you turn Rails routes into
|
4
|
+
[URI Template strings](http://tools.ietf.org/html/rfc6570). It's useful for
|
5
|
+
helping yourself generate the `_links` part of
|
6
|
+
[HAL](http://stateless.co/hal_specification.html), for example.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'zooplankton'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install zooplankton
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
Given a route file like this:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
SomeApp::Application.routes.draw do
|
28
|
+
root 'root#index'
|
29
|
+
get '/post/:slug', to: 'posts#show', as: :post
|
30
|
+
get '/post/:slug/comment/:comment_id', to: 'commendts#show', as: :comment
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
You can use it like this:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
> Zooplankton.path_template_for(:root)
|
38
|
+
# => '/'
|
39
|
+
> Zooplankton.path_template_for(:post)
|
40
|
+
# => '/post/{slug}'
|
41
|
+
> Zooplankton.path_template_for(:comment)
|
42
|
+
# => '/post/{slug}/comment/{comment_id}'
|
43
|
+
> Zooplankton.path_template_for(:comment, slug: 'the-best-post-ever')
|
44
|
+
# => '/post/the-best-post-ever/comment/{comment_id}'
|
45
|
+
> Zooplankton.url_template_for(:root)
|
46
|
+
# => 'http://example.com/'
|
47
|
+
> Zooplankton.url_template_for(:post)
|
48
|
+
# => 'http://example.com/post/{slug}'
|
49
|
+
```
|
50
|
+
|
51
|
+
## Contributing
|
52
|
+
|
53
|
+
Help is gladly welcomed. If you have a feature you'd like to add, it's much more
|
54
|
+
likely to get in (or get in faster) the closer you stick to these steps:
|
55
|
+
|
56
|
+
1. Open an Issue to talk about it. We can discuss whether it's the right
|
57
|
+
direction or maybe help track down a bug, etc.
|
58
|
+
1. Fork the project, and make a branch to work on your feature/fix. Master is
|
59
|
+
where you'll want to start from.
|
60
|
+
1. Turn the Issue into a Pull Request. There are several ways to do this, but
|
61
|
+
[hub](https://github.com/defunkt/hub) is probably the easiest.
|
62
|
+
1. Make sure your Pull Request includes tests.
|
63
|
+
1. Bonus points if your Pull Request updates `CHANGES.md` to include a summary
|
64
|
+
of your changes and your name like the other entries. If the last entry is
|
65
|
+
the last release, add a new `## Unreleased` heading.
|
66
|
+
|
67
|
+
If you don't know how to fix something, even just a Pull Request that includes a
|
68
|
+
failing test can be helpful. If in doubt, make an Issue to discuss.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/zooplankton.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
|
12
|
+
# Run specs in random order to surface order dependencies. If you find an
|
13
|
+
# order dependency and want to debug it, you can fix the order by providing
|
14
|
+
# the seed, which is printed after each run.
|
15
|
+
# --seed 1234
|
16
|
+
config.order = 'random'
|
17
|
+
|
18
|
+
config.expect_with :rspec do |expectations|
|
19
|
+
expectations.syntax = :expect
|
20
|
+
end
|
21
|
+
|
22
|
+
config.mock_with :rspec do |mocks|
|
23
|
+
mocks.syntax = :expect
|
24
|
+
end
|
25
|
+
end
|
data/zooplankton.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'zooplankton/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "zooplankton"
|
8
|
+
spec.version = Zooplankton::VERSION
|
9
|
+
spec.authors = ["Ben Hamill"]
|
10
|
+
spec.email = ["git-commits@benhamill.com"]
|
11
|
+
spec.description = %q{A library for turning Rails routes into URI Templates, like maybe for HAL.}
|
12
|
+
spec.summary = %q{A library for turning Rails routes into URI Templates.}
|
13
|
+
spec.homepage = "https://github.com/benhamill/zooplankton#zooplankton"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "pry"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: zooplankton
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Hamill
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A library for turning Rails routes into URI Templates, like maybe for
|
70
|
+
HAL.
|
71
|
+
email:
|
72
|
+
- git-commits@benhamill.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- .gitignore
|
78
|
+
- .rspec
|
79
|
+
- Gemfile
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- lib/zooplankton.rb
|
84
|
+
- lib/zooplankton/version.rb
|
85
|
+
- spec/spec_helper.rb
|
86
|
+
- zooplankton.gemspec
|
87
|
+
homepage: https://github.com/benhamill/zooplankton#zooplankton
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubyforge_project:
|
107
|
+
rubygems_version: 2.0.3
|
108
|
+
signing_key:
|
109
|
+
specification_version: 4
|
110
|
+
summary: A library for turning Rails routes into URI Templates.
|
111
|
+
test_files:
|
112
|
+
- spec/spec_helper.rb
|