kelredd-sinatra-helpers 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/sinatra_helpers.rb +1 -0
- data/lib/sinatra_helpers/cache.rb +15 -0
- data/lib/sinatra_helpers/environment_tests.rb +0 -1
- data/lib/sinatra_helpers/erb/analytics.rb +8 -0
- data/lib/sinatra_helpers/generator/file_templates/env.rb.erb +4 -4
- data/lib/sinatra_helpers/version.rb +1 -1
- metadata +7 -5
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.files = %w(README.rdoc Rakefile) + Dir.glob("{bin,lib}/**/*")
|
18
18
|
s.executables = ['sinatra']
|
19
19
|
|
20
|
-
s.add_dependency('kelredd-useful', ['>= 0.3.
|
20
|
+
s.add_dependency('kelredd-useful', ['>= 0.3.3'])
|
21
21
|
|
22
22
|
s.add_development_dependency("shoulda", [">= 2.10.2"])
|
23
23
|
s.add_development_dependency("sinatra", [">= 0.9.4"])
|
data/lib/sinatra_helpers.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
|
3
|
+
module SinatraHelpers; end
|
4
|
+
module SinatraHelpers::Cache
|
5
|
+
|
6
|
+
def cache_for(time_in_secs)
|
7
|
+
if production?
|
8
|
+
headers['Cache-Control'] = "public, max-age=#{time_in_secs}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
Sinatra::Application.helpers SinatraHelpers::Cache
|
15
|
+
Sinatra::Application.register SinatraHelpers::Cache
|
@@ -17,15 +17,15 @@ rescue LoadError => err
|
|
17
17
|
puts "no environment config set up for '#{RACK_ENV.downcase}', ignoring..."
|
18
18
|
end
|
19
19
|
|
20
|
+
# load app files
|
21
|
+
load_app 'helpers'
|
22
|
+
load_app 'models'
|
23
|
+
|
20
24
|
# Load initializers
|
21
25
|
Dir[root_path('config', 'initializers', '*.rb')].each do |file|
|
22
26
|
require file
|
23
27
|
end
|
24
28
|
|
25
|
-
# load app files
|
26
|
-
load_app 'helpers'
|
27
|
-
load_app 'models'
|
28
|
-
|
29
29
|
# load middlewares
|
30
30
|
# TODO: set your session cookie name here
|
31
31
|
use Rack::Session::Cookie, :key => '_sess'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 6
|
9
|
+
version: 0.2.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Kelly Redding
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-16 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,8 +27,8 @@ dependencies:
|
|
27
27
|
segments:
|
28
28
|
- 0
|
29
29
|
- 3
|
30
|
-
-
|
31
|
-
version: 0.3.
|
30
|
+
- 3
|
31
|
+
version: 0.3.3
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -99,7 +99,9 @@ files:
|
|
99
99
|
- README.rdoc
|
100
100
|
- Rakefile
|
101
101
|
- bin/sinatra
|
102
|
+
- lib/sinatra_helpers/cache.rb
|
102
103
|
- lib/sinatra_helpers/environment_tests.rb
|
104
|
+
- lib/sinatra_helpers/erb/analytics.rb
|
103
105
|
- lib/sinatra_helpers/erb/forms.rb
|
104
106
|
- lib/sinatra_helpers/erb/links.rb
|
105
107
|
- lib/sinatra_helpers/erb/partials.rb
|