rosette 0.3.2 → 0.3.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/lib/rosette/cli.rb +27 -13
- data/lib/rosette/manager.rb +4 -4
- data/lib/rosette/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a6d97a97a755feb6b3d7a69bb1059ca61a4d13775feee044bd984bd2d676c9a
|
4
|
+
data.tar.gz: ac18c0186280744399171f29f64a2f63e36b027c9e2147227dfac4690d1387a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3fc87c9790ff2227446db2c29b91b238b7b9de9c25a172e98afc4663f291977301dc0dd66d70f35ceff0eee0adc5a6e14864ec1b7dca1e5a0009951308b6065
|
7
|
+
data.tar.gz: 8f5fa5333bde31e318d9d1da5f3cd73889073d0210c08185c0380caa909aec93c00d390be151274ce38c6a56e81f321e24c7b777c8cbbb9076ab828c582a3dd0
|
data/lib/rosette/cli.rb
CHANGED
@@ -12,23 +12,29 @@ module Rosette
|
|
12
12
|
delegate :select, :ask, to: :@prompt
|
13
13
|
|
14
14
|
def run
|
15
|
-
|
15
|
+
loop do
|
16
|
+
ask_for_command
|
17
|
+
return exit 0 if exit_cli?
|
16
18
|
|
17
|
-
|
19
|
+
next display_help if help?
|
20
|
+
next normalize! if normalize?
|
18
21
|
|
19
|
-
|
20
|
-
|
22
|
+
ask_for_key
|
23
|
+
send command
|
24
|
+
end
|
21
25
|
end
|
22
26
|
|
23
27
|
private
|
24
28
|
|
25
29
|
def ask_for_command
|
26
|
-
@prompt
|
27
|
-
@command = select("
|
28
|
-
menu.choice("Read a translation", "read")
|
29
|
-
menu.choice("Add a translation", "add")
|
30
|
-
menu.choice("Remove a translation", "remove")
|
31
|
-
menu.choice("
|
30
|
+
@prompt = TTY::Prompt.new
|
31
|
+
@command = select("\nWhat do you want to achieve?") do |menu|
|
32
|
+
menu.choice("1. Read a translation", "read")
|
33
|
+
menu.choice("2. Add a translation", "add")
|
34
|
+
menu.choice("3. Remove a translation", "remove")
|
35
|
+
menu.choice("4. Normalize locales", "normalize")
|
36
|
+
menu.choice("5. Help", "help")
|
37
|
+
menu.choice("6. Exit", "exit_cli")
|
32
38
|
end
|
33
39
|
end
|
34
40
|
|
@@ -43,6 +49,10 @@ module Rosette
|
|
43
49
|
end
|
44
50
|
end
|
45
51
|
|
52
|
+
def exit_cli? = command == "exit_cli"
|
53
|
+
def help? = command == "help"
|
54
|
+
def normalize? = command == "normalize"
|
55
|
+
|
46
56
|
# COMMANDS
|
47
57
|
|
48
58
|
def read
|
@@ -65,11 +75,15 @@ module Rosette
|
|
65
75
|
end
|
66
76
|
end
|
67
77
|
|
68
|
-
def
|
78
|
+
def normalize!
|
79
|
+
Manager.normalize!
|
80
|
+
end
|
81
|
+
|
82
|
+
def display_help
|
69
83
|
puts <<~HELP
|
70
84
|
|
71
|
-
For
|
72
|
-
It can begin with or without the locale. These are all
|
85
|
+
For commands read/add/remove you must provide a key pointing to the translation.
|
86
|
+
It can begin with or without the locale. These keys are all considered equivalent:
|
73
87
|
|
74
88
|
fr.activemodel.errors.blank
|
75
89
|
en.activemodel.errors.blank
|
data/lib/rosette/manager.rb
CHANGED
@@ -10,6 +10,10 @@ class Manager
|
|
10
10
|
METHOD
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.normalize!
|
14
|
+
I18n::Tasks::CLI.start(["normalize"]) if Rosette.normalize
|
15
|
+
end
|
16
|
+
|
13
17
|
private
|
14
18
|
|
15
19
|
def initialize(locale, key, translation = nil)
|
@@ -68,8 +72,4 @@ class Manager
|
|
68
72
|
key.split(".").map(&:to_sym)
|
69
73
|
end
|
70
74
|
|
71
|
-
def self.normalize!
|
72
|
-
I18n::Tasks::CLI.start(["normalize"]) if Rosette.normalize
|
73
|
-
end
|
74
|
-
|
75
75
|
end
|
data/lib/rosette/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rosette
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Platteeuw
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n-tasks
|