sinatra 1.4.6 → 2.0.0

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.

Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHORS.md +5 -2
  3. data/{CHANGES → CHANGELOG.md} +126 -46
  4. data/CONTRIBUTING.md +100 -0
  5. data/Gemfile +12 -17
  6. data/LICENSE +5 -2
  7. data/MAINTENANCE.md +42 -0
  8. data/README.de.md +711 -466
  9. data/README.es.md +206 -171
  10. data/README.fr.md +370 -344
  11. data/README.hu.md +44 -10
  12. data/README.ja.md +300 -210
  13. data/README.ko.md +230 -191
  14. data/README.md +675 -528
  15. data/README.pt-br.md +149 -115
  16. data/README.pt-pt.md +65 -65
  17. data/README.ru.md +198 -97
  18. data/README.zh.md +1943 -1237
  19. data/Rakefile +72 -49
  20. data/SECURITY.md +35 -0
  21. data/lib/sinatra/base.rb +141 -207
  22. data/lib/sinatra/indifferent_hash.rb +150 -0
  23. data/lib/sinatra/main.rb +1 -0
  24. data/lib/sinatra/show_exceptions.rb +70 -56
  25. data/lib/sinatra/version.rb +1 -1
  26. data/sinatra.gemspec +19 -7
  27. metadata +32 -163
  28. data/test/asciidoctor_test.rb +0 -72
  29. data/test/base_test.rb +0 -167
  30. data/test/builder_test.rb +0 -91
  31. data/test/coffee_test.rb +0 -96
  32. data/test/compile_test.rb +0 -183
  33. data/test/contest.rb +0 -91
  34. data/test/creole_test.rb +0 -65
  35. data/test/delegator_test.rb +0 -160
  36. data/test/encoding_test.rb +0 -20
  37. data/test/erb_test.rb +0 -116
  38. data/test/extensions_test.rb +0 -98
  39. data/test/filter_test.rb +0 -487
  40. data/test/haml_test.rb +0 -109
  41. data/test/helper.rb +0 -132
  42. data/test/helpers_test.rb +0 -1917
  43. data/test/integration/app.rb +0 -79
  44. data/test/integration_helper.rb +0 -236
  45. data/test/integration_test.rb +0 -104
  46. data/test/less_test.rb +0 -69
  47. data/test/liquid_test.rb +0 -77
  48. data/test/mapped_error_test.rb +0 -285
  49. data/test/markaby_test.rb +0 -80
  50. data/test/markdown_test.rb +0 -85
  51. data/test/mediawiki_test.rb +0 -68
  52. data/test/middleware_test.rb +0 -68
  53. data/test/nokogiri_test.rb +0 -67
  54. data/test/public/favicon.ico +0 -0
  55. data/test/rabl_test.rb +0 -89
  56. data/test/rack_test.rb +0 -45
  57. data/test/radius_test.rb +0 -59
  58. data/test/rdoc_test.rb +0 -66
  59. data/test/readme_test.rb +0 -130
  60. data/test/request_test.rb +0 -100
  61. data/test/response_test.rb +0 -63
  62. data/test/result_test.rb +0 -76
  63. data/test/route_added_hook_test.rb +0 -59
  64. data/test/routing_test.rb +0 -1412
  65. data/test/sass_test.rb +0 -115
  66. data/test/scss_test.rb +0 -88
  67. data/test/server_test.rb +0 -56
  68. data/test/settings_test.rb +0 -582
  69. data/test/sinatra_test.rb +0 -12
  70. data/test/slim_test.rb +0 -102
  71. data/test/static_test.rb +0 -236
  72. data/test/streaming_test.rb +0 -149
  73. data/test/stylus_test.rb +0 -90
  74. data/test/templates_test.rb +0 -382
  75. data/test/textile_test.rb +0 -65
  76. data/test/views/a/in_a.str +0 -1
  77. data/test/views/ascii.erb +0 -2
  78. data/test/views/b/in_b.str +0 -1
  79. data/test/views/calc.html.erb +0 -1
  80. data/test/views/error.builder +0 -3
  81. data/test/views/error.erb +0 -3
  82. data/test/views/error.haml +0 -3
  83. data/test/views/error.sass +0 -2
  84. data/test/views/explicitly_nested.str +0 -1
  85. data/test/views/foo/hello.test +0 -1
  86. data/test/views/hello.asciidoc +0 -1
  87. data/test/views/hello.builder +0 -1
  88. data/test/views/hello.coffee +0 -1
  89. data/test/views/hello.creole +0 -1
  90. data/test/views/hello.erb +0 -1
  91. data/test/views/hello.haml +0 -1
  92. data/test/views/hello.less +0 -5
  93. data/test/views/hello.liquid +0 -1
  94. data/test/views/hello.mab +0 -1
  95. data/test/views/hello.md +0 -1
  96. data/test/views/hello.mediawiki +0 -1
  97. data/test/views/hello.nokogiri +0 -1
  98. data/test/views/hello.rabl +0 -2
  99. data/test/views/hello.radius +0 -1
  100. data/test/views/hello.rdoc +0 -1
  101. data/test/views/hello.sass +0 -2
  102. data/test/views/hello.scss +0 -3
  103. data/test/views/hello.slim +0 -1
  104. data/test/views/hello.str +0 -1
  105. data/test/views/hello.styl +0 -2
  106. data/test/views/hello.test +0 -1
  107. data/test/views/hello.textile +0 -1
  108. data/test/views/hello.wlang +0 -1
  109. data/test/views/hello.yajl +0 -1
  110. data/test/views/layout2.builder +0 -3
  111. data/test/views/layout2.erb +0 -2
  112. data/test/views/layout2.haml +0 -2
  113. data/test/views/layout2.liquid +0 -2
  114. data/test/views/layout2.mab +0 -2
  115. data/test/views/layout2.nokogiri +0 -3
  116. data/test/views/layout2.rabl +0 -3
  117. data/test/views/layout2.radius +0 -2
  118. data/test/views/layout2.slim +0 -3
  119. data/test/views/layout2.str +0 -2
  120. data/test/views/layout2.test +0 -1
  121. data/test/views/layout2.wlang +0 -2
  122. data/test/views/nested.str +0 -1
  123. data/test/views/utf8.erb +0 -2
  124. data/test/wlang_test.rb +0 -87
  125. data/test/yajl_test.rb +0 -86
data/Rakefile CHANGED
@@ -3,22 +3,13 @@ require 'rake/testtask'
3
3
  require 'fileutils'
4
4
  require 'date'
5
5
 
6
- # CI Reporter is only needed for the CI
7
- begin
8
- require 'ci/reporter/rake/test_unit'
9
- rescue LoadError
10
- end
11
-
12
6
  task :default => :test
13
7
  task :spec => :test
14
8
 
15
9
  CLEAN.include "**/*.rbc"
16
10
 
17
11
  def source_version
18
- @source_version ||= begin
19
- load './lib/sinatra/version.rb'
20
- Sinatra::VERSION
21
- end
12
+ @source_version ||= File.read(File.expand_path("../VERSION", __FILE__)).strip
22
13
  end
23
14
 
24
15
  def prev_feature
@@ -61,7 +52,8 @@ namespace :test do
61
52
  desc 'Measures test coverage'
62
53
  task :coverage do
63
54
  rm_f "coverage"
64
- sh "rcov -Ilib test/*_test.rb"
55
+ ENV['COVERAGE'] = '1'
56
+ Rake::Task['test'].invoke
65
57
  end
66
58
  end
67
59
 
@@ -95,9 +87,9 @@ end
95
87
 
96
88
  # Thanks in announcement ===============================================
97
89
 
98
- team = ["Ryan Tomayko", "Blake Mizerany", "Simon Rozet", "Konstantin Haase"]
90
+ team = ["Ryan Tomayko", "Blake Mizerany", "Simon Rozet", "Konstantin Haase", "Zachary Scott"]
99
91
  desc "list of contributors"
100
- task :thanks, [:release,:backports] do |t, a|
92
+ task :thanks, ['release:all', :backports] do |t, a|
101
93
  a.with_defaults :release => "#{prev_version}..HEAD",
102
94
  :backports => "#{prev_feature}.0..#{prev_feature}.x"
103
95
  included = `git log --format=format:"%aN\t%s" #{a.release}`.lines.map { |l| l.force_encoding('binary') }
@@ -146,54 +138,85 @@ end
146
138
  # PACKAGING ============================================================
147
139
 
148
140
  if defined?(Gem)
149
- # Load the gemspec using the same limitations as github
150
- def spec
151
- require 'rubygems' unless defined? Gem::Specification
152
- @spec ||= eval(File.read('sinatra.gemspec'))
141
+ GEMS_AND_ROOT_DIRECTORIES = {
142
+ "sinatra" => ".",
143
+ "sinatra-contrib" => "./sinatra-contrib",
144
+ "rack-protection" => "./rack-protection"
145
+ }
146
+
147
+ def package(gem, ext='')
148
+ "pkg/#{gem}-#{source_version}" + ext
153
149
  end
154
150
 
155
- def package(ext='')
156
- "pkg/sinatra-#{spec.version}" + ext
157
- end
151
+ directory 'pkg/'
152
+ CLOBBER.include('pkg')
158
153
 
159
- desc 'Build packages'
160
- task :package => %w[.gem .tar.gz].map {|e| package(e)}
154
+ GEMS_AND_ROOT_DIRECTORIES.each do |gem, directory|
155
+ file package(gem, '.gem') => ["pkg/", "#{directory + '/' + gem}.gemspec"] do |f|
156
+ sh "cd #{directory} && gem build #{gem}.gemspec"
157
+ mv directory + "/" + File.basename(f.name), f.name
158
+ end
161
159
 
162
- desc 'Build and install as local gem'
163
- task :install => package('.gem') do
164
- sh "gem install #{package('.gem')}"
160
+ file package(gem, '.tar.gz') => ["pkg/"] do |f|
161
+ sh <<-SH
162
+ git archive \
163
+ --prefix=#{gem}-#{source_version}/ \
164
+ --format=tar \
165
+ HEAD -- #{directory} | gzip > #{f.name}
166
+ SH
167
+ end
165
168
  end
166
169
 
167
- directory 'pkg/'
168
- CLOBBER.include('pkg')
170
+ namespace :package do
171
+ GEMS_AND_ROOT_DIRECTORIES.each do |gem, directory|
172
+ desc "Build #{gem} packages"
173
+ task gem => %w[.gem .tar.gz].map { |e| package(gem, e) }
174
+ end
169
175
 
170
- file package('.gem') => %w[pkg/ sinatra.gemspec] + spec.files do |f|
171
- sh "gem build sinatra.gemspec"
172
- mv File.basename(f.name), f.name
176
+ desc "Build all packages"
177
+ task :all => GEMS_AND_ROOT_DIRECTORIES.keys
173
178
  end
174
179
 
175
- file package('.tar.gz') => %w[pkg/] + spec.files do |f|
176
- sh <<-SH
177
- git archive \
178
- --prefix=sinatra-#{source_version}/ \
179
- --format=tar \
180
- HEAD | gzip > #{f.name}
181
- SH
180
+ namespace :install do
181
+ GEMS_AND_ROOT_DIRECTORIES.each do |gem, directory|
182
+ desc "Build and install #{gem} as local gem"
183
+ task gem => package(gem, '.gem') do
184
+ sh "gem install #{package(gem, '.gem')}"
185
+ end
186
+ end
187
+
188
+ desc "Build and install all of the gems as local gems"
189
+ task :all => GEMS_AND_ROOT_DIRECTORIES.keys
182
190
  end
183
191
 
184
- task 'release' => ['test', package('.gem')] do
185
- if File.binread("CHANGES") =~ /= \d\.\d\.\d . not yet released$/i
186
- fail 'please update changes first' unless %x{git symbolic-ref HEAD} == "refs/heads/prerelease\n"
192
+ namespace :release do
193
+ GEMS_AND_ROOT_DIRECTORIES.each do |gem, directory|
194
+ desc "Release #{gem} as a package"
195
+ task gem => "package:#{gem}" do
196
+ sh <<-SH
197
+ gem install #{package(gem, '.gem')} --local &&
198
+ gem push #{package(gem, '.gem')}
199
+ SH
200
+ end
201
+ end
202
+
203
+ desc "Commits the version to github repository"
204
+ task :commit_version do
205
+ sh <<-SH
206
+ sed -i "s/.*VERSION.*/ VERSION = '#{source_version}'/" lib/sinatra/version.rb
207
+ sed -i "s/.*VERSION.*/ VERSION = '#{source_version}'/" sinatra-contrib/lib/sinatra/contrib/version.rb
208
+ sed -i "s/.*VERSION.*/ VERSION = '#{source_version}'/" rack-protection/lib/rack/protection/version.rb
209
+ SH
210
+
211
+ sh <<-SH
212
+ git commit --allow-empty -a -m '#{source_version} release' &&
213
+ git tag -s v#{source_version} -m '#{source_version} release' &&
214
+ git push && (git push origin || true) &&
215
+ git push --tags && (git push origin --tags || true)
216
+ SH
187
217
  end
188
218
 
189
- sh <<-SH
190
- gem install #{package('.gem')} --local &&
191
- gem push #{package('.gem')} &&
192
- git commit --allow-empty -a -m '#{source_version} release' &&
193
- git tag -s v#{source_version} -m '#{source_version} release' &&
194
- git tag -s #{source_version} -m '#{source_version} release' &&
195
- git push && (git push sinatra || true) &&
196
- git push --tags && (git push sinatra --tags || true)
197
- SH
219
+ desc "Release all gems as packages"
220
+ task :all => [:test, :commit_version] + GEMS_AND_ROOT_DIRECTORIES.keys
198
221
  end
199
222
  end
data/SECURITY.md ADDED
@@ -0,0 +1,35 @@
1
+ # Reporting a security bug
2
+
3
+ All security bugs in Sinatra should be reported to the core team through our private mailing list [sinatra-security@googlegroups.com](https://groups.google.com/group/sinatra-security). Your report will be acknowledged within 24 hours, and you’ll receive a more detailed response to your email within 48 hours indicating the next steps in handling your report.
4
+
5
+ After the initial reply to your report the security team will endeavor to keep you informed of the progress being made towards a fix and full announcement. These updates will be sent at least every five days, in reality this is more likely to be every 24-48 hours.
6
+
7
+ If you have not received a reply to your email within 48 hours, or have not heard from the security team for the past five days there are a few steps you can take:
8
+
9
+ * Contact the current security coordinator [Zachary Scott](mailto:zzak@ruby-lang.org) directly
10
+
11
+ ## Disclosure Policy
12
+
13
+ Sinatra has a 5 step disclosure policy, that is upheld to the best of our ability.
14
+
15
+ 1. Security report received and is assigned a primary handler. This person will coordinate the fix and release process.
16
+ 2. Problem is confirmed and, a list of all affected versions is determined. Code is audited to find any potential similar problems.
17
+ 3. Fixes are prepared for all releases which are still supported. These fixes are not committed to the public repository but rather held locally pending the announcement.
18
+ 4. A suggested embargo date for this vulnerability is chosen and distros@openwall is notified. This notification will include patches for all versions still under support and a contact address for packagers who need advice back-porting patches to older versions.
19
+ 5. On the embargo date, the [mailing list][mailing-list] and [security list][security-list] are sent a copy of the announcement. The changes are pushed to the public repository and new gems released to rubygems.
20
+
21
+ Typically the embargo date will be set 72 hours from the time vendor-sec is first notified, however this may vary depending on the severity of the bug or difficulty in applying a fix.
22
+
23
+ This process can take some time, especially when coordination is required with maintainers of other projects. Every effort will be made to handle the bug in as timely a manner as possible, however it’s important that we follow the release process above to ensure that the disclosure is handled in a consistent manner.
24
+
25
+ ## Security Updates
26
+
27
+ Security updates will be posted on the [mailing list][mailing-list] and [security list][security-list].
28
+
29
+ ## Comments on this Policy
30
+
31
+ If you have any suggestions to improve this policy, please send an email the core team at [sinatrarb@googlegroups.com](https://groups.google.com/group/sinatrarb).
32
+
33
+
34
+ [mailing-list]: http://groups.google.com/group/sinatrarb/topics
35
+ [security-list]: http://groups.google.com/group/sinatra-security/topics