gonative-cli 1.3.3 → 1.3.5
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 +4 -4
- data/Gemfile.lock +6 -6
- data/lib/gonative/commands/ios/embed_scripts.rb +15 -0
- data/lib/gonative/commands/ios/publish.rb +3 -2
- data/lib/gonative/commands.rb +1 -0
- data/lib/gonative/plugins/ios/build_framework.rb +21 -18
- data/lib/gonative/plugins/ios/embed_scripts.rb +55 -0
- data/lib/gonative/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f42b092dc883417d5ef7e77808a421ec5ab97e8d25a7b8e7fff947920a28272a
|
4
|
+
data.tar.gz: d740e585b5cafaa70f1b65510e9672f8e250b5753c15f6b357ee7c54b22b943a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a689ff2f8f58ac5f6f0f660d7a01f7774fa4cb5db19ab893acf4860aef006afabcfdb1bdbbcd1792a77d8057cabd725904c580fe3de28aea8527473598652179
|
7
|
+
data.tar.gz: 1f0d62246fc9823a3dfd987c203b0d7a479c8de9efbb2f47863b01eee7a9aef55ae6bd20e15e800d3cf37289de9fe6defcd038ac072f5067b9fac90ab0bbaf30
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gonative-cli (1.3.
|
4
|
+
gonative-cli (1.3.5)
|
5
5
|
activesupport (~> 6.0)
|
6
6
|
cocoapods (~> 1.10)
|
7
7
|
colorize (~> 0.8.0)
|
@@ -29,12 +29,12 @@ GEM
|
|
29
29
|
atomos (0.1.3)
|
30
30
|
byebug (11.1.3)
|
31
31
|
claide (1.1.0)
|
32
|
-
cocoapods (1.14.
|
32
|
+
cocoapods (1.14.3)
|
33
33
|
addressable (~> 2.8)
|
34
34
|
claide (>= 1.0.2, < 2.0)
|
35
|
-
cocoapods-core (= 1.14.
|
35
|
+
cocoapods-core (= 1.14.3)
|
36
36
|
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
37
|
-
cocoapods-downloader (>= 2.0)
|
37
|
+
cocoapods-downloader (>= 2.1, < 3.0)
|
38
38
|
cocoapods-plugins (>= 1.0.0, < 2.0)
|
39
39
|
cocoapods-search (>= 1.0.0, < 2.0)
|
40
40
|
cocoapods-trunk (>= 1.6.0, < 2.0)
|
@@ -47,7 +47,7 @@ GEM
|
|
47
47
|
nap (~> 1.0)
|
48
48
|
ruby-macho (>= 2.3.0, < 3.0)
|
49
49
|
xcodeproj (>= 1.23.0, < 2.0)
|
50
|
-
cocoapods-core (1.14.
|
50
|
+
cocoapods-core (1.14.3)
|
51
51
|
activesupport (>= 5.0, < 8)
|
52
52
|
addressable (~> 2.8)
|
53
53
|
algoliasearch (~> 1.0)
|
@@ -58,7 +58,7 @@ GEM
|
|
58
58
|
public_suffix (~> 4.0)
|
59
59
|
typhoeus (~> 1.0)
|
60
60
|
cocoapods-deintegrate (1.0.5)
|
61
|
-
cocoapods-downloader (2.
|
61
|
+
cocoapods-downloader (2.1)
|
62
62
|
cocoapods-plugins (1.0.0)
|
63
63
|
nap
|
64
64
|
cocoapods-search (1.0.1)
|
@@ -8,11 +8,12 @@ module GoNative
|
|
8
8
|
desc 'Verify, build and release a new version'
|
9
9
|
option :skip_build, type: :boolean, default: false
|
10
10
|
option :debug, type: :boolean, default: false
|
11
|
+
option :use_existing_build, type: :boolean, default: false
|
11
12
|
option :archs, default: 'x86_64,arm64'
|
12
13
|
|
13
|
-
def call(skip_build:, debug:, archs:, **)
|
14
|
+
def call(skip_build:, debug:, archs:, use_existing_build:, **)
|
14
15
|
Plugins::IOS::Verify.call
|
15
|
-
Plugins::IOS::BuildFramework.call(archs, debug) unless skip_build
|
16
|
+
Plugins::IOS::BuildFramework.call(archs, debug, use_existing_build) unless skip_build
|
16
17
|
Plugins::IOS::Release.call
|
17
18
|
end
|
18
19
|
end
|
data/lib/gonative/commands.rb
CHANGED
@@ -9,6 +9,7 @@ module GoNative
|
|
9
9
|
register 'ios publish', IOS::Publish
|
10
10
|
register 'ios extract-extensions', IOS::ExtractExtensions
|
11
11
|
register 'ios embed-extensions', IOS::EmbedExtensions
|
12
|
+
register 'ios embed-scripts', IOS::EmbedScripts
|
12
13
|
register 'ios set-bundle-id', IOS::SetBundleId
|
13
14
|
register 'ios rename', IOS::Rename
|
14
15
|
register 'ios version', IOS::Version
|
@@ -14,23 +14,26 @@ module GoNative
|
|
14
14
|
|
15
15
|
BUILD_TEMPLATE_DIRECTORY_PATH = File.expand_path(File.join(__dir__, '../../../..', 'templates', 'build', 'ios'))
|
16
16
|
|
17
|
-
attr_reader :plugin_name, :archs, :persist_build_dir
|
17
|
+
attr_reader :plugin_name, :archs, :persist_build_dir, :use_existing_build
|
18
18
|
|
19
|
-
def initialize(archs, persist_build_dir)
|
20
|
-
podspec_file = Dir[
|
21
|
-
raise Error,
|
19
|
+
def initialize(archs, persist_build_dir, use_existing_build)
|
20
|
+
podspec_file = Dir['./*.podspec'].first
|
21
|
+
raise Error, 'No podspec exists.' unless podspec_file
|
22
22
|
|
23
23
|
@plugin_name = File.basename(podspec_file, '.podspec')
|
24
24
|
@archs = archs.gsub(',', ' ')
|
25
25
|
@persist_build_dir = persist_build_dir
|
26
|
+
@use_existing_build = use_existing_build
|
26
27
|
end
|
27
28
|
|
28
29
|
def call
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
30
|
+
cd_build_dir(!use_existing_build)
|
31
|
+
unless use_existing_build
|
32
|
+
create_framework_proj
|
33
|
+
move_template_files!
|
34
|
+
run_pod_install
|
35
|
+
chmod_frameworks_script!
|
36
|
+
end
|
34
37
|
build_framework!
|
35
38
|
move_framework_file
|
36
39
|
ensure
|
@@ -38,16 +41,16 @@ module GoNative
|
|
38
41
|
FileUtils.rm_rf('build') unless persist_build_dir
|
39
42
|
end
|
40
43
|
|
41
|
-
def
|
44
|
+
def cd_build_dir(create)
|
42
45
|
build_dir = File.join(FileUtils.pwd, 'build')
|
43
|
-
FileUtils.mkdir(build_dir)
|
46
|
+
FileUtils.mkdir(build_dir) if create
|
44
47
|
FileUtils.cd(build_dir)
|
45
48
|
end
|
46
49
|
|
47
50
|
def create_framework_proj
|
48
51
|
proj = Xcodeproj::Project.new(FileUtils.pwd)
|
49
52
|
target = proj.new_target(:framework,
|
50
|
-
|
53
|
+
plugin_name.to_s,
|
51
54
|
:ios,
|
52
55
|
deployment_target)
|
53
56
|
main_group = proj.new_group(plugin_name, plugin_name)
|
@@ -83,9 +86,9 @@ module GoNative
|
|
83
86
|
|
84
87
|
def add_headers(target, group)
|
85
88
|
headers_group = group.new_group('Headers', 'Headers')
|
86
|
-
references = Dir.glob("../#{plugin_name}/Classes/**/*.h").map
|
89
|
+
references = Dir.glob("../#{plugin_name}/Classes/**/*.h").map do |file|
|
87
90
|
headers_group.new_file("../../#{file}")
|
88
|
-
|
91
|
+
end
|
89
92
|
header_files = target.add_file_references(references)
|
90
93
|
header_files << target.headers_build_phase.add_file_reference(group.new_file("../#{plugin_name}-umbrella.h"))
|
91
94
|
header_files.each do |header|
|
@@ -94,9 +97,9 @@ module GoNative
|
|
94
97
|
end
|
95
98
|
|
96
99
|
def move_template_files!
|
97
|
-
plugin_dependencies = spec.dependencies.map
|
100
|
+
plugin_dependencies = spec.dependencies.map do |d|
|
98
101
|
["pod '#{d.name}'", "'#{d.requirement}'"].compact.join(', ')
|
99
|
-
|
102
|
+
end * "\n\t"
|
100
103
|
FileUtils.cp_r("#{BUILD_TEMPLATE_DIRECTORY_PATH}/.", '.')
|
101
104
|
headers = Dir.glob("../#{plugin_name}/Classes/**/*.h").map { |f| "#import \"#{File.basename(f)}\"" } * "\n"
|
102
105
|
Utils::TemplateInflator.new(plugin_name: plugin_name,
|
@@ -118,12 +121,12 @@ module GoNative
|
|
118
121
|
Utils::UI.info 'Building framework'
|
119
122
|
return if system('sh create-framework.sh >/dev/null 2>/dev/null')
|
120
123
|
|
121
|
-
raise Error,
|
124
|
+
raise Error, 'Error building framework. Please run the create-framework file manually to fix any errors'
|
122
125
|
end
|
123
126
|
|
124
127
|
def move_framework_file
|
125
128
|
FileUtils.rm_rf('../XCFramework')
|
126
|
-
FileUtils.mv(
|
129
|
+
FileUtils.mv('XCFramework', '..', force: true)
|
127
130
|
end
|
128
131
|
|
129
132
|
def deployment_target
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'xcodeproj'
|
5
|
+
|
6
|
+
module GoNative
|
7
|
+
module Plugins
|
8
|
+
module IOS
|
9
|
+
class EmbedScripts
|
10
|
+
TARGET_SCRIPTS_FILE_NAME = 'target_scripts.yml'
|
11
|
+
|
12
|
+
extend DSL::Serviceable
|
13
|
+
autoload :FileUtils, 'fileutils'
|
14
|
+
|
15
|
+
attr_reader :scripts
|
16
|
+
|
17
|
+
def call
|
18
|
+
prepare_scripts
|
19
|
+
return unless scripts?
|
20
|
+
|
21
|
+
embed_in_project
|
22
|
+
end
|
23
|
+
|
24
|
+
def scripts?
|
25
|
+
!scripts.empty?
|
26
|
+
end
|
27
|
+
|
28
|
+
def prepare_scripts
|
29
|
+
scripts_paths = `find ./Pods -name #{TARGET_SCRIPTS_FILE_NAME}`.split("\n")
|
30
|
+
@scripts = scripts_paths
|
31
|
+
.map { |path| YAML.load_file(path)['scripts'] }
|
32
|
+
.flatten
|
33
|
+
end
|
34
|
+
|
35
|
+
def embed_in_project
|
36
|
+
proj = Xcodeproj::Project.open('MedianIOS.xcodeproj')
|
37
|
+
app_target = proj.native_targets.first
|
38
|
+
scripts.each do |script|
|
39
|
+
app_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|
|
40
|
+
phase.name = script['name'] || 'New Run Script Phase'
|
41
|
+
phase.input_paths = script['input_paths']
|
42
|
+
phase.output_paths = script['output_paths']
|
43
|
+
phase.shell_path = script['shell_path']
|
44
|
+
phase.shell_script = script['shell_script']
|
45
|
+
|
46
|
+
app_target.build_phases << phase
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
proj.save
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/gonative/version.rb
CHANGED
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: 1.3.
|
4
|
+
version: 1.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hunaid Hassan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-11-
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/gonative/commands/base.rb
|
193
193
|
- lib/gonative/commands/ios/create.rb
|
194
194
|
- lib/gonative/commands/ios/embed_extensions.rb
|
195
|
+
- lib/gonative/commands/ios/embed_scripts.rb
|
195
196
|
- lib/gonative/commands/ios/extract_extensions.rb
|
196
197
|
- lib/gonative/commands/ios/publish.rb
|
197
198
|
- lib/gonative/commands/ios/rename.rb
|
@@ -204,6 +205,7 @@ files:
|
|
204
205
|
- lib/gonative/plugins/ios/build_framework.rb
|
205
206
|
- lib/gonative/plugins/ios/create.rb
|
206
207
|
- lib/gonative/plugins/ios/embed_extensions.rb
|
208
|
+
- lib/gonative/plugins/ios/embed_scripts.rb
|
207
209
|
- lib/gonative/plugins/ios/extract_extensions.rb
|
208
210
|
- lib/gonative/plugins/ios/helpers.rb
|
209
211
|
- lib/gonative/plugins/ios/helpers/spec_reader.rb
|