Class Raven::M2LocalRepository
In: lib/raven/repo_builder.rb
Parent: Object

Methods

each   each_old   new  

Public Class methods

[Source]

     # File lib/raven/repo_builder.rb, line 168
168:     def initialize(dir)
169:       @dir = dir
170:     end

Public Instance methods

[Source]

     # File lib/raven/repo_builder.rb, line 184
184:     def each
185:       queue = ['']
186:       while (queue.length > 0)
187:         path = queue.pop
188:         # Going down each folder until we find a jar

189:         Raven.dir_each(File.join(@dir, path)) do |elmt|
190:           if (File.file?(File.join(@dir, path, elmt)))
191:             if (elmt[-4..-1] == '.jar')
192:               # Extracting group, artifact and version from the full path

193:               c_path = File.join(path, elmt)
194:               groupNArt = c_path[/^.*\/[0-9]/][1..-3].gsub(File::SEPARATOR, '.')
195:               groupId = groupNArt[0..(groupNArt.rindex('.') -1)]
196:               artifactId = groupNArt[(groupNArt.rindex('.') + 1) .. -1]
197:               v1 = c_path[0..c_path.rindex('/') - 1]
198:               versionId = v1[v1.rindex('/')+1..-1]
199:               art_path = "#{groupId.gsub('.', File::SEPARATOR)}/#{artifactId}/#{versionId}/#{artifactId}-#{versionId}.jar"
200:               artifact = Raven::Artifact.new(groupId, artifactId, versionId, art_path)
201:               yield artifact
202:               break
203:             end
204:           else
205:             queue << File.join(path, elmt)
206:           end
207:         end
208:       end
209:     end

[Source]

     # File lib/raven/repo_builder.rb, line 172
172:     def each_old
173:       Raven.dir_each(@dir) do |groupId|
174:         Raven.dir_each(File.join(@dir, groupId)) do |artifactId|
175:           Raven.dir_each(File.join(@dir, groupId, artifactId)) do |versionId|
176:             art_path = "#{groupId}/#{artifactId}/#{versionId}/#{artifactId}-#{versionId}.jar"
177:             artifact = Raven::Artifact.new(groupId, artifactId, versionId, art_path)
178:             yield(artifact)
179:           end
180:         end
181:       end
182:     end

[Validate]