class Fastlane::Actions::ExportXliffAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb, line 34
def self.authors
  ["alexander sun"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb, line 52
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :xcodeproj,
                       env_name: "XLIFF_EN_GEN_PROJECT",
                       description: "Specify the path to your main Xcode project",
                       optional: false,
                       type: String,
                       verify_block: proc do |value|
                         UI.user_error!("Please specify your project file path") if !value.end_with? ".xcodeproj"
                         UI.user_error!("Could not find Xcode project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
                       end),
    FastlaneCore::ConfigItem.new(key: :exportLanguage,
                       env_name: "XLIFF_EN_GEN_LANGUAGE",
                       description: "target language",
                       optional: true,
                       type: String,
                       default_value: "en")
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb, line 30
def self.description
  "export xliff for an xcode project"
end
details() click to toggle source
# File lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb, line 48
def self.details
  "using "
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb, line 72
def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end
output() click to toggle source
# File lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb, line 42
def self.output
  [
    ['XE_XLIFF_LOCATION', 'Path to en.xliff']
  ]
end
return_value() click to toggle source
# File lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb, line 38
def self.return_value
  # If your method provides a return value, you can describe here what it does
end
run(params) click to toggle source
# File lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb, line 7
def self.run(params)

  projectPath = File.absolute_path(params[:xcodeproj])
  
  UI.message("Located project at: "+projectPath)

  workingPath = File.dirname(projectPath)

  dir = File.dirname(projectPath)
  
  file = File.basename(projectPath)
  
  sh ("cd #{dir} && xcodebuild -exportLocalizations -localizationPath #{workingPath} -project #{file} -exportLanguage en")

  xliffPath = File.join(workingPath, "en.xliff")

  Actions.lane_context[SharedValues::XE_XLIFF_LOCATION] = xliffPath

  xliffPath
end