sinatra-mapping 1.0.5 → 1.0.6

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.
data/CHANGES CHANGED
@@ -1,45 +1,48 @@
1
1
  = Changes
2
2
 
3
- [1.0.5 - July 2009]
3
+ [1.0.6 - 2009-08-21]
4
+ * Fixes in the method for build path mapped.
5
+
6
+ [1.0.5 - 2009-07-30]
4
7
  * Fixes in the HTML attributes into helper method for link attributes.
5
8
  * Fixes in the map path method which check script name in environment.
6
9
  * Improvements helper methods.
7
10
  * Updates in documentation.
8
11
 
9
- [1.0.4 - July 2009]
12
+ [1.0.4 - 2009-07-29]
10
13
  * Error in root path without application/script name has been fixed.
11
14
  * Helper for mapping has been registered automatically.
12
15
 
13
- [1.0.3 - July 2009]
16
+ [1.0.3 - 2009-07-27]
14
17
  * Error in root path without script name in environment have been fixed.
15
18
 
16
- [1.0.2 - July 2009]
19
+ [1.0.2 - 2009-07-21]
17
20
  * The method for creates paths with parameters has been fixed.
18
21
 
19
22
  * RDoc has been updated.
20
23
 
21
- [1.0.1 - July 2009]
24
+ [1.0.1 - 2009-07-21]
22
25
  * The method for creates links has been fixed.
23
26
 
24
- [1.0.0 - July 2009]
27
+ [1.0.0 - 2009-07-21]
25
28
  * Added new helper method for creates links.
26
29
 
27
30
  * All features for first release have been finished.
28
31
 
29
- [0.2.1 - July 2009]
32
+ [0.2.1 - 2009-07-20]
30
33
  * The helper method for show title path has been fixed.
31
34
 
32
35
  * Added new task for show the current version.
33
36
 
34
- [0.2.0 - July 2009]
37
+ [0.2.0 - 2009-07-18]
35
38
  * New method for mapping of paths has been added.
36
39
 
37
- [0.1.1 - July 2009]
40
+ [0.1.1 - 2009-07-17]
38
41
  * New helper methods have been added.
39
42
 
40
43
  * Improvements in map method.
41
44
 
42
- [0.1.0 - July 2009]
45
+ [0.1.0 - 2009-07-16]
43
46
  * This version has been extracted from
44
47
  {Postview}[http://postview.rubyforge.org] project.
45
48
 
data/README.rdoc CHANGED
@@ -1,33 +1,51 @@
1
1
  = Sinatra::Mapping
2
2
 
3
- Map easily URLs paths.
3
+ Map easily URLs paths in your Web applications.
4
4
 
5
5
  * {Repository}[http://github.com/hallison/sinatra-mapping]
6
6
  * {Project}[http://rubyforge.org/projects/sinatra-mapping]
7
7
  * {Documentation}[:link:Sinatra/Mapping.html]
8
8
  * {Issues}[http://github.com/hallison/sinatra-mapping/issues]
9
9
 
10
- {Sinatra}[http://www.sinatrarb.com]
11
- {mapping extension}[http://sinatra-mapping.rubyforge.org] is a minimal
12
- module that is useful for create map names for Sinatra web application.
10
+ The extention Sinatra::Mapping is a minimal module that is useful for
11
+ create map names for {Ruby}[http://www.ruby-lang.org]
12
+ {Sinatra}[http://www.sinatrarb.com] web applications.
13
13
 
14
- Install stable version gem:
14
+ Install stable version gem from {RubyForge.org}[http://www.rubyforge.org/]:
15
15
 
16
16
  gem install sinatra-mapping
17
17
 
18
- Or, install development version gem:
18
+ Or, install development version gem from {GitHub.com}[http://github.com/]:
19
19
 
20
20
  gem install hallison-sinatra-mapping --source http://gems.github.com
21
21
 
22
- == Getting start
22
+ :session: Getting start
23
23
 
24
- Use extension using registered method in main source of application.
24
+ Sinatra implements REST routes:
25
+
26
+ get '/' do
27
+ .. show something ..
28
+ end
29
+
30
+ post '/' do
31
+ .. create something ..
32
+ end
33
+
34
+ put '/' do
35
+ .. update something ..
36
+ end
37
+
38
+ delete '/' do
39
+ .. annihilate something ..
40
+ end
41
+
42
+ Use extension by registered method in the main source of application.
25
43
  Example:
26
44
 
27
45
  require 'sinatra'
28
46
  require 'sinatra/mapping'
29
47
 
30
- class BlogAppication < Sinatra::Base
48
+ class BlogAppication < Sinatra::Application
31
49
 
32
50
  register Sinatra::Mapping
33
51
 
data/Rakefile CHANGED
@@ -40,14 +40,16 @@ namespace :version do
40
40
  end
41
41
  end
42
42
 
43
- Rake::TestTask.new
43
+ Rake::TestTask.new :test do |spec|
44
+ spec.test_files = FileList["test/*_test.rb"]
45
+ end
44
46
 
45
47
  Rake::GemPackageTask.new(@spec) do |pkg|
46
48
  pkg.need_tar_bz2 = true
47
49
  end
48
50
 
49
- Rake::RDocTask.new("doc") do |rdoc|
50
- rdoc.title = "Sinatra::Mapping"
51
+ Rake::RDocTask.new("doc:api") do |rdoc|
52
+ rdoc.title = "Sinatra::Mapping - API Documentation"
51
53
  rdoc.main = "README.rdoc"
52
54
  rdoc.options = [ '-SHN', '-f', 'darkfish' ]
53
55
  rdoc.rdoc_dir = 'doc'
data/VERSION CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  :release:
3
- :date: 2009-07-30
4
- :cycle: Release
3
+ :date: 2009-08-21
4
+ :cycle: Stable release
5
5
  :major: 1
6
6
  :minor: 0
7
- :patch: 5
7
+ :patch: 6
@@ -91,9 +91,10 @@ module Sinatra
91
91
 
92
92
  # Get paths from location maps.
93
93
  def locations_get_from(*args)
94
- args.delete(:root)
95
- args.collect do |path|
96
- @locations.has_key?(path) ? @locations[path] : path
94
+ args.flatten.reject do |path|
95
+ path == :root
96
+ end.collect do |path|
97
+ @locations[path] || path
97
98
  end
98
99
  end
99
100
 
@@ -18,12 +18,13 @@ class AppForTest < Sinatra::Base
18
18
  register Sinatra::Mapping
19
19
  helpers Sinatra::MappingHelpers
20
20
 
21
- map :root # root_path => /
22
- map :about # about_path => /about
21
+ map :root, "blog" # root_path => /blog/
22
+ map :about # about_path => /blog/about
23
23
 
24
- mapping :posts => "articles", # posts_path => /articles
25
- :archive => "archive/articles", # archive_path => /archive/articles
26
- :search => "find-articles" # search_path => /find-articles
24
+ mapping :posts => "articles", # posts_path => /blog/articles
25
+ :archive => "archive/articles", # archive_path => /blog/archive/articles
26
+ :search => "find-articles", # search_path => /blog/find-articles
27
+ :drafts => "unpublished" # drafts_path => /blog/unpublished
27
28
 
28
29
  before do
29
30
  @date = Date.today
@@ -81,6 +82,13 @@ class AppForTest < Sinatra::Base
81
82
  end_content
82
83
  end
83
84
 
85
+ get drafts_path do
86
+ <<-end_content.gsub(/^ /,'')
87
+ #{title_path :drafts}:#{path_to [:drafts, :posts]}
88
+ #{link_to "Unpublished", :drafts, :posts, :title => 'Unpublished'}
89
+ end_content
90
+ end
91
+
84
92
  end
85
93
 
86
94
  class TestMapping < Test::Unit::TestCase
@@ -94,7 +102,8 @@ class TestMapping < Test::Unit::TestCase
94
102
  :posts_path => "/articles",
95
103
  :archive_path => "/archive/articles",
96
104
  :about_path => "/about",
97
- :search_path => "/find-articles"
105
+ :search_path => "/find-articles",
106
+ :drafts_path => "/unpublished"
98
107
  }
99
108
  end
100
109
 
@@ -198,5 +207,12 @@ class TestMapping < Test::Unit::TestCase
198
207
  end
199
208
  end
200
209
 
210
+ def test_should_check_path_method_with_array_params
211
+ get "#{app.drafts_path}" do |response|
212
+ assert response.ok?
213
+ assert_equal "Unpublished:#{@locations[:drafts_path]}#{@locations[:posts_path]}", response.body.split("\n")[0]
214
+ assert_equal "<a href=\"#{@locations[:drafts_path]}#{@locations[:posts_path]}\" title=\"Unpublished\">Unpublished</a>", response.body.split("\n")[1]
215
+ end
216
+ end
201
217
  end
202
218
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-mapping
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hallison Batista
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-30 00:00:00 -04:00
12
+ date: 2009-08-21 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -51,7 +51,7 @@ files:
51
51
  - lib/sinatra/mapping.rb
52
52
  - lib/sinatra/mapping_helpers.rb
53
53
  - sinatra-mapping.gemspec
54
- - test/test_mapping.rb
54
+ - test/mapping_test.rb
55
55
  has_rdoc: true
56
56
  homepage: http://sinatra-mapping.rubyforge.org/
57
57
  licenses: []
@@ -85,5 +85,5 @@ rubygems_version: 1.3.3
85
85
  signing_key:
86
86
  specification_version: 3
87
87
  summary: Sinatra mapping extension for web application.
88
- test_files:
89
- - test/test_mapping.rb
88
+ test_files: []
89
+