fastlane-plugin-poeditor_export 0.1.0 → 0.2.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
  SHA1:
3
- metadata.gz: 3480e05c4ee5cd94a28898769d667cd82a2284be
4
- data.tar.gz: a9c4cfca8dfc659b2683c49ff3a3f7440652e5f8
3
+ metadata.gz: f2a587922eb9f759bf04ddab0cbb0a0b6eded586
4
+ data.tar.gz: 412a3090cab4dea5caadc5194016ecf89f06f6d1
5
5
  SHA512:
6
- metadata.gz: 21e689915787f96532005ae6753b07ff14edc5c5ae9cb25838651107eee74bab3435ccf5cf32070aeb0dfa892b0dafd0280e8b798fda5918582df991324c30cd
7
- data.tar.gz: 0120057d74944c86909f49201f8c9a5ae5a90afc373a35d69ff0ccba6367a387384d5852fe05b7675de11b0e48c705534a5d4ea6a28fa4a6932a940a1819ef38
6
+ metadata.gz: 8cb0f0f92ed7c66e36a6d2d5fb7524edb96aa2859cb7a391707c918f4ae9ec6ff27d697cea0e122c547bc9988960758cd4a76e3a7bc57d0a4878cca678f1f3cb
7
+ data.tar.gz: 2f698b3393954444759fd7d3ab218fe96817c7f4a0b4647f4690083cdc27d500ab8262c1e25b57ac44e1b76097388d7719883d1ff4d02889d83b8d3fe07a2abe
data/README.md CHANGED
@@ -14,13 +14,9 @@ fastlane add_plugin poeditor_export
14
14
 
15
15
  Exports translations from POEditor.com
16
16
 
17
- **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
-
19
17
  ## Example
20
18
 
21
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
-
23
- **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
19
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
24
20
 
25
21
  ## Run tests for this plugin
26
22
 
@@ -30,7 +26,7 @@ To run both the tests, and code style validation, run
30
26
  rake
31
27
  ```
32
28
 
33
- To automatically fix many of the styling issues, use
29
+ To automatically fix many of the styling issues, use
34
30
  ```
35
31
  rubocop -a
36
32
  ```
@@ -2,7 +2,12 @@ module Fastlane
2
2
  module Actions
3
3
  class PoeditorExportAction < Action
4
4
  def self.run(params)
5
- UI.message("The poeditor_export plugin is working!")
5
+
6
+ file_uri = Helper::PoeditorExportHelper.export_for_lanaguage(params)
7
+ res = Net::HTTP.get_response(file_uri)
8
+
9
+ File.open(params[:output_path], 'w+') { |file| file.write(res.body) }
10
+ UI.message('Exported from POEditor!')
6
11
  end
7
12
 
8
13
  def self.description
@@ -15,19 +20,35 @@ module Fastlane
15
20
 
16
21
  def self.available_options
17
22
  [
18
- # FastlaneCore::ConfigItem.new(key: :your_option,
19
- # env_name: "POEDITOR_EXPORT_YOUR_OPTION",
20
- # description: "A description of your option",
21
- # optional: false,
22
- # type: String)
23
+ FastlaneCore::ConfigItem.new(key: :api_token,
24
+ env_name: "POEDITOR_API_TOKEN",
25
+ description: "The API token for a POEditor.com Account",
26
+ optional: false,
27
+ type: String),
28
+ FastlaneCore::ConfigItem.new(key: :project_id,
29
+ env_name: "POEDITOR_PROJECT_ID",
30
+ description: "The ID of the POEditor.com Project to export",
31
+ optional: false,
32
+ type: String),
33
+ FastlaneCore::ConfigItem.new(key: :export_format,
34
+ env_name: "POEDITOR_EXPORT_FORMAT",
35
+ description: "The format to export to",
36
+ optional: false,
37
+ type: String),
38
+ FastlaneCore::ConfigItem.new(key: :language,
39
+ env_name: "POEDITOR_EXPORT_LANGUAGE",
40
+ description: "The language to export",
41
+ optional: false,
42
+ type: String),
43
+ FastlaneCore::ConfigItem.new(key: :output_path,
44
+ env_name: "POEDITOR_OUTPUT_PATH",
45
+ description: "The output path for exported file",
46
+ optional: false,
47
+ type: String)
23
48
  ]
24
49
  end
25
50
 
26
51
  def self.is_supported?(platform)
27
- # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
28
- # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
29
- #
30
- # [:ios, :mac, :android].include?(platform)
31
52
  true
32
53
  end
33
54
  end
@@ -1,11 +1,23 @@
1
1
  module Fastlane
2
2
  module Helper
3
3
  class PoeditorExportHelper
4
- # class methods that you define here become available in your action
5
- # as `Helper::PoeditorExportHelper.your_method`
6
- #
7
- def self.show_message
8
- UI.message("Hello from the poeditor_export plugin helper!")
4
+ API_URL = 'https://poeditor.com/api/'
5
+ EXPORT_ACTION = 'export'
6
+
7
+ def self.export_for_lanaguage(params)
8
+ uri = URI(API_URL)
9
+
10
+ export_params = {
11
+ api_token: params[:api_token],
12
+ action: EXPORT_ACTION,
13
+ id: params[:project_id],
14
+ type: params[:export_format],
15
+ language: params[:language]
16
+ }
17
+
18
+ res = Net::HTTP.post_form(uri, export_params)
19
+ json = JSON.parse(res.body)
20
+ URI(json["item"])
9
21
  end
10
22
  end
11
23
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module PoeditorExport
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-poeditor_export
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
  - James Campbell
@@ -106,7 +106,7 @@ files:
106
106
  - lib/fastlane/plugin/poeditor_export/actions/poeditor_export_action.rb
107
107
  - lib/fastlane/plugin/poeditor_export/helper/poeditor_export_helper.rb
108
108
  - lib/fastlane/plugin/poeditor_export/version.rb
109
- homepage:
109
+ homepage: https://github.com/Supmenow/fastlane-plugin-poeditor_export
110
110
  licenses:
111
111
  - MIT
112
112
  metadata: {}