Class: Raven::M2LocalRepository
- Inherits:
-
Object
- Object
- Raven::M2LocalRepository
- Defined in:
- lib/raven/repo_builder.rb
Instance Method Summary collapse
- #each ⇒ Object
- #each_old ⇒ Object
-
#initialize(dir) ⇒ M2LocalRepository
constructor
A new instance of M2LocalRepository.
Constructor Details
#initialize(dir) ⇒ M2LocalRepository
Returns a new instance of M2LocalRepository.
168 169 170 |
# File 'lib/raven/repo_builder.rb', line 168 def initialize(dir) @dir = dir end |
Instance Method Details
#each ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/raven/repo_builder.rb', line 184 def each queue = [''] while (queue.length > 0) path = queue.pop # Going down each folder until we find a jar Raven.dir_each(File.join(@dir, path)) do |elmt| if (File.file?(File.join(@dir, path, elmt))) if (elmt[-4..-1] == '.jar') # Extracting group, artifact and version from the full path c_path = File.join(path, elmt) groupNArt = c_path[/^.*\/[0-9]/][1..-3].gsub(File::SEPARATOR, '.') groupId = groupNArt[0..(groupNArt.rindex('.') -1)] artifactId = groupNArt[(groupNArt.rindex('.') + 1) .. -1] v1 = c_path[0..c_path.rindex('/') - 1] versionId = v1[v1.rindex('/')+1..-1] art_path = "#{groupId.gsub('.', File::SEPARATOR)}/#{artifactId}/#{versionId}/#{artifactId}-#{versionId}.jar" artifact = Raven::Artifact.new(groupId, artifactId, versionId, art_path) yield artifact break end else queue << File.join(path, elmt) end end end end |
#each_old ⇒ Object
172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/raven/repo_builder.rb', line 172 def each_old Raven.dir_each(@dir) do |groupId| Raven.dir_each(File.join(@dir, groupId)) do |artifactId| Raven.dir_each(File.join(@dir, groupId, artifactId)) do |versionId| art_path = "#{groupId}/#{artifactId}/#{versionId}/#{artifactId}-#{versionId}.jar" artifact = Raven::Artifact.new(groupId, artifactId, versionId, art_path) yield(artifact) end end end end |