session_countdown 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.html +6 -6
- data/README.rdoc +5 -5
- data/VERSION +1 -1
- data/created.rid +1 -1
- data/lib/session_countdown.rb +1 -1
- data/session_countdown.gemspec +1 -1
- data/test/common/test_controller_test.rb +9 -9
- data/test/rails2x_root/test/functional/test_controller_test.rb +9 -9
- data/test/rails3x_root/Gemfile.lock +1 -1
- data/test/rails3x_root/test/functional/test_controller_test.rb +9 -9
- metadata +3 -3
data/README.html
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
<h2>File: README.rdoc</h2>
|
10
10
|
<table>
|
11
11
|
<tr><td>Path:</td><td>README.rdoc</td></tr>
|
12
|
-
<tr><td>Modified:</td><td>Fri Aug 06
|
12
|
+
<tr><td>Modified:</td><td>Fri Aug 06 09:30:20 -0400 2010</td></tr>
|
13
13
|
</table>
|
14
14
|
|
15
15
|
<h1>session_countdown</h1>
|
@@ -17,7 +17,7 @@
|
|
17
17
|
A Ruby on Rails plugin that puts a countdown timer on the session object.
|
18
18
|
</p>
|
19
19
|
<pre>
|
20
|
-
session.
|
20
|
+
session.countdown_start(30.minutes)
|
21
21
|
session.countdown_running? # => true
|
22
22
|
session.countdown_expire
|
23
23
|
session.countdown_running? # => false
|
@@ -45,7 +45,7 @@ timer.</em>
|
|
45
45
|
Start a countdown timer
|
46
46
|
</p>
|
47
47
|
<pre>
|
48
|
-
session.
|
48
|
+
session.countdown_start(seconds, name = :default)
|
49
49
|
</pre>
|
50
50
|
<p>
|
51
51
|
<em>You can have multiple countdown timers if you name them. The default
|
@@ -64,7 +64,7 @@ Expire early (i.e. logout)
|
|
64
64
|
session.countdown_expire(name = :default)
|
65
65
|
</pre>
|
66
66
|
<p>
|
67
|
-
Restart, using the duration supplied to
|
67
|
+
Restart, using the duration supplied to countdown_start
|
68
68
|
</p>
|
69
69
|
<pre>
|
70
70
|
session.countdown_restart(name = :default)
|
@@ -114,7 +114,7 @@ Understanding timer running, expired, and never started
|
|
114
114
|
def login
|
115
115
|
user = User.find_by_email(params[:email)
|
116
116
|
if user && user.password_matches?(params[:password])
|
117
|
-
session.
|
117
|
+
session.countdown_start(1.hour)
|
118
118
|
redirect_to :controller => :private
|
119
119
|
else
|
120
120
|
flash.now[:notice] = "Sorry, email/password wrong"
|
@@ -150,7 +150,7 @@ If you want an "remember me" feature you need to do two things.
|
|
150
150
|
Set timer for far future when user checks "remember me"
|
151
151
|
</p>
|
152
152
|
<pre>
|
153
|
-
session.
|
153
|
+
session.countdown_start(1.year)
|
154
154
|
</pre>
|
155
155
|
<p>
|
156
156
|
Tell rails to serve up a persistent cookie instead of session cookie,
|
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
A Ruby on Rails plugin that puts a countdown timer on the session
|
6
6
|
object.
|
7
7
|
|
8
|
-
session.
|
8
|
+
session.countdown_start(30.minutes)
|
9
9
|
session.countdown_running? # => true
|
10
10
|
session.countdown_expire
|
11
11
|
session.countdown_running? # => false
|
@@ -32,7 +32,7 @@ non-existent countdown timer.</i>
|
|
32
32
|
|
33
33
|
Start a countdown timer
|
34
34
|
|
35
|
-
session.
|
35
|
+
session.countdown_start(seconds, name = :default)
|
36
36
|
|
37
37
|
<i>You can have multiple countdown timers if you name them. The
|
38
38
|
default countdown timer is named "default".</i>
|
@@ -45,7 +45,7 @@ Expire early (i.e. logout)
|
|
45
45
|
|
46
46
|
session.countdown_expire(name = :default)
|
47
47
|
|
48
|
-
Restart, using the duration supplied to
|
48
|
+
Restart, using the duration supplied to countdown_start
|
49
49
|
|
50
50
|
session.countdown_restart(name = :default)
|
51
51
|
|
@@ -91,7 +91,7 @@ Understanding timer running, expired, and never started
|
|
91
91
|
def login
|
92
92
|
user = User.find_by_email(params[:email)
|
93
93
|
if user && user.password_matches?(params[:password])
|
94
|
-
session.
|
94
|
+
session.countdown_start(1.hour)
|
95
95
|
redirect_to :controller => :private
|
96
96
|
else
|
97
97
|
flash.now[:notice] = "Sorry, email/password wrong"
|
@@ -127,7 +127,7 @@ If you want an "remember me" feature you need to do two things.
|
|
127
127
|
|
128
128
|
Set timer for far future when user checks "remember me"
|
129
129
|
|
130
|
-
session.
|
130
|
+
session.countdown_start(1.year)
|
131
131
|
|
132
132
|
Tell rails to serve up a persistent cookie instead of session cookie,
|
133
133
|
probably in application_controller.rb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/created.rid
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Fri, 06 Aug 2010
|
1
|
+
Fri, 06 Aug 2010 09:30:21 -0400
|
data/lib/session_countdown.rb
CHANGED
@@ -8,7 +8,7 @@ module SessionCountdown
|
|
8
8
|
|
9
9
|
@@default_name = "default"
|
10
10
|
|
11
|
-
def
|
11
|
+
def countdown_start(delta, name = @@default_name)
|
12
12
|
self[get_zero_key(name)] = Time.now + delta
|
13
13
|
self[get_zero_delta_key(name)] = delta # save for reset
|
14
14
|
end
|
data/session_countdown.gemspec
CHANGED
@@ -17,7 +17,7 @@ class TestControllerTest < ActionController::TestCase
|
|
17
17
|
assert ! session.countdown_running?
|
18
18
|
assert ! session.countdown_expired?
|
19
19
|
|
20
|
-
session.
|
20
|
+
session.countdown_start(1.minute)
|
21
21
|
assert session.countdown_running?
|
22
22
|
assert ! session.countdown_expired?
|
23
23
|
|
@@ -40,7 +40,7 @@ class TestControllerTest < ActionController::TestCase
|
|
40
40
|
assert ! session.countdown_expired?
|
41
41
|
|
42
42
|
# with countdown started
|
43
|
-
session.
|
43
|
+
session.countdown_start(1.minute)
|
44
44
|
assert session.countdown_running?
|
45
45
|
assert ! session.countdown_expired?
|
46
46
|
|
@@ -56,8 +56,8 @@ class TestControllerTest < ActionController::TestCase
|
|
56
56
|
|
57
57
|
## start up two counters
|
58
58
|
|
59
|
-
session.
|
60
|
-
session.
|
59
|
+
session.countdown_start(1.minute)
|
60
|
+
session.countdown_start(1.minute, :admin)
|
61
61
|
|
62
62
|
## expire default counter
|
63
63
|
|
@@ -75,7 +75,7 @@ class TestControllerTest < ActionController::TestCase
|
|
75
75
|
|
76
76
|
## mixing calls to both timers
|
77
77
|
|
78
|
-
session.
|
78
|
+
session.countdown_start(1.minute)
|
79
79
|
assert session.countdown_running?()
|
80
80
|
assert ! session.countdown_running?(:admin)
|
81
81
|
session.countdown_expire
|
@@ -90,7 +90,7 @@ class TestControllerTest < ActionController::TestCase
|
|
90
90
|
|
91
91
|
test "expiring and resetting" do
|
92
92
|
|
93
|
-
session.
|
93
|
+
session.countdown_start(1.minute)
|
94
94
|
assert session.countdown_running?
|
95
95
|
assert ! session.countdown_expired?
|
96
96
|
|
@@ -108,7 +108,7 @@ class TestControllerTest < ActionController::TestCase
|
|
108
108
|
|
109
109
|
test "named expiring and resetting" do
|
110
110
|
|
111
|
-
session.
|
111
|
+
session.countdown_start(1.minute, :admin)
|
112
112
|
assert session.countdown_running?(:admin)
|
113
113
|
assert ! session.countdown_expired?(:admin)
|
114
114
|
|
@@ -144,7 +144,7 @@ class TestControllerTest < ActionController::TestCase
|
|
144
144
|
|
145
145
|
test "countdown_count" do
|
146
146
|
|
147
|
-
session.
|
147
|
+
session.countdown_start(1.minute)
|
148
148
|
assert session.countdown_count < 1.minute
|
149
149
|
assert session.countdown_count > (1.minute - 1)
|
150
150
|
Timecop.travel(30.seconds)
|
@@ -163,7 +163,7 @@ class TestControllerTest < ActionController::TestCase
|
|
163
163
|
# copied from README, mostly checking spelling
|
164
164
|
test "rdoc example" do
|
165
165
|
|
166
|
-
session.
|
166
|
+
session.countdown_start(30.minutes)
|
167
167
|
session.countdown_running? # => true
|
168
168
|
session.countdown_expire
|
169
169
|
session.countdown_running? # => false
|
@@ -17,7 +17,7 @@ class TestControllerTest < ActionController::TestCase
|
|
17
17
|
assert ! session.countdown_running?
|
18
18
|
assert ! session.countdown_expired?
|
19
19
|
|
20
|
-
session.
|
20
|
+
session.countdown_start(1.minute)
|
21
21
|
assert session.countdown_running?
|
22
22
|
assert ! session.countdown_expired?
|
23
23
|
|
@@ -40,7 +40,7 @@ class TestControllerTest < ActionController::TestCase
|
|
40
40
|
assert ! session.countdown_expired?
|
41
41
|
|
42
42
|
# with countdown started
|
43
|
-
session.
|
43
|
+
session.countdown_start(1.minute)
|
44
44
|
assert session.countdown_running?
|
45
45
|
assert ! session.countdown_expired?
|
46
46
|
|
@@ -56,8 +56,8 @@ class TestControllerTest < ActionController::TestCase
|
|
56
56
|
|
57
57
|
## start up two counters
|
58
58
|
|
59
|
-
session.
|
60
|
-
session.
|
59
|
+
session.countdown_start(1.minute)
|
60
|
+
session.countdown_start(1.minute, :admin)
|
61
61
|
|
62
62
|
## expire default counter
|
63
63
|
|
@@ -75,7 +75,7 @@ class TestControllerTest < ActionController::TestCase
|
|
75
75
|
|
76
76
|
## mixing calls to both timers
|
77
77
|
|
78
|
-
session.
|
78
|
+
session.countdown_start(1.minute)
|
79
79
|
assert session.countdown_running?()
|
80
80
|
assert ! session.countdown_running?(:admin)
|
81
81
|
session.countdown_expire
|
@@ -90,7 +90,7 @@ class TestControllerTest < ActionController::TestCase
|
|
90
90
|
|
91
91
|
test "expiring and resetting" do
|
92
92
|
|
93
|
-
session.
|
93
|
+
session.countdown_start(1.minute)
|
94
94
|
assert session.countdown_running?
|
95
95
|
assert ! session.countdown_expired?
|
96
96
|
|
@@ -108,7 +108,7 @@ class TestControllerTest < ActionController::TestCase
|
|
108
108
|
|
109
109
|
test "named expiring and resetting" do
|
110
110
|
|
111
|
-
session.
|
111
|
+
session.countdown_start(1.minute, :admin)
|
112
112
|
assert session.countdown_running?(:admin)
|
113
113
|
assert ! session.countdown_expired?(:admin)
|
114
114
|
|
@@ -144,7 +144,7 @@ class TestControllerTest < ActionController::TestCase
|
|
144
144
|
|
145
145
|
test "countdown_count" do
|
146
146
|
|
147
|
-
session.
|
147
|
+
session.countdown_start(1.minute)
|
148
148
|
assert session.countdown_count < 1.minute
|
149
149
|
assert session.countdown_count > (1.minute - 1)
|
150
150
|
Timecop.travel(30.seconds)
|
@@ -163,7 +163,7 @@ class TestControllerTest < ActionController::TestCase
|
|
163
163
|
# copied from README, mostly checking spelling
|
164
164
|
test "rdoc example" do
|
165
165
|
|
166
|
-
session.
|
166
|
+
session.countdown_start(30.minutes)
|
167
167
|
session.countdown_running? # => true
|
168
168
|
session.countdown_expire
|
169
169
|
session.countdown_running? # => false
|
@@ -17,7 +17,7 @@ class TestControllerTest < ActionController::TestCase
|
|
17
17
|
assert ! session.countdown_running?
|
18
18
|
assert ! session.countdown_expired?
|
19
19
|
|
20
|
-
session.
|
20
|
+
session.countdown_start(1.minute)
|
21
21
|
assert session.countdown_running?
|
22
22
|
assert ! session.countdown_expired?
|
23
23
|
|
@@ -40,7 +40,7 @@ class TestControllerTest < ActionController::TestCase
|
|
40
40
|
assert ! session.countdown_expired?
|
41
41
|
|
42
42
|
# with countdown started
|
43
|
-
session.
|
43
|
+
session.countdown_start(1.minute)
|
44
44
|
assert session.countdown_running?
|
45
45
|
assert ! session.countdown_expired?
|
46
46
|
|
@@ -56,8 +56,8 @@ class TestControllerTest < ActionController::TestCase
|
|
56
56
|
|
57
57
|
## start up two counters
|
58
58
|
|
59
|
-
session.
|
60
|
-
session.
|
59
|
+
session.countdown_start(1.minute)
|
60
|
+
session.countdown_start(1.minute, :admin)
|
61
61
|
|
62
62
|
## expire default counter
|
63
63
|
|
@@ -75,7 +75,7 @@ class TestControllerTest < ActionController::TestCase
|
|
75
75
|
|
76
76
|
## mixing calls to both timers
|
77
77
|
|
78
|
-
session.
|
78
|
+
session.countdown_start(1.minute)
|
79
79
|
assert session.countdown_running?()
|
80
80
|
assert ! session.countdown_running?(:admin)
|
81
81
|
session.countdown_expire
|
@@ -90,7 +90,7 @@ class TestControllerTest < ActionController::TestCase
|
|
90
90
|
|
91
91
|
test "expiring and resetting" do
|
92
92
|
|
93
|
-
session.
|
93
|
+
session.countdown_start(1.minute)
|
94
94
|
assert session.countdown_running?
|
95
95
|
assert ! session.countdown_expired?
|
96
96
|
|
@@ -108,7 +108,7 @@ class TestControllerTest < ActionController::TestCase
|
|
108
108
|
|
109
109
|
test "named expiring and resetting" do
|
110
110
|
|
111
|
-
session.
|
111
|
+
session.countdown_start(1.minute, :admin)
|
112
112
|
assert session.countdown_running?(:admin)
|
113
113
|
assert ! session.countdown_expired?(:admin)
|
114
114
|
|
@@ -144,7 +144,7 @@ class TestControllerTest < ActionController::TestCase
|
|
144
144
|
|
145
145
|
test "countdown_count" do
|
146
146
|
|
147
|
-
session.
|
147
|
+
session.countdown_start(1.minute)
|
148
148
|
assert session.countdown_count < 1.minute
|
149
149
|
assert session.countdown_count > (1.minute - 1)
|
150
150
|
Timecop.travel(30.seconds)
|
@@ -163,7 +163,7 @@ class TestControllerTest < ActionController::TestCase
|
|
163
163
|
# copied from README, mostly checking spelling
|
164
164
|
test "rdoc example" do
|
165
165
|
|
166
|
-
session.
|
166
|
+
session.countdown_start(30.minutes)
|
167
167
|
session.countdown_running? # => true
|
168
168
|
session.countdown_expire
|
169
169
|
session.countdown_running? # => false
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: session_countdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kevin Swope
|