sinatra-fix_951 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.travis.yml +24 -0
- data/Gemfile +82 -0
- data/Rakefile +7 -0
- data/Readme.md +55 -0
- data/lib/sinatra/fix_951.rb +3 -0
- data/sinatra-fix_951.gemspec +14 -0
- data/test.rb +57 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7de5a3271eb11d6cee35247559e34b2e90523a5f
|
4
|
+
data.tar.gz: 51ff29c937fe5828d1d2af2cbbf56d8df4a2d052
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 55bdde9fffde3b2b1bf20d0eed2da96c105a94d505994b54799363aeaa608a9ec7acfda5585328a0b16c335d08573fd4e3a4d5fc78d33cd646a600784e49f976
|
7
|
+
data.tar.gz: 5046102e6ae621b2e70578ff246801c5b2bf566debd87101a699952e6d94831839449c54b7bcfd3bff770c21f64a43b0e375fa32e0b0b2131dd8bd3a7156e386
|
data/.gitignore
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# THIS IS COPY / PASTED STRAIGHT OUT OF THE SINATRA GEMFILE:
|
2
|
+
# https://github.com/sinatra/sinatra/blob/v1.4.5/.gitignore
|
3
|
+
|
4
|
+
# please add general patterns to your global ignore list
|
5
|
+
# see https://github.com/github/gitignore#readme
|
6
|
+
.DS_STORE
|
7
|
+
*.swp
|
8
|
+
*.rbc
|
9
|
+
*.sass-cache
|
10
|
+
/pkg
|
11
|
+
/doc/api
|
12
|
+
/Gemfile.lock
|
13
|
+
*.gem
|
data/.travis.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# THIS IS COPY / PASTED STRAIGHT OUT OF THE SINATRA GEMFILE:
|
2
|
+
# https://github.com/sinatra/sinatra/blob/v1.4.5/.travis.yml
|
3
|
+
---
|
4
|
+
rvm:
|
5
|
+
- 1.8.7
|
6
|
+
- 1.9.2
|
7
|
+
- 1.9.3
|
8
|
+
- 2.0.0
|
9
|
+
- 2.1.0
|
10
|
+
- rbx
|
11
|
+
- jruby
|
12
|
+
- jruby-head
|
13
|
+
- ruby-head
|
14
|
+
matrix:
|
15
|
+
include:
|
16
|
+
- { rvm: 1.9.3, env: rack=1.4.0 }
|
17
|
+
- { rvm: 1.8.7, env: tilt=master }
|
18
|
+
- { rvm: 1.9.3, env: rack=master }
|
19
|
+
- { rvm: 1.9.3, env: tilt=master }
|
20
|
+
allow_failures:
|
21
|
+
- env: tilt=master
|
22
|
+
- rvm: rbx
|
23
|
+
- rvm: ruby-head
|
24
|
+
- rvm: jruby-head
|
data/Gemfile
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# THIS IS COPY / PASTED STRAIGHT OUT OF THE SINATRA GEMFILE:
|
2
|
+
# https://github.com/sinatra/sinatra/blob/v1.4.5/Gemfile
|
3
|
+
|
4
|
+
# Why use bundler?
|
5
|
+
# Well, not all development dependencies install on all rubies. Moreover, `gem
|
6
|
+
# install sinatra --development` doesn't work, as it will also try to install
|
7
|
+
# development dependencies of our dependencies, and those are not conflict free.
|
8
|
+
# So, here we are, `bundle install`.
|
9
|
+
#
|
10
|
+
# If you have issues with a gem: `bundle install --without-coffee-script`.
|
11
|
+
|
12
|
+
RUBY_ENGINE = 'ruby' unless defined? RUBY_ENGINE
|
13
|
+
source 'https://rubygems.org' unless ENV['QUICK']
|
14
|
+
gemspec
|
15
|
+
|
16
|
+
gem 'rake'
|
17
|
+
gem 'rack-test', '>= 0.5.6'
|
18
|
+
gem 'minitest', '= 5.5.1'
|
19
|
+
|
20
|
+
# Allows stuff like `tilt=1.2.2 bundle install` or `tilt=master ...`.
|
21
|
+
# Used by the CI.
|
22
|
+
github = "git://github.com/%s.git"
|
23
|
+
repos = {'tilt' => github % "rtomayko/tilt", 'rack' => github % "rack/rack"}
|
24
|
+
|
25
|
+
%w[tilt rack].each do |lib|
|
26
|
+
dep = case ENV[lib]
|
27
|
+
when 'stable', nil then nil
|
28
|
+
when /(\d+\.)+\d+/ then "~> " + ENV[lib].sub("#{lib}-", '')
|
29
|
+
else {:git => repos[lib], :branch => dep}
|
30
|
+
end
|
31
|
+
gem lib, dep
|
32
|
+
end
|
33
|
+
|
34
|
+
if RUBY_ENGINE == 'jruby'
|
35
|
+
gem 'nokogiri', '!= 1.5.0'
|
36
|
+
gem 'jruby-openssl'
|
37
|
+
gem 'trinidad'
|
38
|
+
end
|
39
|
+
|
40
|
+
if RUBY_ENGINE == "ruby" and RUBY_VERSION > '1.9.2'
|
41
|
+
gem 'less', '~> 2.0'
|
42
|
+
gem 'therubyracer'
|
43
|
+
gem 'redcarpet'
|
44
|
+
gem 'wlang', '>= 2.0.1'
|
45
|
+
gem 'bluecloth'
|
46
|
+
gem 'rdiscount'
|
47
|
+
gem 'RedCloth'
|
48
|
+
gem 'puma'
|
49
|
+
gem 'net-http-server'
|
50
|
+
gem 'yajl-ruby'
|
51
|
+
gem 'nokogiri'
|
52
|
+
gem 'thin'
|
53
|
+
gem 'slim', '~> 1.0'
|
54
|
+
gem 'coffee-script', '>= 2.0'
|
55
|
+
gem 'rdoc'
|
56
|
+
gem 'kramdown'
|
57
|
+
gem 'maruku'
|
58
|
+
gem 'creole'
|
59
|
+
gem 'wikicloth'
|
60
|
+
gem 'markaby'
|
61
|
+
gem 'radius'
|
62
|
+
gem 'asciidoctor'
|
63
|
+
gem 'liquid'
|
64
|
+
gem 'stylus'
|
65
|
+
gem 'rabl'
|
66
|
+
gem 'builder'
|
67
|
+
gem 'erubis'
|
68
|
+
gem 'haml', '>= 3.0'
|
69
|
+
gem 'sass'
|
70
|
+
end
|
71
|
+
|
72
|
+
gem 'pry'
|
73
|
+
|
74
|
+
if RUBY_ENGINE == "rbx"
|
75
|
+
gem 'json'
|
76
|
+
gem 'rubysl'
|
77
|
+
gem 'rubysl-test-unit'
|
78
|
+
end
|
79
|
+
|
80
|
+
platforms :ruby_18, :jruby do
|
81
|
+
gem 'json' unless RUBY_VERSION > '1.9' # is there a jruby but 1.8 only selector?
|
82
|
+
end
|
data/Rakefile
ADDED
data/Readme.md
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
[![Build Status](https://secure.travis-ci.org/JoshCheek/sinatra-fix_951.png?branch=master)](https://travis-ci.org/JoshCheek/sinatra-fix_951)
|
2
|
+
|
3
|
+
Fix for Sinatra 1.4.5's [issue #951](https://github.com/sinatra/sinatra/issues/951)
|
4
|
+
===================================================================================
|
5
|
+
|
6
|
+
Fixes a bug that my students have been hitting while working on their projects.
|
7
|
+
|
8
|
+
How to know if you hit this
|
9
|
+
---------------------------
|
10
|
+
|
11
|
+
You will know if you hit this, because you'll get an error message like
|
12
|
+
|
13
|
+
```
|
14
|
+
NoMethodError: undefined method `join' for #<String:0x007f62c3e6fb90>
|
15
|
+
```
|
16
|
+
|
17
|
+
Or maybe one like this:
|
18
|
+
|
19
|
+
```
|
20
|
+
Unexpected error while processing request: undefined method `join' for #<String:0x007fa3d244d1f8>
|
21
|
+
```
|
22
|
+
|
23
|
+
If you want to understand it better, the issue is [here](https://github.com/sinatra/sinatra/issues/951),
|
24
|
+
and I traced its history and explained what happened and why [here](https://github.com/sinatra/sinatra/issues/951#issuecomment-73140540).
|
25
|
+
|
26
|
+
If you want to understand why this fixes the issue,
|
27
|
+
then you'll need to learn the Ruby Object Model.
|
28
|
+
This is a class that [I teach](object-model-2httpsgithubcomjoshcheekruby-object-model),
|
29
|
+
come and learn with us at the [Turing School of Software and Design](http://turing.io/)!
|
30
|
+
|
31
|
+
Installing
|
32
|
+
----------
|
33
|
+
|
34
|
+
If you're using Bundler, then add this to your Gemfile:
|
35
|
+
|
36
|
+
```ruby
|
37
|
+
gem 'sinatra-fix_951', require: 'sinatra/fix_951'
|
38
|
+
```
|
39
|
+
|
40
|
+
If you aren't using Bundler, then install it from the command-line:
|
41
|
+
|
42
|
+
```sh
|
43
|
+
$ gem install sinatra-fix_951
|
44
|
+
```
|
45
|
+
|
46
|
+
And then require it wherever you're currently requiring Sinatra:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
require 'sinatra/fix_951'
|
50
|
+
```
|
51
|
+
|
52
|
+
LICENSE
|
53
|
+
-------
|
54
|
+
|
55
|
+
MIT, to mirror [Sinatra's license](https://github.com/sinatra/sinatra/blob/master/LICENSE).
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.name = 'sinatra-fix_951'
|
3
|
+
s.version = '1.0.0'
|
4
|
+
s.description = "Fix bug #951 in Sinatra version 1.4.5"
|
5
|
+
s.summary = "My students at the Turing School of Software and Design have been hitting this bug for three or four months now. Finally decided to just fix it."
|
6
|
+
s.authors = ["Josh Cheek"]
|
7
|
+
s.email = "josh.cheek@gmail.com"
|
8
|
+
s.homepage = "https://github.com/JoshCheek/sinatra-fix_951"
|
9
|
+
s.license = 'MIT'
|
10
|
+
s.files = `git ls-files`.split("\n")
|
11
|
+
s.test_files = ['test.rb']
|
12
|
+
|
13
|
+
s.add_dependency 'sinatra', '= 1.4.5'
|
14
|
+
end
|
data/test.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# Initially tested with this shell script (syntax is fish, not bash)
|
2
|
+
# $ ruby -I . (find test -type f -name '*_test.rb' | awk '{ print "-r" $0 }') -e 'Sinatra::ShowExceptions.module_eval { def pretty(*) Array super end }'
|
3
|
+
|
4
|
+
# this needs to support 1.8.7, which doesn't load rubygems by default -- actually, on my Ruby, it doesn't even ship with rubygems!
|
5
|
+
require 'rubygems'
|
6
|
+
|
7
|
+
# Fake it out to require the new minitest instead of the old minitest
|
8
|
+
# The dependency wasn't formally specified, and it depends on ActiveSupport, which mandates the new Minitest,
|
9
|
+
# but it was written against the old minitest, so we're just making it think the old one was loaded,
|
10
|
+
# while forcing it to actually load the new one, and then faking the interface enough to appease the tests
|
11
|
+
gem 'minitest', '~> 5.1'
|
12
|
+
$LOADED_FEATURES << `gem which test/unit`.chomp # so it won't try to re-require files that don't exist anymore
|
13
|
+
$LOADED_FEATURES << 'test/unit.rb' # 1.8.7 version of the previous line
|
14
|
+
require 'minitest/autorun' # the new equivalent
|
15
|
+
require 'minitest/unit' # the new equivalent
|
16
|
+
Test = Minitest
|
17
|
+
module Minitest::Unit::Assertions
|
18
|
+
include Minitest::Assertions
|
19
|
+
alias assert_raise assert_raises
|
20
|
+
alias assert_not_nil assert
|
21
|
+
attr_writer :assertions
|
22
|
+
def assertions
|
23
|
+
@assertions ||= 0
|
24
|
+
end
|
25
|
+
def assert_nothing_raised(*)
|
26
|
+
yield
|
27
|
+
end
|
28
|
+
end
|
29
|
+
class Test::Unit::TestCase
|
30
|
+
include Minitest::Unit::Assertions
|
31
|
+
class << self
|
32
|
+
remove_method :inherited # this method will spam us with like a hundred deprecations for using the old interface
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
# relevant dirs
|
38
|
+
sinatra_gemspec = Gem::Specification.find_by_path 'sinatra'
|
39
|
+
test_path = File.join sinatra_gemspec.full_gem_path, 'test'
|
40
|
+
|
41
|
+
# fix load path :/
|
42
|
+
$LOAD_PATH.unshift sinatra_gemspec.full_gem_path
|
43
|
+
|
44
|
+
# load tests
|
45
|
+
Dir[File.join test_path, '*_test.rb'].
|
46
|
+
reject { |file| File.basename(file) == 'rdoc_test.rb' }. # rdoc_test is broken b/c assertion matches a regex against its content
|
47
|
+
each { |file| require file }
|
48
|
+
|
49
|
+
# Fix test that fails due to conflation of `respond_to?` in test helper with the one in Kernel
|
50
|
+
# Nothing seems to actually depend on this method
|
51
|
+
class Test::Unit::TestCase
|
52
|
+
remove_method :respond_to?
|
53
|
+
end
|
54
|
+
|
55
|
+
# load our code to make the tests pass
|
56
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
|
57
|
+
require 'sinatra/fix_951'
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sinatra-fix_951
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh Cheek
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sinatra
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.4.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.4.5
|
27
|
+
description: 'Fix bug #951 in Sinatra version 1.4.5'
|
28
|
+
email: josh.cheek@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- ".gitignore"
|
34
|
+
- ".travis.yml"
|
35
|
+
- Gemfile
|
36
|
+
- Rakefile
|
37
|
+
- Readme.md
|
38
|
+
- lib/sinatra/fix_951.rb
|
39
|
+
- sinatra-fix_951.gemspec
|
40
|
+
- test.rb
|
41
|
+
homepage: https://github.com/JoshCheek/sinatra-fix_951
|
42
|
+
licenses:
|
43
|
+
- MIT
|
44
|
+
metadata: {}
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options: []
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
requirements: []
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 2.4.1
|
62
|
+
signing_key:
|
63
|
+
specification_version: 4
|
64
|
+
summary: My students at the Turing School of Software and Design have been hitting
|
65
|
+
this bug for three or four months now. Finally decided to just fix it.
|
66
|
+
test_files:
|
67
|
+
- test.rb
|
68
|
+
has_rdoc:
|