cocoapods-modularization 0.0.2 → 0.0.6

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: 1cde6391ce2e9acbdfda733ce4ee1f7554efc154e25609497ed5e2c0311dc4ab
4
- data.tar.gz: 1136a975ded5270f9b57f521c97cfce57e13d3ba184bc9057cf93562540cf5f3
3
+ metadata.gz: de8f24caef31650588dd309bd663416bb5322030af7c3b642f6c44db43d49d21
4
+ data.tar.gz: e955afc7b9efd3b975ad53cf8be764de90c5e881e0557ef458fa4aa43375373d
5
5
  SHA512:
6
- metadata.gz: 6cdb49c8786470aafae93516037445123a3305f9c6f7ff1eb406cbfe317fb1e300bfee9daee93df70e9de7960d7e278fa9f3f9e6610561e9b02b5ded5c78f4f0
7
- data.tar.gz: 6b22853de266f03dde6f0959ea24403dd7d8de592db92546449d034994bf9a5d64cb2436ab14fe89587e20ee72ecb00a7c854e36238a40ba303c892a6b25a3c7
6
+ metadata.gz: 54f16cd703bc29bab7a39b4427106e1eab975444898d624309b0aac426b1700b7d7b48db9671db39dbdfd63f4af564120deab327c8083519520ee33c5b82c387
7
+ data.tar.gz: 9fe85d77afaf64152ce9b4ce33e2790f50f4f8c7c6ee2d09f38804c4ef73d36af26c6c800e505290b0dd2b2a3a16decc8189514678b2e1a4262aaf194db34111
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'cocoapods-modularization/generate'
4
+
5
+ module Pod
6
+ class Command
7
+ class Gen < Command
8
+ self.summary = 'Generates Xcode workspaces from a podspec.'
9
+
10
+ self.description = <<-DESC.strip_heredoc
11
+ #{summary}
12
+
13
+ pod gen allows you to keep your Podfile and podspecs as the single source of
14
+ truth for pods under development. By generating throw-away workspaces capable of
15
+ building, running, and testing a pod, you can focus on library development
16
+ without worrying about other code or managing an Xcode project.
17
+
18
+ pod gen works particularly well for monorepo projects, since it is capable of
19
+ using your existing settings when generating the workspace, making each gen'ed
20
+ project truly a small slice of the larger application.
21
+ DESC
22
+
23
+ def self.options
24
+ super.concat(Generate::Configuration.options.map do |option|
25
+ next unless option.cli_name
26
+
27
+ flag = "--#{option.cli_name}"
28
+ flag += "=#{option.arg_name}" if option.arg_name
29
+ [flag, option.message]
30
+ end.compact)
31
+ end
32
+
33
+ self.arguments = [
34
+ CLAide::Argument.new(%w[PODSPEC DIR], false, true)
35
+ ]
36
+
37
+ # @return [Configuration]
38
+ # the configuration used when generating workspaces
39
+ #
40
+ attr_reader :configuration
41
+
42
+ def initialize(argv)
43
+ options_hash = Generate::Configuration.options.each_with_object({}) do |option, options|
44
+ value =
45
+ if option.name == :podspec_paths
46
+ argv.arguments!
47
+ elsif option.flag?
48
+ argv.flag?(option.cli_name)
49
+ else
50
+ argv.option(option.cli_name)
51
+ end
52
+
53
+ next if value.nil?
54
+ options[option.name] = option.coerce(value)
55
+ end
56
+ UI.puts "options_hash: #{options_hash}"
57
+ @configuration = merge_configuration(options_hash)
58
+ super
59
+ end
60
+
61
+ def run
62
+ UI.puts "[pod gen] Running with #{configuration.to_s.gsub("\n", " \n")}" if configuration.pod_config.verbose?
63
+
64
+ # this is done here rather than in the installer so we only update sources once,
65
+ # even if there are multiple podspecs
66
+ update_sources if configuration.repo_update?
67
+
68
+ Generate::PodfileGenerator.new(configuration).podfiles_by_spec.each do |spec, podfile|
69
+ Generate::Installer.new(configuration, spec, podfile).install!
70
+ end
71
+
72
+ remove_warnings(UI.warnings)
73
+ end
74
+
75
+ def validate!
76
+ super
77
+
78
+ config_errors = configuration.validate
79
+ help! config_errors.join("\n ") if config_errors.any?
80
+ end
81
+
82
+ private
83
+
84
+ def merge_configuration(options)
85
+ # must use #to_enum explicitly since descend doesn't return an enumerator on 2.1
86
+ config_hashes = Pathname.pwd.to_enum(:descend).map do |dir|
87
+ path = dir + '.gen_config.yml'
88
+ next unless path.file?
89
+ Pod::Generate::Configuration.from_file(path)
90
+ end.compact
91
+
92
+ options.delete(:podspec_paths) if options[:podspec_paths].empty? && config_hashes.any? { |h| h.include?(:podspec_paths) }
93
+
94
+ env = Generate::Configuration.from_env(ENV)
95
+ config_hashes = [env] + config_hashes
96
+ config_hashes << options
97
+
98
+ configuration = config_hashes.compact.each_with_object({}) { |e, h| h.merge!(e) }
99
+ Pod::Generate::Configuration.new(pod_config: config, **configuration)
100
+ end
101
+
102
+ def remove_warnings(warnings)
103
+ warnings.reject! do |warning|
104
+ warning[:message].include? 'Automatically assigning platform'
105
+ end
106
+ end
107
+
108
+ def update_sources
109
+ UI.title 'Updating specs repos' do
110
+ configuration.sources.each do |source|
111
+ source = config.sources_manager.source_with_name_or_url(source)
112
+ UI.titled_section "Updating spec repo `#{source.name}`" do
113
+ source.update(config.verbose?)
114
+ source.verify_compatibility!
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
@@ -51,7 +51,7 @@ module Pod
51
51
  # encode podfile
52
52
  begin
53
53
  Meta::MetaReference.encode_podfile(@enable_branch)
54
- rescue StandardError => e
54
+ rescue Exception => e
55
55
  UI.puts "pod install error: #{e}"
56
56
  end
57
57
 
@@ -66,7 +66,7 @@ module Pod
66
66
 
67
67
  begin
68
68
  add_modularization_into_xcode_reference
69
- rescue StandardError => e
69
+ rescue Exception => e
70
70
  UI.puts e
71
71
  end
72
72
  end
@@ -0,0 +1,40 @@
1
+ require 'fileutils'
2
+
3
+ module Pod
4
+ class Command
5
+ class Mod < Command
6
+ class Template < Mod
7
+
8
+ self.summary = 'Fetch build.rb from remote'
9
+
10
+ self.description = <<-DESC
11
+ Fetch build.rb from remote
12
+ DESC
13
+
14
+ def initialize(argv)
15
+ super
16
+ end
17
+
18
+ def validate!
19
+ super
20
+ end
21
+
22
+ def run
23
+ build_path = "#{Dir.pwd}/build.rb"
24
+ if File.exist?(build_path)
25
+ FileUtils.rm_rf(build_path)
26
+ end
27
+ `git clone http://gitlab.appshahe.com/ios-specs/template.git .build`
28
+
29
+ unless File.exist?("#{Dir.pwd}/.build")
30
+ puts "./.build not found"
31
+ return
32
+ end
33
+
34
+ FileUtils.mv("#{Dir.pwd}/.build/build.rb", "#{Dir.pwd}/build.rb")
35
+ FileUtils.rm_rf("#{Dir.pwd}/.build")
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -7,6 +7,7 @@ require 'cocoapods-modularization/command/mod/config'
7
7
  require 'cocoapods-modularization/command/mod/add'
8
8
  require 'cocoapods-modularization/command/mod/update'
9
9
  require 'cocoapods-modularization/command/mod/base'
10
+ require 'cocoapods-modularization/command/mod/template'
10
11
 
11
12
  module Pod
12
13
  class Command
@@ -1,2 +1,3 @@
1
1
  require 'cocoapods-modularization/command/mod'
2
2
  require 'cocoapods-modularization/command/install'
3
+ require 'cocoapods-modularization/command/gen'
@@ -1,3 +1,3 @@
1
1
  module CocoapodsModularization
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -29,7 +29,10 @@ module Pod
29
29
 
30
30
  # podfile <= meta & data
31
31
  def encode_podfile(enable_branch = false)
32
+ raise 'meta.yml not found, run \'pod mod sync\' at first' unless File.exists?(Meta::MetaConstants.meta_path)
32
33
  meta = MetaConstants.generate_yml_to_hash(MetaConstants.meta_path)
34
+
35
+ raise 'data.yml not found, run \'pod mod sync\' at first' unless File.exists?(Meta::MetaConstants.data_path)
33
36
  data = MetaConstants.read_data(enable_branch)
34
37
 
35
38
  target_definitions = meta['target_definitions']
@@ -117,8 +120,9 @@ module Pod
117
120
  def try_source(e, dependency_data)
118
121
  binary = dependency_data[MetaConstants.binary_key]
119
122
  source_url = dependency_data[MetaConstants.source_key]
120
- if binary
121
- source_url ||= Private::PrivateCache.binary_repo_url
123
+ puts "e: #{e}, dependency_data: #{dependency_data}"
124
+ if binary && source_url == Private::PrivateCache.source_repo_url
125
+ source_url = Private::PrivateCache.binary_repo_url
122
126
  else
123
127
  source_url ||= Private::PrivateCache.source_repo_url
124
128
  end
@@ -198,7 +198,7 @@ module Pod
198
198
 
199
199
  def make_branch_cache_workspace_if_needed
200
200
  unless File.directory?(Meta::MetaConstants.pods_generator_path)
201
- raise "#{Meta::MetaConstants.pods_generator_path} not found"
201
+ raise "#{Meta::MetaConstants.pods_generator_path} not found, run 'pod sync' at first"
202
202
  end
203
203
 
204
204
  unless File.exists?(Meta::MetaConstants.branch_cache_path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-modularization
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - lazy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-26 00:00:00.000000000 Z
11
+ date: 2021-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: cocoapods-disable-podfile-validations
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.1.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.1.1
41
55
  description: A short description of cocoapods-modularization.
42
56
  email:
43
57
  - 515310192@qq.com
@@ -47,6 +61,7 @@ extra_rdoc_files: []
47
61
  files:
48
62
  - lib/cocoapods-modularization.rb
49
63
  - lib/cocoapods-modularization/command.rb
64
+ - lib/cocoapods-modularization/command/gen.rb
50
65
  - lib/cocoapods-modularization/command/install.rb
51
66
  - lib/cocoapods-modularization/command/mod.rb
52
67
  - lib/cocoapods-modularization/command/mod/add.rb
@@ -57,6 +72,7 @@ files:
57
72
  - lib/cocoapods-modularization/command/mod/inspect.rb
58
73
  - lib/cocoapods-modularization/command/mod/source.rb
59
74
  - lib/cocoapods-modularization/command/mod/sync.rb
75
+ - lib/cocoapods-modularization/command/mod/template.rb
60
76
  - lib/cocoapods-modularization/command/mod/update.rb
61
77
  - lib/cocoapods-modularization/gem_version.rb
62
78
  - lib/cocoapods-modularization/generate.rb