cocoapods-fump 0.1.0
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 +7 -0
- data/lib/cocoapods-fump/command/fump.rb +47 -0
- data/lib/cocoapods-fump/command.rb +1 -0
- data/lib/cocoapods-fump/gem_version.rb +3 -0
- data/lib/cocoapods-fump/integration/cocoapods_additions/installer_additions.rb +51 -0
- data/lib/cocoapods-fump/integration/cocoapods_additions/lockfile_additions.rb +14 -0
- data/lib/cocoapods-fump/integration/cocoapods_additions/resolver_additions.rb +61 -0
- data/lib/cocoapods-fump/integration/cocoapods_additions/spec_additions.rb +21 -0
- data/lib/cocoapods-fump/integration/cocoapods_additions/spec_state_additions.rb +36 -0
- data/lib/cocoapods-fump/integration/cocoapods_additions/target_definition_additions.rb +58 -0
- data/lib/cocoapods-fump/integration/cocoapods_additions.rb +7 -0
- data/lib/cocoapods-fump/main.rb +14 -0
- data/lib/cocoapods-fump.rb +1 -0
- data/lib/cocoapods_plugin.rb +2 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3f835e2fb710c6eb68ae962e58fe5ab34a64ad1c469f968e8c6f5efe85c04357
|
4
|
+
data.tar.gz: 4b962eca9c4344c92fd229f1210df5a8bb07af6dbb22fb961121d799adee1dfd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eaf56c3740dacb4eb70e411855ff919c68912c01982bb67be9917471b4f2106ca67c2b60e1b33cb58012133ede962fdb8bfe1adcf159991c1c0e22783166a8d2
|
7
|
+
data.tar.gz: '02091925011dce679188ae24b2f74cec824689c160f0199546e470be40fa740c86c8bd2bf5b0ad802d12a7046298b05a4133f35920a5f830152f04afcb6ea937'
|
@@ -0,0 +1,47 @@
|
|
1
|
+
## bgarelli 10/22
|
2
|
+
## MercadoLibre
|
3
|
+
##
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
# This is an example of a cocoapods plugin adding a top-level subcommand
|
7
|
+
# to the 'pod' command.
|
8
|
+
#
|
9
|
+
# You can also create subcommands of existing or new commands. Say you
|
10
|
+
# wanted to add a subcommand to `list` to show newly deprecated pods,
|
11
|
+
# (e.g. `pod list deprecated`), there are a few things that would need
|
12
|
+
# to change.
|
13
|
+
#
|
14
|
+
# - move this file to `lib/pod/command/list/deprecated.rb` and update
|
15
|
+
# the class to exist in the the Pod::Command::List namespace
|
16
|
+
# - change this class to extend from `List` instead of `Command`. This
|
17
|
+
# tells the plugin system that it is a subcommand of `list`.
|
18
|
+
# - edit `lib/cocoapods_plugins.rb` to require this file
|
19
|
+
#
|
20
|
+
# @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
|
21
|
+
# in the `plugins.json` file, once your plugin is released.
|
22
|
+
#
|
23
|
+
class Fump < Command
|
24
|
+
self.summary = 'Short description of cocoapods-fump.'
|
25
|
+
|
26
|
+
self.description = <<-DESC
|
27
|
+
Longer description of cocoapods-fump.
|
28
|
+
DESC
|
29
|
+
|
30
|
+
def initialize(name, required, repeatable = false)
|
31
|
+
@name = name
|
32
|
+
@required = required
|
33
|
+
@repeatable = repeatable
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
def validate!
|
38
|
+
super
|
39
|
+
help! 'A Pod name is required.' unless @name
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
UI.puts "Add your implementation for the cocoapods-fump plugin in #{__FILE__}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-fump/command/fump'
|
@@ -0,0 +1,51 @@
|
|
1
|
+
## bgarelli 10/22
|
2
|
+
## MercadoLibre
|
3
|
+
##
|
4
|
+
module Pod
|
5
|
+
# The Installer is responsible of taking a Podfile and transform it in the
|
6
|
+
# Pods libraries. It also integrates the user project so the Pods
|
7
|
+
# libraries can be used out of the box.
|
8
|
+
#
|
9
|
+
# The Installer is capable of doing incremental updates to an existing Pod
|
10
|
+
# installation.
|
11
|
+
#
|
12
|
+
# The Installer gets the information that it needs mainly from 3 files:
|
13
|
+
#
|
14
|
+
# - Podfile: The specification written by the user that contains
|
15
|
+
# information about targets and Pods.
|
16
|
+
# - Podfile.lock: Contains information about the pods that were previously
|
17
|
+
# installed and in concert with the Podfile provides information about
|
18
|
+
# which specific version of a Pod should be installed. This file is
|
19
|
+
# ignored in update mode.
|
20
|
+
# - Manifest.lock: A file contained in the Pods folder that keeps track of
|
21
|
+
# the pods installed in the local machine. This files is used once the
|
22
|
+
# exact versions of the Pods has been computed to detect if that version
|
23
|
+
# is already installed. This file is not intended to be kept under source
|
24
|
+
# control and is a copy of the Podfile.lock.
|
25
|
+
#
|
26
|
+
# The Installer is designed to work in environments where the Podfile folder
|
27
|
+
# is under source control and environments where it is not. The rest of the
|
28
|
+
# files, like the user project and the workspace are assumed to be under
|
29
|
+
# source control.
|
30
|
+
#
|
31
|
+
class Installer
|
32
|
+
class << self
|
33
|
+
def getForcedVersionFor(root)
|
34
|
+
last_value = Pod::Installer.installer_forced.select{ |key, value| key == root }.last
|
35
|
+
final_value = last_value.last.last unless last_value.nil?
|
36
|
+
Pod::Version.new(final_value) unless final_value.nil?
|
37
|
+
end
|
38
|
+
end
|
39
|
+
## Stores a static hash containing a dependency's root name as key
|
40
|
+
## and a version requirement string representation as value
|
41
|
+
@@installer_forced = []
|
42
|
+
|
43
|
+
def self.installer_forced
|
44
|
+
@@installer_forced
|
45
|
+
end
|
46
|
+
|
47
|
+
def installer_forced
|
48
|
+
@@installer_forced
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
## bgarelli 10/22
|
2
|
+
## MercadoLibre
|
3
|
+
##
|
4
|
+
module Pod
|
5
|
+
## @note: this may be one of the spots to properly fix cached reqs disabling forced versions
|
6
|
+
## right now the workaround is to delete Podfile.lock if there are forced versions
|
7
|
+
class Lockfile
|
8
|
+
old_to_lock = instance_method('dependencies_to_lock_pod_named')
|
9
|
+
## FOR THIS OVERRIDE TO WORK: uncomment '../spec_additions' in cocoapods_additions.rb
|
10
|
+
define_method('dependencies_to_lock_pod_named') do |name|
|
11
|
+
puts "To Lock: #{name}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
## bgarelli 10/22
|
2
|
+
## MercadoLibre
|
3
|
+
##
|
4
|
+
require 'molinillo'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
# The resolver is responsible of generating a list of specifications grouped
|
8
|
+
# by target for a given Podfile.
|
9
|
+
#
|
10
|
+
class Resolver
|
11
|
+
## Inject force version logic when dependencies are given to Molinillo for analysis.
|
12
|
+
##
|
13
|
+
## @note The base logic is copied from the original implementation.
|
14
|
+
## @note A check was inserted into legacy logic to verify if the dependency version is forced, if so,
|
15
|
+
## its version is replaced with the declared at podfile. Anything else legacy flow goes on.
|
16
|
+
##
|
17
|
+
old_dep_for = instance_method('dependencies_for')
|
18
|
+
# Returns the dependencies of `specification`.
|
19
|
+
#
|
20
|
+
# @return [Array<Specification>] all dependencies of `specification`.
|
21
|
+
#
|
22
|
+
# @param [Specification] specification the specification whose own
|
23
|
+
# dependencies are being asked for.
|
24
|
+
#
|
25
|
+
define_method('dependencies_for') do |specification|
|
26
|
+
spec_name = Specification.root_name(specification.name)
|
27
|
+
specification.all_dependencies.map do |dependency|
|
28
|
+
forced_version = Installer.getForcedVersionFor(dependency.root_name)
|
29
|
+
if forced_version.nil?
|
30
|
+
if dependency.root_name == spec_name
|
31
|
+
dependency.dup.tap { |d| d.specific_version = specification.version }
|
32
|
+
else
|
33
|
+
dependency
|
34
|
+
end
|
35
|
+
else
|
36
|
+
dependency.dup.tap { |d| d.specific_version = forced_version }
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
41
|
+
## @note: this may be one of the spots to properly fix cached reqs disabling forced versions
|
42
|
+
## right now the workaround is to delete Podfile.lock if there are forced versions
|
43
|
+
old_search = instance_method('search_for')
|
44
|
+
# Returns (and caches) the specification that satisfy the given dependency.
|
45
|
+
#
|
46
|
+
# @return [Array<Specification>] the specifications that satisfy the given
|
47
|
+
# `dependency`.
|
48
|
+
#
|
49
|
+
# @param [Dependency] dependency the dependency that is being searched for.
|
50
|
+
#
|
51
|
+
##define_method('search_for') do |dependency|
|
52
|
+
## forced_names = Pod::Installer.installer_forced.map{|key, value| key}
|
53
|
+
## if forced_names.include?(dependency.root_name)
|
54
|
+
## additional_requirements = @podfile_requirements_by_root_name[dependency.root_name]
|
55
|
+
## specifications_for_dependency(dependency, additional_requirements).freeze
|
56
|
+
## else
|
57
|
+
## old_search.bind(self).(dependency)
|
58
|
+
## end
|
59
|
+
##end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# bgarelli 10/22
|
2
|
+
# MercadoLibre
|
3
|
+
module Pod
|
4
|
+
# Original Doc
|
5
|
+
# ___________________
|
6
|
+
# The Specification provides a DSL to describe a Pod. A pod is defined as a
|
7
|
+
# library originating from a source. A specification can support detailed
|
8
|
+
# attributes for modules of code through subspecs.
|
9
|
+
#
|
10
|
+
# Usually it is stored in files with `podspec` extension.
|
11
|
+
#
|
12
|
+
class Specification
|
13
|
+
oldStore = instance_method('store_attribute')
|
14
|
+
|
15
|
+
define_method('store_attribute') do |name, value, platform_name=nil|
|
16
|
+
## FOR THIS OVERRIDE TO WORK: uncomment '../spec_additions' in cocoapods_additions.rb
|
17
|
+
oldStore.bind(self).(name, final_value, platform_name)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Pod
|
2
|
+
class Installer
|
3
|
+
class Analyzer
|
4
|
+
|
5
|
+
old = instance_method(:analyze)
|
6
|
+
# Performs the analysis.
|
7
|
+
#
|
8
|
+
# The Podfile and the Lockfile provide the information necessary to
|
9
|
+
# compute which specification should be installed. The manifest of the
|
10
|
+
# sandbox returns which specifications are installed.
|
11
|
+
#
|
12
|
+
# @param [Boolean] allow_fetches
|
13
|
+
# whether external sources may be fetched
|
14
|
+
#
|
15
|
+
# @return [AnalysisResult]
|
16
|
+
#
|
17
|
+
define_method(:analyze) do |fetch|
|
18
|
+
old.bind(self).(fetch)
|
19
|
+
end
|
20
|
+
# This class represents the state of a collection of Pods.
|
21
|
+
#
|
22
|
+
# @note The names of the pods stored by this class are always the **root**
|
23
|
+
# name of the specification.
|
24
|
+
#
|
25
|
+
# @note The motivation for this class is to ensure that the names of the
|
26
|
+
# subspecs are added instead of the name of the Pods.
|
27
|
+
#
|
28
|
+
class SpecsState
|
29
|
+
## Allows changing the status of a pod after analyzer has run (detect changed forced option)
|
30
|
+
def changed_state(pod)
|
31
|
+
add_name(pod, :changed)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
## bgarelli 10/22
|
2
|
+
## MercadoLibre
|
3
|
+
##
|
4
|
+
## The custom parsing implementation executes before the legacy one
|
5
|
+
## to retrieve :forced markers and remove them before it takes place.
|
6
|
+
module Pod
|
7
|
+
class Podfile
|
8
|
+
# The TargetDefinition stores the information of a CocoaPods static
|
9
|
+
# library. The target definition can be linked with one or more targets of
|
10
|
+
# the user project.
|
11
|
+
#
|
12
|
+
# Target definitions can be nested and by default inherit the dependencies
|
13
|
+
# of the parent.
|
14
|
+
#
|
15
|
+
class TargetDefinition
|
16
|
+
def forced_keyword
|
17
|
+
return :forced
|
18
|
+
end
|
19
|
+
## Reads for :forced attribute present in dependencies declared at the podfile.
|
20
|
+
## Keeps forced libs info in memory and remove the marker from the hash,
|
21
|
+
## to avoid exception due unrecognized flags by cocoapods.
|
22
|
+
def parse_fump_framework(name, requirements)
|
23
|
+
options = requirements.last
|
24
|
+
|
25
|
+
if options.is_a?(Hash) && options[forced_keyword] != nil
|
26
|
+
explicit_forced_flag = options.delete(forced_keyword)
|
27
|
+
requirements.pop if options.empty?
|
28
|
+
end
|
29
|
+
|
30
|
+
## Keep marked deps at Installer.installer_forced static attribute.
|
31
|
+
if explicit_forced_flag
|
32
|
+
pod_name = Specification.root_name(name)
|
33
|
+
puts "Forced #{name} version: #{requirements}"
|
34
|
+
Pod::Installer.installer_forced << [name, requirements]
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
## Modifying `:parse_inhibit_warnings` is less effort than putting code in the
|
39
|
+
## `store_pod` method.
|
40
|
+
old_method = instance_method(:parse_inhibit_warnings)
|
41
|
+
|
42
|
+
define_method(:parse_inhibit_warnings) do |name, requirements|
|
43
|
+
parse_fump_framework(name, requirements)
|
44
|
+
## Temporal workaround for avoiding conflicts with cached requirements.
|
45
|
+
##
|
46
|
+
## @note As Podfile.lock is deleted there are no chaced versions.
|
47
|
+
unless Pod::Installer.installer_forced.empty?
|
48
|
+
begin
|
49
|
+
File.delete('Podfile.lock')
|
50
|
+
rescue Errno::ENOENT
|
51
|
+
end
|
52
|
+
end
|
53
|
+
## @todo: unless forced all.
|
54
|
+
old_method.bind(self).(name, requirements)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require_relative 'cocoapods_additions/installer_additions'
|
2
|
+
##require_relative 'cocoapods_additions/lockfile_additions'
|
3
|
+
require_relative 'cocoapods_additions/resolver_additions'
|
4
|
+
##require_relative 'cocoapods_additions/spec_additions'
|
5
|
+
##require_relative 'cocoapods_additions/spec_state_additions'
|
6
|
+
require_relative 'cocoapods_additions/target_definition_additions'
|
7
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
## bgarelli 10/22
|
2
|
+
## MercadoLibre
|
3
|
+
##
|
4
|
+
## @note importing this file loads the overrides for the methods within the flow;
|
5
|
+
## the logic goes along with the steps contained in it
|
6
|
+
require_relative "integration/cocoapods_additions"
|
7
|
+
|
8
|
+
Pod::HooksManager.register('cocoapods-fump', :pre_install) do |installer_context|
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
Pod::HooksManager.register('cocoapods-fump', :post_install) do |installer_context|
|
13
|
+
Pod::UI.notice "Dependencies Forced Succesfully"
|
14
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'cocoapods-fump/gem_version'
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-fump
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bruno Garelli
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-11-25 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: rake
|
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
|
+
description: A short description of cocoapods-fump.
|
42
|
+
email:
|
43
|
+
- bruno.garelli@mercadolibre.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- lib/cocoapods-fump.rb
|
49
|
+
- lib/cocoapods-fump/command.rb
|
50
|
+
- lib/cocoapods-fump/command/fump.rb
|
51
|
+
- lib/cocoapods-fump/gem_version.rb
|
52
|
+
- lib/cocoapods-fump/integration/cocoapods_additions.rb
|
53
|
+
- lib/cocoapods-fump/integration/cocoapods_additions/installer_additions.rb
|
54
|
+
- lib/cocoapods-fump/integration/cocoapods_additions/lockfile_additions.rb
|
55
|
+
- lib/cocoapods-fump/integration/cocoapods_additions/resolver_additions.rb
|
56
|
+
- lib/cocoapods-fump/integration/cocoapods_additions/spec_additions.rb
|
57
|
+
- lib/cocoapods-fump/integration/cocoapods_additions/spec_state_additions.rb
|
58
|
+
- lib/cocoapods-fump/integration/cocoapods_additions/target_definition_additions.rb
|
59
|
+
- lib/cocoapods-fump/main.rb
|
60
|
+
- lib/cocoapods_plugin.rb
|
61
|
+
homepage: https://github.com/EXAMPLE/cocoapods-fump
|
62
|
+
licenses:
|
63
|
+
- MIT
|
64
|
+
metadata: {}
|
65
|
+
post_install_message:
|
66
|
+
rdoc_options: []
|
67
|
+
require_paths:
|
68
|
+
- lib
|
69
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ">="
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
requirements: []
|
80
|
+
rubygems_version: 3.2.3
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: A longer description of cocoapods-fump.
|
84
|
+
test_files: []
|