cocoapods-localsource 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e4f7b313a055db81b9c6e7a82e687d71c31cecaa
|
4
|
+
data.tar.gz: 13a4a99017168063e6cc8b8f502e49fdc79bb886
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 13514103adbd09eb5920cfd562de15e2776c25b568c8f088aa76966ff30c01d0f44b9af97eee30b16d70ae441f3414019aed2377809a787688c97d9bfca16a7d
|
7
|
+
data.tar.gz: c1a0a7bd9d2f303a51eb6773949939715c2b3c3d160039adc0f538b6aa59777c765ed7bfbe55d0954b78fbe98b4cca48ae6fe96c88a2ad443e618783db05a8ad
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'cocoapods-core'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Podfile
|
5
|
+
module DSL
|
6
|
+
def local_source(*paths)
|
7
|
+
paths.each do |path|
|
8
|
+
LocalModuleManager.addLocalPath(path)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class LocalModuleManager
|
16
|
+
@@all_modules = {}
|
17
|
+
@@resolved_modules = {}
|
18
|
+
|
19
|
+
def self.all_modules
|
20
|
+
@@all_modules
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.set_resolved(name)
|
24
|
+
@@resolved_modules[name] = true
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.resolved?(name)
|
28
|
+
@@resolved_modules.key?(name)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.addLocalPath(path)
|
32
|
+
dependencies = findLocalModules(path)
|
33
|
+
|
34
|
+
dependencies.each do |key, value|
|
35
|
+
existingModule = @@all_modules[value.name]
|
36
|
+
raise "Duplicate local module definition for #{value.name} at #{path}. Already defined here: #{existingModule.module_podspec_path}" unless existingModule.nil?
|
37
|
+
@@all_modules[key] = value
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.local?(name)
|
42
|
+
!@@all_modules[name].nil?
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.findLocalModules(path)
|
46
|
+
modules = {}
|
47
|
+
Dir.chdir(path) do
|
48
|
+
podspec_paths = Dir["*/*.podspec"]
|
49
|
+
|
50
|
+
podspec_paths.each do |p|
|
51
|
+
pathComponents = p.split("/")
|
52
|
+
moduleName = pathComponents[1].split(".podspec")[0]
|
53
|
+
foundModule = LocalModule.new(path, pathComponents[0], moduleName)
|
54
|
+
|
55
|
+
modules[moduleName] = foundModule
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
return modules
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
class LocalModule
|
65
|
+
def initialize(modulesPath, root, name)
|
66
|
+
@modules_path = modulesPath
|
67
|
+
@root = root
|
68
|
+
@name = name
|
69
|
+
end
|
70
|
+
|
71
|
+
attr_reader :modules_path
|
72
|
+
attr_reader :root
|
73
|
+
attr_reader :name
|
74
|
+
|
75
|
+
def module_path
|
76
|
+
"#{@modules_path}/#{@root}"
|
77
|
+
end
|
78
|
+
|
79
|
+
def module_podspec_path
|
80
|
+
"#{@modules_path}/#{@root}/#{@name}.podspec"
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'cocoapods'
|
2
|
+
require 'cocoapods-core'
|
3
|
+
require_relative 'LocalModuleManager'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Dependency
|
7
|
+
alias_method :real_initialize, :initialize
|
8
|
+
def initialize(name = nil, *requirements)
|
9
|
+
# adds requirement hash if it's not present
|
10
|
+
requirements << {} unless requirements.last.is_a?(Hash)
|
11
|
+
|
12
|
+
pathComponents = name.split("/")
|
13
|
+
baseName = pathComponents[0]
|
14
|
+
|
15
|
+
if LocalModuleManager.all_modules[baseName].present?
|
16
|
+
localModule = LocalModuleManager.all_modules[baseName]
|
17
|
+
# remove version requirement, if local
|
18
|
+
requirements = requirements[1..-1] unless requirements.first.is_a?(Hash)
|
19
|
+
# add path to local dependency
|
20
|
+
requirements.last[:path] = localModule.module_path
|
21
|
+
end
|
22
|
+
|
23
|
+
real_initialize(name, *requirements)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module Pod
|
29
|
+
class Installer
|
30
|
+
class Analyzer
|
31
|
+
def allDependenciesFor(name, localModules = LocalModuleManager.all_modules)
|
32
|
+
if LocalModuleManager.resolved?(name)
|
33
|
+
# if the local dependency has already been resolved, we don't need to resolve the dependencies again.
|
34
|
+
return []
|
35
|
+
end
|
36
|
+
|
37
|
+
pathComponents = name.split("/")
|
38
|
+
baseName = pathComponents[0]
|
39
|
+
importingSubspec = pathComponents.length > 1
|
40
|
+
|
41
|
+
localModule = localModules[baseName]
|
42
|
+
|
43
|
+
podspec = nil
|
44
|
+
# Position in the modules directory to generate the subspecs correctly
|
45
|
+
Dir.chdir(localModule.module_path) do
|
46
|
+
podspec = eval File.read("#{baseName}.podspec")
|
47
|
+
end
|
48
|
+
|
49
|
+
# Use the subspec if we're importing it
|
50
|
+
if importingSubspec
|
51
|
+
podspec = podspec.subspec_by_name(name)
|
52
|
+
end
|
53
|
+
|
54
|
+
# Get all local dependencies of the spec/subspec
|
55
|
+
allDependencies = podspec.all_dependencies.select { |d| LocalModuleManager.local?(d.name) }
|
56
|
+
|
57
|
+
# Get other dependencies recursively
|
58
|
+
allDependencies.each do |dependency|
|
59
|
+
allDependencies += allDependenciesFor(dependency.name, localModules)
|
60
|
+
end
|
61
|
+
|
62
|
+
LocalModuleManager.set_resolved(name)
|
63
|
+
return allDependencies.uniq
|
64
|
+
end
|
65
|
+
|
66
|
+
alias_method :real_dependencies_to_fetch, :dependencies_to_fetch
|
67
|
+
def dependencies_to_fetch(podfile_state)
|
68
|
+
real_dependencies_to_fetch(podfile_state)
|
69
|
+
|
70
|
+
resolvedLocalDependencies = @deps_to_fetch.map do |key, value|
|
71
|
+
allDependenciesFor(key.name)
|
72
|
+
end.flatten.uniq
|
73
|
+
|
74
|
+
@deps_to_fetch = (@deps_to_fetch | resolvedLocalDependencies).uniq
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-localsource
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Peter
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-03-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cocoapods-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: cocoapods
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A simple hello world gem
|
42
|
+
email: daniel.peter@me.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- lib/cocoapods-localsource.rb
|
48
|
+
- lib/cocoapods-localsource/LocalModuleManager.rb
|
49
|
+
- lib/cocoapods-localsource/PodSwizzle.rb
|
50
|
+
homepage: http://rubygems.org/gems/cocoapods-localsource
|
51
|
+
licenses:
|
52
|
+
- MIT
|
53
|
+
metadata:
|
54
|
+
source_code_uri: https://github.com/ohitsdaniel/cocoapods-localsource
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.5.2.3
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: Allows including local podspec dependencies withouth the need of an externally
|
75
|
+
hosted source
|
76
|
+
test_files: []
|