Class: Raven::M1LocalRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/raven/repo_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ M1LocalRepository

Returns a new instance of M1LocalRepository.



213
214
215
# File 'lib/raven/repo_builder.rb', line 213

def initialize(dir)
  @dir = dir
end

Instance Method Details

#eachObject



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/raven/repo_builder.rb', line 217

def each
  Raven.dir_each(@dir) do |groupId|
    if (File.exist?(File.join(@dir, groupId, 'jars')))
      Raven.dir_each(File.join(@dir, groupId, 'jars')) do |filename|
        next if filename[-4, 4] != '.jar'
        begin
          versionId = filename[/-[^a-z].*\.jar/][1..-5]
          artifactId = filename[0..(-versionId.length-6)]
          art_path = "#{groupId}/jars/#{artifactId}-#{versionId}.jar"
          artifact = Raven::Artifact.new(groupId, artifactId, versionId, art_path)
          yield(artifact)
        rescue NoMethodError
          # Will happen if one of the regular expressions return nil
          puts "File #{filename} doesn't seem to be correctly named, ignoring."
        end
      end
    end
  end
end