fastlane-plugin-xliff_en_gen 0.3.1 → 0.4.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: 8d8183c6a8b7508ff5b180881040482a087c126c
4
- data.tar.gz: 035331dbbb3ce794a8ef98c412283b3e297398b3
3
+ metadata.gz: f52e504b6a930f6b8266dba33d5a7d1671a1c7b4
4
+ data.tar.gz: '08277625ce5e608abfb6565cd69e10ab9711e4e2'
5
5
  SHA512:
6
- metadata.gz: c7aee5bea143b2b77a6a369837ee1290e58495d47f367e4b7bb321daf9ad9652109239dfbc6bc911e2d3806d12de1e65ac1f354418183cbe2f1fdda6a346c2a1
7
- data.tar.gz: 92e1920ca35169ccd3b370a8a640bd99a18c9bdd19c52dba3a0f4550e4ee43ca842e067c83714ff00756a032f616e7f4fd7fa2f95a2f12395549f4224c40a9aa
6
+ metadata.gz: f6b0d3c0f66599717b6a468ac3d5b600b1f93fed3e68cbadbf09429d319f2e2bfb4b6c15545ecb3cfb53f5dff8faa72103566796d3355fc4444aa2d4a4698683
7
+ data.tar.gz: 537f39b2afa0506966536b66294c89a5b85b871c28d97cebcf9b5701c3e9cb758cbe992bbca85b4a1cf02fde54cc49bbd631fea46f1a860554ffeb640eb951c3
@@ -1,7 +1,11 @@
1
1
  module Fastlane
2
2
  module Actions
3
+ module SharedValues
4
+ XE_XLIFF_LOCATION = :XE_XLIFF_LOCATION
5
+ end
3
6
  class XliffEnGenAction < Action
4
7
  def self.run(params)
8
+
5
9
  require 'nokogiri'
6
10
 
7
11
  projectPath = File.absolute_path(params[:xcodeproj])
@@ -17,12 +21,14 @@ module Fastlane
17
21
  sh ("cd #{dir} && xcodebuild -exportLocalizations -localizationPath #{workingPath} -project #{file} -exportLanguage en")
18
22
 
19
23
  xliffPath = File.join(workingPath, "en.xliff")
24
+
25
+ Actions.lane_context[SharedValues::XE_XLIFF_LOCATION] = xliffPath
20
26
 
21
27
  doc = Nokogiri::XML(File.open(xliffPath))
22
28
 
23
29
  doc.remove_namespaces!
24
30
 
25
- UI.message("Found: "+doc.xpath("count(//file[@original='uan/en.lproj/Localizable.strings']/body/trans-unit)").to_s()+" translation unit")
31
+ UI.message("Found total: "+doc.xpath("count(//file[@original='uan/en.lproj/Localizable.strings']/body/trans-unit)").to_s()+" translation unit")
26
32
 
27
33
  transUnits = doc.xpath("//file[contains(@original,'Localizable.strings')]/body/trans-unit")
28
34
 
@@ -67,8 +73,12 @@ module Fastlane
67
73
 
68
74
  UI.message("Localizable moved to: "+localizablePath)
69
75
 
70
- FileUtils.rm xliffPath, :force => true
71
-
76
+ keepFile = params[:keepArtifacts]
77
+
78
+ if not keepFile
79
+ FileUtils.rm xliffPath, :force => true
80
+ end
81
+
72
82
  end
73
83
 
74
84
 
@@ -84,9 +94,15 @@ module Fastlane
84
94
  def self.return_value
85
95
  # If your method provides a return value, you can describe here what it does
86
96
  end
97
+ def self.output
98
+ [
99
+ ['XE_XLIFF_LOCATION', 'Path to en.xliff']
100
+ ]
101
+ end
87
102
 
88
103
  def self.details
89
- "Generate new Localizable.strings file based on the exported en.xliff by using xcode build, and over write the file based on the en.xliff.\n This will include nokogiri to parse xml."
104
+ "Generate new Localizable.strings file based on the exported en.xliff by using xcode build, and over write the file based on the en.xliff.\n This will include nokogiri to parse xml.
105
+ lane context XE_XLIFF_LOCATION will be used for store location of the en.xliff"
90
106
  end
91
107
 
92
108
  def self.available_options
@@ -107,7 +123,13 @@ module Fastlane
107
123
  type: String,
108
124
  verify_block: proc do |value|
109
125
  UI.user_error!("Could not find Localizable.strings project at path '#{File.expand_path(value)}'") if !File.exist?(value) and !Helper.is_test?
110
- end)
126
+ end),
127
+ FastlaneCore::ConfigItem.new(key: :keepArtifacts,
128
+ env_name: "XLIFF_EN_GEN_KEEP_ARTIFACTS",
129
+ description: "whether keep the en.xliff file for your use",
130
+ optional: true,
131
+ default_value: false,
132
+ type: TrueClass)
111
133
  ]
112
134
  end
113
135
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module XliffEnGen
3
- VERSION = "0.3.1"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-xliff_en_gen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - alexander sun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-25 00:00:00.000000000 Z
11
+ date: 2017-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri