Module: Qricker
- Defined in:
- lib/qricker.rb,
lib/qricker/module.rb,
lib/qricker/version.rb,
lib/qricker/podspecs.rb,
lib/qricker/dependency.rb,
lib/qricker/module_cache.rb,
lib/qricker/spec_builder.rb
Defined Under Namespace
Classes: DependencyNode, ModuleCache, Resolver, RickerSpec, SpecBuilder
Constant Summary
collapse
- VERSION =
'0.1.13'
Class Method Summary
collapse
Class Method Details
.allPodSpecs(path) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/qricker/podspecs.rb', line 38
def Qricker.allPodSpecs(path)
podspecs = findPodspecs(path)
transSpecs = []
if not podspecs.nil?
podspecs.each { |specpath|
spec = RickerSpec.new(File.basename(specpath,".podspec"), specpath.dirname)
transSpecs << spec
}
end
return transSpecs
end
|
.collectDependencies(config, dependecies, originSpec) ⇒ Object
135
136
137
138
139
140
141
142
143
144
145
|
# File 'lib/qricker/dependency.rb', line 135
def Qricker.collectDependencies(config,dependecies, originSpec)
if config.get_groups.include?(originSpec)
podspec = Pod::Specification.from_file(config[originSpec]["PATH"]+"/#{originSpec}.podspec")
podspec.dependencies.each { |pspec|
if not dependecies.include? pspec.name
dependecies << pspec.name
collectDependencies(config,dependecies, pspec.name)
end
}
end
end
|
.dependency(localfile, specnames) ⇒ Object
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# File 'lib/qricker/dependency.rb', line 148
def Qricker.dependency(localfile , specnames)
config = ParseConfig.new(localfile)
if config.nil?
return []
end
allDependencies = []
if not specnames.nil?
specnames.each { |name|
collectDependencies(config,allDependencies, name)
}
end
outputDependencies = []
allDependencies.each { |dep|
if config.get_groups.include?(dep)
spec = RickerSpec.new(dep, config[dep]["PATH"])
outputDependencies << spec
end
}
return sortDenpencies outputDependencies
end
|
.dependencyIncludeSelf(localfile, specnames) ⇒ Object
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
# File 'lib/qricker/dependency.rb', line 179
def Qricker.dependencyIncludeSelf(localfile, specnames)
config = ParseConfig.new(localfile)
if config.nil?
return []
end
allDependencies = Array.new(specnames)
if not specnames.nil?
specnames.each { |name|
collectDependencies(config,allDependencies, name)
}
end
outputDependencies = []
allDependencies.each { |dep|
if config.get_groups.include?(dep)
spec = RickerSpec.new(dep, config[dep]["PATH"])
outputDependencies << spec
end
}
return sortDenpencies(outputDependencies)
end
|
.findPodspecs(path) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/qricker/podspecs.rb', line 4
def Qricker.findPodspecs(path)
podspecs = []
path = Pathname(path)
if not path.absolute?
path = path.realpath
end
path.entries.each { |entry|
if (entry.extname == '.podspec' || entry.to_s.end_with?('.podspec.json'))
if path.basename.to_path == "Local Podspecs"
next
end
podspecs.push(path.join(entry))
end
}
if podspecs.count != 0
return podspecs
else
path.entries.each { |entry|
next if entry.to_path == "."
next if entry.to_path == ".."
next if entry.to_path == ".git"
next if entry.to_path == ".repo"
next if entry.to_path.start_with?("cocoapods-")
next if entry.to_path.start_with?("hive-deploy")
if File.directory?(path.join(entry))
subpath = path.join(entry)
ps = findPodspecs(subpath)
podspecs = podspecs + ps
end
}
end
return podspecs
end
|
.parseRCTL(rctlFile) ⇒ Object
35
36
37
|
# File 'lib/qricker/module.rb', line 35
def Qricker.parseRCTL(rctlFile)
end
|
.sortDenpencies(deps) ⇒ Object
170
171
172
173
174
175
176
177
|
# File 'lib/qricker/dependency.rb', line 170
def Qricker.sortDenpencies(deps)
resolver = Resolver.new(deps)
deps = resolver.sorted
puts "依赖关系图为:"
resolver.printSelf
return deps
end
|
.transferSpec(rctlFile, specFile) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/qricker.rb', line 16
def Qricker.transferSpec(rctlFile,specFile)
if not Pathname(specFile).exist?
print "File Not Exist!!!"
exit(1)
end
moduleCache = ModuleCache.new(rctlFile)
spec = Pod::Specification.from_file(specFile)
tspecBuilder = SpecBuilder.new(spec, moduleCache )
tspec = tspecBuilder.spec_metadata + "\n"+ tspecBuilder.spec_close
return tspec
end
|