flycal-cli 1.5.1 → 1.5.2
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/flycal/cli/config.rb +10 -1
- data/lib/flycal/cli/hooks.rb +20 -5
- data/lib/flycal.rb +1 -1
- data/locales/en.json +3 -2
- data/locales/it.json +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 406ca19950c40ebb2ab3d0215d16c97154c6d322d90a3e7dce39440b8c272601
|
|
4
|
+
data.tar.gz: 79734bbb5b9a884517be0095351ee6cb43fd52af62d8022592860d884de302fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ead67f0591807b59784123b7943c6a27975b6dec986327a4888cae463f0929c7c1b770b807ebef18c887f5499eec9b0dcc662e4d64362a8f17211db45ac549b2
|
|
7
|
+
data.tar.gz: 2023d313314d76377b9e287f59f5ff0170864d1b8bf5726d3eed08d594f36477cb08016624b046d8d8153bf47408a3e109c767fd4f5d15532c712517cf5e690c
|
data/lib/flycal/cli/config.rb
CHANGED
|
@@ -172,7 +172,16 @@ module Cli
|
|
|
172
172
|
return false unless File.file?(source)
|
|
173
173
|
|
|
174
174
|
FileUtils.mkdir_p(config_dir)
|
|
175
|
-
FileUtils.mv(source, config_backup_file)
|
|
175
|
+
FileUtils.mv(source, config_backup_file, force: true)
|
|
176
|
+
FileUtils.rm_f(source)
|
|
177
|
+
true
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def remove_tokens!
|
|
181
|
+
path = tokens_path
|
|
182
|
+
return false unless File.file?(path)
|
|
183
|
+
|
|
184
|
+
FileUtils.rm_f(path)
|
|
176
185
|
true
|
|
177
186
|
end
|
|
178
187
|
|
data/lib/flycal/cli/hooks.rb
CHANGED
|
@@ -19,14 +19,16 @@ module Cli
|
|
|
19
19
|
return if skip_post_uninstall?
|
|
20
20
|
return unless interactive?
|
|
21
21
|
return unless last_flycal_cli_install?
|
|
22
|
-
return unless
|
|
22
|
+
return unless uninstall_cleanup_needed?
|
|
23
23
|
|
|
24
|
-
print "#{
|
|
24
|
+
print "#{uninstall_text('hooks.after_uninstall.prompt')} "
|
|
25
25
|
return unless accept_default_no?
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
backed_up = Config.backup_and_remove_config!
|
|
28
|
+
Config.remove_tokens!
|
|
29
|
+
|
|
30
|
+
puts uninstall_text("hooks.after_uninstall.saved", { backup: Config.config_backup_file }) if backed_up
|
|
31
|
+
puts uninstall_text("hooks.after_uninstall.tokens_removed")
|
|
30
32
|
end
|
|
31
33
|
|
|
32
34
|
def after_login
|
|
@@ -77,6 +79,19 @@ module Cli
|
|
|
77
79
|
true
|
|
78
80
|
end
|
|
79
81
|
|
|
82
|
+
def uninstall_cleanup_needed?
|
|
83
|
+
File.file?(Config.config_file) || File.file?(Config.tokens_path)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Avoid Cli::Locale (it reads Config and would recreate config.yml after the backup).
|
|
87
|
+
def uninstall_text(key, vars = {})
|
|
88
|
+
previous = Thread.current[:flycal_locale_default_provider]
|
|
89
|
+
Thread.current[:flycal_locale_default_provider] = nil
|
|
90
|
+
Flycal::Locale.t(key, vars)
|
|
91
|
+
ensure
|
|
92
|
+
Thread.current[:flycal_locale_default_provider] = previous
|
|
93
|
+
end
|
|
94
|
+
|
|
80
95
|
def skip_cli_after_install?(argv)
|
|
81
96
|
argv = Array(argv)
|
|
82
97
|
return true if argv.intersect?(%w[--version -v --help -h])
|
data/lib/flycal.rb
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Under Rails, Zeitwerk autoloads lib/flycal/*.
|
|
5
5
|
# The CLI gem entrypoint (flycal_cli/lib/flycal_cli.rb) eager-requires what it needs.
|
|
6
6
|
module Flycal
|
|
7
|
-
VERSION = "1.5.
|
|
7
|
+
VERSION = "1.5.2"
|
|
8
8
|
|
|
9
9
|
def self.connect(credentials:)
|
|
10
10
|
Client.new(credentials: credentials)
|
data/locales/en.json
CHANGED
|
@@ -63,8 +63,9 @@
|
|
|
63
63
|
"goodbye": "happy calendling!"
|
|
64
64
|
},
|
|
65
65
|
"after_uninstall": {
|
|
66
|
-
"prompt": "Remove
|
|
67
|
-
"saved": "Saved as %{backup}"
|
|
66
|
+
"prompt": "Remove Flycal config and Google session? config.yml will be saved as config.backup.yml, tokens.yml will be deleted (y/N):",
|
|
67
|
+
"saved": "Saved as %{backup}",
|
|
68
|
+
"tokens_removed": "Removed ~/.flycal/tokens.yml"
|
|
68
69
|
}
|
|
69
70
|
},
|
|
70
71
|
"errors": {
|
data/locales/it.json
CHANGED
|
@@ -63,8 +63,9 @@
|
|
|
63
63
|
"goodbye": "happy calendling!"
|
|
64
64
|
},
|
|
65
65
|
"after_uninstall": {
|
|
66
|
-
"prompt": "Vuoi rimuovere
|
|
67
|
-
"saved": "Salvato in %{backup}"
|
|
66
|
+
"prompt": "Vuoi rimuovere la configurazione e la sessione Google? config.yml verrà salvato come config.backup.yml, tokens.yml verrà cancellato (y/N):",
|
|
67
|
+
"saved": "Salvato in %{backup}",
|
|
68
|
+
"tokens_removed": "Rimosso ~/.flycal/tokens.yml"
|
|
68
69
|
}
|
|
69
70
|
},
|
|
70
71
|
"errors": {
|