beaker-i18n_helper 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +5 -13
- data/lib/beaker/i18n_helper/version.rb +1 -1
- data/lib/beaker/i18n_helper.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a92eea0c2995ff9bfc05eb14dbd7a4fe8866cee
|
4
|
+
data.tar.gz: 05c9e958e3b13ef6c201b8f47ecfe2d82957d7e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f33cf0b421c770fe240de47b386ac41e1504f275ebeb29e5918bdcaf513a5419189983df95b46fac2de7eab0cfa7cdbff59ecd82c6001e3a40f699e4bec6f26
|
7
|
+
data.tar.gz: d84552e8412a7a7982ae46a697ce298bff0f5c429bdff6b1f7d6f7706dae2917e15562a64539d08b4606b8e38d15e4e70cdfcabed0b48473407b270bba425bbf
|
data/CHANGELOG.md
CHANGED
@@ -3,8 +3,16 @@
|
|
3
3
|
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
4
4
|
and this project adheres to [Semantic Versioning](http://semver.org).
|
5
5
|
|
6
|
+
## [1.0.1]
|
7
|
+
### Summary
|
8
|
+
This release fixes the `change_locale_on` method and makes some README updates.
|
9
|
+
|
10
|
+
#### Fixed
|
11
|
+
- `change_locale_on` now clears and sets environment variables, eliminating the issue where locales would stack
|
12
|
+
|
6
13
|
## [1.0.0]
|
7
14
|
### Summary
|
8
15
|
This is the first release of this gem.
|
9
16
|
|
17
|
+
[1.0.1]:https://github.com/puppetlabs/beaker-i18n_helper/compare/1.0.0...1.0.1
|
10
18
|
[1.0.0]:https://github.com/puppetlabs/beaker-i18n_helper/tags/1.0.0
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ c.before :suite do
|
|
25
25
|
# Required for binding tests.
|
26
26
|
if fact('osfamily') == 'Debian'
|
27
27
|
#install language pack on debian systems
|
28
|
-
install_language_pack_on(host, "ja_JP")
|
28
|
+
install_language_pack_on(host, "ja_JP.utf-8")
|
29
29
|
end
|
30
30
|
if fact('osfamily') == 'RedHat'
|
31
31
|
if fact('operatingsystemmajrelease') =~ /7/ || fact('operatingsystem') =~ /Fedora/
|
@@ -44,33 +44,25 @@ end
|
|
44
44
|
|
45
45
|
#### install_language_pack_on(host, lang)
|
46
46
|
|
47
|
-
Uses Beaker's `install_package` to install a language pack for the desired language.
|
47
|
+
Uses Beaker's `install_package` to install a language pack for the desired language. Takes the host and `lang`, a POSIX locale identifier ([lang]_[region].[charset])
|
48
48
|
|
49
49
|
```ruby
|
50
|
-
install_language_pack_on(host, 'ja_JP')
|
51
|
-
```
|
52
|
-
|
53
|
-
```ruby
|
54
|
-
install_language_pack_on(host, 'de_DE.utf8')
|
50
|
+
install_language_pack_on(host, 'ja_JP.utf-8')
|
55
51
|
```
|
56
52
|
Usually only needed for Debian systems, RHEL installs all language packs by default.
|
57
53
|
|
58
54
|
#### change_locale_on(host, lang)
|
59
55
|
|
60
|
-
Takes in a
|
61
|
-
|
62
|
-
e.g.
|
56
|
+
Takes in a POSIX locale identifier, `lang`, and sets $LANG, $LANGUAGE, and on the target host to `#{lang}`.
|
63
57
|
|
64
58
|
```ruby
|
65
|
-
change_locale_on(host, "
|
59
|
+
change_locale_on(host, "de_DE.utf-8")
|
66
60
|
```
|
67
61
|
|
68
62
|
## Limitations
|
69
63
|
|
70
64
|
So far, this helper has only been tested for use with Debian and RedHat hosts.
|
71
65
|
|
72
|
-
Full disclosure: changing the locale only uses global environment variables. Because the Beaker function I used is additive, it's only good for setting the locale to another language and then back to English **once**. At least that's all we've tested it with. Hopefully some day that will change. See the Development section.
|
73
|
-
|
74
66
|
## Development
|
75
67
|
|
76
68
|
PRs welcome!
|
data/lib/beaker/i18n_helper.rb
CHANGED
@@ -41,9 +41,10 @@ module Beaker::I18nHelper # rubocop:disable Style/ClassAndModuleChildren
|
|
41
41
|
valid_lang_string?(lang)
|
42
42
|
Array(hsts).each do |host|
|
43
43
|
begin
|
44
|
+
host.clear_env_var('LANG')
|
44
45
|
host.add_env_var('LANG', lang)
|
46
|
+
host.clear_env_var('LANGUAGE')
|
45
47
|
host.add_env_var('LANGUAGE', lang)
|
46
|
-
host.add_env_var('LC_ALL', lang)
|
47
48
|
rescue RuntimeError
|
48
49
|
raise "Unable to change locale to #{lang} on #{host}"
|
49
50
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beaker-i18n_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Putnam
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|