fastlane-plugin-poesie 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c437e4dd6b6b407b172c41c40e568e9ed5679e2ee5d4c2d4ba58a15f7960d3d8
4
- data.tar.gz: 1f5f106ccdbc3b0d0f1f5e6ba238b613ce53408c54f02db2cf7620be3e5444a3
3
+ metadata.gz: 0f858952c1cf77728663bf46b04a143fde7f32d29e2b8ac9c47fd579c986f567
4
+ data.tar.gz: f006deaf84f22998f74dfa2ff43d6affb09627e9b38ac0297714f83e095ef104
5
5
  SHA512:
6
- metadata.gz: 32a6726ba81324858792913bc49960a8d39f2b3670d38ef828bd279de55064a665f062149ac174740f90a9ce01e589de02e197206513abe735569dbfac53f700
7
- data.tar.gz: 9016e13db868dbeefa3ba0cb3cb4a9efb21a9b5123e2322d2aa56ae177ff1cdc48222144c24b9e04b858b260ddce4b2c46bedf4c8e4e311d8b00335ec5803280
6
+ metadata.gz: 7c9dfa570524bf9abe93fbaafe9cab59739e48b4afa2568e094127a5418d0ca03a59f2f81274226e42d870a083679d6e52e38c203834e297d260b6fa57ab54fb
7
+ data.tar.gz: c4d5d12e28a0451da44010663cee67cae897c493f5665f1cd952dfb91264e4e7bc38d1918823d23d2efbd02af98cfc342a3ecd43f81025f3e7ffaacacf37747f
@@ -1,4 +1,3 @@
1
- require 'fastlane/action'
2
1
  require 'poesie'
3
2
 
4
3
  module Fastlane
@@ -6,7 +5,11 @@ module Fastlane
6
5
  class PoesieAction < Action
7
6
  def self.run(params)
8
7
  exporter = ::Poesie::Exporter.new(params[:api_token], params[:project_id])
9
- params[:languages].each do |language|
8
+ languages = params[:languages]
9
+ if languages.nil?
10
+ languages = Helper::PoesieHelper.list_of_languages(params[:api_token], params[:project_id])
11
+ end
12
+ languages.each do |language|
10
13
  ::Poesie::Log::title("== Language #{language} ==")
11
14
  string_path = params[:string_files_path] + language + ".lproj/Localizable.strings"
12
15
  exporter.run(language) do |terms|
@@ -53,7 +56,7 @@ module Fastlane
53
56
  FastlaneCore::ConfigItem.new(key: :languages,
54
57
  env_name: "POEDITOR_SUPPORTED_LANGUAGES",
55
58
  description: "The languages to export",
56
- optional: false,
59
+ optional: true,
57
60
  type: Array),
58
61
  FastlaneCore::ConfigItem.new(key: :string_files_path,
59
62
  env_name: "PROJECT_STRING_FILES_PATH",
@@ -8,8 +8,20 @@ module Fastlane
8
8
  # class methods that you define here become available in your action
9
9
  # as `Helper::PoesieHelper.your_method`
10
10
  #
11
- def self.show_message
12
- UI.message("Hello from the poesie plugin helper!")
11
+ def self.list_of_languages(api_token, project_id)
12
+ uri = URI('https://api.poeditor.com/v2/languages/list')
13
+ res = Net::HTTP.post_form(uri, 'api_token' => api_token, 'id' => project_id, 'type' => 'json')
14
+ json = JSON.parse(res.body)
15
+ unless json['response']['status'] == 'success'
16
+ r = json['response']
17
+ puts "Error #{r['code']} (#{r['status']})\n#{r['message']}"
18
+ exit 1
19
+ end
20
+ json["result"]["languages"].map { |lan| lan["code"] }
21
+ end
22
+
23
+ def test
24
+ puts "wtf"
13
25
  end
14
26
  end
15
27
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Poesie
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.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.1.0
4
+ version: 0.2.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-08 00:00:00.000000000 Z
11
+ date: 2019-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: poesie