cocoapods-pod-merge 0.0.3 → 0.0.4

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: c15e511e82a904dc11616d9ac811f643216f5d1d34646518ad29a6dbde1e0ec2
4
- data.tar.gz: 7a94572e547e895e73f48a99989a81b0444a2fba735e2cc3ac777dbf92845f49
3
+ metadata.gz: 8b459bb9880825b248a09ba05792ae6c2610fe1d030542f87c768b6be8a97863
4
+ data.tar.gz: ed15333591feed5844193f04c6d1e958d20d0585b7a8c1e789f4120797a2f0da
5
5
  SHA512:
6
- metadata.gz: b3d41d5e2c522632f5a42810e6837bb128da441780efb802704cc5af7d5e10076c9c927f096c6a4b3195e058ecfaee4e8de898b74e2673b62f52cad95cca5923
7
- data.tar.gz: 3b438bfa2eda55b58bd0740af5aba4401d25e00f813a1d2d29a4071abceaf70f0fa23094e26a5f235328591fd8ab6db523484d28ef4e544cb58a195065b37606
6
+ metadata.gz: c975c7ff7c90670e90186b8e18d51ee2d13df43dd45a9ff47bfefa090edede0fe9b5a9c19a646fee9614bc92ef8499e19312815542548918188a81912b29ae66
7
+ data.tar.gz: 9298c5dc639536457934ae3c9cd7db3b65e568e0840bd20047a95885019dbc5dc1e7a1cedbbbeef4b834b7e786ffb19bb28f667ddf7bd097469f7bc08d7746b2
@@ -72,6 +72,14 @@ module CocoapodsPodMerge
72
72
  add_to_gitignore
73
73
  end
74
74
 
75
+ def add_mergefile_to_project(installer_context)
76
+ pods_project = Xcodeproj::Project.open(installer_context.pods_project.path)
77
+ mergefile = pods_project.new_file('../MergeFile')
78
+ mergefile.explicit_file_type = 'text.script.ruby'
79
+ mergefile.include_in_index = '1'
80
+ pods_project.save
81
+ end
82
+
75
83
  def add_to_gitignore
76
84
  gitignore_file = '.gitignore'
77
85
 
@@ -247,6 +255,7 @@ module CocoapodsPodMerge
247
255
  Dir.glob('**/*.{h,m,mm,swift}').each do |source_file|
248
256
  contents = File.read(source_file)
249
257
  if has_dependencies
258
+ # Fix imports of style import xx
250
259
  pods_to_merge.each do |pod|
251
260
  modular_imports = contents.scan(%r{<#{pod}/(.+)>})
252
261
  next unless modular_imports&.last
@@ -257,6 +266,15 @@ module CocoapodsPodMerge
257
266
  end
258
267
  File.open(source_file, 'w') { |file| file.puts contents_with_imports_fixed }
259
268
  end
269
+
270
+ # Fix imports of style import xx
271
+ pods_to_merge.each do |pod|
272
+ modular_imports = contents.scan("import #{pod}")
273
+ next unless modular_imports&.last
274
+
275
+ Pod::UI.puts "\t\tExperimental: ".yellow + "Found a module import in #{source_file}, fixing this by removing it".magenta
276
+ File.open(source_file, 'w') { |file| file.puts contents.gsub("import #{pod}", '') }
277
+ end
260
278
  else
261
279
  modular_imports = contents.scan(%r{<#{pod}/(.+)>})
262
280
  next unless modular_imports&.last
@@ -2,5 +2,5 @@
2
2
  # Use of this source code is governed by an MIT-style license that can be found in the LICENSE file
3
3
 
4
4
  module CocoapodsPodMerge
5
- VERSION = "0.0.3"
5
+ VERSION = "0.0.4"
6
6
  end
@@ -7,5 +7,9 @@ module CocoapodsPodMerge
7
7
  Pod::HooksManager.register('cocoapods-pod-merge', :pre_install) do |installer_context|
8
8
  PodMerger.new.begin(installer_context)
9
9
  end
10
+
11
+ Pod::HooksManager.register('cocoapods-pod-merge', :post_install) do |installer_context|
12
+ PodMerger.new.add_mergefile_to_project(installer_context)
13
+ end
10
14
  end
11
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-pod-merge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siddharth Gupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-06 00:00:00.000000000 Z
11
+ date: 2019-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler