Class: Fastlane::Actions::ExportXliffAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb

Class Method Summary collapse

Class Method Details

.authorsObject



34
35
36
# File 'lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb', line 34

def self.authors
  ["alexander sun"]
end

.available_optionsObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# 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

.descriptionObject



30
31
32
# File 'lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb', line 30

def self.description
  "export xliff for an xcode project"
end

.detailsObject



48
49
50
# File 'lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb', line 48

def self.details
  "using "
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/fastlane/plugin/xliff_en_gen/actions/export_xliff.rb', line 72

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.outputObject



42
43
44
45
46
# 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_valueObject



38
39
40
# 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) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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