sinatra 1.1.a → 1.1.b

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sinatra might be problematic. Click here for more details.

data/CHANGES CHANGED
@@ -49,10 +49,10 @@
49
49
  * 599 now is a legal status code. (Steve Shreeve)
50
50
 
51
51
  * This release is compatible with Ruby 1.9.2. Sinatra was trying to read
52
- none existent files Ruby added to the call stack. (Shota Fukumori,
52
+ non existent files Ruby added to the call stack. (Shota Fukumori,
53
53
  Konstantin Haase)
54
54
 
55
- * Prevents a memory leak on 1.8.6 is production mode. Note, however, that
55
+ * Prevents a memory leak on 1.8.6 in production mode. Note, however, that
56
56
  this is due to a bug in 1.8.6 and request will have the additional overhead
57
57
  of parsing templates again on that version. It is recommended to use at
58
58
  least Ruby 1.8.7. (Konstantin Haase)
@@ -247,7 +247,7 @@ Renderiza <tt>./views/index.nokogiri</tt>.
247
247
 
248
248
  === Plantillas Sass
249
249
 
250
- La gem/librería sass es necesaria para renderizar plantillas Sass:
250
+ La gem/librería haml es necesaria para renderizar plantillas Sass:
251
251
 
252
252
  ## Vas a necesitar requerir haml o sass en tu app
253
253
  require 'sass'
@@ -271,7 +271,7 @@ y reemplazadas individualmente.
271
271
 
272
272
  === Plantillas Scss
273
273
 
274
- La gem/librería sass es necesaria para renderizar plantillas Scss:
274
+ La gem/librería haml es necesaria para renderizar plantillas Scss:
275
275
 
276
276
  ## Vas a necesitar requerir haml o sass en tu app
277
277
  require 'sass'
@@ -244,7 +244,7 @@ Utilisera le template: <tt>./views/index.nokogiri</tt>.
244
244
 
245
245
  === Templates Sass
246
246
 
247
- Le gem sass est nécessaire pour utiliser la fonction de rendu Sass:
247
+ Le gem haml est nécessaire pour utiliser la fonction de rendu Sass:
248
248
 
249
249
  ## Chargez la bibliothèque haml ou sass dans votre application
250
250
  require 'sass'
@@ -268,7 +268,7 @@ et supportent aussi la réécriture (surcharge) comme dans cet exemple.
268
268
 
269
269
  === Scss Templates
270
270
 
271
- Le gem sass est nécessaire pour utiliser la fonction de rendu Scss:
271
+ Le gem haml est nécessaire pour utiliser la fonction de rendu Scss:
272
272
 
273
273
  ## Chargez la bibliothèque haml ou sass dans votre application
274
274
  require 'sass'
@@ -171,7 +171,7 @@ Ez pedig a <tt>./views/index.builder</tt> állományt fogja renderelni.
171
171
 
172
172
  === Sass sablonok
173
173
 
174
- Sass sablonok használatához szükség lesz a sass gem-re vagy könyvtárra:
174
+ Sass sablonok használatához szükség lesz a haml gem-re vagy könyvtárra:
175
175
 
176
176
  ## Be kell importálni a haml, vagy a sass könyvtárat
177
177
  require 'sass'
@@ -245,7 +245,7 @@ Renders <tt>./views/index.nokogiri</tt>.
245
245
 
246
246
  === Sass Templates
247
247
 
248
- The sass gem/library is required to render Sass templates:
248
+ The haml gem/library is required to render Sass templates:
249
249
 
250
250
  ## You'll need to require haml or sass in your app
251
251
  require 'sass'
@@ -269,7 +269,7 @@ and overridden on an individual basis.
269
269
 
270
270
  === Scss Templates
271
271
 
272
- The sass gem/library is required to render Scss templates:
272
+ The haml gem/library is required to render Scss templates:
273
273
 
274
274
  ## You'll need to require haml or sass in your app
275
275
  require 'sass'
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ end
16
16
  if !ENV['NO_TEST_FIX'] and RUBY_VERSION == '1.9.2' and RUBY_PATCHLEVEL == 0
17
17
  # Avoids seg fault
18
18
  task(:test) do
19
- second_run = %w[settings rdoc markaby].map { |l| "test/#{l}_test.rb" }
19
+ second_run = %w[settings rdoc markaby templates static textile].map { |l| "test/#{l}_test.rb" }
20
20
  first_run = Dir.glob('test/*_test.rb') - second_run
21
21
  [first_run, second_run].each { |f| sh "testrb #{f.join ' '}" }
22
22
  end
@@ -124,4 +124,16 @@ if defined?(Gem)
124
124
  File.open(f.name, 'w') { |io| io.write(spec) }
125
125
  puts "updated #{f.name}"
126
126
  end
127
+
128
+ task 'release' => package('.gem') do
129
+ sh <<-SH
130
+ gem install #{package('.gem')} --local &&
131
+ gem push #{package('.gem')} &&
132
+ git add sinatra.gemspec &&
133
+ git commit --allow-empty -m 'Release #{source_version}' &&
134
+ git -s #{source_version} -m 'Release #{source_version}' &&
135
+ git push && (git push sinatra || true) &&
136
+ git push --tags && (git push sinatra --tags || true)
137
+ SH
138
+ end
127
139
  end
@@ -7,7 +7,7 @@ require 'sinatra/showexceptions'
7
7
  require 'tilt'
8
8
 
9
9
  module Sinatra
10
- VERSION = '1.1.a'
10
+ VERSION = '1.1.b'
11
11
 
12
12
  # The request object. See Rack::Request for more info:
13
13
  # http://rack.rubyforge.org/doc/classes/Rack/Request.html
@@ -130,13 +130,8 @@ module Sinatra
130
130
  def content_type(type, params={})
131
131
  mime_type = mime_type(type)
132
132
  fail "Unknown media type: %p" % type if mime_type.nil?
133
- params[:charset] ||= defined?(Encoding) ? Encoding.default_external.to_s.downcase : 'utf-8'
134
- if params.any?
135
- params = params.collect { |kv| "%s=%s" % kv }.join(', ')
136
- response['Content-Type'] = [mime_type, params].join(";")
137
- else
138
- response['Content-Type'] = mime_type
139
- end
133
+ params[:charset] ||= params.delete('charset') || settings.default_encoding
134
+ response['Content-Type'] = "#{mime_type};#{params.map { |kv| kv.join('=') }.join(', ')}"
140
135
  end
141
136
 
142
137
  # Set the Content-Disposition to "attachment" with the specified filename,
@@ -154,9 +149,8 @@ module Sinatra
154
149
  stat = File.stat(path)
155
150
  last_modified stat.mtime
156
151
 
157
- content_type mime_type(opts[:type]) ||
158
- opts[:type] ||
159
- mime_type(File.extname(path)) ||
152
+ content_type opts[:type] ||
153
+ File.extname(path) ||
160
154
  response['Content-Type'] ||
161
155
  'application/octet-stream'
162
156
 
@@ -1216,15 +1210,10 @@ module Sinatra
1216
1210
  # The latter might not be necessary if Rack handles it one day.
1217
1211
  # Keep an eye on Rack's LH #100.
1218
1212
  if defined? Encoding
1219
- if Encoding.default_external.to_s =~ /^ASCII/
1220
- Encoding.default_external = "UTF-8"
1221
- end
1222
- Encoding.default_internal ||= Encoding.default_external
1223
-
1224
1213
  def force_encoding(data)
1225
1214
  return if data == self || data.is_a?(Tempfile)
1226
1215
  if data.respond_to? :force_encoding
1227
- data.force_encoding(Encoding.default_external)
1216
+ data.force_encoding settings.default_encoding
1228
1217
  elsif data.respond_to? :each_value
1229
1218
  data.each_value { |v| force_encoding(v) }
1230
1219
  elsif data.respond_to? :each
@@ -1235,7 +1224,6 @@ module Sinatra
1235
1224
  def force_encoding(*) end
1236
1225
  end
1237
1226
 
1238
-
1239
1227
  reset!
1240
1228
 
1241
1229
  set :environment, (ENV['RACK_ENV'] || :development).to_sym
@@ -1245,6 +1233,7 @@ module Sinatra
1245
1233
  set :sessions, false
1246
1234
  set :logging, false
1247
1235
  set :method_override, false
1236
+ set :default_encoding, "utf-8"
1248
1237
 
1249
1238
  class << self
1250
1239
  alias_method :methodoverride?, :method_override?
@@ -3,8 +3,8 @@ Gem::Specification.new do |s|
3
3
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
4
4
 
5
5
  s.name = 'sinatra'
6
- s.version = '1.1.a'
7
- s.date = '2010-10-19'
6
+ s.version = '1.1.b'
7
+ s.date = '2010-10-23'
8
8
 
9
9
  s.description = "Classy web-development dressed in a DSL"
10
10
  s.summary = "Classy web-development dressed in a DSL"
@@ -8,7 +8,8 @@ class BaseTest < Test::Unit::TestCase
8
8
  end
9
9
 
10
10
  it 'allows unicode strings in ascii templates per default (1.9)' do
11
- @base.new.haml(:ascii, {}, :value => "åkej")
11
+ next unless defined? Encoding
12
+ @base.new.haml(File.read(@base.views + "/ascii.haml").encode("ASCII"), {}, :value => "åkej")
12
13
  end
13
14
 
14
15
  it 'allows ascii strings in unicode templates per default (1.9)' do
@@ -91,7 +91,7 @@ class StaticTest < Test::Unit::TestCase
91
91
  assert not_found?
92
92
  end
93
93
 
94
- def test_valid_range(http_range, range, path, file)
94
+ def assert_valid_range(http_range, range, path, file)
95
95
  request = Rack::MockRequest.new(@app)
96
96
  response = request.get("/#{File.basename(path)}", 'HTTP_RANGE' => http_range)
97
97
 
@@ -113,23 +113,23 @@ class StaticTest < Test::Unit::TestCase
113
113
  assert length > 9000, "The test file #{path} is too short (#{length} bytes) to run these tests"
114
114
 
115
115
  [0..0, 42..88, 1234..1234, 100..9000, 0..(length-1), (length-1)..(length-1)].each do |range|
116
- test_valid_range("bytes=#{range.begin}-#{range.end}", range, path, file)
116
+ assert_valid_range("bytes=#{range.begin}-#{range.end}", range, path, file)
117
117
  end
118
118
 
119
119
  [0, 100, length-100, length-1].each do |start|
120
- test_valid_range("bytes=#{start}-", (start..length-1), path, file)
120
+ assert_valid_range("bytes=#{start}-", (start..length-1), path, file)
121
121
  end
122
122
 
123
123
  [1, 100, length-100, length-1, length].each do |range_length|
124
- test_valid_range("bytes=-#{range_length}", (length-range_length..length-1), path, file)
124
+ assert_valid_range("bytes=-#{range_length}", (length-range_length..length-1), path, file)
125
125
  end
126
126
 
127
127
  # Some valid ranges that exceed the length of the file:
128
- test_valid_range("bytes=100-999999", (100..length-1), path, file)
129
- test_valid_range("bytes=100-#{length}", (100..length-1), path, file)
130
- test_valid_range("bytes=-#{length}", (0..length-1), path, file)
131
- test_valid_range("bytes=-#{length+1}", (0..length-1), path, file)
132
- test_valid_range("bytes=-999999", (0..length-1), path, file)
128
+ assert_valid_range("bytes=100-999999", (100..length-1), path, file)
129
+ assert_valid_range("bytes=100-#{length}", (100..length-1), path, file)
130
+ assert_valid_range("bytes=-#{length}", (0..length-1), path, file)
131
+ assert_valid_range("bytes=-#{length+1}", (0..length-1), path, file)
132
+ assert_valid_range("bytes=-999999", (0..length-1), path, file)
133
133
  end
134
134
 
135
135
  it 'correctly ignores syntactically invalid range requests' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra
3
3
  version: !ruby/object:Gem::Version
4
- hash: 118
4
+ hash: 119
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - a
10
- version: 1.1.a
9
+ - b
10
+ version: 1.1.b
11
11
  platform: ruby
12
12
  authors:
13
13
  - Blake Mizerany
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-10-19 00:00:00 +02:00
21
+ date: 2010-10-23 00:00:00 +02:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency