kelredd-sinatra-helpers 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
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.0'])
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"])
@@ -1,3 +1,4 @@
1
+ require 'sinatra_helpers/cache'
1
2
  require 'sinatra_helpers/environment_tests'
2
3
  require 'sinatra_helpers/erb'
3
4
 
@@ -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
@@ -1,7 +1,6 @@
1
1
  require 'sinatra/base'
2
2
 
3
3
  module SinatraHelpers; end
4
-
5
4
  module SinatraHelpers::EnvironmentTests
6
5
 
7
6
  def production?
@@ -0,0 +1,8 @@
1
+ require 'erb'
2
+ require 'sinatra/base'
3
+ require "useful/erb_helpers/analytics"
4
+
5
+ module SinatraHelpers; end
6
+ module SinatraHelpers::Erb; end
7
+
8
+ Sinatra::Application.helpers Useful::ErbHelpers::Analytics
@@ -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'
@@ -3,7 +3,7 @@ module SinatraHelpers
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 2
6
- TINY = 5
6
+ TINY = 6
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 5
9
- version: 0.2.5
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-09 00:00:00 -05:00
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
- - 0
31
- version: 0.3.0
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