captive-release 0.7.2 → 0.8.0
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '028b75d95da7f0c5ae533774c1fc1bc353234bd569a58f9c83798e0519a592c2'
|
|
4
|
+
data.tar.gz: bb5a5ffbbaf260dad04cd28afb303c476ae5dff295454bbf1b95708bfba58126
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ee228007f5b5cb48c7d2fb2402a019c287b4d2a8dc1e37df0e6a0f3c159af97ce4aa3e5e95e57d6b1b947538414c081ea78a998a056a8db80770d263ea3371d9
|
|
7
|
+
data.tar.gz: 1a0ae25c85c204a1ac5431a4d1e704b67715b77c281763b103ff90da04a1a8550b628f4f1e3a785d743a1ec78b9c2d02b328ef1bee37ec5955085ad12b59666d
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "
|
|
3
|
+
require "yaml"
|
|
4
4
|
require_relative "locale"
|
|
5
5
|
|
|
6
6
|
module CaptiveRelease
|
|
7
|
-
# Les textes de la CLI dans la langue du développeur, lus
|
|
7
|
+
# Les textes de la CLI dans la langue du développeur, lus depuis locales/*.yml.
|
|
8
8
|
#
|
|
9
9
|
# Cette unité change quand la façon de retrouver un texte change, les fichiers YAML quand un
|
|
10
|
-
# texte change, Locale quand la détection de la langue change.
|
|
11
|
-
#
|
|
10
|
+
# texte change, Locale quand la détection de la langue change. Pas de gem i18n : la formule
|
|
11
|
+
# Homebrew installe la gem sans ses dépendances, une dépendance runtime casse l'installation.
|
|
12
12
|
module Messages
|
|
13
|
-
OUI
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
OUI = %w[y yes o oui].freeze
|
|
14
|
+
CATALOGUES = Locale::SUPPORTED.to_h do |langue|
|
|
15
|
+
[ langue, YAML.load_file("#{__dir__}/locales/#{langue}.yml").dig(langue, "captive_release") ]
|
|
16
|
+
end.freeze
|
|
16
17
|
|
|
17
18
|
def self.locale = @locale ||= Locale.detect
|
|
18
19
|
|
|
@@ -20,9 +21,16 @@ module CaptiveRelease
|
|
|
20
21
|
@locale = langue
|
|
21
22
|
end
|
|
22
23
|
|
|
23
|
-
#
|
|
24
|
-
#
|
|
25
|
-
def self.t(cle, **valeurs)
|
|
24
|
+
# fetch : un texte manquant doit casser la suite de tests, pas s'afficher vide devant le
|
|
25
|
+
# développeur. Un texte qui dépend du nombre porte ses formes one et other.
|
|
26
|
+
def self.t(cle, **valeurs)
|
|
27
|
+
texte = catalogue.fetch(cle.to_s)
|
|
28
|
+
texte = texte.fetch(valeurs[:count] == 1 ? "one" : "other") if texte.is_a?(Hash)
|
|
29
|
+
format(texte, **valeurs)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def self.catalogue = CATALOGUES.fetch(locale)
|
|
33
|
+
private_class_method :catalogue
|
|
26
34
|
|
|
27
35
|
# « o » comme « y » : l'invite française propose [o/N], mais un réflexe anglais ne doit
|
|
28
36
|
# pas se transformer en refus.
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
module CaptiveRelease
|
|
4
4
|
# Quels fichiers d'un dépôt portent une version, et sous quel format.
|
|
5
5
|
class VersionDetector
|
|
6
|
-
RUBY_VERSION_PATTERN
|
|
7
|
-
|
|
6
|
+
RUBY_VERSION_PATTERN = /VERSION\s*=\s*["'].+?["']/
|
|
7
|
+
EXPO_APP_JSON_PATTERN = /"expo"\s*:.*"version"\s*:/m
|
|
8
|
+
GRADLE_PATH = %w[android app build.gradle].freeze
|
|
8
9
|
|
|
9
10
|
def self.scan(root = ".")
|
|
10
11
|
new(root).scan
|
|
@@ -17,6 +18,7 @@ module CaptiveRelease
|
|
|
17
18
|
def scan
|
|
18
19
|
by_name("package.json", "package_json") +
|
|
19
20
|
by_name("app.config.js", "app_config_js") +
|
|
21
|
+
by_content(%w[** app.json], "app_json", EXPO_APP_JSON_PATTERN) +
|
|
20
22
|
by_content(%w[lib ** version.rb], "ruby_version", RUBY_VERSION_PATTERN) +
|
|
21
23
|
by_name("VERSION", "plain") +
|
|
22
24
|
android_gradle +
|
|
@@ -23,7 +23,7 @@ module CaptiveRelease
|
|
|
23
23
|
|
|
24
24
|
def write(content, old_version, new_version) = @write.call(content, old_version, new_version)
|
|
25
25
|
|
|
26
|
-
#
|
|
26
|
+
# Cinq des sept formats ne diffèrent que par le motif qui capture la version et par la
|
|
27
27
|
# forme du remplacement. Les décrire un par un faisait apparier leurs lambdas par Flay.
|
|
28
28
|
#
|
|
29
29
|
# Le motif qui retrouve la version à remplacer est dérivé de celui qui la capture : le
|
|
@@ -73,6 +73,10 @@ module CaptiveRelease
|
|
|
73
73
|
"app_config_js" => by_label(/version:\s*/, "version: "),
|
|
74
74
|
"android_gradle" => by_label(/versionName\s+/, "versionName "),
|
|
75
75
|
|
|
76
|
+
# Pas de JSON.parse : Expo tolère les virgules finales qu'il refuserait.
|
|
77
|
+
"app_json" => by_pattern(/"version"\s*:\s*"(.+?)"/, %("version": "x.y.z")) \
|
|
78
|
+
{ |_, nouvelle| %("version": "#{nouvelle}") },
|
|
79
|
+
|
|
76
80
|
"ios_plist" => by_pattern(
|
|
77
81
|
%r{<key>CFBundleShortVersionString</key>\s*<string>(.+?)</string>},
|
|
78
82
|
"CFBundleShortVersionString key",
|
metadata
CHANGED
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: captive-release
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Captive Studio
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
-
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: i18n
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - '='
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: 1.15.2
|
|
19
|
-
type: :runtime
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - '='
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: 1.15.2
|
|
11
|
+
dependencies: []
|
|
26
12
|
description: Gère les bumps de version (patch/minor/major/custom), met à jour package.json
|
|
27
13
|
et fichiers VERSION, crée le commit, le tag et la release GitHub.
|
|
28
14
|
email:
|