cocoapods-podspec-binary 0.0.1 → 0.0.2

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: f72431b055019b6e7378fb89425060fd38fd73a574a857831af8d21366fa232a
4
- data.tar.gz: c427ddfdaf904ca14d68028d03caf4c1826211147f0a3a979cceb3404696dcfd
3
+ metadata.gz: e577e29dc2968b4ae3fa28ca13146e1125644a0c2b73590886d77798ff8f4d6d
4
+ data.tar.gz: 8d6c0451acf9fe9288775f98ecbaf247b1ba34d0a63332276bf688fd93f745c8
5
5
  SHA512:
6
- metadata.gz: 1e2f9b66964e91d6becd2e3177520ebac2cb54c8b334d6aac09359aebbd4bfa2fa878a743c1f4e16190c86a17c03698793e15235ce6b80ea76feeec7e5c6b114
7
- data.tar.gz: e361d70899cea6182de506a59fe5dae029fcca3fc0399e478a08811627023ba625c5ce0e043b611808f7c3ca42fc49ae4836b0d8f8c39bb42395a14240ba725b
6
+ metadata.gz: 31fa892c3ef8edca940e7b7c434b5952c2eb655feb122c8ddb4cae9dabd5f20b0ac44d4b3451eb873f6208cb8b64f8335fd2fe602202e9bcbabc563f633d0c0f
7
+ data.tar.gz: 43e98f93f0ffc1931be88d2a93bbb90ac87e09e5080e2d7f352f0dac9b680b7bffe8482a7992b7771466627f6d5b911d460ea4b6a50113666b941e0d552382dc
@@ -42,7 +42,6 @@ module Pod
42
42
  @pod_version = argv.shift_argument
43
43
  @config_instance = MBuildConfig.instance
44
44
  @build_dir = @config_instance.mbuild_dir
45
- @sources = argv.option('sources')
46
45
  super
47
46
  end
48
47
 
@@ -50,7 +49,7 @@ module Pod
50
49
  [
51
50
  ['--framework', 'Used to generate the framework '],
52
51
  ['--xcframework', 'Used to generate the xcframework '],
53
- ['--sources=[sources]', 'The sources from which to pull dependent pods ']
52
+ ['--sources', 'The sources from which to pull dependent pods ']
54
53
  ].concat(super).reject { |(name, _)| name == 'name' }
55
54
  end
56
55
 
@@ -62,10 +61,12 @@ module Pod
62
61
  end
63
62
 
64
63
  def prepare
64
+ puts 'prepare begin'
65
65
  init_config
66
66
  MBuildFileUtils.create_folder(@build_dir)
67
67
  Dir.chdir(@build_dir)
68
68
  BuildProject.new.prepare_project
69
+ puts 'prepare end'
69
70
  end
70
71
 
71
72
  def init_config
@@ -76,10 +77,6 @@ module Pod
76
77
  @config_instance.command_config(@pod_name, @pod_version)
77
78
  end
78
79
  @config_instance.library_type = @xcframework ? BinaryType::XCFRAMEWORK : BinaryType::FRAMEWORK
79
- puts "Preparing to generate the binary version of #{@pod_name}:#{@pod_version}."
80
- return unless @sources
81
-
82
- @config_instance.sources = @sources
83
80
  end
84
81
 
85
82
  def generate_project
@@ -87,21 +84,16 @@ module Pod
87
84
  end
88
85
 
89
86
  def build_binary
90
- puts "Commencing the build of #{@pod_name}:#{@pod_version}."
91
- project_dir = File.join(@build_dir, 'BinaryProj/Example')
87
+ project_dir = File.join(@build_dir, 'project')
92
88
  Dir.chdir(project_dir)
93
89
  binary_type = @xcframework ? BinaryType::XCFRAMEWORK : BinaryType::FRAMEWORK
94
90
  build_binary = BuildBinary.new(binary_type)
95
91
  build_binary.build
96
- puts "The successful build of the #{@pod_name}:#{@pod_version} #{@binary_type}."
97
92
  end
98
93
 
99
94
  def export_binary
100
- puts 'Exporting binary files.'
101
95
  export_dir = @config_instance.root_dir
102
- FileUtils.cp_r("#{@build_dir}/#{@pod_name}-#{@pod_version}", export_dir)
103
- FileUtils.rm_rf("#{@build_dir}/#{@pod_name}-#{@pod_version}")
104
- puts 'Task execution completed.'
96
+ FileUtils.cp_r("#{@build_dir}/#{@pod_name}", export_dir)
105
97
  end
106
98
  end
107
99
  end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPodspecBinary
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -56,16 +56,14 @@ class BuildBinary
56
56
  end
57
57
 
58
58
  def generate_final_binary(framework)
59
- binary_dir = "#{@config_instance.mbuild_dir}/#{@pod_name}-#{@pod_version}"
60
- Dir.mkdir(binary_dir) unless Dir.exist? binary_dir
59
+ binary_dir = "#{@config_instance.mbuild_dir}/#{@pod_name}"
60
+ Dir.mkdir(binary_dir) if Dir.exist? binary_dir
61
61
  FileUtils.cp_r(framework, binary_dir)
62
- podspec_file = "#{Dir.pwd}/#{@pod_name}.podspec.json"
63
- FileUtils.cp_r(podspec_file, binary_dir)
64
62
  end
65
63
 
66
64
  def generate_cache_file
67
- binary_dir = "#{@config_instance.mbuild_dir}/#{@pod_name}-#{@pod_version}/Podfile.lock"
68
- FileUtils.cp_r("#{@config_instance.mbuild_dir}/BinaryProj/Example/Podfile.lock", binary_dir)
65
+ binary_dir = "#{@config_instance.mbuild_dir}/#{@pod_name}/Podfile.lock"
66
+ FileUtils.cp_r("#{@config_instance.mbuild_dir}/project/Podfile.lock", binary_dir)
69
67
  end
70
68
 
71
69
  private
@@ -9,13 +9,17 @@ module Pod
9
9
  # class
10
10
  class Request
11
11
  old_method = instance_method(:validate!)
12
+
12
13
  define_method(:validate!) do
14
+ puts '++++podspec hook+++++'
13
15
  pod_name = MBuildConfig.instance.pod_name
14
16
  pod_version = MBuildConfig.instance.pod_version
15
- if spec.name == pod_name && spec.version.to_s == pod_version
16
- podspec_hash = spec.attributes_hash.deep_dup
17
- Pod::MbuildPodspec.new(podspec_hash).generate_podspec
17
+ puts "#{pod_name}:#{pod_version}"
18
+ if !spec.nil? && spec.name == pod_name && spec.version == pod_version
19
+ MbuildPodspec.new(spec).generate_podspec
20
+ puts 'podspec hook'
18
21
  end
22
+
19
23
  old_method.bind(self).call
20
24
  end
21
25
  end
@@ -5,34 +5,31 @@ require 'fileutils'
5
5
  module Pod
6
6
  # generate podspec
7
7
  class MbuildPodspec
8
- def initialize(podspec_hash)
9
- @binary_type = MBuildConfig.instance.library_type == BinaryType::FRAMEWORK ? 'framework' : 'xcframework'
8
+ def initialize(podspec)
9
+ @podspec = podspec
10
+ @binary_type = MBuildConfig.instance.binary_type == BinaryType::FRAMEWORK ? 'framework' : 'xcframework'
10
11
  @config_instance = MBuildConfig.instance
11
12
  @pod_name = MBuildConfig.instance.pod_name
12
13
  @pod_version = MBuildConfig.instance.pod_version
13
- @podspec_hash = podspec_hash
14
+ @podspec_hash = podspec.attributes_hash.deep_dup
14
15
  end
15
16
 
16
17
  def generate_podspec
17
18
  binary_spec_version
18
- binary_spec_source
19
19
  binary_spec_framework
20
20
  binary_spec_lib
21
21
  binary_spec_public_header_files
22
22
  binary_private_header_files
23
+
23
24
  write_podspec_to_file
25
+ puts 'Generated podspec'
24
26
  end
25
27
 
26
28
  private
27
29
 
28
30
  def write_podspec_to_file
29
- podspec_file = "#{Dir.pwd}/#{@pod_name}.podspec.json"
30
31
  podspec_json = JSON.pretty_generate(@podspec_hash)
31
- File.write(podspec_file, podspec_json)
32
- end
33
-
34
- def binary_spec_source
35
- @podspec_hash['source'] = { 'http': 'The location where files are stored' }
32
+ File.write("#{Dir.pwd}/#{@pod_name}.podspec.json", podspec_json)
36
33
  end
37
34
 
38
35
  def binary_spec_version
@@ -63,9 +60,7 @@ module Pod
63
60
  end
64
61
 
65
62
  def binary_spec_public_header_files
66
- @podspec_hash.delete('default_subspecs') if @podspec_hash.key?('default_subspecs')
67
- @podspec_hash.delete('source_files') if @podspec_hash.key?('source_files')
68
- @podspec_hash.delete('public_header_files') if @podspec_hash.key?('public_header_files')
63
+ @podspec_hash.slice!('default_subspecs', 'source_files', 'public_header_files')
69
64
  @podspec_hash['public_header_files'] = "#{@pod_name}/Headers/*.h"
70
65
  end
71
66
  end
@@ -6,18 +6,17 @@ require 'cocoapods'
6
6
  class BuildProject
7
7
  def initialize
8
8
  @config_instance = MBuildConfig.instance
9
- @project_dir = File.join(MBuildConfig.instance.mbuild_dir, 'BinaryProj/Example')
9
+ @project_dir = File.join(MBuildConfig.instance.mbuild_dir, 'project')
10
10
  end
11
11
 
12
12
  def prepare_project
13
- example_dir = File.join(MBuildConfig.instance.mbuild_dir, 'BinaryProj')
13
+ example_dir = @project_dir
14
14
  if File.directory?(example_dir)
15
15
  Git.open(example_dir).reset_hard
16
- Git.open(example_dir).clean(force: true)
17
16
  Git.open(example_dir).pull
18
17
  else
19
18
  MBuildFileUtils.create_folder(@project_dir)
20
- example_url = 'git@github.com:HuolalaTech/hll-cocoapods-podspec-binary.git'
19
+ example_url = 'ssh://git@gitlab.huolala.cn:56358/group-wp-sdk/binary-example-ios.git'
21
20
  Git.clone(example_url, example_dir)
22
21
  end
23
22
  end
@@ -34,11 +33,10 @@ class BuildProject
34
33
  podfile_content = File.read(podfile_path)
35
34
  pod_name = @config_instance.pod_name
36
35
  pod_version = @config_instance.pod_version
37
- new_content = podfile_content.gsub('BINARY_NAME', pod_name).gsub('BINARY_VERSION', pod_version)
38
- if @config_instance.sources
39
- new_content.prepend(@config_instance.sources.split(',').map { |it| "source \"#{it.strip}\"\n" }.join)
40
- end
41
-
36
+ puts("name:#{pod_name} version:#{pod_version}")
37
+ new_content = podfile_content.gsub('BINARY_NAME', pod_name).gsub('BINARY_VERSION', pod_version).gsub(
38
+ 'cocoapods-mdapbox', 'cocoapods-podspec-binary'
39
+ )
42
40
  File.open(podfile_path, 'w') { |file| file.puts new_content }
43
41
  end
44
42
 
@@ -5,12 +5,15 @@ require 'zlib'
5
5
  # FileUtils: A utility class for file operations.
6
6
  class MBuildFileUtils
7
7
  def self.create_folder(folder_path)
8
- return if File.directory?(folder_path)
9
-
10
- begin
11
- Dir.mkdir(folder_path)
12
- rescue SystemCallError => e
13
- puts "Error creating folder: #{e.message}"
8
+ if File.directory?(folder_path)
9
+ puts 'Folder already exists.'
10
+ else
11
+ begin
12
+ Dir.mkdir(folder_path)
13
+ puts 'Folder created successfully!'
14
+ rescue SystemCallError => e
15
+ puts "Error creating folder: #{e.message}"
16
+ end
14
17
  end
15
18
  end
16
19
 
@@ -4,6 +4,5 @@
4
4
  require 'cocoapods-podspec-binary'
5
5
  require 'cocoapods-podspec-binary/command/mbuild'
6
6
  require 'cocoapods-podspec-binary/mbuild/mbuild_hook'
7
- require 'cocoapods-podspec-binary/mbuild/mbuild_podspec'
8
7
  require 'cocoapods-podspec-binary/utils/file_utils'
9
8
  require 'cocoapods-podspec-binary/utils/git_utils'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-podspec-binary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pengpeng.dai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-22 00:00:00.000000000 Z
11
+ date: 2024-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler