fastlane-plugin-onesky 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f01209a76cfd86ee3fdde349cf23ce589c2c9414
4
+ data.tar.gz: 29f3e02daf777744c56c94b13fbbb6e3f58540ea
5
+ SHA512:
6
+ metadata.gz: a18305dbeaa514607bad66a6ec8b833d5b59834b1493a8ba3f664ad2545f33d558d99eaad36a3e8303007cc0529cdce1781f3c404256e8dc7239e9f24a76eedb
7
+ data.tar.gz: fe0b9d70207231419ad32283efbcaa6fd3da8cc5de219790d224a011a4ee9739aabaaf435080cb28f50f8a5e8de6cb832021cd668e468e49103817731c47e529
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Daniel Kiedrowski <daniel@levire.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,105 @@
1
+ # OneSky Fastlane Plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-onesky)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-onesky`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin onesky
11
+ ```
12
+
13
+ ## About
14
+
15
+ This fastlane plugin helps you to update the translations of your app using the OneSky service. You can upload your current base localization file with `onesky_upload` and download new translations with `onesky_download` from OneSky.
16
+
17
+ OneSky is a translation service for to help ypu translate your iOS, Android, Websites and Software. TO find out more about the OneSky Service, please head over to http://www.oneskyapp.com.
18
+
19
+ ## Reference and Example
20
+
21
+ The OneSky fastlane plugin provides two new actions: `onesky_upload` and `onesky_download`
22
+
23
+ ### `onesky_upload`
24
+
25
+ Uploads a new translation file to the onesky service.
26
+
27
+ ````ruby
28
+ onesky_upload(
29
+ public_key: "abc123abc123abc123abc123abc123abc",
30
+ secret_key: "xyz890xyz890xyz890xyz890xyz890xyz",
31
+ project_id: "1234",
32
+ strings_file_path: "./localizations/en.xliff",
33
+ strings_file_format: "XLIFF",
34
+ deprecate_missing: true
35
+ )
36
+ ````
37
+
38
+ Parameter | Description
39
+ --------- | -----------
40
+ `public_key` | Your OneSky account public key. You retrive it by logging into your OneSky account, go to *Settings* and then *API Keys & Usages*.
41
+ `private_key` | Your OneSky account private key. You retrive it by logging into your OneSky account, go to *Settings* and then *API Keys & Usages*.
42
+ `project_id` | The ID of the project you want the tranlstions uploaded for. You retrive it, by logging into your OneSky account, navigate to your projects overview and copy the number behind the # in the brackets. (i.e. (#1234) -> `"1234"`)
43
+ `strings_file_path` | The file path to the localization file you want to upload.
44
+ `strings_file_format` | The format of localization file you want to upload. For more information about the available types head over to https://github.com/onesky/api-documentation-platform/blob/master/reference/format.md.
45
+ `deprecate_missing` | *(optional)* Indicates whether the strings that aren't available in the new translation file should be marked as deprecated. Defaults to `false`.
46
+
47
+ ### `onesky_download`
48
+
49
+ Uploads a new translation file to the onesky service.
50
+
51
+ ````ruby
52
+ onesky_download(
53
+ public_key: "abc123abc123abc123abc123abc123abc",
54
+ secret_key: "xyz890xyz890xyz890xyz890xyz890xyz",
55
+ project_id: "1234",
56
+ locale: "de",
57
+ filename: "en.xliff",
58
+ destination: "./localizations/de.xliff"
59
+ )
60
+ ````
61
+
62
+ Parameter | Description
63
+ --------- | -----------
64
+ `public_key` | Your OneSky account public key. You retrive it by logging into your OneSky account, go to *Settings* and then *API Keys & Usages*.
65
+ `private_key` | Your OneSky account private key. You retrive it by logging into your OneSky account, go to *Settings* and then *API Keys & Usages*.
66
+ `project_id` | The ID of the project you want the tranlstions downloaded for. You retrive it, by logging into your OneSky account, navigate to your projects overview and copy the number behind the # in the brackets. (i.e. (#1234) -> `"1234"`)
67
+ `locale` | The locale your wnat to download the translation for.
68
+ `filename` | The filename fo the file you want the translation for. It is the name of your original uploaded file.
69
+ `destination` | Filepath of the file to write the translations to.
70
+
71
+ ## Run tests for this plugin
72
+
73
+ To run both the tests, and code style validation, run
74
+
75
+ ```
76
+ rake
77
+ ```
78
+
79
+ To automatically fix many of the styling issues, use
80
+ ```
81
+ rubocop -a
82
+ ```
83
+
84
+ ## Issues and Feedback
85
+
86
+ For any other issues and feedback about this plugin, please submit it to this repository.
87
+
88
+ ## Troubleshooting
89
+
90
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
91
+
92
+ ## Using `fastlane` Plugins
93
+
94
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
95
+
96
+ ## About `fastlane`
97
+
98
+ `fastlane` is the easiest way to automate building and releasing your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
99
+
100
+ ## Acknowledgements
101
+ The code for the upload action is based on the fastlane plugin `upload_to_onesky` by [@joshrlesch](https://github.com/joshrlesch):
102
+ https://github.com/joshrlesch/fastlane-plugin-upload_to_onesky
103
+
104
+
105
+ This plugin was developed for and during the work on the [Youpooly iOS App](https://www.youpooly.com).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/onesky/version'
2
+
3
+ module Fastlane
4
+ module Onesky
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::Onesky.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,81 @@
1
+ module Fastlane
2
+ module Actions
3
+ class OneskyDownloadAction < Action
4
+ def self.run(params)
5
+ Actions.verify_gem!('onesky-ruby')
6
+ require 'onesky'
7
+
8
+ client = ::Onesky::Client.new(params[:public_key], params[:secret_key])
9
+ project = client.project(params[:project_id])
10
+
11
+ UI.success "Downloading translation '#{params[:locale]}' of file '#{params[:filename]}' from OneSky to: '#{params[:destination]}'"
12
+ resp = project.export_translation(source_file_name: params[:filename], locale: params[:locale])
13
+ File.open(params[:destination], 'w') { |file| file.write(resp) }
14
+ end
15
+
16
+ def self.description
17
+ 'Download a translation file from OneSky'
18
+ end
19
+
20
+ def self.authors
21
+ ['danielkiedrowski']
22
+ end
23
+
24
+ def self.available_options
25
+ [
26
+ FastlaneCore::ConfigItem.new(key: :public_key,
27
+ env_name: 'ONESKY_PUBLIC_KEY',
28
+ description: 'Public key for OneSky',
29
+ is_string: true,
30
+ optional: false,
31
+ verify_block: proc do |value|
32
+ raise "No Public Key for OneSky given, pass using `public_key: 'token'`".red unless value and !value.empty?
33
+ end),
34
+ FastlaneCore::ConfigItem.new(key: :secret_key,
35
+ env_name: 'ONESKY_SECRET_KEY',
36
+ description: 'Secret Key for OneSky',
37
+ is_string: true,
38
+ optional: false,
39
+ verify_block: proc do |value|
40
+ raise "No Secret Key for OneSky given, pass using `secret_key: 'token'`".red unless value and !value.empty?
41
+ end),
42
+ FastlaneCore::ConfigItem.new(key: :project_id,
43
+ env_name: 'ONESKY_PROJECT_ID',
44
+ description: 'Project Id to upload file to',
45
+ optional: false,
46
+ verify_block: proc do |value|
47
+ raise "No project id given, pass using `project_id: 'id'`".red unless value and !value.empty?
48
+ end),
49
+ FastlaneCore::ConfigItem.new(key: :locale,
50
+ env_name: 'ONESKY_DOWNLOAD_LOCALE',
51
+ description: 'Locale to download the translation for',
52
+ is_string: true,
53
+ optional: false,
54
+ verify_block: proc do |value|
55
+ raise 'No locale for translation given'.red unless value and !value.empty?
56
+ end),
57
+ FastlaneCore::ConfigItem.new(key: :filename,
58
+ env_name: 'ONESKY_DOWNLOAD_FILENAME',
59
+ description: 'Name of the file to download the localization for',
60
+ is_string: true,
61
+ optional: false,
62
+ verify_block: proc do |value|
63
+ raise "No filename given. Please specify the filename of the file you want to download the translations for using `filename: 'filename'`".red unless value and !value.empty?
64
+ end),
65
+ FastlaneCore::ConfigItem.new(key: :destination,
66
+ env_name: 'ONESKY_DOWNLOAD_DESTINATION',
67
+ description: 'Destination file to write the downloaded file to',
68
+ is_string: true,
69
+ optional: false,
70
+ verify_block: proc do |value|
71
+ raise "Please specify the filename of the desrtination file you want to download the translations to using `destination: 'filename'`".red unless value and !value.empty?
72
+ end)
73
+ ]
74
+ end
75
+
76
+ def self.is_supported?(platform)
77
+ true
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,89 @@
1
+ module Fastlane
2
+ module Actions
3
+ class OneskyUploadAction < Action
4
+ def self.run(params)
5
+ Actions.verify_gem!('onesky-ruby')
6
+ require 'onesky'
7
+
8
+ client = ::Onesky::Client.new(params[:public_key], params[:secret_key])
9
+
10
+ project = client.project(params[:project_id])
11
+
12
+ UI.success 'Starting the upload to OneSky'
13
+ resp = project.upload_file(
14
+ file: params[:strings_file_path],
15
+ file_format: params[:strings_file_format],
16
+ is_keeping_all_strings: !params[:deprecate_missing]
17
+ )
18
+
19
+ if resp.code == 201
20
+ UI.success "#{File.basename params[:strings_file_path]} was successfully uploaded to project #{params[:project_id]} in OneSky"
21
+ else
22
+ UI.error "Error uploading file to OneSky, Status code is #{resp.code}"
23
+ end
24
+ end
25
+
26
+ def self.description
27
+ 'Upload a strings file to OneSky'
28
+ end
29
+
30
+ def self.authors
31
+ ['JMoravec', 'joshrlesch', 'danielkiedrowski']
32
+ end
33
+
34
+ def self.available_options
35
+ [
36
+ FastlaneCore::ConfigItem.new(key: :public_key,
37
+ env_name: 'ONESKY_PUBLIC_KEY',
38
+ description: 'Public key for OneSky',
39
+ is_string: true,
40
+ optional: false,
41
+ verify_block: proc do |value|
42
+ raise "No Public Key for OneSky given, pass using `public_key: 'token'`".red unless value and !value.empty?
43
+ end),
44
+ FastlaneCore::ConfigItem.new(key: :secret_key,
45
+ env_name: 'ONESKY_SECRET_KEY',
46
+ description: 'Secret Key for OneSky',
47
+ is_string: true,
48
+ optional: false,
49
+ verify_block: proc do |value|
50
+ raise "No Secret Key for OneSky given, pass using `secret_key: 'token'`".red unless value and !value.empty?
51
+ end),
52
+ FastlaneCore::ConfigItem.new(key: :project_id,
53
+ env_name: 'ONESKY_PROJECT_ID',
54
+ description: 'Project Id to upload file to',
55
+ optional: false,
56
+ verify_block: proc do |value|
57
+ raise "No project id given, pass using `project_id: 'id'`".red unless value and !value.empty?
58
+ end),
59
+ FastlaneCore::ConfigItem.new(key: :strings_file_path,
60
+ env_name: 'ONESKY_STRINGS_FILE_PATH',
61
+ description: 'Base file path for the strings file to upload',
62
+ is_string: true,
63
+ optional: false,
64
+ verify_block: proc do |value|
65
+ raise "Couldn't find file at path '#{value}'".red unless File.exist?(value)
66
+ end),
67
+ FastlaneCore::ConfigItem.new(key: :strings_file_format,
68
+ env_name: 'ONESKY_STRINGS_FORMAT',
69
+ description: 'Format of the strings file: see https://github.com/onesky/api-documentation-platform/blob/master/reference/format.md',
70
+ is_string: true,
71
+ optional: false,
72
+ verify_block: proc do |value|
73
+ raise 'No file format given'.red unless value and !value.empty?
74
+ end),
75
+ FastlaneCore::ConfigItem.new(key: :deprecate_missing,
76
+ env_name: 'ONESKY_DEPRECATE_MISSING',
77
+ description: 'Should missing phrases be marked as deprecated in OneSky?',
78
+ is_string: false,
79
+ optional: true,
80
+ default_value: false)
81
+ ]
82
+ end
83
+
84
+ def self.is_supported?(platform)
85
+ true
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,12 @@
1
+ module Fastlane
2
+ module Helper
3
+ class OneskyHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::OneskyHelper.your_method`
6
+ #
7
+ def self.show_message
8
+ UI.message("Hello from the onesky plugin helper!")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Onesky
3
+ VERSION = "0.2.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-onesky
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Kiedrowski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: onesky-ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fastlane
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.105.3
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.105.3
111
+ description:
112
+ email: daniel@levire.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - LICENSE
118
+ - README.md
119
+ - lib/fastlane/plugin/onesky.rb
120
+ - lib/fastlane/plugin/onesky/actions/onesky_download_action.rb
121
+ - lib/fastlane/plugin/onesky/actions/onesky_upload_action.rb
122
+ - lib/fastlane/plugin/onesky/helper/onesky_helper.rb
123
+ - lib/fastlane/plugin/onesky/version.rb
124
+ homepage: https://github.com/danielkiedrowski/fastlane-plugin-onesky
125
+ licenses:
126
+ - MIT
127
+ metadata: {}
128
+ post_install_message:
129
+ rdoc_options: []
130
+ require_paths:
131
+ - lib
132
+ required_ruby_version: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ requirements: []
143
+ rubyforge_project:
144
+ rubygems_version: 2.6.6
145
+ signing_key:
146
+ specification_version: 4
147
+ summary: Helps to update the translations of your app using the OneSky service.
148
+ test_files: []