azuma 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/azuma +3 -1
- data/lib/azuma.rb +4 -2
- data/lib/azuma/announcement.rb +23 -3
- data/lib/azuma/cli.rb +5 -3
- data/lib/azuma/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d57bb230b01d3dc761f648e44ddd9444c6c5d1f
|
4
|
+
data.tar.gz: 928d6834211115541830ff9b4498d941283daee4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85014e3f81b07a8bbd1fc2a6a8e505b2ca568c61fbac325dd0819b0ac6c9da67cdb8193b5d4c0c6167931204987323ee6666a79cb20f6037c3b856d7449ff70a
|
7
|
+
data.tar.gz: 7814648dee684dd8030a5a5b546de7e7917ead14ee68a2c23d553d0e90f88a3f87b1d2a32197f34f3fba3610d473b1bb00a477dbfc27c29ce3c604cea2675bcc
|
data/README.md
CHANGED
data/bin/azuma
CHANGED
@@ -15,6 +15,7 @@ options = {}
|
|
15
15
|
|
16
16
|
opt = OptionParser.new
|
17
17
|
opt.on('-t', '--talkers="NAME1,NAME2..."') {|v| options[:talkers] = v }
|
18
|
+
opt.on('-l', '--lang=ja (DEFAULT en)') {|v| options[:lang] = v }
|
18
19
|
|
19
20
|
begin
|
20
21
|
opt.parse!(ARGV)
|
@@ -31,5 +32,6 @@ unless (talkers = options[:talkers])
|
|
31
32
|
end
|
32
33
|
|
33
34
|
talkers = talkers.split(',').map(&:strip)
|
35
|
+
language = options[:lang] || 'en'
|
34
36
|
|
35
|
-
Azuma::CLI.start(talkers)
|
37
|
+
Azuma::CLI.start(talkers, language)
|
data/lib/azuma.rb
CHANGED
@@ -4,8 +4,10 @@ require 'azuma/core'
|
|
4
4
|
Azuma::Core.prepend Azuma::Announcement
|
5
5
|
|
6
6
|
module Azuma
|
7
|
-
def entry(talkers)
|
8
|
-
Azuma::Core.new(talkers)
|
7
|
+
def entry(talkers, language)
|
8
|
+
core = Azuma::Core.new(talkers)
|
9
|
+
core.language = language
|
10
|
+
core
|
9
11
|
end
|
10
12
|
|
11
13
|
module_function :entry
|
data/lib/azuma/announcement.rb
CHANGED
@@ -2,20 +2,40 @@ require 'shellwords'
|
|
2
2
|
|
3
3
|
module Azuma
|
4
4
|
module Announcement
|
5
|
+
attr_accessor :language
|
6
|
+
|
5
7
|
def next_talker
|
6
8
|
super.tap do |talker|
|
7
9
|
message = if talker
|
8
|
-
|
10
|
+
designate_talker_message(talker)
|
9
11
|
else
|
10
|
-
|
12
|
+
curtain_talk
|
11
13
|
end
|
12
14
|
|
13
15
|
puts message
|
14
16
|
|
15
17
|
if /darwin/ === RUBY_PLATFORM
|
16
|
-
|
18
|
+
system("say #{Shellwords.shellescape(message)}")
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def designate_talker_message(talker)
|
26
|
+
if language == 'ja'
|
27
|
+
"次は#{talker}さんの番です。"
|
28
|
+
else
|
29
|
+
"Next is the turn of #{talker}."
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def curtain_talk
|
34
|
+
if language == 'ja'
|
35
|
+
'もう発表者はいません。お疲れ様でした。'
|
36
|
+
else
|
37
|
+
'All of the presentation was the end. Thank you for your kind attention.'
|
38
|
+
end
|
39
|
+
end
|
20
40
|
end
|
21
41
|
end
|
data/lib/azuma/cli.rb
CHANGED
@@ -2,15 +2,17 @@ require 'readline'
|
|
2
2
|
|
3
3
|
module Azuma
|
4
4
|
class CLI
|
5
|
-
def self.start(talkers)
|
6
|
-
|
5
|
+
def self.start(talkers, language)
|
6
|
+
language ||= 'en'
|
7
|
+
|
8
|
+
azuma = Azuma.entry(talkers, language)
|
7
9
|
|
8
10
|
Signal.trap(:EXIT) { puts; exit! }
|
9
11
|
|
10
12
|
puts 'Ctrl-D to exit'
|
11
13
|
|
12
14
|
while Readline.readline('> press enter to show next talker', true)
|
13
|
-
break unless
|
15
|
+
break unless azuma.next_talker
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
data/lib/azuma/version.rb
CHANGED