rtomayko-sinatra 0.3.3 → 0.8.9

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.
Files changed (81) hide show
  1. data/AUTHORS +40 -0
  2. data/CHANGES +167 -0
  3. data/README.rdoc +104 -98
  4. data/Rakefile +27 -9
  5. data/{test → compat}/app_test.rb +11 -10
  6. data/{test → compat}/application_test.rb +10 -5
  7. data/compat/builder_test.rb +101 -0
  8. data/{test → compat}/custom_error_test.rb +0 -0
  9. data/compat/erb_test.rb +136 -0
  10. data/{test → compat}/events_test.rb +12 -2
  11. data/compat/filter_test.rb +30 -0
  12. data/compat/haml_test.rb +233 -0
  13. data/compat/helper.rb +21 -0
  14. data/compat/mapped_error_test.rb +72 -0
  15. data/{test → compat}/pipeline_test.rb +9 -4
  16. data/{test → compat}/public/foo.xml +0 -0
  17. data/compat/sass_test.rb +57 -0
  18. data/{test → compat}/sessions_test.rb +0 -0
  19. data/{test → compat}/streaming_test.rb +4 -1
  20. data/{test → compat}/sym_params_test.rb +0 -0
  21. data/{test → compat}/template_test.rb +0 -0
  22. data/{test → compat}/use_in_file_templates_test.rb +0 -0
  23. data/{test → compat}/views/foo.builder +0 -0
  24. data/{test → compat}/views/foo.erb +0 -0
  25. data/{test → compat}/views/foo.haml +0 -0
  26. data/{test → compat}/views/foo.sass +0 -0
  27. data/{test → compat}/views/foo_layout.erb +0 -0
  28. data/{test → compat}/views/foo_layout.haml +0 -0
  29. data/{test → compat}/views/layout_test/foo.builder +0 -0
  30. data/{test → compat}/views/layout_test/foo.erb +0 -0
  31. data/{test → compat}/views/layout_test/foo.haml +0 -0
  32. data/{test → compat}/views/layout_test/foo.sass +0 -0
  33. data/{test → compat}/views/layout_test/layout.builder +0 -0
  34. data/{test → compat}/views/layout_test/layout.erb +0 -0
  35. data/{test → compat}/views/layout_test/layout.haml +0 -0
  36. data/{test → compat}/views/layout_test/layout.sass +0 -0
  37. data/{test → compat}/views/no_layout/no_layout.builder +0 -0
  38. data/{test → compat}/views/no_layout/no_layout.haml +0 -0
  39. data/lib/sinatra/base.rb +818 -0
  40. data/lib/sinatra/compat.rb +239 -0
  41. data/{images → lib/sinatra/images}/404.png +0 -0
  42. data/{images → lib/sinatra/images}/500.png +0 -0
  43. data/lib/sinatra/main.rb +48 -0
  44. data/lib/sinatra/test/rspec.rb +1 -9
  45. data/lib/sinatra/test/spec.rb +1 -9
  46. data/lib/sinatra/test/unit.rb +3 -5
  47. data/lib/sinatra/test.rb +112 -0
  48. data/lib/sinatra.rb +3 -1486
  49. data/sinatra.gemspec +66 -36
  50. data/test/base_test.rb +72 -0
  51. data/test/builder_test.rb +56 -89
  52. data/test/data/reload_app_file.rb +3 -0
  53. data/test/erb_test.rb +44 -125
  54. data/test/filter_test.rb +29 -20
  55. data/test/haml_test.rb +57 -218
  56. data/test/helpers_test.rb +368 -0
  57. data/test/mapped_error_test.rb +141 -49
  58. data/test/middleware_test.rb +63 -0
  59. data/test/options_test.rb +103 -0
  60. data/test/reload_test.rb +65 -0
  61. data/test/request_test.rb +11 -0
  62. data/test/result_test.rb +92 -0
  63. data/test/routing_test.rb +338 -0
  64. data/test/sass_test.rb +33 -50
  65. data/test/sinatra_test.rb +15 -0
  66. data/test/static_test.rb +60 -0
  67. data/test/templates_test.rb +92 -0
  68. data/test/views/hello.builder +1 -0
  69. data/test/views/hello.erb +1 -0
  70. data/test/views/hello.haml +1 -0
  71. data/test/views/hello.sass +2 -0
  72. data/test/views/hello.test +1 -0
  73. data/test/views/layout2.builder +3 -0
  74. data/test/views/layout2.erb +2 -0
  75. data/test/views/layout2.haml +2 -0
  76. data/test/views/layout2.test +1 -0
  77. metadata +78 -48
  78. data/ChangeLog +0 -96
  79. data/lib/sinatra/test/methods.rb +0 -76
  80. data/test/event_context_test.rb +0 -15
  81. data/test/helper.rb +0 -9
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtomayko-sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Mizerany
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-02 00:00:00 -07:00
12
+ date: 2009-01-13 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -17,9 +17,9 @@ dependencies:
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
20
- - - ~>
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.4.0
22
+ version: 0.9.0
23
23
  version:
24
24
  description: Classy web-development dressed in a DSL
25
25
  email:
@@ -31,53 +31,83 @@ extra_rdoc_files:
31
31
  - README.rdoc
32
32
  - LICENSE
33
33
  files:
34
- - ChangeLog
34
+ - AUTHORS
35
+ - CHANGES
35
36
  - LICENSE
36
37
  - README.rdoc
37
38
  - Rakefile
38
- - images/404.png
39
- - images/500.png
39
+ - compat/app_test.rb
40
+ - compat/application_test.rb
41
+ - compat/builder_test.rb
42
+ - compat/custom_error_test.rb
43
+ - compat/erb_test.rb
44
+ - compat/events_test.rb
45
+ - compat/filter_test.rb
46
+ - compat/haml_test.rb
47
+ - compat/helper.rb
48
+ - compat/mapped_error_test.rb
49
+ - compat/pipeline_test.rb
50
+ - compat/public/foo.xml
51
+ - compat/sass_test.rb
52
+ - compat/sessions_test.rb
53
+ - compat/streaming_test.rb
54
+ - compat/sym_params_test.rb
55
+ - compat/template_test.rb
56
+ - compat/use_in_file_templates_test.rb
57
+ - compat/views/foo.builder
58
+ - compat/views/foo.erb
59
+ - compat/views/foo.haml
60
+ - compat/views/foo.sass
61
+ - compat/views/foo_layout.erb
62
+ - compat/views/foo_layout.haml
63
+ - compat/views/layout_test/foo.builder
64
+ - compat/views/layout_test/foo.erb
65
+ - compat/views/layout_test/foo.haml
66
+ - compat/views/layout_test/foo.sass
67
+ - compat/views/layout_test/layout.builder
68
+ - compat/views/layout_test/layout.erb
69
+ - compat/views/layout_test/layout.haml
70
+ - compat/views/layout_test/layout.sass
71
+ - compat/views/no_layout/no_layout.builder
72
+ - compat/views/no_layout/no_layout.haml
40
73
  - lib/sinatra.rb
41
- - lib/sinatra/test/methods.rb
74
+ - lib/sinatra/base.rb
75
+ - lib/sinatra/compat.rb
76
+ - lib/sinatra/images/404.png
77
+ - lib/sinatra/images/500.png
78
+ - lib/sinatra/main.rb
79
+ - lib/sinatra/test.rb
42
80
  - lib/sinatra/test/rspec.rb
43
81
  - lib/sinatra/test/spec.rb
44
82
  - lib/sinatra/test/unit.rb
45
83
  - sinatra.gemspec
46
- - test/app_test.rb
47
- - test/application_test.rb
84
+ - test/base_test.rb
48
85
  - test/builder_test.rb
49
- - test/custom_error_test.rb
86
+ - test/data/reload_app_file.rb
50
87
  - test/erb_test.rb
51
- - test/event_context_test.rb
52
- - test/events_test.rb
53
88
  - test/filter_test.rb
54
89
  - test/haml_test.rb
55
- - test/helper.rb
90
+ - test/helpers_test.rb
56
91
  - test/mapped_error_test.rb
57
- - test/pipeline_test.rb
58
- - test/public/foo.xml
92
+ - test/middleware_test.rb
93
+ - test/options_test.rb
94
+ - test/reload_test.rb
95
+ - test/request_test.rb
96
+ - test/result_test.rb
97
+ - test/routing_test.rb
59
98
  - test/sass_test.rb
60
- - test/sessions_test.rb
61
- - test/streaming_test.rb
62
- - test/sym_params_test.rb
63
- - test/template_test.rb
64
- - test/use_in_file_templates_test.rb
65
- - test/views/foo.builder
66
- - test/views/foo.erb
67
- - test/views/foo.haml
68
- - test/views/foo.sass
69
- - test/views/foo_layout.erb
70
- - test/views/foo_layout.haml
71
- - test/views/layout_test/foo.builder
72
- - test/views/layout_test/foo.erb
73
- - test/views/layout_test/foo.haml
74
- - test/views/layout_test/foo.sass
75
- - test/views/layout_test/layout.builder
76
- - test/views/layout_test/layout.erb
77
- - test/views/layout_test/layout.haml
78
- - test/views/layout_test/layout.sass
79
- - test/views/no_layout/no_layout.builder
80
- - test/views/no_layout/no_layout.haml
99
+ - test/sinatra_test.rb
100
+ - test/static_test.rb
101
+ - test/templates_test.rb
102
+ - test/views/hello.builder
103
+ - test/views/hello.erb
104
+ - test/views/hello.haml
105
+ - test/views/hello.sass
106
+ - test/views/hello.test
107
+ - test/views/layout2.builder
108
+ - test/views/layout2.erb
109
+ - test/views/layout2.haml
110
+ - test/views/layout2.test
81
111
  has_rdoc: true
82
112
  homepage: http://sinatra.rubyforge.org
83
113
  post_install_message:
@@ -110,20 +140,20 @@ signing_key:
110
140
  specification_version: 2
111
141
  summary: Classy web-development dressed in a DSL
112
142
  test_files:
113
- - test/app_test.rb
114
- - test/application_test.rb
143
+ - test/base_test.rb
115
144
  - test/builder_test.rb
116
- - test/custom_error_test.rb
117
145
  - test/erb_test.rb
118
- - test/event_context_test.rb
119
- - test/events_test.rb
120
146
  - test/filter_test.rb
121
147
  - test/haml_test.rb
148
+ - test/helpers_test.rb
122
149
  - test/mapped_error_test.rb
123
- - test/pipeline_test.rb
150
+ - test/middleware_test.rb
151
+ - test/options_test.rb
152
+ - test/reload_test.rb
153
+ - test/request_test.rb
154
+ - test/result_test.rb
155
+ - test/routing_test.rb
124
156
  - test/sass_test.rb
125
- - test/sessions_test.rb
126
- - test/streaming_test.rb
127
- - test/sym_params_test.rb
128
- - test/template_test.rb
129
- - test/use_in_file_templates_test.rb
157
+ - test/sinatra_test.rb
158
+ - test/static_test.rb
159
+ - test/templates_test.rb
data/ChangeLog DELETED
@@ -1,96 +0,0 @@
1
- = 0.3.3 / 2009-01-06
2
-
3
- * Pin to Rack 0.4.0 (this is the last release on Rack 0.4)
4
-
5
- * Log unhandled exception backtraces to rack.errors.
6
-
7
- * Use RACK_ENV environment variable to establish Sinatra
8
- environment when given. Thin sets this when started with
9
- the -e argument.
10
-
11
- * BUG: raising Sinatra::NotFound resulted in a 500 response
12
- code instead of 404.
13
-
14
- * BUG: use_in_file_templates! failes with CR/LF (#45)
15
-
16
- * BUG: Sinatra detects the app file and root path when run under
17
- thin/passenger.
18
-
19
- = 0.3.2
20
-
21
- * BUG: Static and send_file read entire file into String before
22
- sending. Updated to stream with 8K chunks instead.
23
-
24
- * Rake tasks and assets for building basic documentation website.
25
- See http://sinatra.rubyforge.org
26
-
27
- * Various minor doc fixes.
28
-
29
- = 0.3.1
30
-
31
- * Unbreak optional path parameters [jeremyevans]
32
-
33
- = 0.3.0
34
-
35
- * Add sinatra.gemspec w/ support for github gem builds. Forks can now
36
- enable the build gem option in github to get free username-sinatra.gem
37
- builds: gem install username-sinatra.gem --source=http://gems.github.com/
38
-
39
- * Require rack-0.4 gem; removes frozen rack dir.
40
-
41
- * Basic RSpec support; require 'sinatra/test/rspec' instead of
42
- 'sinatra/test/spec' to use. [avdi]
43
-
44
- * before filters can modify request environment vars used for
45
- routing (e.g., PATH_INFO, REQUEST_METHOD, etc.) for URL rewriting
46
- type functionality.
47
-
48
- * In-file templates now uses @@ instead of ## as template separator.
49
-
50
- * Top-level environment test predicates: development?, test?, production?
51
-
52
- * Top-level "set", "enable", and "disable" methods for tweaking
53
- app options. [rtomayko]
54
-
55
- * Top-level "use" method for building Rack middleware pipelines
56
- leading to app. See README for usage. [rtomayko]
57
-
58
- * New "reload" option - set false to disable reloading in development.
59
-
60
- * New "host" option - host/ip to bind to [cschneid]
61
-
62
- * New "app_file" option - override the file to reload in development
63
- mode [cschneid]
64
-
65
- * Development error/not_found page cleanup [sr, adamwiggins]
66
-
67
- * Remove a bunch of core extensions (String#to_param, String#from_param,
68
- Hash#from_params, Hash#to_params, Hash#symbolize_keys, Hash#pass)
69
-
70
- * Various grammar and formatting fixes to README; additions on
71
- community and contributing [cypher]
72
-
73
- * Build RDoc using Hanna template: http://sinatrarb.rubyforge.org/api
74
-
75
- * Specs, documentation and fixes for splat'n routes [vic]
76
-
77
- * Fix whitespace errors across all source files. [rtomayko]
78
-
79
- * Fix streaming issues with Mongrel (body not closed). [bmizerany]
80
-
81
- * Fix various issues with environment not being set properly (configure
82
- blocks not running, error pages not registering, etc.) [cypher]
83
-
84
- * Fix to allow locals to be passed to ERB templates [cschneid]
85
-
86
- * Fix locking issues causing random errors during reload in development.
87
-
88
- * Fix for escaped paths not resolving static files [Matthew Walker]
89
-
90
- = 0.2.1
91
-
92
- * File upload fix and minor tweaks.
93
-
94
- = 0.2.0
95
-
96
- * Initial gem release of 0.2 coebase.
@@ -1,76 +0,0 @@
1
- module Sinatra
2
-
3
- module Test
4
-
5
- module Methods
6
- include Rack::Utils
7
-
8
- ENV_KEY_NAMES = {
9
- :accept => "HTTP_ACCEPT",
10
- :agent => "HTTP_USER_AGENT",
11
- :host => "HTTP_HOST",
12
- :session => "HTTP_COOKIE",
13
- :cookies => "HTTP_COOKIE",
14
- :content_type => "CONTENT_TYPE"
15
- }
16
-
17
- def session(data, key = 'rack.session')
18
- data = data.from_params if data.respond_to?(:from_params)
19
- "#{escape(key)}=#{[Marshal.dump(data)].pack("m*")}"
20
- end
21
-
22
- def normalize_rack_environment(env)
23
- env.inject({}) do |hash,(k,v)|
24
- hash[ENV_KEY_NAMES[k] || k] = v
25
- hash
26
- end
27
- end
28
-
29
- def hash_to_param_string(hash)
30
- hash.map { |pair| pair.map{|v|escape(v)}.join('=') }.join('&')
31
- end
32
-
33
- %w(get head post put delete).each do |verb|
34
- http_method = verb.upcase
35
- define_method("#{verb}_it") do |path, *args|
36
- @request = Rack::MockRequest.new(Sinatra.build_application)
37
- opts, input =
38
- case args.size
39
- when 2 # input, env
40
- input, env = args
41
- [env, input]
42
- when 1 # params
43
- if (data = args.first).kind_of?(Hash)
44
- env = (data.delete(:env) || {})
45
- [env, hash_to_param_string(data)]
46
- else
47
- [{}, data]
48
- end
49
- when 0
50
- [{}, '']
51
- else
52
- raise ArgumentError, "zero, one, or two arguments expected"
53
- end
54
- opts = normalize_rack_environment(opts)
55
- opts[:input] ||= input
56
- @response = @request.request(http_method, path, opts)
57
- end
58
- end
59
-
60
- def follow!
61
- get_it(@response.location)
62
- end
63
-
64
- def method_missing(name, *args)
65
- if @response.respond_to?(name)
66
- @response.send(name, *args)
67
- else
68
- super
69
- end
70
- end
71
-
72
- end
73
-
74
- end
75
-
76
- end
@@ -1,15 +0,0 @@
1
- require File.dirname(__FILE__) + '/helper'
2
-
3
- context "EventContext" do
4
-
5
- specify "DSLified setters" do
6
-
7
- cx = Sinatra::EventContext.new(stub_everything, Rack::Response.new, {})
8
- lambda {
9
- cx.status 404
10
- }.should.not.raise(ArgumentError)
11
-
12
- end
13
-
14
- end
15
-
data/test/helper.rb DELETED
@@ -1,9 +0,0 @@
1
- require 'rubygems'
2
- require 'mocha'
3
-
4
- gem 'rack', '~> 0.4.0'
5
-
6
- $:.unshift File.dirname(File.dirname(__FILE__)) + "/lib"
7
-
8
- require 'sinatra'
9
- require 'sinatra/test/spec'