lita 4.8.0.beta1 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lita/common.rb +17 -1
- data/lib/lita/config.rb +1 -0
- data/lib/lita/default_configuration.rb +1 -0
- data/lib/lita/version.rb +1 -1
- data/spec/lita/default_configuration_spec.rb +10 -0
- data/spec/lita_spec.rb +7 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 055bddddd7e8a6659039339de7eed646d12916e70869ca54be4e5d3547ec39fb
|
4
|
+
data.tar.gz: 4765f8c35b5e3f8deec77a3ea6a7a4333e4ce6220adefc713df7d51e966dc175
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ebf1592790f08cebd83768ab4cecb872ca33f200ad0b79d1de7e8e2495d28f5a8757054e3c4b641d199453be3aec8e8414b5e4c216c5c6df1fa9be98ac3d873
|
7
|
+
data.tar.gz: a5cee53960718b60109d95480bba07c8950ae42ec386169f87e9cbc18f7e91bfcaa85e1fdf609f76531080d8ef6639050d6d06b611cec3e29c23f49d528797f0
|
data/lib/lita/common.rb
CHANGED
@@ -12,7 +12,12 @@ module Lita
|
|
12
12
|
I18n.reload!
|
13
13
|
end
|
14
14
|
|
15
|
-
# Sets I18n.locale
|
15
|
+
# Sets +I18n.locale+, normalizing the provided locale name.
|
16
|
+
#
|
17
|
+
# Note that setting this only affects the current thread. Since handler
|
18
|
+
# methods are dispatched in new threads, changing the locale globally will
|
19
|
+
# require calling this method at the start of every handler method.
|
20
|
+
# Alternatively, use {Lita#default_locale=} which will affect all threads.
|
16
21
|
# @param new_locale [Symbol, String] The code of the locale to use.
|
17
22
|
# @return [void]
|
18
23
|
# @since 3.0.0
|
@@ -20,6 +25,16 @@ module Lita
|
|
20
25
|
I18n.locale = new_locale.to_s.tr("_", "-")
|
21
26
|
end
|
22
27
|
|
28
|
+
# Sets +I18n.default_locale+, normalizing the provided locale name.
|
29
|
+
#
|
30
|
+
# This is preferred over {Lita#locale=} as it affects all threads.
|
31
|
+
# @param new_locale [Symbol, String] The code of the locale to use.
|
32
|
+
# @return [void]
|
33
|
+
# @since 4.8.0
|
34
|
+
def default_locale=(new_locale)
|
35
|
+
I18n.default_locale = new_locale.to_s.tr("_", "-")
|
36
|
+
end
|
37
|
+
|
23
38
|
# The absolute path to Lita's templates directory.
|
24
39
|
# @return [String] The path.
|
25
40
|
# @since 3.0.0
|
@@ -33,3 +48,4 @@ I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
|
33
48
|
Lita.load_locales(Dir[File.join(Lita.template_root, "locales", "*.yml")])
|
34
49
|
I18n.enforce_available_locales = false
|
35
50
|
Lita.locale = ENV["LANG"] unless ENV["LANG"].nil?
|
51
|
+
Lita.default_locale = ENV["LANG"] unless ENV["LANG"].nil?
|
data/lib/lita/config.rb
CHANGED
@@ -43,6 +43,7 @@ module Lita
|
|
43
43
|
config.robot.name = "Lita"
|
44
44
|
config.robot.adapter = :shell
|
45
45
|
config.robot.locale = I18n.locale
|
46
|
+
config.robot.default_locale = I18n.default_locale
|
46
47
|
config.robot.log_level = :info
|
47
48
|
config.robot.admins = nil
|
48
49
|
config.robot.log_formatter = nil
|
@@ -131,6 +131,7 @@ module Lita
|
|
131
131
|
config :alias, type: String
|
132
132
|
config :adapter, types: [String, Symbol], default: :shell
|
133
133
|
config :locale, types: [String, Symbol], default: I18n.locale
|
134
|
+
config :default_locale, types: [String, Symbol], default: I18n.default_locale
|
134
135
|
config :log_level, types: [String, Symbol], default: :info do
|
135
136
|
validate do |value|
|
136
137
|
unless LOG_LEVELS.include?(value.to_s.downcase.strip)
|
data/lib/lita/version.rb
CHANGED
@@ -233,6 +233,16 @@ describe Lita::DefaultConfiguration, lita: true do
|
|
233
233
|
expect(config.robot.locale).to eq(:es)
|
234
234
|
end
|
235
235
|
|
236
|
+
it "has a default default locale" do
|
237
|
+
expect(config.robot.default_locale).to eq(I18n.default_locale)
|
238
|
+
end
|
239
|
+
|
240
|
+
it "can set a default locale" do
|
241
|
+
config.robot.default_locale = :es
|
242
|
+
|
243
|
+
expect(config.robot.default_locale).to eq(:es)
|
244
|
+
end
|
245
|
+
|
236
246
|
it "has a default log level" do
|
237
247
|
expect(config.robot.log_level).to eq(:info)
|
238
248
|
end
|
data/spec/lita_spec.rb
CHANGED
@@ -58,6 +58,13 @@ describe Lita do
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
+
describe ".default_locale=" do
|
62
|
+
it "sets I18n.default_locale to the normalized locale" do
|
63
|
+
expect(I18n).to receive(:default_locale=).with("zh-TW")
|
64
|
+
described_class.default_locale = "zh_TW"
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
61
68
|
describe ".redis" do
|
62
69
|
let(:redis_namespace) { instance_double("Redis") }
|
63
70
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.8.0
|
4
|
+
version: 4.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Cuadra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -402,11 +402,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
402
402
|
version: 2.5.0
|
403
403
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
404
404
|
requirements:
|
405
|
-
- - "
|
405
|
+
- - ">="
|
406
406
|
- !ruby/object:Gem::Version
|
407
|
-
version:
|
407
|
+
version: '0'
|
408
408
|
requirements: []
|
409
|
-
rubygems_version: 3.1.
|
409
|
+
rubygems_version: 3.1.4
|
410
410
|
signing_key:
|
411
411
|
specification_version: 4
|
412
412
|
summary: ChatOps framework for Ruby. Lita is a robot companion for your chat room.
|