sinatra-cache 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,25 +0,0 @@
1
- ## CLASSIC.rb
2
- ## Simple example app of how to use the Sinatra::Cache plugin in a normal 'Classic' Sinatra app.
3
-
4
- require "rubygems"
5
- require "sinatra"
6
- require 'sinatra/cache'
7
-
8
- set :public, "#{File.dirname(__FILE__)}/public"
9
- set :views, "#{File.dirname(__FILE__)}/views"
10
-
11
-
12
- get '/' do
13
- erb(:index)
14
- end
15
-
16
- get '/cache' do
17
- cache("Hello World from Sinatra Version=[#{Sinatra::VERSION}]")
18
- end
19
-
20
- # YES, I know this is NOT ideal, but it's only a test ;-)
21
- get '/cache_expire' do
22
- cache_expire("/cache")
23
- end
24
-
25
- #/EOF
@@ -1,36 +0,0 @@
1
- ## MYAPP.rb
2
- ## Simple example app of how to use the Sinatra::Cache plugin in a new 'Sub-Classed' Sinatra app
3
- ## that inherits from Sinatra::Base
4
-
5
- require "rubygems"
6
- require "sinatra/base"
7
- require 'sinatra/cache'
8
-
9
- class MyApp < Sinatra::Base
10
-
11
- register Sinatra::Cache
12
-
13
- enable :logging
14
- enable :static
15
-
16
- set :public, "#{File.dirname(__FILE__)}/public"
17
- set :views, "#{File.dirname(__FILE__)}/views"
18
-
19
- get '/' do
20
- erb(:index)
21
- end
22
-
23
- get '/cache' do
24
- cache("Hello World from Sinatra Version=[#{Sinatra::VERSION}]")
25
- end
26
-
27
- # YES, I know this is NOT ideal, but it's only a test ;-)
28
- get '/cache_expire' do
29
- cache_expire("/cache")
30
- end
31
-
32
- end
33
-
34
- MyApp.run!(:port => 4568) if __FILE__ == $0
35
-
36
- #/EOF
@@ -1,37 +0,0 @@
1
- ## MYAPP_DEFAULT.rb
2
- ## Simple example app of how to use the Sinatra::Cache plugin in a new 'Sub-Classed' Sinatra app
3
- ## that inherits from Sinatra::Default
4
-
5
- require "rubygems"
6
- require "sinatra/base"
7
- require 'sinatra/cache'
8
-
9
- class MyAppDefault < Sinatra::Default
10
-
11
- register Sinatra::Cache
12
-
13
- # these are enabled by default in Sinatra::Default
14
- # enable :logging
15
- # enable :static
16
-
17
- set :public, "#{File.dirname(__FILE__)}/public"
18
- set :views, "#{File.dirname(__FILE__)}/views"
19
-
20
- get '/' do
21
- erb(:index)
22
- end
23
-
24
- get '/cache' do
25
- cache("Hello World from Sinatra Version=[#{Sinatra::VERSION}]")
26
- end
27
-
28
- # YES, I know this is NOT ideal, but it's only a test ;-)
29
- get '/cache_expire' do
30
- cache_expire("/cache")
31
- end
32
-
33
- end
34
-
35
- MyAppDefault.run!(:port => 4569) if __FILE__ == $0
36
-
37
- #/EOF
data/test/helper.rb DELETED
@@ -1,62 +0,0 @@
1
- # vendor_sinatra = "#{File.dirname(File.dirname(__FILE__))}/vendor/sinatra"
2
- # puts vendor_sinatra
3
- # $LOAD_PATH.unshift "#{vendor_sinatra}/lib" if test(?d, vendor_sinatra)
4
-
5
- path_2_my_lib = File.expand_path('../lib')
6
- $LOAD_PATH.unshift path_2_my_lib
7
-
8
- require 'rubygems'
9
- require 'sinatra/base'
10
- begin
11
- require 'test/spec'
12
- rescue LoadError
13
- raise "These tests depends upon the Test-Spec gem [sudo gem install test-spec]"
14
- end
15
- require 'sinatra/test'
16
-
17
-
18
- # The code below was lovingly plagiarized from Sinatra.
19
-
20
- class Sinatra::Base
21
- # Allow assertions in request context
22
- include Test::Unit::Assertions
23
- end
24
-
25
- class Test::Unit::TestCase
26
- include Sinatra::Test
27
-
28
- def setup
29
- Sinatra::Default.set :environment, :test
30
- end
31
-
32
- # Sets up a Sinatra::Base subclass defined with the block
33
- # given. Used in setup or individual spec methods to establish
34
- # the application.
35
- def mock_app(base=Sinatra::Base, &block)
36
- @app = Sinatra.new(base, &block)
37
- end
38
-
39
- def restore_default_options
40
- Sinatra::Default.set(
41
- :environment => :development,
42
- :raise_errors => Proc.new { test? },
43
- :dump_errors => true,
44
- :sessions => false,
45
- :logging => Proc.new { ! test? },
46
- :methodoverride => true,
47
- :static => true,
48
- :run => Proc.new { ! test? }
49
- )
50
- end
51
-
52
- # quick convenience methods..
53
-
54
- def fixtures_path
55
- "#{File.dirname(File.expand_path(__FILE__))}/fixtures"
56
- end
57
-
58
- def public_fixtures_path
59
- "#{fixtures_path}/public"
60
- end
61
-
62
- end