fastlane-plugin-polidea 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a3706fea486fadab41eb80201a9acba5b0dcd47
4
- data.tar.gz: d391b3a2d6eca7ce6bd7e0338c1332b3ccb58a61
3
+ metadata.gz: 8f75eb5cc2b56664bf3b36bd0b093c169f3fe505
4
+ data.tar.gz: 4ba202029f04c9a8f19d440eafa2b77e7dbaed69
5
5
  SHA512:
6
- metadata.gz: b25a716c8badb0492b7b4cc701e119e3ede5bc5ce591999bcd14ddacb282ea1fd7bb216be360094b3303f726e42162b2a62e2f72e94a1b3d4493abc7979b81da
7
- data.tar.gz: 6aae6cdf90b2e894a5eb0a4aa66c135315dbdd8b859a3ca96a1adc08e06ba4b575931a51b6678974c61b33ce1950159744cf2c7ab70a0f434a50774a79ea101f
6
+ metadata.gz: a40ba8d09c29abd1124f9d3e83d260c9813eb6af8b59c820c7936d2bc4c9bf5e20173799c7c32986b932f2e4db51f29b0dbf65d0b05946a5d843a686792539f5
7
+ data.tar.gz: da5dd3f1109375b19255dc1c2ddd4bb0eea2bcffd9c1395745ffa70d483d0434ddaaf6473df39e3c4593a88df8056336a01a00c7ea98ef1798663ec6ce917ca0
@@ -0,0 +1,71 @@
1
+ require 'securerandom'
2
+
3
+ module Fastlane
4
+ module Actions
5
+ module SharedValues
6
+ PREFIX_SCHEMA = :PREFIX_SCHEMA
7
+ end
8
+
9
+ class AddPrefixSchemaAction < Action
10
+ def self.run(config)
11
+ prefix_schema = generate_url_scheme
12
+
13
+ info_plists = Dir.glob(File.join(config[:path], "**/*Info.plist"))
14
+ UI.user_error!("There isn't any Info.plist in this directory") if info_plists.empty?
15
+ info_plists.each do |info_plist|
16
+ update_plist(info_plist, prefix_schema)
17
+ end
18
+
19
+ Actions.lane_context[SharedValues::PREFIX_SCHEMA] = prefix_schema
20
+
21
+ prefix_schema
22
+ end
23
+
24
+ def self.generate_url_scheme
25
+ SecureRandom.urlsafe_base64(12)
26
+ end
27
+
28
+ def self.update_plist(info_plist_path, prefix_schema)
29
+ modify_plist(info_plist_path, "Add :CFBundleURLTypes array")
30
+ modify_plist(info_plist_path, "Add :CFBundleURLTypes:0 dict")
31
+ modify_plist(info_plist_path, "Add :CFBundleURLTypes:0:CFBundleURLName string 'com.polideastore.\\$(PRODUCT_NAME)'")
32
+ modify_plist(info_plist_path, "Add :CFBundleURLTypes:0:CFBundleURLSchemes array")
33
+ modify_plist(info_plist_path, "Add :CFBundleURLTypes:0:CFBundleURLSchemes:0 string '#{prefix_schema}'")
34
+ modify_plist(info_plist_path, "Save")
35
+ UI.success("Added custom url scheme: #{prefix_schema} to plist file: #{info_plist_path}")
36
+ end
37
+
38
+ def self.modify_plist(info_plist_path, command)
39
+ system "/usr/libexec/PlistBuddy -c \"#{command}\" \"#{info_plist_path}\""
40
+ end
41
+
42
+ def self.description
43
+ "Add prefix schema for Polidea Store"
44
+ end
45
+
46
+ def self.available_options
47
+ [
48
+ FastlaneCore::ConfigItem.new(key: :path,
49
+ env_name: "",
50
+ description: "Path where search for Info.plist begins",
51
+ default_value: File.absolute_path("."),
52
+ optional: true)
53
+ ]
54
+ end
55
+
56
+ def self.output
57
+ [
58
+ ['PREFIX_SCHEMA', 'Prefix schema added to Info.plist']
59
+ ]
60
+ end
61
+
62
+ def self.author
63
+ "Piotrek Dubiel"
64
+ end
65
+
66
+ def self.is_supported?(platform)
67
+ platform == :ios
68
+ end
69
+ end
70
+ end
71
+ end
@@ -135,6 +135,9 @@ module Fastlane
135
135
 
136
136
  def self.get_config(platform, params)
137
137
  binary_size = params[:binary_size] || Actions.lane_context[Actions::SharedValues::BINARY_SIZE]
138
+ api_token = params[:api_token]
139
+ icon_url = params[:icon_url]
140
+ release_notes = params[:release_notes]
138
141
 
139
142
  case platform
140
143
  when :ios
@@ -144,6 +147,7 @@ module Fastlane
144
147
  version = params[:bundle_version] || info['CFBundleShortVersionString']
145
148
  href = itms_href(params[:plist_url])
146
149
  url_scheme = get_url_scheme(info)
150
+ UI.user_error!("No prefix scheme found in Info.plist. Make sure `add_prefix_schema` action succeded before build action") if url_scheme.nil?
147
151
  when :android
148
152
  manifest = Android::Apk.new(params[:apk]).manifest
149
153
  app_name = params[:app_name] || manifest.label
@@ -154,14 +158,14 @@ module Fastlane
154
158
  end
155
159
 
156
160
  config = {
157
- api_token: params[:api_token],
161
+ api_token: api_token,
158
162
  app_name: app_name,
159
163
  app_identifier: app_identifier,
160
164
  version: version,
161
165
  version_code: version_code,
162
- icon_url: params[:icon_url],
166
+ icon_url: icon_url,
163
167
  href: href,
164
- release_notes: params[:release_notes],
168
+ release_notes: release_notes,
165
169
  binary_size: binary_size,
166
170
  url_scheme: url_scheme
167
171
  }
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Polidea
3
- VERSION = "0.2.3"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-polidea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotrek Dubiel
@@ -179,6 +179,7 @@ files:
179
179
  - LICENSE
180
180
  - README.md
181
181
  - lib/fastlane/plugin/polidea.rb
182
+ - lib/fastlane/plugin/polidea/actions/add_prefix_schema.rb
182
183
  - lib/fastlane/plugin/polidea/actions/extract_app_icon.rb
183
184
  - lib/fastlane/plugin/polidea/actions/extract_app_name.rb
184
185
  - lib/fastlane/plugin/polidea/actions/extract_version.rb