cocoapods-localsource 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-localsource/LocalModuleManager.rb +79 -72
- data/lib/cocoapods-localsource/PodSwizzle.rb +87 -73
- metadata +29 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d475a0ff9c25be38fc36c5cd9db0bad44464f43
|
4
|
+
data.tar.gz: 1ab25d87ce28d632220a00185853e24e8243138e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5faf4968e1128d7d43453b524243f34889de98c7d729365af77ccc2aa1c581327b0bbb680b99872089de4f4931fb2006541fb2567100728e234fb01130b054c9
|
7
|
+
data.tar.gz: 9ee6f0b7eb24ddac6b85827e842730b09cab45ff57e125ea75b791886ff5bddf9afee933818e731938f39e22ee6b55dd07b94c996e3dc0ea2c06afa42c13eabb
|
@@ -1,82 +1,89 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
1
|
+
class LocalModuleManager
|
2
|
+
@@all_modules = {}
|
3
|
+
@@resolved_modules = {}
|
4
|
+
@@local_paths = []
|
14
5
|
|
15
|
-
|
16
|
-
@@all_modules
|
17
|
-
|
6
|
+
def self.all_modules
|
7
|
+
@@all_modules
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.resolved_modules
|
11
|
+
@@resolved_modules
|
12
|
+
end
|
18
13
|
|
19
|
-
|
20
|
-
|
14
|
+
def self.local_paths
|
15
|
+
@@local_paths
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.set_resolved(name)
|
19
|
+
@@resolved_modules[name] = true
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.resolved?(name)
|
23
|
+
@@resolved_modules.key?(name)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.addLocalPath(path)
|
27
|
+
raise "Trying to add local path '#{path}' twice" unless !@@local_paths.include?(path)
|
28
|
+
|
29
|
+
@@local_paths << path
|
30
|
+
dependencies = findLocalModules(path)
|
31
|
+
|
32
|
+
dependencies.each do |key, value|
|
33
|
+
existingModule = @@all_modules[value.name]
|
34
|
+
raise "Duplicate local module definition for #{value.name} at #{path}. Already defined here: #{existingModule.module_podspec_path}" unless existingModule.nil?
|
35
|
+
@@all_modules[key] = value
|
21
36
|
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.local?(name)
|
40
|
+
!@@all_modules[name].nil?
|
41
|
+
end
|
22
42
|
|
23
|
-
|
24
|
-
|
43
|
+
def self.findLocalModules(path)
|
44
|
+
modules = {}
|
45
|
+
Dir.chdir(path) do
|
46
|
+
podspec_paths = Dir["*/*.podspec"]
|
47
|
+
|
48
|
+
podspec_paths.each do |p|
|
49
|
+
pathComponents = p.split("/")
|
50
|
+
moduleName = pathComponents[1].split(".podspec")[0]
|
51
|
+
foundModule = LocalModule.new(path, pathComponents[0], moduleName)
|
52
|
+
|
53
|
+
modules[moduleName] = foundModule
|
54
|
+
end
|
25
55
|
end
|
26
56
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
57
|
+
return modules
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.clear
|
61
|
+
@@all_modules = {}
|
62
|
+
@@resolved_modules = {}
|
63
|
+
@@local_paths = []
|
64
|
+
end
|
61
65
|
end
|
62
66
|
|
67
|
+
class LocalModule
|
68
|
+
def initialize(modulesPath, root, name)
|
69
|
+
@modules_path = modulesPath
|
70
|
+
@root = root
|
71
|
+
@name = name
|
72
|
+
end
|
63
73
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
@root = root
|
68
|
-
@name = name
|
69
|
-
end
|
74
|
+
attr_reader :modules_path
|
75
|
+
attr_reader :root
|
76
|
+
attr_reader :name
|
70
77
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
78
|
+
def module_path
|
79
|
+
"#{@modules_path}/#{@root}"
|
80
|
+
end
|
81
|
+
|
82
|
+
def module_podspec_path
|
83
|
+
"#{@modules_path}/#{@root}/#{@name}.podspec"
|
84
|
+
end
|
85
|
+
|
86
|
+
def ==(anOther)
|
87
|
+
module_podspec_path == anOther.module_podspec_path
|
88
|
+
end
|
89
|
+
end
|
@@ -1,78 +1,92 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require_relative
|
1
|
+
require "cocoapods"
|
2
|
+
require "cocoapods-core"
|
3
|
+
require_relative "LocalModuleManager"
|
4
4
|
|
5
5
|
module Pod
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
6
|
+
class Podfile
|
7
|
+
module DSL
|
8
|
+
def local_source(*paths)
|
9
|
+
paths.each do |path|
|
10
|
+
LocalModuleManager.addLocalPath(path)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
26
15
|
end
|
27
16
|
|
28
17
|
module Pod
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
18
|
+
class Dependency
|
19
|
+
alias_method :real_initialize, :initialize
|
20
|
+
|
21
|
+
def initialize(name = nil, *requirements)
|
22
|
+
# adds requirement hash if it's not present
|
23
|
+
requirements << {} unless requirements.last.is_a?(Hash)
|
24
|
+
|
25
|
+
pathComponents = name.split("/")
|
26
|
+
baseName = pathComponents[0]
|
27
|
+
|
28
|
+
if LocalModuleManager.all_modules[baseName].present?
|
29
|
+
localModule = LocalModuleManager.all_modules[baseName]
|
30
|
+
# remove version requirement, if local
|
31
|
+
requirements = requirements[1..-1] unless requirements.first.is_a?(Hash)
|
32
|
+
# add path to local dependency
|
33
|
+
requirements.last[:path] = localModule.module_path
|
34
|
+
end
|
35
|
+
|
36
|
+
real_initialize(name, *requirements)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
module Pod
|
42
|
+
class Installer
|
43
|
+
class Analyzer
|
44
|
+
def allDependenciesFor(name, localModules = LocalModuleManager.all_modules)
|
45
|
+
if LocalModuleManager.resolved?(name)
|
46
|
+
# if the local dependency has already been resolved, we don't need to resolve the dependencies again.
|
47
|
+
return []
|
48
|
+
end
|
49
|
+
|
50
|
+
pathComponents = name.split("/")
|
51
|
+
baseName = pathComponents[0]
|
52
|
+
importingSubspec = pathComponents.length > 1
|
53
|
+
|
54
|
+
localModule = localModules[baseName]
|
55
|
+
|
56
|
+
podspec = nil
|
57
|
+
# Position in the modules directory to generate the subspecs correctly
|
58
|
+
Dir.chdir(localModule.module_path) do
|
59
|
+
podspec = eval File.read("#{baseName}.podspec")
|
60
|
+
end
|
61
|
+
|
62
|
+
# Use the subspec if we're importing it
|
63
|
+
if importingSubspec
|
64
|
+
podspec = podspec.subspec_by_name(name)
|
65
|
+
end
|
66
|
+
|
67
|
+
# Get all local dependencies of the spec/subspec
|
68
|
+
allDependencies = podspec.all_dependencies.select { |d| LocalModuleManager.local?(d.name) }
|
69
|
+
|
70
|
+
# Get other dependencies recursively
|
71
|
+
allDependencies.each do |dependency|
|
72
|
+
allDependencies += allDependenciesFor(dependency.name, localModules)
|
73
|
+
end
|
74
|
+
|
75
|
+
LocalModuleManager.set_resolved(name)
|
76
|
+
return allDependencies.uniq
|
77
|
+
end
|
78
|
+
|
79
|
+
alias_method :real_dependencies_to_fetch, :dependencies_to_fetch
|
80
|
+
|
81
|
+
def dependencies_to_fetch(podfile_state)
|
82
|
+
real_dependencies_to_fetch(podfile_state)
|
83
|
+
|
84
|
+
resolvedLocalDependencies = @deps_to_fetch.map do |key, value|
|
85
|
+
allDependenciesFor(key.name)
|
86
|
+
end.flatten.uniq
|
87
|
+
|
88
|
+
@deps_to_fetch = (@deps_to_fetch | resolvedLocalDependencies).uniq
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-localsource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Peter
|
@@ -38,6 +38,34 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '12.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '12.3'
|
41
69
|
description: " cocoapods-localsource allows to import local development pods without
|
42
70
|
specifying a path.\n In your apps Podfile, require the gem and define the local
|
43
71
|
module directory by passing the path to `local_source`.\n Using this cocoapods
|