Class: LocalModuleManager
- Inherits:
-
Object
- Object
- LocalModuleManager
- Defined in:
- lib/cocoapods-localsource/LocalModuleManager.rb
Constant Summary collapse
- @@all_modules =
{}
- @@resolved_modules =
{}
- @@local_paths =
[]
Class Method Summary collapse
- .addLocalPath(path) ⇒ Object
- .all_modules ⇒ Object
- .clear ⇒ Object
- .findLocalModules(path) ⇒ Object
- .local?(name) ⇒ Boolean
- .local_paths ⇒ Object
- .resolved?(name) ⇒ Boolean
- .resolved_modules ⇒ Object
- .set_resolved(name) ⇒ Object
Class Method Details
.addLocalPath(path) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 26 def self.addLocalPath(path) raise "Trying to add local path '#{path}' twice" unless !@@local_paths.include?(path) @@local_paths << path dependencies = findLocalModules(path) dependencies.each do |key, value| existingModule = @@all_modules[value.name] raise "Duplicate local module definition for #{value.name} at #{path}. Already defined here: #{existingModule.module_podspec_path}" unless existingModule.nil? @@all_modules[key] = value end end |
.all_modules ⇒ Object
6 7 8 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 6 def self.all_modules @@all_modules end |
.clear ⇒ Object
60 61 62 63 64 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 60 def self.clear @@all_modules = {} @@resolved_modules = {} @@local_paths = [] end |
.findLocalModules(path) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 43 def self.findLocalModules(path) modules = {} Dir.chdir(path) do podspec_paths = Dir["*/*.podspec"] podspec_paths.each do |p| pathComponents = p.split("/") moduleName = pathComponents[1].split(".podspec")[0] foundModule = LocalModule.new(path, pathComponents[0], moduleName) modules[moduleName] = foundModule end end return modules end |
.local?(name) ⇒ Boolean
39 40 41 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 39 def self.local?(name) !@@all_modules[name].nil? end |
.local_paths ⇒ Object
14 15 16 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 14 def self.local_paths @@local_paths end |
.resolved?(name) ⇒ Boolean
22 23 24 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 22 def self.resolved?(name) @@resolved_modules.key?(name) end |
.resolved_modules ⇒ Object
10 11 12 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 10 def self.resolved_modules @@resolved_modules end |
.set_resolved(name) ⇒ Object
18 19 20 |
# File 'lib/cocoapods-localsource/LocalModuleManager.rb', line 18 def self.set_resolved(name) @@resolved_modules[name] = true end |