Class: Fastlane::Actions::CreateTranslationAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::CreateTranslationAction
- Defined in:
- lib/fastlane/plugin/translation/actions/create_translation_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
37 38 39 |
# File 'lib/fastlane/plugin/translation/actions/create_translation_action.rb', line 37 def self. ["Krzysztof Piatkowski", "Jakob Jensen"] end |
.available_options ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/fastlane/plugin/translation/actions/create_translation_action.rb', line 48 def self. [ FastlaneCore::ConfigItem.new(key: :config_path, env_name: "FL_TRANSLATION_CONFIG_PATH", description: "reference for the config json file, see https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md for more info", optional: false), FastlaneCore::ConfigItem.new(key: :doc_name, env_name: "FL_TRANSLATION_DOC_NAME", description: "unique name of the google sheet", optional: false), FastlaneCore::ConfigItem.new(key: :owner_email, env_name: "FL_TRANSLATION_OWNER_EMAIL", description: "The mail to give ownership over the the document", optional: false), FastlaneCore::ConfigItem.new(key: :seed_email, env_name: "FL_TRANSLATION_SEED_EMAIL", description: "The mail to give rights when initializing the document", optional: false) ] end |
.description ⇒ Object
33 34 35 |
# File 'lib/fastlane/plugin/translation/actions/create_translation_action.rb', line 33 def self.description "Create sheet for translations in Google sheets." end |
.details ⇒ Object
44 45 46 |
# File 'lib/fastlane/plugin/translation/actions/create_translation_action.rb', line 44 def self.details nil end |
.is_supported?(platform) ⇒ Boolean
69 70 71 |
# File 'lib/fastlane/plugin/translation/actions/create_translation_action.rb', line 69 def self.is_supported?(platform) true end |
.return_value ⇒ Object
41 42 |
# File 'lib/fastlane/plugin/translation/actions/create_translation_action.rb', line 41 def self.return_value end |
.run(params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fastlane/plugin/translation/actions/create_translation_action.rb', line 6 def self.run(params) UI. "Logging into google using #{params[:config_path]}" session = GoogleDrive::Session.from_config(params[:config_path]) UI. "Creating document with title '#{params[:doc_name]}'" file = session.spreadsheet_by_title(params[:doc_name]) if file raise "Document already exists, please change to a different doc_name".red else tmp_file = "#{FastlaneCore::FastlaneFolder.path}/translations" f = File.open(tmp_file, "w") f.close file = session.upload_from_file(File.absolute_path(tmp_file).to_s, params[:doc_name], convert: true, content_type: "text/csv") File.delete(tmp_file) file.acl.push({ type: 'user', value: params[:owner_email], role: 'owner' }) file.acl.push({ type: 'user', value: params[:seed_email], role: 'writer' }) unless params[:owner_email] == params[:seed_email] UI. "Done creating document, use doc_id:'#{file.id}' for pulling translations.".yellow end end |