fastlane-plugin-poesie 0.2.0 → 0.3.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: 0f858952c1cf77728663bf46b04a143fde7f32d29e2b8ac9c47fd579c986f567
4
- data.tar.gz: f006deaf84f22998f74dfa2ff43d6affb09627e9b38ac0297714f83e095ef104
3
+ metadata.gz: 522a64de11d89de80904b62e34f3bb822cab0c428e113109efda313d2067ef28
4
+ data.tar.gz: 0b012087e2270ba93254f83291c73f2c9461e0c5b6c710306c481c89fbad6074
5
5
  SHA512:
6
- metadata.gz: 7c9dfa570524bf9abe93fbaafe9cab59739e48b4afa2568e094127a5418d0ca03a59f2f81274226e42d870a083679d6e52e38c203834e297d260b6fa57ab54fb
7
- data.tar.gz: c4d5d12e28a0451da44010663cee67cae897c493f5665f1cd952dfb91264e4e7bc38d1918823d23d2efbd02af98cfc342a3ecd43f81025f3e7ffaacacf37747f
6
+ metadata.gz: '073924908b39e144b542b310a4b40e2b27bed0bb293adeb3d05ee0b179781a914a36b1474e9b5e40c5847a18534c29776829c8f0feb1aa6d8878eec92cb24d35'
7
+ data.tar.gz: a2de6fa0f345dbece8548f8f656c715cc2fe5a33effdc0529712c79011d7e563eb0c8421018b5259c1a4f52fb2d43cba8736df395fc88cfe000e0fd328071378
@@ -9,9 +9,17 @@ module Fastlane
9
9
  if languages.nil?
10
10
  languages = Helper::PoesieHelper.list_of_languages(params[:api_token], params[:project_id])
11
11
  end
12
+
13
+ paths = Helper::PoesieHelper.path_for_localized_file(languages, params[:strings_file_name])
14
+
15
+ if paths.count != languages.count
16
+ ::Poesie.exit_with_error("Error while finding localized files.\nSearching for languages: #{languages}\nFound: #{paths.keys
17
+ }}")
18
+ end
19
+
12
20
  languages.each do |language|
13
21
  ::Poesie::Log::title("== Language #{language} ==")
14
- string_path = params[:string_files_path] + language + ".lproj/Localizable.strings"
22
+ string_path = paths[language]
15
23
  exporter.run(language) do |terms|
16
24
  # Localizable.strings
17
25
  ::Poesie::AppleFormatter::write_strings_file(
@@ -58,10 +66,10 @@ module Fastlane
58
66
  description: "The languages to export",
59
67
  optional: true,
60
68
  type: Array),
61
- FastlaneCore::ConfigItem.new(key: :string_files_path,
62
- env_name: "PROJECT_STRING_FILES_PATH",
63
- description: "The path to localized string files",
64
- optional: false,
69
+ FastlaneCore::ConfigItem.new(key: :strings_file_name,
70
+ env_name: "PROJECT_STRING_FILE_NAME",
71
+ description: "Name of a localized .strings file. Default is Localizable.strings",
72
+ optional: true,
65
73
  type: String)
66
74
  ]
67
75
  end
@@ -20,8 +20,26 @@ module Fastlane
20
20
  json["result"]["languages"].map { |lan| lan["code"] }
21
21
  end
22
22
 
23
- def test
24
- puts "wtf"
23
+ def self.path_for_localized_file(languages, filename = nil)
24
+ require 'find'
25
+
26
+ if filename.nil?
27
+ filename = "Localizable.strings"
28
+ end
29
+ paths = {}
30
+ Find.find(Dir.pwd) do |path|
31
+ if FileTest.file?(path) && File.basename(path) == filename
32
+ languages.each { |lang|
33
+ if File.basename(File.dirname(path)) == "#{lang}.lproj"
34
+ paths[lang] = path
35
+ end
36
+ }
37
+ Find.prune
38
+ else
39
+ next
40
+ end
41
+ end
42
+ paths
25
43
  end
26
44
  end
27
45
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Poesie
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-poesie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrik Potoček
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-11 00:00:00.000000000 Z
11
+ date: 2019-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: poesie