auto-session-timeout 0.5 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 02bbfdce7a19e58350dc5d7153a95a2673e2f166
4
+ data.tar.gz: 331e66cc1b92b7415dea5919c67f0003158f9af6
5
+ SHA512:
6
+ metadata.gz: c3408a75e3f956e720a70230bf29b9a4cddd06216f2002cb3c997449b55e6fb1a16ad658060c71a7eae9bf5bc005fbdd1fc6e309188dd5876013e7e784abc806
7
+ data.tar.gz: 99af47d54bf36126b672ba7622599f24a4e0e13cf012d0948dbf2fd4ee1e549db9fbcc299106f7d238b57f066445640fad52f6fb3bdac8f97a4ebd6739f149d1
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/CHANGELOG CHANGED
@@ -1 +1,3 @@
1
+ 6/22/13 - Switched to Bundler for generating the gemspec [Matthew Bass]
2
+
1
3
  4/22/09 - Initial import [Matthew Bass]
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in auto-session-timeout.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Matthew Bass (http://www.matthewbass.com)
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,4 +1,4 @@
1
- = auto-session-timeout
1
+ # auto-session-timeout
2
2
 
3
3
  Provides automatic session timeout in a Rails application. Very easy
4
4
  to install and configure. Have you ever wanted to force your users
@@ -6,102 +6,100 @@ off your app if they go idle for a certain period of time? Many
6
6
  online banking sites use this technique. If your app is used on any
7
7
  kind of public computer system, this plugin is a necessity.
8
8
 
9
+ ## Installation
9
10
 
10
- == Installation
11
+ Add this line to your application's Gemfile:
11
12
 
12
- Install the gem directly:
13
+ gem 'auto-session-timeout'
13
14
 
14
- sudo gem install pelargir-auto-session-timeout --source=http://gems.github.com
15
-
16
- Or install the gem in your Rails project:
17
-
18
- script/plugin install git://github.com/pelargir/auto-session-timeout.git
15
+ And then execute:
19
16
 
20
- Or clone the project:
17
+ $ bundle
21
18
 
22
- git clone git://github.com/pelargir/auto-session-timeout.git
19
+ Or install it yourself as:
23
20
 
21
+ $ gem install auto-session-timeout
24
22
 
25
- == Usage
23
+ ## Usage
26
24
 
27
25
  After installing, tell your application controller to use auto timeout:
28
26
 
29
- class ApplicationController < ActionController::Base
30
- auto_session_timeout 1.hour
31
- ...
32
- end
27
+ class ApplicationController < ActionController::Base
28
+ auto_session_timeout 1.hour
29
+ ...
30
+ end
33
31
 
34
- You will also need to insert this line inside the <body></body> tags in
35
- your views. The easiest way to do this is to insert it once inside your
32
+ You will also need to insert this line inside the body tags in your
33
+ views. The easiest way to do this is to insert it once inside your
36
34
  default or application-wide layout. Make sure you are only rendering
37
35
  it if the user is logged in, otherwise the plugin will attempt to force
38
36
  non-existent sessions to timeout, wreaking havoc:
39
37
 
40
- <html>
41
- <head>...</head>
42
38
  <body>
43
39
  <% if logged_in? -%>
44
40
  <%= auto_session_timeout_js %>
45
41
  <% end -%>
46
- ...
47
42
  </body>
48
- </html>
49
43
 
50
44
  You need to setup two actions: one to return the session status and
51
45
  another that runs when the session times out. You can use the default
52
46
  actions included with the plugin by inserting this line in your target
53
47
  controller (most likely your user or session controller):
54
48
 
55
- class SessionsController < ApplicationController
56
- auto_session_timeout_actions
57
- ...
58
- end
49
+ class SessionsController < ApplicationController
50
+ auto_session_timeout_actions
51
+ end
59
52
 
60
53
  To customize the default actions, simply override them. You can call
61
54
  the render_session_status and render_session_timeout methods to use
62
55
  the default implementation from the plugin, or you can define the
63
56
  actions entirely with your own custom code:
64
57
 
65
- class SessionsController < ApplicationController
66
- def active
67
- render_session_status
58
+ class SessionsController < ApplicationController
59
+ def active
60
+ render_session_status
61
+ end
62
+
63
+ def timeout
64
+ render_session_timeout
65
+ end
68
66
  end
69
-
70
- def timeout
71
- render_session_timeout
72
- end
73
- ...
74
- end
75
67
 
76
68
  In any of these cases, make sure to properly map the actions in
77
69
  your routes.rb file:
78
70
 
79
- map.active '/active', :controller => 'sessions', :action => 'active'
80
- map.timeout '/timeout', :controller => 'sessions', :action => 'timeout'
71
+ map.active '/active', :controller => 'sessions', :action => 'active'
72
+ map.timeout '/timeout', :controller => 'sessions', :action => 'timeout'
81
73
 
82
74
  You're done! Enjoy watching your sessions automatically timeout.
83
75
 
84
-
85
- == Additional Configuration
76
+ ## Additional Configuration
86
77
 
87
78
  By default, the JavaScript code checks the server every 60 seconds for
88
79
  active sessions. If you prefer that it check more frequently, pass a
89
80
  frequency attribute to the helper method. The frequency is given in
90
81
  seconds. The following example checks the server every 15 seconds:
91
82
 
92
- <html>
93
- <head>...</head>
94
- <body>
95
- <% if logged_in? -%>
96
- <%= auto_session_timeout_js :frequency => 15 %>
97
- <% end -%>
98
- ...
99
- </body>
100
- </html>
101
-
102
-
103
- == Resources
104
-
105
- Repository: http://github.com/pelargir/auto-session-timeout/
106
- Blog: http://matthewbass.com
107
- Author: Matthew Bass
83
+ <html>
84
+ <head>...</head>
85
+ <body>
86
+ <% if logged_in? -%>
87
+ <%= auto_session_timeout_js :frequency => 15 %>
88
+ <% end -%>
89
+ ...
90
+ </body>
91
+ </html>
92
+
93
+ ## Contributing
94
+
95
+ 1. Fork it
96
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
97
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
98
+ 4. Push to the branch (`git push origin my-new-feature`)
99
+ 5. Create new Pull Request
100
+
101
+ ## Resources
102
+
103
+ * Repository: http://github.com/pelargir/auto-session-timeout/
104
+ * Blog: http://www.matthewbass.com
105
+ * Author: Matthew Bass
data/Rakefile CHANGED
@@ -1,9 +1,10 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
+ require 'bundler/gem_tasks'
4
5
 
5
6
  task :default => :test
6
7
 
7
8
  Rake::TestTask.new('test') do |t|
8
9
  t.pattern = 'test/*_test.rb'
9
- end
10
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'auto/session/timeout/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "auto-session-timeout"
8
+ spec.version = Auto::Session::Timeout::VERSION
9
+ spec.authors = ["Matthew Bass"]
10
+ spec.email = ["pelargir@gmail.com"]
11
+ spec.description = %q{Provides automatic session timeout in a Rails application.}
12
+ spec.summary = %q{Provides automatic session timeout in a Rails application.}
13
+ spec.homepage = "http://github.com/pelargir/auto-session-timeout"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "minitest", "~> 4.2"
24
+ spec.add_development_dependency "actionpack", "~> 3.2"
25
+ end
@@ -0,0 +1,9 @@
1
+ require "auto/session/timeout/version"
2
+
3
+ module Auto
4
+ module Session
5
+ module Timeout
6
+ # Your code goes here...
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ module Auto
2
+ module Session
3
+ module Timeout
4
+ VERSION = "0.7"
5
+ end
6
+ end
7
+ end
@@ -1,9 +1,9 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
- class AutoSessionTimeoutTest < Test::Unit::TestCase
3
+ describe AutoSessionTimeout do
4
4
 
5
- def test_something
5
+ it "tests something" do
6
6
  assert true
7
7
  end
8
8
 
9
- end
9
+ end
data/test/test_helper.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'rubygems'
2
- require 'test/unit'
2
+ require 'minitest/autorun'
3
3
  require 'action_controller'
4
4
 
5
5
  require File.expand_path(File.dirname(__FILE__) + '/../lib/auto_session_timeout')
metadata CHANGED
@@ -1,65 +1,116 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: auto-session-timeout
3
- version: !ruby/object:Gem::Version
4
- version: "0.5"
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.7'
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Matthew Bass
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
-
12
- date: 2009-04-22 00:00:00 -04:00
13
- default_executable:
14
- dependencies: []
15
-
16
- description: Adds several handy expectations for testing ActiveRecord model validations.
17
- email: pelargir@gmail.com
11
+ date: 2013-06-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '4.2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '4.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: actionpack
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '3.2'
69
+ description: Provides automatic session timeout in a Rails application.
70
+ email:
71
+ - pelargir@gmail.com
18
72
  executables: []
19
-
20
73
  extensions: []
21
-
22
- extra_rdoc_files:
23
- - README
24
- files:
25
- - auto_session_timeout.gemspec
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
26
77
  - CHANGELOG
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - auto-session-timeout.gemspec
27
83
  - init.rb
84
+ - lib/auto/session/timeout.rb
85
+ - lib/auto/session/timeout/version.rb
28
86
  - lib/auto_session_timeout.rb
29
87
  - lib/auto_session_timeout_helper.rb
30
- - MIT-LICENSE
31
- - Rakefile
32
- - README
33
88
  - test/auto_session_timeout_test.rb
34
89
  - test/test_helper.rb
35
- has_rdoc: true
36
90
  homepage: http://github.com/pelargir/auto-session-timeout
37
- licenses: []
38
-
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
39
94
  post_install_message:
40
- rdoc_options:
41
- - --main
42
- - README
43
- require_paths:
95
+ rdoc_options: []
96
+ require_paths:
44
97
  - lib
45
- required_ruby_version: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: "0"
50
- version:
51
- required_rubygems_version: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: "0"
56
- version:
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
57
108
  requirements: []
58
-
59
109
  rubyforge_project:
60
- rubygems_version: 1.3.4
110
+ rubygems_version: 2.0.3
61
111
  signing_key:
62
- specification_version: 3
112
+ specification_version: 4
63
113
  summary: Provides automatic session timeout in a Rails application.
64
- test_files: []
65
-
114
+ test_files:
115
+ - test/auto_session_timeout_test.rb
116
+ - test/test_helper.rb
data/MIT-LICENSE DELETED
@@ -1,16 +0,0 @@
1
- Copyright (c) 2009 Matthew Bass (http://matthewbass.com)
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software
4
- and associated documentation files (the "Software"), to deal in the Software without
5
- restriction, including without limitation the rights to use, copy, modify, merge, publish,
6
- distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
7
- Software is furnished to do so, subject to the following conditions:
8
-
9
- The above copyright notice and this permission notice shall be included in all copies or
10
- substantial portions of the Software.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
13
- BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
14
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
15
- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,25 +0,0 @@
1
- Gem::Specification.new do |s|
2
- s.name = "auto-session-timeout"
3
- s.version = "0.5"
4
- s.date = "2009-04-22"
5
- s.summary = "Provides automatic session timeout in a Rails application."
6
- s.email = "pelargir@gmail.com"
7
- s.homepage = "http://github.com/pelargir/auto-session-timeout"
8
- s.description = "Adds several handy expectations for testing ActiveRecord model validations."
9
- s.has_rdoc = true
10
- s.authors = ["Matthew Bass"]
11
- s.files = [
12
- "auto_session_timeout.gemspec",
13
- "CHANGELOG",
14
- "init.rb",
15
- "lib/auto_session_timeout.rb",
16
- "lib/auto_session_timeout_helper.rb",
17
- "MIT-LICENSE",
18
- "Rakefile",
19
- "README",
20
- "test/auto_session_timeout_test.rb",
21
- "test/test_helper.rb"
22
- ]
23
- s.rdoc_options = ["--main", "README"]
24
- s.extra_rdoc_files = ["README"]
25
- end