timer_with_snooze 0.0.1 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config.rb +9 -0
- data/lib/config.rb +7 -0
- data/lib/locales/en.yml +9 -0
- data/lib/locales/ja.yml +9 -0
- data/lib/run_sample.rb +1 -1
- data/lib/timer_with_snooze/version.rb +1 -1
- data/lib/timer_with_snooze.rb +25 -12
- data/timer_with_snooze.gemspec +1 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb7b447689ef9ef50c5b6dc579c16c4de2d8ca9a0097b66895b7dbcfa1037bca
|
4
|
+
data.tar.gz: a5b1c42563444f76834eab4bc3e024a0180a02b027f23b8912f2494490dc3e20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e372234317d81a03d9e397e125454409ba168b5a32d565c96bfd8290fb84e31867075933adddbb43ec2721d75c6bad8819f00d27d2b12e92091ca0d6d1aab464
|
7
|
+
data.tar.gz: 69a6a30c974a087ac476037bc467fa120beba7b59e7f76b940906706f7f101db0242d371d0f1e42a79703115d4ad6e1cbe48979e7e5f3abcf11c6423351b92ad
|
data/config.rb
ADDED
data/lib/config.rb
ADDED
data/lib/locales/en.yml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
en:
|
2
|
+
input_hour: Please input hour of clock.
|
3
|
+
err_hour: The value of hour is not proper.
|
4
|
+
input_minute: Please input minute of clock.
|
5
|
+
err_minute: The value of minute is not proper.
|
6
|
+
add_this_time: Will you add this time to clock? (y/n)
|
7
|
+
add_more_time: You want add more times to clock? (y/n)
|
8
|
+
display_times: The setting times on clock is as follows.
|
9
|
+
start_clock: Do you want start the clock? (y/n)
|
data/lib/locales/ja.yml
ADDED
data/lib/run_sample.rb
CHANGED
data/lib/timer_with_snooze.rb
CHANGED
@@ -1,4 +1,17 @@
|
|
1
1
|
require "timer_with_snooze/version"
|
2
|
+
require "i18n"
|
3
|
+
require_relative "config"
|
4
|
+
|
5
|
+
#require File.join(File.expand_path('..', __FILE__), 'config.rb')
|
6
|
+
#require_relative "config"
|
7
|
+
|
8
|
+
=begin
|
9
|
+
dir = File.expand_path('..', __FILE__)
|
10
|
+
local_files = Dir.glob(File.join(dir, 'locales/*.yml'))
|
11
|
+
I18n.load_path = local_files
|
12
|
+
#I18n.locale = :ja
|
13
|
+
I18n.locale = :en
|
14
|
+
=end
|
2
15
|
|
3
16
|
module TimerWithSnooze
|
4
17
|
|
@@ -18,19 +31,19 @@ module TimerWithSnooze
|
|
18
31
|
def _setting
|
19
32
|
result = false
|
20
33
|
until result
|
21
|
-
hour = InputData.input_int_validation("
|
34
|
+
hour = InputData.input_int_validation I18n.t("input_hour")
|
22
35
|
result = hour.between?(0,23)
|
23
36
|
if !result
|
24
|
-
puts "
|
37
|
+
puts I18n.t("err_hour")
|
25
38
|
end
|
26
39
|
end
|
27
40
|
|
28
41
|
result = false
|
29
42
|
until result
|
30
|
-
minute = InputData.input_int_validation("
|
43
|
+
minute = InputData.input_int_validation I18n.t("input_minute")
|
31
44
|
result = minute.between?(0,59)
|
32
45
|
if !result
|
33
|
-
puts "
|
46
|
+
puts I18n.t("err_minute")
|
34
47
|
end
|
35
48
|
end
|
36
49
|
|
@@ -41,7 +54,7 @@ module TimerWithSnooze
|
|
41
54
|
time_arr = [yr,mn,dd,hour,minute,0]
|
42
55
|
|
43
56
|
atime = Time.new(*time_arr)
|
44
|
-
ans = InputData.input_str_validation("#{atime}
|
57
|
+
ans = InputData.input_str_validation("#{atime}" + I18n.t("add_this_time"), 'y')
|
45
58
|
if ans
|
46
59
|
@stops << atime
|
47
60
|
end
|
@@ -51,7 +64,7 @@ module TimerWithSnooze
|
|
51
64
|
result = true
|
52
65
|
while result
|
53
66
|
_setting
|
54
|
-
result = InputData.input_str_validation("
|
67
|
+
result = InputData.input_str_validation(I18n.t("add_more_time"), 'y')
|
55
68
|
end
|
56
69
|
|
57
70
|
list_all_stops
|
@@ -80,7 +93,7 @@ module TimerWithSnooze
|
|
80
93
|
end
|
81
94
|
|
82
95
|
def list_all_stops
|
83
|
-
puts
|
96
|
+
puts I18n.t("display_times")
|
84
97
|
@stops.each do |stop|
|
85
98
|
puts "#{stop}"
|
86
99
|
end
|
@@ -106,14 +119,14 @@ module TimerWithSnooze
|
|
106
119
|
puts "SIGINT"
|
107
120
|
exit(0)
|
108
121
|
else
|
109
|
-
puts "Snooze
|
110
|
-
|
122
|
+
puts "Snooze stopped\n"
|
123
|
+
return true
|
111
124
|
end
|
112
125
|
}
|
113
126
|
|
114
127
|
print "."; #puts Alert.runtime_class.now
|
115
128
|
|
116
|
-
if !snoozup and Alert.runtime_class.now >= stoptime
|
129
|
+
if !snoozup and Alert.runtime_class.now >= stoptime and Alert.runtime_class.now < stoptime + 60 * 15
|
117
130
|
puts "snooze started at #{stoptime}"
|
118
131
|
snoozup = snooze
|
119
132
|
end
|
@@ -134,8 +147,8 @@ module TimerWithSnooze
|
|
134
147
|
return true
|
135
148
|
}
|
136
149
|
|
137
|
-
|
138
|
-
print "wake up! "
|
150
|
+
15.times do
|
151
|
+
print "wake up! \a "
|
139
152
|
sleep 2
|
140
153
|
end
|
141
154
|
print "\n"
|
data/timer_with_snooze.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timer_with_snooze
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- n.hodoshima
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '12.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: i18n
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
41
55
|
description: timer under construction.
|
42
56
|
email:
|
43
57
|
- hodoshima@job4sp.com
|
@@ -55,7 +69,11 @@ files:
|
|
55
69
|
- Rakefile
|
56
70
|
- bin/console
|
57
71
|
- bin/setup
|
72
|
+
- config.rb
|
58
73
|
- exe/timer_with_snooze
|
74
|
+
- lib/config.rb
|
75
|
+
- lib/locales/en.yml
|
76
|
+
- lib/locales/ja.yml
|
59
77
|
- lib/run_sample.rb
|
60
78
|
- lib/timer_with_snooze.rb
|
61
79
|
- lib/timer_with_snooze/version.rb
|