gonative-cli 0.8.1 → 0.9.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
  SHA256:
3
- metadata.gz: 341c48f844c28ac2a8f5139a1d5445c9892565a61ebe2b90773448e6dfd36e11
4
- data.tar.gz: 2633635ba0e18942008e5ed0f2a4f0627b06b9db60153d9cdba79f07e6c22dae
3
+ metadata.gz: 392a2b4ff0ecb66ee524f2b0843f2aa334c22c0bd2723bb28a569e9318bdb111
4
+ data.tar.gz: efce28573e1fd80d0a408ad0c62fd48d687c791efa05ea90dd096fc2fc748d0a
5
5
  SHA512:
6
- metadata.gz: d9fa855c120bb8065128479038d33edb26b2a2c3327d1118a32b441652143e4fe7cbd3160bb397f2a957fade4b2f6ad63cbc4b6bad7d2a12a78deb6ab616710e
7
- data.tar.gz: 3b7b8213d27e221de23870010637c74c7c2d7b21ad87a85b283e639cfbef81ea36f3da3865abd389c0afde86fbfff29e1b08755363513562a3bc25eac9cb14cf
6
+ metadata.gz: 446b75f6fd9d62edb92c3ba57ef32837e64fcb02834dcbb26c2abe146eebe083fce59bf34fcf3f90f1d2f4db2256d59bc0232a2ae36a4263344c192293650793
7
+ data.tar.gz: b0732cacf207e93be3b22cec558a6cb87307ef7b627cd68f2b1b63bf1363c0fce6c48f4baa2d7e4bb8d712053440fed962fec065f0074a1b20b5a7a34f07ec59
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gonative-cli (0.7.17)
4
+ gonative-cli (0.8.1)
5
5
  activesupport (~> 6.0)
6
6
  cocoapods (~> 1.10)
7
7
  colorize (~> 0.8.0)
@@ -4,7 +4,7 @@ module GoNative
4
4
  module Commands
5
5
  module IOS
6
6
  class EmbedExtensions < Base
7
- desc 'Extracts extension targets from a project'
7
+ desc 'Embeds all extensions from plugins to the project'
8
8
 
9
9
  def call(**)
10
10
  Plugins::IOS::EmbedExtensions.call
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module GoNative
4
+ module Commands
5
+ module IOS
6
+ class SetBundleId < Base
7
+ desc 'Sets bundle Id '
8
+
9
+ argument :bundle_id, required: true, desc: 'Bundle id for the app'
10
+ option :with_entitlements, type: :boolean, default: false
11
+
12
+ def call(bundle_id:, with_entitlements:, **)
13
+ Plugins::IOS::SetBundleId.call(bundle_id, with_entitlements)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -7,8 +7,9 @@ module GoNative
7
7
  register 'version', Version, aliases: %w[--version -v]
8
8
  register 'ios create', IOS::Create
9
9
  register 'ios publish', IOS::Publish
10
- register 'ios extract', IOS::ExtractExtensions
11
- register 'ios embed', IOS::EmbedExtensions
10
+ register 'ios extract-extensions', IOS::ExtractExtensions
11
+ register 'ios embed-extensions', IOS::EmbedExtensions
12
+ register 'ios set-bundle-id', IOS::SetBundleId
12
13
  register 'android create', Android::Create
13
14
  end
14
15
  end
@@ -25,7 +25,7 @@ module GoNative
25
25
  .flatten
26
26
  .each { |path| FileUtils.cp_r(path, '.') }
27
27
  @extensions = extension_paths
28
- .map { |path| Pathname(path).children.select{ |p| p.extname == '.json'} }
28
+ .map { |path| Pathname(path).children.select { |p| p.extname == '.json' } }
29
29
  .flatten
30
30
  .map { |p| JSON.parse(File.read(p)) }
31
31
  end
@@ -39,16 +39,15 @@ module GoNative
39
39
  '11.0')
40
40
  extension_group = proj.new_group(extension['name'], extension['name'])
41
41
 
42
- extension['headers'].each{ |path| extension_group.new_file(path) }
43
- target.add_file_references(extension['source_files'].map{ |path| extension_group.new_file(path) })
44
- target.add_resources(extension['resources'].map{ |path| extension_group.new_file(path) })
42
+ extension['headers'].each { |path| extension_group.new_file(path) }
43
+ target.add_file_references(extension['source_files'].map { |path| extension_group.new_file(path) })
44
+ target.add_resources(extension['resources'].map { |path| extension_group.new_file(path) })
45
45
  target.add_system_frameworks(extension['system_frameworks'])
46
-
47
- if extension['entitlements']
48
- extension_group.new_file(extension['entitlements'])
49
- target.build_configurations.each do |config|
50
- config.build_settings['CODE_SIGN_ENTITLEMENTS'] = "#{extension['name']}/#{extension['entitlements']}"
51
- end
46
+ extension_group.new_file(extension['info'])
47
+ extension_group.new_file(extension['entitlements']) if extension['entitlements']
48
+ target.build_configurations.each do |config|
49
+ config.build_settings['INFOPLIST_FILE'] = "#{extension['name']}/#{extension['info']}"
50
+ config.build_settings['CODE_SIGN_ENTITLEMENTS'] = "#{extension['name']}/#{extension['entitlements']}" if extension['entitlements']
52
51
  end
53
52
  end
54
53
 
@@ -31,6 +31,7 @@ module GoNative
31
31
  target_definition[:name] = extension_name
32
32
 
33
33
  FileUtils.cd(extension_name)
34
+ target_definition[:info] = `find . -name '*Info.plist'`.split("\n").first
34
35
  target_definition[:entitlements] = `find -E . -regex ".*\.(entitlements)"`.split("\n").first
35
36
  target_definition[:headers] = `find -E . -regex ".*\.(h)"`.split("\n")
36
37
  target_definition[:source_files] = `find -E . -regex ".*\.(m|swift)"`.split("\n")
@@ -56,7 +57,7 @@ module GoNative
56
57
  }
57
58
  end
58
59
 
59
- target_definition.slice(:entitlements, :headers, :source_files, :resources).values.compact.flatten.each do |file_path|
60
+ target_definition.slice(:info, :entitlements, :headers, :source_files, :resources).values.compact.flatten.each do |file_path|
60
61
  system('ditto', file_path, "#{original_path}/#{extension_path}/#{file_path}")
61
62
  end
62
63
 
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'xcodeproj'
4
+ require 'cfpropertylist'
5
+
6
+ module GoNative
7
+ module Plugins
8
+ module IOS
9
+ class SetBundleId
10
+ extend DSL::Serviceable
11
+
12
+ attr_reader :bundle_id
13
+
14
+ def initialize(bundle_id, update_entitlements)
15
+ @bundle_id = bundle_id
16
+ @update_entitlements = update_entitlements
17
+ end
18
+
19
+ def call
20
+ update_project
21
+ update_entitlements if update_entitlements?
22
+ end
23
+
24
+ def update_project
25
+ proj = Xcodeproj::Project.open('./GoNativeIOS.xcodeproj')
26
+ proj.targets.each do |target|
27
+ case target.product_type
28
+ when Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application]
29
+ set_target_bundle_id(target, bundle_id)
30
+ when Xcodeproj::Constants::PRODUCT_TYPE_UTI[:app_extension]
31
+ set_target_bundle_id(target, bundle_id + '.' + target.name)
32
+ else
33
+ next
34
+ end
35
+ end
36
+
37
+ proj.save
38
+ end
39
+
40
+ def update_entitlements
41
+ entitlement_files = `find -E . -maxdepth 2 -regex ".*\.(entitlements)"`.split("\n")
42
+ entitlement_files.each do |entitlement_file|
43
+ plist = CFPropertyList::List.new(file: entitlement_file)
44
+ entitlements = CFPropertyList.native_types(plist.value)
45
+ entitlements['com.apple.security.application-groups'] = ['group.' + bundle_id]
46
+ plist.value = CFPropertyList.guess(entitlements)
47
+ plist.save(entitlement_file, CFPropertyList::List::FORMAT_XML)
48
+ end
49
+ end
50
+
51
+ private
52
+
53
+ def set_target_bundle_id(target, bundle_id)
54
+ target.build_configurations.each do |config|
55
+ config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = bundle_id
56
+ end
57
+ end
58
+
59
+ def update_entitlements?
60
+ @update_entitlements
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GoNative
4
- VERSION = "0.8.1"
4
+ VERSION = "0.9.0"
5
5
  end
@@ -14,7 +14,7 @@ TODO: Add long description of the pod here.
14
14
 
15
15
  s.ios.deployment_target = '10.0'
16
16
  s.swift_versions = '5.0'
17
- s.preserve_paths = 'plist/*.{plist}'
17
+ s.preserve_paths = ['plist/*.{plist}', 'Extensions/**/*']
18
18
 
19
19
  s.subspec 'Source' do |cs|
20
20
  cs.source_files = '#{plugin_name}/Classes/**/*.{h,m,swift}'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gonative-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hunaid Hassan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-27 00:00:00.000000000 Z
11
+ date: 2022-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-cli
@@ -193,6 +193,7 @@ files:
193
193
  - lib/gonative/commands/ios/embed_extensions.rb
194
194
  - lib/gonative/commands/ios/extract_extensions.rb
195
195
  - lib/gonative/commands/ios/publish.rb
196
+ - lib/gonative/commands/ios/set_bundle_id.rb
196
197
  - lib/gonative/commands/version.rb
197
198
  - lib/gonative/dsl/error_catchable.rb
198
199
  - lib/gonative/dsl/serviceable.rb
@@ -202,6 +203,7 @@ files:
202
203
  - lib/gonative/plugins/ios/embed_extensions.rb
203
204
  - lib/gonative/plugins/ios/extract_extensions.rb
204
205
  - lib/gonative/plugins/ios/release.rb
206
+ - lib/gonative/plugins/ios/set_bundle_id.rb
205
207
  - lib/gonative/plugins/ios/verify.rb
206
208
  - lib/gonative/utils.rb
207
209
  - lib/gonative/utils/content_evaluator.rb