sinatra-session 0.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +5 -2
- data/Rakefile +24 -1
- data/lib/sinatra/session.rb +7 -4
- data/sinatra-session.gemspec +5 -5
- metadata +7 -6
data/README
CHANGED
@@ -2,7 +2,7 @@ Sinatra::Session
|
|
2
2
|
================
|
3
3
|
|
4
4
|
Sinatra::Session is a small extension for Sinatra apps that provides several
|
5
|
-
|
5
|
+
convenient settings and methods when working with cookie-based sessions.
|
6
6
|
|
7
7
|
Settings
|
8
8
|
--------
|
@@ -32,7 +32,7 @@ Helper Methods
|
|
32
32
|
Installation
|
33
33
|
------------
|
34
34
|
|
35
|
-
Via
|
35
|
+
Via RubyGems:
|
36
36
|
|
37
37
|
$ sudo gem install sinatra-session
|
38
38
|
|
@@ -48,6 +48,9 @@ Usage
|
|
48
48
|
As with all Sinatra extensions, Sinatra::Session may be used in both classic
|
49
49
|
and modular-style apps. First, classic.
|
50
50
|
|
51
|
+
require 'sinatra'
|
52
|
+
require 'sinatra/session'
|
53
|
+
|
51
54
|
set :session_fail, '/login'
|
52
55
|
set :session_secret, 'So0perSeKr3t!'
|
53
56
|
|
data/Rakefile
CHANGED
@@ -2,7 +2,28 @@ require 'rake/clean'
|
|
2
2
|
|
3
3
|
task :default => :package
|
4
4
|
|
5
|
-
|
5
|
+
# DOCS ########################################################################
|
6
|
+
|
7
|
+
desc "Generate API documentation"
|
8
|
+
task :api => FileList['lib/**/*.rb'] do |t|
|
9
|
+
output_dir = ENV['OUTPUT_DIR'] || 'api'
|
10
|
+
rm_rf output_dir
|
11
|
+
sh((<<-SH).gsub(/[\s\n]+/, ' ').strip)
|
12
|
+
hanna
|
13
|
+
--op #{output_dir}
|
14
|
+
--promiscuous
|
15
|
+
--charset utf8
|
16
|
+
--fmt html
|
17
|
+
--inline-source
|
18
|
+
--line-numbers
|
19
|
+
--accessor option_accessor=RW
|
20
|
+
--main Sinatra::Session
|
21
|
+
--title 'Sinatra::Session API Documentation'
|
22
|
+
#{t.prerequisites.join(' ')}
|
23
|
+
SH
|
24
|
+
end
|
25
|
+
|
26
|
+
CLEAN.include 'api'
|
6
27
|
|
7
28
|
# PACKAGING & INSTALLATION ####################################################
|
8
29
|
|
@@ -37,3 +58,5 @@ if defined?(Gem)
|
|
37
58
|
sh "gem push #{package('.gem')}"
|
38
59
|
end
|
39
60
|
end
|
61
|
+
|
62
|
+
CLOBBER.include 'dist'
|
data/lib/sinatra/session.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
|
3
3
|
module Sinatra
|
4
|
+
# Simple, secure sessions for Sinatra.
|
5
|
+
#
|
6
|
+
# http://mjijackson.com/sinatra-session
|
4
7
|
module Session
|
5
8
|
|
6
9
|
# Request-level helper methods for Sinatra routes.
|
7
10
|
module Helpers
|
8
|
-
# After this method is called, calls to #
|
11
|
+
# After this method is called, calls to #session? will return +true+.
|
9
12
|
def session_start!
|
10
13
|
session['sinatra.session'] = true
|
11
14
|
end
|
@@ -21,7 +24,7 @@ module Sinatra
|
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
24
|
-
# Returns +true+ if the current session is valid, false otherwise.
|
27
|
+
# Returns +true+ if the current session is valid, +false+ otherwise.
|
25
28
|
def session?
|
26
29
|
!! session['sinatra.session']
|
27
30
|
end
|
@@ -33,8 +36,8 @@ module Sinatra
|
|
33
36
|
end
|
34
37
|
end
|
35
38
|
|
36
|
-
# A wrapper for Rack::Session::Cookie middleware that allows an options
|
37
|
-
# hash to be returned from the block given to the
|
39
|
+
# A wrapper for the Rack::Session::Cookie middleware that allows an options
|
40
|
+
# hash to be returned from the block given to the +use+ statement instead
|
38
41
|
# of being provided up front.
|
39
42
|
module Cookie
|
40
43
|
def self.new(app, options={})
|
data/sinatra-session.gemspec
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'sinatra-session'
|
3
|
-
s.version = '0.
|
4
|
-
s.date = '2010-
|
3
|
+
s.version = '1.0.0'
|
4
|
+
s.date = '2010-05-12'
|
5
5
|
|
6
|
-
s.summary = 'Simple
|
7
|
-
s.description = 'Simple
|
6
|
+
s.summary = 'Simple, secure sessions for Sinatra'
|
7
|
+
s.description = 'Simple, secure sessions for Sinatra'
|
8
8
|
|
9
9
|
s.author = 'Michael Jackson'
|
10
10
|
s.email = 'mjijackson@gmail.com'
|
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.rdoc_options = %w< --line-numbers --inline-source --title Sinatra::Session --main Sinatra::Session >
|
22
22
|
s.extra_rdoc_files = %w< README >
|
23
23
|
|
24
|
-
s.homepage = 'http://
|
24
|
+
s.homepage = 'http://mjijackson.com/sinatra-session'
|
25
25
|
end
|
metadata
CHANGED
@@ -3,9 +3,10 @@ name: sinatra-session
|
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
|
-
- 0
|
7
6
|
- 1
|
8
|
-
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
version: 1.0.0
|
9
10
|
platform: ruby
|
10
11
|
authors:
|
11
12
|
- Michael Jackson
|
@@ -13,7 +14,7 @@ autorequire:
|
|
13
14
|
bindir: bin
|
14
15
|
cert_chain: []
|
15
16
|
|
16
|
-
date: 2010-
|
17
|
+
date: 2010-05-12 00:00:00 -06:00
|
17
18
|
default_executable:
|
18
19
|
dependencies:
|
19
20
|
- !ruby/object:Gem::Dependency
|
@@ -41,7 +42,7 @@ dependencies:
|
|
41
42
|
version: "0"
|
42
43
|
type: :development
|
43
44
|
version_requirements: *id002
|
44
|
-
description: Simple
|
45
|
+
description: Simple, secure sessions for Sinatra
|
45
46
|
email: mjijackson@gmail.com
|
46
47
|
executables: []
|
47
48
|
|
@@ -55,7 +56,7 @@ files:
|
|
55
56
|
- Rakefile
|
56
57
|
- README
|
57
58
|
has_rdoc: true
|
58
|
-
homepage: http://
|
59
|
+
homepage: http://mjijackson.com/sinatra-session
|
59
60
|
licenses: []
|
60
61
|
|
61
62
|
post_install_message:
|
@@ -88,6 +89,6 @@ rubyforge_project:
|
|
88
89
|
rubygems_version: 1.3.6
|
89
90
|
signing_key:
|
90
91
|
specification_version: 3
|
91
|
-
summary: Simple
|
92
|
+
summary: Simple, secure sessions for Sinatra
|
92
93
|
test_files: []
|
93
94
|
|