cocoapods-xcconfig-hooks 0.0.1.alpha1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 98dc67c2c4b248edc90303e223d5259de5e27c608ef621c586fb48e8ca00f7b2
4
+ data.tar.gz: e0866467a72d450d5f800e999fb1a1d6f62023fb5a1ca80bbf87f1054f4a160d
5
+ SHA512:
6
+ metadata.gz: b2f1ec8478ba91428c80eabf32a45debaf9ee46a1492ca41f2b1aa67f8f2c15e762d364697973bea15998fc2ff5054ae8ba9e67724007648ab2772d1798291c7
7
+ data.tar.gz: 6122fbf27dba311e382e80c08924f28cbf3e638b74ac6b5209414110638ebe01af312afd488588dd0a47847d19d3ee49535f109ba6f094992b96e9d18eda17aa
@@ -0,0 +1,26 @@
1
+ module Pod
2
+ module XCConfig
3
+ class Config
4
+ attr_accessor :dsl_config
5
+
6
+ def initialize
7
+ @dsl_config = {}
8
+ end
9
+
10
+ def self.instance
11
+ @instance ||= Config.new
12
+ end
13
+
14
+ def hook_dir
15
+ @hook_dir ||= (dsl_config[:hook_dir] || Pathname(".xcconfigs"))
16
+ end
17
+
18
+ def aggregate_targets_only?
19
+ value = dsl_config[:aggregate_targets_only]
20
+ return value unless value.nil?
21
+
22
+ true
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,11 @@
1
+ require "cocoapods-xcconfig-hooks/config"
2
+
3
+ module Pod
4
+ class Podfile
5
+ module DSL
6
+ def config_xcconfig_hooks(options)
7
+ Pod::XCConfig::Config.instance.dsl_config = options
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,49 @@
1
+ require "cocoapods-xcconfig-hooks/config"
2
+ require "cocoapods-xcconfig-hooks/dsl"
3
+
4
+ module Pod
5
+ module XCConfig
6
+ class Hook
7
+ def initialize(context)
8
+ @context = context
9
+ end
10
+
11
+ def sandbox
12
+ @context.sandbox
13
+ end
14
+
15
+ def config
16
+ Config.instance
17
+ end
18
+
19
+ def run
20
+ sandbox.target_support_files_root.glob("*/*.xcconfig") do |path|
21
+ prepend_includes(path)
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ def prepend_includes(path)
28
+ target, config_name, = path.basename.to_s.split(".")
29
+ is_agg_target = target.start_with?("Pods-")
30
+ return if !is_agg_target && config.aggregate_targets_only?
31
+
32
+ includes = [
33
+ "__base__.xcconfig",
34
+ "#{target}.__base__.xcconfig",
35
+ "#{target}.#{config_name}.xcconfig",
36
+ ].map { |p| "#include? \"#{config.hook_dir}/#{p}\"" }
37
+
38
+ to_prepend = <<~HEADER
39
+ #{includes.join("\n")}
40
+ // ------------------------------------------------------------
41
+ // The above includes were injected by cocoapods-xcconfig-hooks
42
+ // ------------------------------------------------------------
43
+
44
+ HEADER
45
+ path.write(to_prepend + path.read)
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1 @@
1
+ require "cocoapods-xcconfig-hooks/gem_version"
@@ -0,0 +1,5 @@
1
+ require 'cocoapods-xcconfig-hooks/main'
2
+
3
+ Pod::HooksManager.register("cocoapods-xcconfig-hooks", :post_install) do |context|
4
+ Pod::XCConfig::Hook.new(context).run
5
+ end
metadata ADDED
@@ -0,0 +1,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-xcconfig-hooks
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha1
5
+ platform: ruby
6
+ authors:
7
+ - Thuyen Trinh
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-12-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: CocoaPods plugin to hook xcconfig of CocoaPods targets
56
+ email:
57
+ - trinhngocthuyen@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - lib/cocoapods-xcconfig-hooks.rb
63
+ - lib/cocoapods-xcconfig-hooks/config.rb
64
+ - lib/cocoapods-xcconfig-hooks/dsl.rb
65
+ - lib/cocoapods-xcconfig-hooks/main.rb
66
+ - lib/cocoapods_plugin.rb
67
+ homepage: https://github.com/trinhngocthuyen/cocoapods-xcconfig-hooks
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">"
83
+ - !ruby/object:Gem::Version
84
+ version: 1.3.1
85
+ requirements: []
86
+ rubygems_version: 3.1.2
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: CocoaPods plugin to hook xcconfig of CocoaPods targets
90
+ test_files: []