fastlane-plugin-rearchive 1.0.0 → 1.0.1

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
  SHA256:
3
- metadata.gz: aaaa414623759395560b9da0d24a575fd59678d3327b12ed85d68dbe73bd2fa3
4
- data.tar.gz: c50be7ac069ee08357a829cf507583a2477022e8af405ff1b38f43d6a7c0ffc2
3
+ metadata.gz: 07b36f4705fba17177e7fcfe57534453d40939f36f1ca13e9450b3ad64a8bede
4
+ data.tar.gz: 331f2ddaec7d48f6da97b352acbf98d499754e6635c01d62c90ab81c14802da0
5
5
  SHA512:
6
- metadata.gz: 996314def095d3347e27e4649435b80fff572e69ca34e227a34394dc031d96e3d2ea052b5be11d161280f2ac5216765e3ea38d3ecbe2f8f0532b7d4e2718168d
7
- data.tar.gz: 695e6151afae12e91c696caab88a33ca8ca7ccf8ecc2c94744cb17b42bd9f56c0691def6fb80daccb92f1a63aa51a9d74717ce0682c668c9cc9c38a1f40e0cb1
6
+ metadata.gz: 040d78db5848930903337beae05e89604ba90c964c26b0d5e12560ccd45fb4b66af6f3b196b4659f8096956c259535a0dc75bfeb7c92fa9f02c13226ae385ecd
7
+ data.tar.gz: b76b6f0d6a86895cc23470ab6f5b848711d81bf24f1616bca7adb31f0b10336aad610283fbef94b9133a11bac8f0bac487078643cd587e6e26acd698d6fdf5d6
@@ -32,9 +32,11 @@ module Fastlane
32
32
  archive.delete(archive.app_path(path))
33
33
  end
34
34
  end
35
- plist_buddy.exec("Delete #{icon_files_key}")
36
- rescue RuntimeError => _e
35
+ rescue RuntimeError => e
36
+ FastlaneCore::UI.message(e)
37
37
  next
38
+ end.each do |(icon_files_key, _)|
39
+ plist_buddy.exec("Delete #{icon_files_key}")
38
40
  end
39
41
  JSON.parse(File.read(iconset_manifest_path))["images"].select do |image|
40
42
  image["filename"]
@@ -54,34 +56,34 @@ module Fastlane
54
56
  idiom_suffix = idiom == "iphone" ? "" : "~#{idiom}"
55
57
  icons_plist_key = ":CFBundleIcons#{idiom_suffix}:CFBundlePrimaryIcon:CFBundleIconFiles"
56
58
  plist_buddy.exec("Add #{icons_plist_key} array")
57
- icons.each do |i|
58
- relative_path = archive.app_path((i[:target]).to_s)
59
+ icons.each do |icon|
60
+ relative_path = archive.app_path((icon[:target]).to_s)
59
61
  local_path = archive.local_path(relative_path)
60
- system("cp #{i[:source].shellescape} #{local_path.shellescape}", exception: true)
62
+ system("cp #{icon[:source].shellescape} #{local_path.shellescape}", exception: true)
61
63
  archive.replace(relative_path)
62
- end
63
- icons.map { |i| i[:name] }.uniq.each_with_index do |key, index|
64
- plist_buddy.exec("Add #{icons_plist_key}:#{index} string #{key}")
64
+ end.map do |icon|
65
+ icon[:name]
66
+ end.uniq.each do |key|
67
+ plist_buddy.exec("Add #{icons_plist_key}: string #{key}")
65
68
  end
66
69
  end
67
70
  Dir.mktmpdir do |dir|
68
71
  Dir.chdir(dir) do
69
72
  IO.popen(%W[
70
- #{IO.popen("xcode-select -p", &:read).chomp}/usr/bin/actool
71
- --output-format=human-readable-text
73
+ /usr/bin/actool
74
+ --output-format human-readable-text
72
75
  --notices
73
76
  --warnings
74
- --output-partial-info-plist=assetcatalog_generated_info.plist
75
- --app-icon=#{File.basename(iconset_path, ".appiconset")}
77
+ --output-partial-info-plist assetcatalog_generated_info.plist
78
+ --app-icon #{File.basename(iconset_path, ".appiconset")}
76
79
  --compress-pngs
77
- --enable-on-demand-resources=YES
78
- --sticker-pack-identifier-prefix=#{plist_buddy.exec("Print CFBundleIdentifier")}.sticker-pack.
79
- --development-region=English
80
- --target-device=iphone
81
- --target-device=ipad
82
- --minimum-deployment-target=#{plist_buddy.exec("Print MinimumOSVersion")}
83
- --platform=iphoneos
84
- --product-type=com.apple.product-type.application
80
+ --enable-on-demand-resources YES
81
+ --sticker-pack-identifier-prefix #{plist_buddy.exec("Print CFBundleIdentifier")}.sticker-pack.
82
+ --target-device iphone
83
+ --target-device ipad
84
+ --minimum-deployment-target #{plist_buddy.exec("Print MinimumOSVersion")}
85
+ --platform iphoneos
86
+ --product-type com.apple.product-type.application
85
87
  --compile
86
88
  .
87
89
  #{File.dirname(iconset_path)}
@@ -40,7 +40,7 @@ module Fastlane
40
40
  optional: false,
41
41
  type: String),
42
42
 
43
- FastlaneCore::ConfigItem.new(key: :replace_files,
43
+ FastlaneCore::ConfigItem.new(key: :files,
44
44
  description: "Files that should be replaced",
45
45
  optional: false,
46
46
  type: Hash)
@@ -41,7 +41,7 @@ module Fastlane
41
41
 
42
42
  def self.extract_app_path(archive_path)
43
43
  plist_buddy = PlistBuddy.new("#{archive_path}/Info.plist")
44
- plist_buddy.exec("Print :ApplicationProperties:ApplicationPath").strip
44
+ plist_buddy.exec("Print :ApplicationProperties:ApplicationPath")
45
45
  end
46
46
  end
47
47
  end
@@ -9,7 +9,7 @@ module Fastlane
9
9
 
10
10
  def exec(command)
11
11
  FastlaneCore::UI.verbose("/usr/libexec/PlistBuddy -c \"#{command}\" \"#{@plist_path}\"")
12
- result = IO.popen("/usr/libexec/PlistBuddy -c \"#{command}\" \"#{@plist_path}\"", &:read).chomp
12
+ result = IO.popen("/usr/libexec/PlistBuddy -c \"#{command}\" \"#{@plist_path}\"", &:read).gsub(/\A\s*"?|"?\s*\z/m, "")
13
13
 
14
14
  if $?.exitstatus.nonzero?
15
15
  FastlaneCore::UI.important("PlistBuddy command failed: #{result}")
@@ -26,11 +26,20 @@ module Fastlane
26
26
 
27
27
  result_lines = result.lines.map(&:chop)
28
28
 
29
- raise "value is not an array: #{result_lines}" unless result_lines.first == "Array {"
29
+ case RUBY_PLATFORM
30
+ when "x86_64-linux", "aarch64-linux-gnu"
31
+ raise "value is not an array (#{RUBY_PLATFORM}): #{result_lines}" unless result_lines.first == "("
30
32
 
31
- array_values = result_lines.drop(1).take(result_lines.size - 2)
33
+ result_lines.drop(1).take(result_lines.size - 2).map do |line|
34
+ line[1..line.size].sub(/,$/, "")
35
+ end
36
+ else
37
+ raise "value is not an array (#{RUBY_PLATFORM}): #{result_lines}" unless result_lines.first == "Array {"
32
38
 
33
- return array_values.map { |line| line[4..line.size] }
39
+ result_lines.drop(1).take(result_lines.size - 2).map do |line|
40
+ line[4..line.size]
41
+ end
42
+ end
34
43
  end
35
44
 
36
45
  def parse_dict_keys(entry)
@@ -38,14 +47,20 @@ module Fastlane
38
47
 
39
48
  result_lines = entry.lines.map(&:chop)
40
49
 
41
- raise "value is not an dict: #{result_lines}" unless result_lines.first == "Dict {"
50
+ case RUBY_PLATFORM
51
+ when "x86_64-linux", "aarch64-linux-gnu"
52
+ raise "value is not an dict (#{RUBY_PLATFORM}): #{result_lines}" unless result_lines.first == "{"
42
53
 
43
- keys = result_lines
44
- .map { |l| l.match(/^\s{4}([^\s}]+)/) }
45
- .select { |l| l }
46
- .map { |l| l[1] }
54
+ result_lines.map do |line|
55
+ line.match(/(?<=^\t)[^\s}]+/)
56
+ end
57
+ else
58
+ raise "value is not an dict (#{RUBY_PLATFORM}): #{result_lines}" unless result_lines.first == "Dict {"
47
59
 
48
- return keys
60
+ result_lines.map do |line|
61
+ line.match(/(?<=^\s{4})[^\s}]+/)
62
+ end
63
+ end.compact.map(&:to_s)
49
64
  end
50
65
  end
51
66
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Rearchive
3
- VERSION = "1.0.0"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-rearchive
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - naoigcat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-04 00:00:00.000000000 Z
11
+ date: 2023-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler