rails-scheduler 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -0
- data/config/locales/en.yml +25 -11
- data/config/locales/es.yml +25 -11
- data/lib/scheduler/model.rb +24 -0
- data/lib/scheduler/version.rb +1 -1
- metadata +13 -13
data/README.rdoc
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
= Rails Scheduler
|
2
2
|
|
3
|
+
{<img src="https://gemnasium.com/atd/rails-scheduler.png" />}[https://gemnasium.com/atd/rails-scheduler]
|
4
|
+
|
3
5
|
This project provides your Rails application with support for scheduled events
|
4
6
|
|
5
7
|
* Provide any model with database-stored scheduler (weekly, monthly, etc..)
|
data/config/locales/en.yml
CHANGED
@@ -6,18 +6,32 @@ en:
|
|
6
6
|
message: "Event does not have recurrence"
|
7
7
|
option: "one-off"
|
8
8
|
daily:
|
9
|
+
description:
|
10
|
+
one: "Every day"
|
11
|
+
other: "Every %{count} days"
|
9
12
|
form:
|
10
13
|
option: "daily"
|
11
14
|
weekly:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
+
description:
|
16
|
+
one: "Every %{week_days}"
|
17
|
+
other: "Every %{week_days} on %{count} weeks"
|
18
|
+
form:
|
19
|
+
every_week: "Every %{form_field} week(s) on the following days:"
|
20
|
+
option: "weekly"
|
15
21
|
monthly:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
description:
|
23
|
+
one: "The %{week_day_order} %{week_day} of the month"
|
24
|
+
other: "The %{week_day_order} %{week_day} of every %{count} months"
|
25
|
+
week_day_order:
|
26
|
+
"1": "first"
|
27
|
+
"2": "second"
|
28
|
+
"3": "third"
|
29
|
+
"-1": "last"
|
30
|
+
form:
|
31
|
+
option: "monthly"
|
32
|
+
week_day: "The %{order_field} %{week_field} of every %{interval_field} month(s)"
|
33
|
+
week_day_order_option:
|
34
|
+
"1": "first"
|
35
|
+
"2": "second"
|
36
|
+
"3": "third"
|
37
|
+
"-1": "last"
|
data/config/locales/es.yml
CHANGED
@@ -6,18 +6,32 @@ es:
|
|
6
6
|
message: "La actividad no se volverá a repetir"
|
7
7
|
option: "ninguna"
|
8
8
|
daily:
|
9
|
+
description:
|
10
|
+
one: "Todos los días"
|
11
|
+
other: "Cada %{count} días"
|
9
12
|
form:
|
10
13
|
option: "diaria"
|
11
14
|
weekly:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
+
description:
|
16
|
+
one: "Todos los %{week_days}"
|
17
|
+
other: "Los %{week_days} de cada %{count} semanas"
|
18
|
+
form:
|
19
|
+
every_week: "Cada %{form_field} semana(s) en los siguientes días:"
|
20
|
+
option: "semanal"
|
15
21
|
monthly:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
22
|
+
description:
|
23
|
+
one: "El %{week_day_order} %{ week_day } del mes"
|
24
|
+
other: "El %{week_day_order} %{ week_day } de cada %{count} meses"
|
25
|
+
week_day_order:
|
26
|
+
"1": "primer"
|
27
|
+
"2": "segundo"
|
28
|
+
"3": "tercer"
|
29
|
+
"-1": "último"
|
30
|
+
form:
|
31
|
+
option: "mensual"
|
32
|
+
week_day: "El %{order_field} %{week_field} de cada %{interval_field} mes(es)"
|
33
|
+
week_day_order_option:
|
34
|
+
"1": "primer"
|
35
|
+
"2": "segundo"
|
36
|
+
"3": "tercer"
|
37
|
+
"-1": "último"
|
data/lib/scheduler/model.rb
CHANGED
@@ -28,6 +28,24 @@ module Scheduler
|
|
28
28
|
Scheduler::FREQUENCIES[frequency]
|
29
29
|
end
|
30
30
|
|
31
|
+
def frequency_description
|
32
|
+
return "" if frequency_sym == :one_off
|
33
|
+
|
34
|
+
options = { :count => interval }
|
35
|
+
|
36
|
+
case frequency_sym
|
37
|
+
when :weekly
|
38
|
+
options[:week_days] = week_days_in_words
|
39
|
+
when :monthly
|
40
|
+
options[:week_day] = week_days_in_words
|
41
|
+
options[:week_day_order] =
|
42
|
+
I18n.t("scheduler.frequency.monthly.description.week_day_order.#{ week_day_order }")
|
43
|
+
end
|
44
|
+
|
45
|
+
I18n.t "scheduler.frequency.#{ frequency_sym }.description", options
|
46
|
+
|
47
|
+
end
|
48
|
+
|
31
49
|
# Get [ 0, 1, 6 ] (monday, tuesday, sunday) from byte
|
32
50
|
def week_days
|
33
51
|
7.times.map{ |i|
|
@@ -37,6 +55,12 @@ module Scheduler
|
|
37
55
|
}.compact
|
38
56
|
end
|
39
57
|
|
58
|
+
def week_days_in_words
|
59
|
+
week_days.map { |d|
|
60
|
+
I18n.l Date.today.beginning_of_week + d, :format => "%A"
|
61
|
+
}.to_sentence
|
62
|
+
end
|
63
|
+
|
40
64
|
def week_day
|
41
65
|
week_days.first
|
42
66
|
end
|
data/lib/scheduler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-03-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &82128310 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 3.1.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *82128310
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: recurrence
|
27
|
-
requirement: &
|
27
|
+
requirement: &82127830 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 1.2.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *82127830
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mysql2
|
38
|
-
requirement: &
|
38
|
+
requirement: &82127460 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *82127460
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: factory_girl
|
49
|
-
requirement: &
|
49
|
+
requirement: &82126740 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *82126740
|
58
58
|
description: ! 'Scheduler support: daily, weekly and montly repetitions'
|
59
59
|
email:
|
60
60
|
- atapiador@dit.upm.es
|
@@ -135,7 +135,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
135
135
|
version: '0'
|
136
136
|
segments:
|
137
137
|
- 0
|
138
|
-
hash:
|
138
|
+
hash: 498138989
|
139
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
140
|
none: false
|
141
141
|
requirements:
|
@@ -144,10 +144,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
segments:
|
146
146
|
- 0
|
147
|
-
hash:
|
147
|
+
hash: 498138989
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 1.8.
|
150
|
+
rubygems_version: 1.8.10
|
151
151
|
signing_key:
|
152
152
|
specification_version: 3
|
153
153
|
summary: Provide a Rails application with support for scheduled events
|