sinatra 0.1.6 → 0.1.7

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/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+ v0.1.7 FIXES:
2
+
3
+ * test/development/production helpers changed to config_for. There was a problem with "test" fubar'ing libraries such as the new release of Sequel
4
+ * StaticEvent now makes sure the file it's looking for is really a file.
5
+
1
6
  v0.1.6 Additions: require users vendor directory on load
2
7
  v0.1.5 Mutex and before-filters
3
8
  v0.1.0 Released!
data/Manifest CHANGED
@@ -33,7 +33,6 @@ LICENSE
33
33
  Manifest
34
34
  RakeFile
35
35
  README
36
- sinatra.gemspec
37
36
  site/index.htm
38
37
  site/index.html
39
38
  site/logo.png
data/README CHANGED
@@ -93,6 +93,7 @@ It's probably going to happen.. you'll find a bug. Please help by:
93
93
  - Ezra Zygmuntowicz (http://brainspl.at) for answering all those random questions over IM and all the poached code
94
94
  - Ditto to Chris Wanstrath (errtheblog.com) and helping me keep things simple, and some cool tricks
95
95
  - Ari Lerner over at CitrusByte for ideas, code, and enthusiasm
96
+ - Christian Neukirchen for Rack (http://rack.rubyforge.org/)
96
97
  - Koshi (http://www.songbirdnest.com/jkoshi/blog) here at POTI, Inc. for the Sinatra mark
97
98
  - Pete Golibersuch for the hat logo
98
99
  - John Philip Green (http://www.linkedin.com/in/johngreen) for motivation and evangelism
data/RakeFile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  require 'echoe'
11
11
 
12
12
  Echoe.new('sinatra') do |p|
13
- p.rubyforge_name = 'bmizerany'
13
+ p.rubyforge_name = 'sinatra'
14
14
  p.dependencies = ['mongrel >=1.0.1', 'rack >=0.2.0']
15
15
  p.summary = "Sinatra is a classy web-framework dressed in a DSL"
16
16
  p.description = "Sinatra is a classy web-framework dressed in a DSL"
@@ -20,7 +20,7 @@ begin
20
20
  p.test_pattern = 'test/**/*_test.rb'
21
21
  p.include_rakefile = true
22
22
  p.rdoc_pattern = ['README', 'LICENSE'] + Dir.glob('lib/**/*.rb') + Dir.glob('vendor/**/*.rb')
23
- p.docs_host = "bmizerany@rubyforge.org:/var/www/gforge-projects/sinatra/"
23
+ p.docs_host = "bmizerany@rubyforge.org:/var/www/gforge-projects/"
24
24
  end
25
25
 
26
26
  rescue LoadError
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ begin
10
10
  require 'echoe'
11
11
 
12
12
  Echoe.new('sinatra') do |p|
13
- p.rubyforge_name = 'bmizerany'
13
+ p.rubyforge_name = 'sinatra'
14
14
  p.dependencies = ['mongrel >=1.0.1', 'rack >=0.2.0']
15
15
  p.summary = "Sinatra is a classy web-framework dressed in a DSL"
16
16
  p.description = "Sinatra is a classy web-framework dressed in a DSL"
@@ -20,7 +20,7 @@ begin
20
20
  p.test_pattern = 'test/**/*_test.rb'
21
21
  p.include_rakefile = true
22
22
  p.rdoc_pattern = ['README', 'LICENSE'] + Dir.glob('lib/**/*.rb') + Dir.glob('vendor/**/*.rb')
23
- p.docs_host = "bmizerany@rubyforge.org:/var/www/gforge-projects/sinatra/"
23
+ p.docs_host = "bmizerany@rubyforge.org:/var/www/gforge-projects/"
24
24
  end
25
25
 
26
26
  rescue LoadError
@@ -1,10 +1,15 @@
1
1
  $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib'
2
2
  require 'sinatra'
3
3
 
4
- production do
5
- sessions :off
4
+ config_for(:production) do
5
+
6
+ get 404 do
7
+ "Not sure what you're looking for .. try something else."
8
+ end
6
9
  end
7
10
 
11
+ sessions :off
12
+
8
13
  get '/' do
9
14
  "Hello World!"
10
15
  end
@@ -21,10 +26,3 @@ end
21
26
  get '/erb2' do
22
27
  erb 'Hello <%= params[:name].capitalize || "World" %> 2!'
23
28
  end
24
-
25
- # Custom 404
26
-
27
- # get 404 do
28
- # 'Custom 404!!!!'
29
- # end
30
-
@@ -114,21 +114,11 @@ module Sinatra
114
114
  Sinatra::StaticEvent.new(path, root)
115
115
  end
116
116
 
117
- # Execute block if in development mode (Used for configuration)
118
- def development
119
- yield if Sinatra::Options.environment == :development
117
+ # Execute block if in environment is equal to env (Used for configuration)
118
+ def config_for(env = :development)
119
+ yield if Sinatra::Options.environment == env.to_sym
120
120
  end
121
-
122
- # Execute block if in production mode (Used for configuration)
123
- def production
124
- yield if Sinatra::Options.environment == :production
125
- end
126
-
127
- # Execute block if in test mode (Used for configuration)
128
- def test
129
- yield if Sinatra::Options.environment == :test
130
- end
131
-
121
+
132
122
  # Define named layouts (default name is <tt>:layout</tt>)
133
123
  #
134
124
  # Examples:
@@ -149,7 +149,8 @@ module Sinatra
149
149
  end
150
150
 
151
151
  def recognize(path)
152
- File.exists?(physical_path_for(path))
152
+ filename = physical_path_for(path)
153
+ File.exists?(filename) && File.file?(filename)
153
154
  end
154
155
 
155
156
  def physical_path_for(path)
@@ -1,19 +1,19 @@
1
1
 
2
- # Gem::Specification for Sinatra-0.1.6
2
+ # Gem::Specification for Sinatra-0.1.7
3
3
  # Originally generated by Echoe
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = %q{sinatra}
7
- s.version = "0.1.6"
8
- s.date = %q{2007-10-15}
7
+ s.version = "0.1.7"
8
+ s.date = %q{2007-10-23}
9
9
  s.summary = %q{Sinatra is a classy web-framework dressed in a DSL}
10
10
  s.email = %q{blake.mizerany@gmail.com}
11
11
  s.homepage = %q{http://sinatra.rubyforge.org/}
12
- s.rubyforge_project = %q{bmizerany}
12
+ s.rubyforge_project = %q{sinatra}
13
13
  s.description = %q{Sinatra is a classy web-framework dressed in a DSL}
14
14
  s.has_rdoc = true
15
15
  s.authors = ["Blake Mizerany"]
16
- s.files = ["CHANGELOG", "examples/hello/hello.rb", "examples/hello/views/hello.erb", "examples/todo/todo.rb", "files/default_index.erb", "files/error.erb", "files/logo.png", "files/not_found.erb", "lib/sinatra/context/renderer.rb", "lib/sinatra/context.rb", "lib/sinatra/core_ext/array.rb", "lib/sinatra/core_ext/class.rb", "lib/sinatra/core_ext/hash.rb", "lib/sinatra/core_ext/kernel.rb", "lib/sinatra/core_ext/metaid.rb", "lib/sinatra/core_ext/module.rb", "lib/sinatra/core_ext/symbol.rb", "lib/sinatra/dispatcher.rb", "lib/sinatra/dsl.rb", "lib/sinatra/environment.rb", "lib/sinatra/event.rb", "lib/sinatra/irb.rb", "lib/sinatra/loader.rb", "lib/sinatra/logger.rb", "lib/sinatra/options.rb", "lib/sinatra/rack_ext/request.rb", "lib/sinatra/route.rb", "lib/sinatra/server.rb", "lib/sinatra/sessions.rb", "lib/sinatra/test_methods.rb", "lib/sinatra.rb", "LICENSE", "Manifest", "RakeFile", "README", "sinatra.gemspec", "site/index.htm", "site/index.html", "site/logo.png", "test/helper.rb", "test/sinatra/dispatcher_test.rb", "test/sinatra/event_test.rb", "test/sinatra/renderer_test.rb", "test/sinatra/request_test.rb", "test/sinatra/route_test.rb", "test/sinatra/static_files/foo.txt", "test/sinatra/static_files_test.rb", "test/sinatra/url_test.rb", "vendor/erb/init.rb", "vendor/erb/lib/erb.rb", "vendor/haml/init.rb", "vendor/haml/lib/haml.rb", "Rakefile"]
16
+ s.files = ["CHANGELOG", "examples/hello/hello.rb", "examples/hello/views/hello.erb", "examples/todo/todo.rb", "files/default_index.erb", "files/error.erb", "files/logo.png", "files/not_found.erb", "lib/sinatra/context/renderer.rb", "lib/sinatra/context.rb", "lib/sinatra/core_ext/array.rb", "lib/sinatra/core_ext/class.rb", "lib/sinatra/core_ext/hash.rb", "lib/sinatra/core_ext/kernel.rb", "lib/sinatra/core_ext/metaid.rb", "lib/sinatra/core_ext/module.rb", "lib/sinatra/core_ext/symbol.rb", "lib/sinatra/dispatcher.rb", "lib/sinatra/dsl.rb", "lib/sinatra/environment.rb", "lib/sinatra/event.rb", "lib/sinatra/irb.rb", "lib/sinatra/loader.rb", "lib/sinatra/logger.rb", "lib/sinatra/options.rb", "lib/sinatra/rack_ext/request.rb", "lib/sinatra/route.rb", "lib/sinatra/server.rb", "lib/sinatra/sessions.rb", "lib/sinatra/test_methods.rb", "lib/sinatra.rb", "LICENSE", "Manifest", "RakeFile", "README", "site/index.htm", "site/index.html", "site/logo.png", "test/helper.rb", "test/sinatra/dispatcher_test.rb", "test/sinatra/event_test.rb", "test/sinatra/renderer_test.rb", "test/sinatra/request_test.rb", "test/sinatra/route_test.rb", "test/sinatra/static_files/foo.txt", "test/sinatra/static_files_test.rb", "test/sinatra/url_test.rb", "vendor/erb/init.rb", "vendor/erb/lib/erb.rb", "vendor/haml/init.rb", "vendor/haml/lib/haml.rb", "Rakefile", "sinatra.gemspec"]
17
17
  s.test_files = ["test/sinatra/dispatcher_test.rb", "test/sinatra/event_test.rb", "test/sinatra/renderer_test.rb", "test/sinatra/request_test.rb", "test/sinatra/route_test.rb", "test/sinatra/static_files_test.rb", "test/sinatra/url_test.rb"]
18
18
  s.add_dependency(%q<mongrel>, [">= 1.0.1"])
19
19
  s.add_dependency(%q<rack>, [">= 0.2.0"])
@@ -34,7 +34,7 @@ end
34
34
  # require 'echoe'
35
35
  #
36
36
  # Echoe.new('sinatra') do |p|
37
- # p.rubyforge_name = 'bmizerany'
37
+ # p.rubyforge_name = 'sinatra'
38
38
  # p.dependencies = ['mongrel >=1.0.1', 'rack >=0.2.0']
39
39
  # p.summary = "Sinatra is a classy web-framework dressed in a DSL"
40
40
  # p.description = "Sinatra is a classy web-framework dressed in a DSL"
@@ -44,7 +44,7 @@ end
44
44
  # p.test_pattern = 'test/**/*_test.rb'
45
45
  # p.include_rakefile = true
46
46
  # p.rdoc_pattern = ['README', 'LICENSE'] + Dir.glob('lib/**/*.rb') + Dir.glob('vendor/**/*.rb')
47
- # p.docs_host = "bmizerany@rubyforge.org:/var/www/gforge-projects/sinatra/"
47
+ # p.docs_host = "bmizerany@rubyforge.org:/var/www/gforge-projects/"
48
48
  # end
49
49
  #
50
50
  # rescue LoadError
@@ -9,6 +9,7 @@ context "StaticEvent" do
9
9
 
10
10
  specify "recognizes paths prefixed with it's path" do
11
11
  File.expects(:exists?).with('/x/bar/test.jpg').returns(true)
12
+ File.expects(:file?).with('/x/bar/test.jpg').returns(true)
12
13
  Sinatra::StaticEvent.new('/foo', '/x/bar').recognize('/foo/test.jpg').should.equal true
13
14
 
14
15
  File.expects(:exists?).with('/x/bar/test.jpg').returns(false)
@@ -23,6 +24,12 @@ context "StaticEvent" do
23
24
  result.body.each { }
24
25
  end
25
26
 
27
+ specify "makes sure it is a file and not a directory" do
28
+ File.expects(:exists?).with('/x/bar').returns(true)
29
+ File.expects(:file?).with('/x/bar').returns(false)
30
+ Sinatra::StaticEvent.new('/foo', '/x').recognize('/foo/bar').should.equal false
31
+ end
32
+
26
33
  end
27
34
 
28
35
  context "StaticEvent (In full context)" do
metadata CHANGED
@@ -3,14 +3,14 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: sinatra
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.6
7
- date: 2007-10-15 00:00:00 -07:00
6
+ version: 0.1.7
7
+ date: 2007-10-23 00:00:00 -07:00
8
8
  summary: Sinatra is a classy web-framework dressed in a DSL
9
9
  require_paths:
10
10
  - lib
11
11
  email: blake.mizerany@gmail.com
12
12
  homepage: http://sinatra.rubyforge.org/
13
- rubyforge_project: bmizerany
13
+ rubyforge_project: sinatra
14
14
  description: Sinatra is a classy web-framework dressed in a DSL
15
15
  autorequire:
16
16
  default_executable:
@@ -64,7 +64,6 @@ files:
64
64
  - Manifest
65
65
  - RakeFile
66
66
  - README
67
- - sinatra.gemspec
68
67
  - site/index.htm
69
68
  - site/index.html
70
69
  - site/logo.png
@@ -82,6 +81,7 @@ files:
82
81
  - vendor/haml/init.rb
83
82
  - vendor/haml/lib/haml.rb
84
83
  - Rakefile
84
+ - sinatra.gemspec
85
85
  test_files:
86
86
  - test/sinatra/dispatcher_test.rb
87
87
  - test/sinatra/event_test.rb