cocoapods-binary-cache 0.1.2 → 0.1.8

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cocoapods-binary-cache/cache/validation_result.rb +4 -0
  3. data/lib/cocoapods-binary-cache/cache/validator.rb +2 -3
  4. data/lib/cocoapods-binary-cache/cache/validator_base.rb +28 -8
  5. data/lib/cocoapods-binary-cache/cache/validator_dependencies_graph.rb +7 -2
  6. data/lib/cocoapods-binary-cache/cache/validator_dev_pods.rb +21 -13
  7. data/lib/cocoapods-binary-cache/cache/validator_non_dev_pods.rb +1 -1
  8. data/lib/cocoapods-binary-cache/dependencies_graph/dependencies_graph.rb +20 -25
  9. data/lib/cocoapods-binary-cache/dependencies_graph/graph_visualizer.rb +29 -38
  10. data/lib/cocoapods-binary-cache/diagnosis/base.rb +13 -0
  11. data/lib/cocoapods-binary-cache/diagnosis/diagnosis.rb +24 -0
  12. data/lib/cocoapods-binary-cache/diagnosis/integration.rb +23 -0
  13. data/lib/cocoapods-binary-cache/env.rb +32 -0
  14. data/lib/cocoapods-binary-cache/helper/checksum.rb +10 -4
  15. data/lib/cocoapods-binary-cache/helper/lockfile.rb +26 -3
  16. data/lib/cocoapods-binary-cache/helper/podspec.rb +5 -1
  17. data/lib/cocoapods-binary-cache/helper/prebuild_order.rb +12 -0
  18. data/lib/cocoapods-binary-cache/hooks/post_install.rb +20 -2
  19. data/lib/cocoapods-binary-cache/hooks/pre_install.rb +14 -44
  20. data/lib/cocoapods-binary-cache/main.rb +2 -1
  21. data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +40 -0
  22. data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +2 -2
  23. data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb +3 -10
  24. data/lib/cocoapods-binary-cache/pod-binary/helper/names.rb +2 -11
  25. data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +15 -15
  26. data/lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb +7 -10
  27. data/lib/cocoapods-binary-cache/pod-binary/integration.rb +1 -3
  28. data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +4 -1
  29. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb +1 -1
  30. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb +0 -3
  31. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb +29 -0
  32. data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +6 -3
  33. data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +42 -50
  34. data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +45 -110
  35. data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -61
  36. data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
  37. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +192 -0
  38. data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +43 -0
  39. data/lib/cocoapods-binary-cache/prebuild_output/metadata.rb +16 -0
  40. data/lib/cocoapods-binary-cache/prebuild_output/output.rb +12 -39
  41. data/lib/cocoapods-binary-cache/scheme_editor.rb +17 -16
  42. data/lib/cocoapods-binary-cache/state_store.rb +16 -6
  43. data/lib/command/binary.rb +21 -2
  44. data/lib/command/config.rb +173 -10
  45. data/lib/command/executor/base.rb +7 -0
  46. data/lib/command/executor/fetcher.rb +4 -4
  47. data/lib/command/executor/prebuilder.rb +2 -2
  48. data/lib/command/executor/pusher.rb +1 -1
  49. data/lib/command/executor/visualizer.rb +3 -2
  50. data/lib/command/fetch.rb +0 -1
  51. data/lib/command/prebuild.rb +14 -2
  52. data/lib/command/push.rb +22 -0
  53. metadata +15 -11
  54. data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -90
  55. data/lib/cocoapods-binary-cache/pod-binary/helper/passer.rb +0 -25
  56. data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +0 -29
  57. data/lib/cocoapods-binary-cache/pod-binary/tool/tool.rb +0 -12
  58. data/lib/cocoapods-binary-cache/pod-rome/build_framework.rb +0 -247
  59. data/lib/cocoapods-binary-cache/prebuild_cache.rb +0 -49
@@ -0,0 +1,32 @@
1
+ module PodPrebuild
2
+ class Env
3
+ @stage_idx = 0
4
+
5
+ class << self
6
+ def reset!
7
+ @stage_idx = 0
8
+ @stages = nil
9
+ end
10
+
11
+ def next_stage!
12
+ @stage_idx += 1 if @stage_idx < stages.count - 1
13
+ end
14
+
15
+ def stages
16
+ @stages ||= PodPrebuild.config.prebuild_job? ? [:prebuild, :integration] : [:integration]
17
+ end
18
+
19
+ def current_stage
20
+ stages[@stage_idx]
21
+ end
22
+
23
+ def prebuild_stage?
24
+ current_stage == :prebuild
25
+ end
26
+
27
+ def integration_stage?
28
+ current_stage == :integration
29
+ end
30
+ end
31
+ end
32
+ end
@@ -4,9 +4,15 @@
4
4
  require "digest/md5"
5
5
 
6
6
  class FolderChecksum
7
- def self.checksum(dir)
8
- files = Dir["#{dir}/**/*"].reject { |f| File.directory?(f) }
9
- content = files.map { |f| File.read(f) }.join
10
- Digest::MD5.hexdigest(content).to_s
7
+ def self.git_checksum(dir)
8
+ checksum_of_files(`git ls-files #{dir}`.split("\n"))
9
+ rescue => e
10
+ Pod::UI.warn "Cannot get checksum of tracked files under #{dir}: #{e}"
11
+ checksum_of_files(Dir["#{dir}/**/*"].reject { |f| File.directory?(f) })
12
+ end
13
+
14
+ def self.checksum_of_files(files)
15
+ checksums = files.sort.map { |f| Digest::MD5.hexdigest(File.read(f)) }
16
+ Digest::MD5.hexdigest(checksums.join)
11
17
  end
12
18
  end
@@ -1,3 +1,5 @@
1
+ require_relative "checksum"
2
+
1
3
  module PodPrebuild
2
4
  class Lockfile
3
5
  attr_reader :lockfile, :data
@@ -15,6 +17,10 @@ module PodPrebuild
15
17
  @data["EXTERNAL SOURCES"] || {}
16
18
  end
17
19
 
20
+ def dev_pod_sources
21
+ @dev_pod_sources ||= external_sources.select { |_, attributes| attributes.key?(:path) } || {}
22
+ end
23
+
18
24
  def dev_pod_names
19
25
  # There are 2 types of external sources:
20
26
  # - Development pods: declared with `:path` option in Podfile, corresponding to `:path` in the Lockfile
@@ -27,7 +33,7 @@ module PodPrebuild
27
33
  # :git: git@remote_url
28
34
  # :commit: abc1234
29
35
  # --------------------
30
- @dev_pod_names ||= external_sources.select { |_, attributes| attributes.key?(:path) }.keys.to_set
36
+ @dev_pod_names ||= dev_pod_sources.keys.to_set
31
37
  end
32
38
 
33
39
  def dev_pods
@@ -40,13 +46,30 @@ module PodPrebuild
40
46
  @non_dev_pods ||= pods.reject { |name, _| dev_pod_names_.include?(name) }
41
47
  end
42
48
 
49
+ def subspec_vendor_pods
50
+ dev_pod_names_ = dev_pod_names
51
+ @subspec_vendor_pods ||= subspec_pods.reject { |name, _| dev_pod_names_.include?(name) }
52
+ end
53
+
54
+ # Return content hash (Hash the directory at source path) of a dev_pod
55
+ # Return nil if it's not a dev_pod
56
+ def dev_pod_hash(pod_name)
57
+ dev_pod_hashes_map[pod_name]
58
+ end
59
+
60
+ private
61
+
43
62
  def subspec_pods
44
- pods.keys
63
+ @subspec_pods ||= pods.keys
45
64
  .select { |k| k.include?("/") }
46
65
  .group_by { |k| k.split("/")[0] }
47
66
  end
48
67
 
49
- private
68
+ # Generate a map between a dev_pod and it source hash
69
+ def dev_pod_hashes_map
70
+ @dev_pod_hashes_map ||=
71
+ dev_pod_sources.map { |name, attribs| [name, FolderChecksum.git_checksum(attribs[:path])] }.to_h
72
+ end
50
73
 
51
74
  # Parse an item under `PODS` section of a Lockfile
52
75
  # @param hash_or_string: an item under `PODS` section, could be a Hash (if having dependencies) or a String
@@ -1,7 +1,11 @@
1
1
  module Pod
2
2
  class Specification
3
3
  def empty_source_files?
4
- return subspecs.all?(&:empty_source_files?) unless subspecs.empty?
4
+
5
+ unless subspecs.empty?
6
+ # return early if there are some files in subpec(s) but process the spec itself
7
+ return false unless subspecs.all?(&:empty_source_files?)
8
+ end
5
9
 
6
10
  check = lambda do |patterns|
7
11
  patterns = [patterns] if patterns.is_a?(String)
@@ -0,0 +1,12 @@
1
+ module PodPrebuild
2
+ module BuildOrder
3
+ def self.order_targets(targets)
4
+ # It's more efficient to build frameworks that have more dependencies first
5
+ # so that the build parallelism is ultilized
6
+ # >> --- MyFramework ----------------------------------|
7
+ # >> --- ADependency ---|
8
+ # >> --- AnotherADependency ---|
9
+ targets.sort_by { |t| -t.recursive_dependent_targets.count }
10
+ end
11
+ end
12
+ end
@@ -5,12 +5,30 @@ module PodPrebuild
5
5
  end
6
6
 
7
7
  def run
8
- return unless Pod::Podfile::DSL.dev_pods_enabled && @installer_context.sandbox.instance_of?(Pod::PrebuildSandbox)
8
+ edit_scheme_for_code_coverage if PodPrebuild::Env.prebuild_stage?
9
+ diagnose if PodPrebuild::Env.integration_stage?
10
+ end
11
+
12
+ private
13
+
14
+ def diagnose
15
+ Pod::UI.title("Diagnosing cocoapods-binary-cache") do
16
+ PodPrebuild::Diagnosis.new(
17
+ cache_validation: PodPrebuild.state.cache_validation,
18
+ standard_sandbox: @installer_context.sandbox,
19
+ specs: @installer_context.umbrella_targets.map(&:specs).flatten
20
+ ).run
21
+ end
22
+ end
23
+
24
+ def edit_scheme_for_code_coverage
25
+ return unless PodPrebuild.config.dev_pods_enabled?
26
+ return unless @installer_context.sandbox.instance_of?(Pod::PrebuildSandbox)
9
27
 
10
28
  # Modify pods scheme to support code coverage
11
29
  # If we don't prebuild dev pod -> no need to care about this in Pod project
12
30
  # because we setup in the main project (ex. DriverCI scheme)
13
- SchemeEditor.edit_to_support_code_coverage(@installer_context.sandbox) if Pod.is_prebuild_stage
31
+ SchemeEditor.edit_to_support_code_coverage(@installer_context.sandbox)
14
32
  end
15
33
  end
16
34
  end
@@ -13,18 +13,17 @@ module PodPrebuild
13
13
  end
14
14
 
15
15
  def run
16
- require_relative "../pod-binary/helper/feature_switches"
17
- return if Pod.is_prebuild_stage
16
+ return if @installer_context.sandbox.is_a?(Pod::PrebuildSandbox)
18
17
 
19
18
  log_section "🚀 Prebuild frameworks"
20
19
  ensure_valid_podfile
21
20
  save_installation_states
22
- prepare_environment
23
21
  create_prebuild_sandbox
24
- Pod::UI.section("Detect implicit dependencies") { detect_implicit_dependencies }
25
- Pod::UI.section("Validate prebuilt cache") { validate_cache }
26
- prebuild! if Pod::Podfile::DSL.prebuild_job?
27
- reset_environment
22
+ Pod::UI.title("Detect implicit dependencies") { detect_implicit_dependencies }
23
+ Pod::UI.title("Validate prebuilt cache") { validate_cache }
24
+ prebuild! if PodPrebuild.config.prebuild_job?
25
+
26
+ PodPrebuild::Env.next_stage!
28
27
  log_section "🤖 Resume pod installation"
29
28
  require_relative "../pod-binary/integration"
30
29
  end
@@ -33,7 +32,6 @@ module PodPrebuild
33
32
 
34
33
  def save_installation_states
35
34
  save_pod_install_options
36
- save_states_from_dsl
37
35
  end
38
36
 
39
37
  def save_pod_install_options
@@ -52,36 +50,10 @@ module PodPrebuild
52
50
  end
53
51
  end
54
52
 
55
- def prepare_environment
56
- Pod::UI.puts "Prepare environment"
57
- Pod.is_prebuild_stage = true
58
- Pod::Podfile::DSL.enable_prebuild_patch true # enable sikpping for prebuild targets
59
- Pod::Installer.force_disable_integration true # don't integrate targets
60
- Pod::Config.force_disable_write_lockfile true # disbale write lock file for perbuild podfile
61
- Pod::Installer.disable_install_complete_message true # disable install complete message
62
- end
63
-
64
- def reset_environment
65
- Pod::UI.puts "Reset environment"
66
- Pod.is_prebuild_stage = false
67
- Pod::Installer.force_disable_integration false
68
- Pod::Podfile::DSL.enable_prebuild_patch false
69
- Pod::Config.force_disable_write_lockfile false
70
- Pod::Installer.disable_install_complete_message false
71
- Pod::UserInterface.warnings = [] # clean the warning in the prebuild step, it's duplicated.
72
- end
73
-
74
- def save_states_from_dsl
75
- # Note: DSL is reloaded when creating an installer (Pod::Installer.new).
76
- # Any mutation to DSL is highly discouraged
77
- # --> Rather, perform mutation on PodPrebuild::StateStore instead
78
- PodPrebuild::StateStore.excluded_pods += Pod::Podfile::DSL.excluded_pods
79
- end
80
-
81
53
  def create_prebuild_sandbox
82
54
  standard_sandbox = installer_context.sandbox
83
55
  @prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox)
84
- Pod::UI.puts "Create prebuild sandbox at #{@prebuild_sandbox.root}"
56
+ Pod::UI.message "Create prebuild sandbox at #{@prebuild_sandbox.root}"
85
57
  end
86
58
 
87
59
  def detect_implicit_dependencies
@@ -91,11 +63,9 @@ module PodPrebuild
91
63
  .group_by { |spec| spec.name.split("/")[0] }
92
64
  .select { |_, specs| specs.all?(&:empty_source_files?) }
93
65
  .keys
94
-
95
- PodPrebuild::StateStore.excluded_pods += pods_with_empty_source_files
66
+ PodPrebuild.config.update_detected_excluded_pods!(pods_with_empty_source_files)
67
+ PodPrebuild.config.update_detected_prebuilt_pod_names!(@original_installer.prebuilt_pod_names)
96
68
  Pod::UI.puts "Exclude pods with empty source files: #{pods_with_empty_source_files.to_a}"
97
-
98
- # TODO (thuyen): Detect dependencies of a prebuilt pod and treat them as prebuilt pods as well
99
69
  end
100
70
 
101
71
  def validate_cache
@@ -104,16 +74,16 @@ module PodPrebuild
104
74
  podfile: podfile,
105
75
  pod_lockfile: installer_context.lockfile,
106
76
  prebuilt_lockfile: prebuilt_lockfile,
107
- validate_prebuilt_settings: Pod::Podfile::DSL.validate_prebuilt_settings,
77
+ validate_prebuilt_settings: PodPrebuild.config.validate_prebuilt_settings,
108
78
  generated_framework_path: prebuild_sandbox.generate_framework_path,
109
79
  sandbox_root: prebuild_sandbox.root,
110
- ignored_pods: PodPrebuild::StateStore.excluded_pods,
111
- prebuilt_pod_names: @original_installer.prebuilt_pod_names
80
+ ignored_pods: PodPrebuild.config.excluded_pods,
81
+ prebuilt_pod_names: PodPrebuild.config.prebuilt_pod_names
112
82
  ).validate
113
- path_to_save_cache_validation = Pod::Podfile::DSL.save_cache_validation_to
83
+ path_to_save_cache_validation = PodPrebuild.config.save_cache_validation_to
114
84
  @cache_validation.update_to(path_to_save_cache_validation) unless path_to_save_cache_validation.nil?
115
85
  cache_validation.print_summary
116
- PodPrebuild::StateStore.cache_validation = cache_validation
86
+ PodPrebuild.state.update(:cache_validation => cache_validation)
117
87
  end
118
88
 
119
89
  def prebuild!
@@ -9,13 +9,14 @@ require_relative "helper/json"
9
9
  require_relative "helper/lockfile"
10
10
  require_relative "helper/path_utils"
11
11
  require_relative "helper/podspec"
12
+ require_relative "env"
12
13
  require_relative "state_store"
13
14
  require_relative "hooks/post_install"
14
15
  require_relative "hooks/pre_install"
15
16
  require_relative "pod-binary/prebuild_dsl"
16
17
  require_relative "pod-binary/prebuild_hook"
17
18
  require_relative "pod-binary/prebuild"
18
- require_relative "prebuild_cache"
19
19
  require_relative "prebuild_output/metadata"
20
20
  require_relative "prebuild_output/output"
21
21
  require_relative "scheme_editor"
22
+ require_relative "diagnosis/diagnosis"
@@ -0,0 +1,40 @@
1
+ require_relative "../../pod-rome/xcodebuild_raw"
2
+ require_relative "../../pod-rome/xcodebuild_command"
3
+
4
+ module Pod
5
+ class Prebuild
6
+ def self.build(options)
7
+ target = options[:target]
8
+ return if target.nil?
9
+
10
+ Pod::UI.puts "Building target: #{target}...".magenta
11
+ options[:sandbox] = Pod::Sandbox.new(Pathname(options[:sandbox])) unless options[:sandbox].is_a?(Pod::Sandbox)
12
+ options[:build_dir] = build_dir(options[:sandbox].root)
13
+
14
+ case target.platform.name
15
+ when :ios, :tvos, :watchos
16
+ XcodebuildCommand.new(options).run
17
+ when :osx
18
+ xcodebuild(
19
+ sandbox: options[:sandbox],
20
+ target: target.label,
21
+ configuration: options[:configuration],
22
+ sdk: "macosx",
23
+ args: options[:args]
24
+ )
25
+ else
26
+ raise "Unsupported platform for '#{target.name}': '#{target.platform.name}'"
27
+ end
28
+ raise "The build directory was not found in the expected location" unless options[:build_dir].directory?
29
+ end
30
+
31
+ def self.remove_build_dir(sandbox_root)
32
+ path = build_dir(sandbox_root)
33
+ path.rmtree if path.exist?
34
+ end
35
+
36
+ def self.build_dir(sandbox_root)
37
+ sandbox_root.parent + "build"
38
+ end
39
+ end
40
+ end
@@ -3,7 +3,7 @@ module Pod
3
3
  # Returns the names of pod targets detected as prebuilt, including
4
4
  # those declared in Podfile and their dependencies
5
5
  def prebuilt_pod_names
6
- prebuilt_pod_targets.map(&:name)
6
+ prebuilt_pod_targets.map(&:name).to_set
7
7
  end
8
8
 
9
9
  # Returns the pod targets detected as prebuilt, including
@@ -17,7 +17,7 @@ module Pod
17
17
  targets = pod_targets.select { |target| explicit_prebuilt_pod_names.include?(target.pod_name) }
18
18
  dependencies = targets.flat_map(&:recursive_dependent_targets) # Treat dependencies as prebuilt pods
19
19
  all = (targets + dependencies).uniq
20
- all = all.reject { |target| sandbox.local?(target.pod_name) } unless Podfile::DSL.dev_pods_enabled?
20
+ all = all.reject { |target| sandbox.local?(target.pod_name) } unless PodPrebuild.config.dev_pods_enabled?
21
21
  all
22
22
  end
23
23
  end
@@ -3,20 +3,13 @@ module Pod
3
3
  class TargetDefinition
4
4
  def detect_prebuilt_pod(name, requirements)
5
5
  @explicit_prebuilt_pod_names ||= []
6
- options = requirements.last
7
- if Pod::Podfile::DSL.prebuild_all?
8
- @explicit_prebuilt_pod_names << Specification.root_name(name)
9
- elsif options.is_a?(Hash) && options[:binary]
10
- @explicit_prebuilt_pod_names << Specification.root_name(name)
11
- end
6
+ options = requirements.last || {}
7
+ @explicit_prebuilt_pod_names << Specification.root_name(name) if options.is_a?(Hash) && options[:binary]
12
8
  options.delete(:binary) if options.is_a?(Hash)
13
9
  requirements.pop if options.empty?
14
10
  end
15
11
 
16
- # Returns the names of pod targets explicitly declared as prebuilt in Podfile
17
- # using `:binary => true`.
18
- # In case `prebuild_all` is ON via `config_cocoapods_binary_cache`, returns the
19
- # name of all pod targets
12
+ # Returns the names of pod targets explicitly declared as prebuilt in Podfile using `:binary => true`.
20
13
  def explicit_prebuilt_pod_names
21
14
  names = @explicit_prebuilt_pod_names || []
22
15
  names += parent.explicit_prebuilt_pod_names if !parent.nil? && parent.is_a?(TargetDefinition)
@@ -18,19 +18,10 @@
18
18
  module Pod
19
19
  def self.fast_get_targets_for_pod_name(pod_name, targets, cache)
20
20
  pod_name = pod_name.split("/")[0] # Look for parent spec instead of subspecs
21
- pod_name_to_targets_hash = nil
22
21
  if cache.empty?
23
- pod_name_to_targets_hash = targets.reduce({}) do |sum, target|
24
- array = sum[target.pod_name] || []
25
- array << target
26
- sum[target.pod_name] = array
27
- sum
28
- end
29
- cache << pod_name_to_targets_hash
22
+ targets.select { |target| target.name == pod_name }
30
23
  else
31
- pod_name_to_targets_hash = cache.first
24
+ cache.first[pod_name] || []
32
25
  end
33
-
34
- pod_name_to_targets_hash[pod_name] || []
35
26
  end
36
27
  end
@@ -2,46 +2,46 @@ require_relative "names"
2
2
 
3
3
  module Pod
4
4
  class PrebuildSandbox < Sandbox
5
-
6
5
  # [String] standard_sandbox_path
7
6
  def self.from_standard_sanbox_path(path)
8
- prebuild_sandbox_path = Pathname.new(path).realpath + "_Prebuild"
9
- self.new(prebuild_sandbox_path)
7
+ prebuild_sandbox_path = Pathname.new(path).realpath + ".." + PodPrebuild.config.prebuild_sandbox_path
8
+ new(prebuild_sandbox_path)
10
9
  end
11
10
 
12
11
  def self.from_standard_sandbox(sandbox)
13
- self.from_standard_sanbox_path(sandbox.root)
12
+ from_standard_sanbox_path(sandbox.root)
14
13
  end
15
14
 
16
15
  def standard_sanbox_path
17
- self.root.parent
16
+ root.parent
18
17
  end
19
18
 
20
19
  def generate_framework_path
21
- self.root + "GeneratedFrameworks"
20
+ root + "GeneratedFrameworks"
22
21
  end
23
22
 
24
23
  # @param name [String] pass the target.name (may containing platform suffix)
25
24
  # @return [Pathname] the folder containing the framework file.
26
25
  def framework_folder_path_for_target_name(name)
27
- self.generate_framework_path + name
26
+ generate_framework_path + name
28
27
  end
29
28
 
30
29
  def exsited_framework_target_names
31
- exsited_framework_name_pairs.map { |pair| pair[0] }.uniq
30
+ existed_framework_name_pairs.map { |pair| pair[0] }.uniq
32
31
  end
33
32
 
34
33
  def exsited_framework_pod_names
35
- exsited_framework_name_pairs.map { |pair| pair[1] }.uniq
34
+ existed_framework_name_pairs.map { |pair| pair[1] }.uniq
36
35
  end
37
36
 
38
37
  def existed_target_names_for_pod_name(pod_name)
39
- exsited_framework_name_pairs.select { |pair| pair[1] == pod_name }.map { |pair| pair[0] }
38
+ existed_framework_name_pairs.select { |pair| pair[1] == pod_name }.map { |pair| pair[0] }
40
39
  end
41
40
 
42
41
  def save_pod_name_for_target(target)
43
42
  folder = framework_folder_path_for_target_name(target.name)
44
43
  return unless folder.exist?
44
+
45
45
  flag_file_path = folder + "#{target.pod_name}.pod_name"
46
46
  File.write(flag_file_path.to_s, "")
47
47
  end
@@ -54,16 +54,16 @@ module Pod
54
54
  end
55
55
  name = name.basename(".pod_name").to_s unless name.nil?
56
56
  name ||= Pathname.new(target_folder_path).basename.to_s # for compatibility with older version
57
+ name
57
58
  end
58
59
 
59
60
  # Array<[target_name, pod_name]>
60
- def exsited_framework_name_pairs
61
+ def existed_framework_name_pairs
61
62
  return [] unless generate_framework_path.exist?
62
- generate_framework_path.children().map do |framework_path|
63
- if framework_path.directory? && (not framework_path.children.empty?)
63
+
64
+ generate_framework_path.children.map do |framework_path|
65
+ if framework_path.directory? && !framework_path.children.empty?
64
66
  [framework_path.basename.to_s, pod_name_for_target_folder(framework_path)]
65
- else
66
- nil
67
67
  end
68
68
  end.reject(&:nil?).uniq
69
69
  end