Class: Jars::Lock
- Inherits:
-
Object
- Object
- Jars::Lock
- Defined in:
- lib/jars/lock.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ Lock
constructor
A new instance of Lock.
- #process(scope) ⇒ Object
Constructor Details
#initialize(file) ⇒ Lock
Returns a new instance of Lock.
47 48 49 |
# File 'lib/jars/lock.rb', line 47 def initialize(file) @file = file end |
Instance Method Details
#process(scope) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/jars/lock.rb', line 51 def process(scope) scope ||= :runtime File.read(@file).each_line do |line| next if line !~ /:.+:/ jar = JarDetails.new(line.strip.sub(/:jar:/, ':').sub(/:$/, ': ').split(/:/)) case scope when :all yield jar when :compile # jar.scope is maven scope yield jar if jar.scope != :test when :provided # jar.scope is maven scope yield jar if jar.scope == :provided when :runtime # jar.scope is maven scope yield jar if (jar.scope != :test) && (jar.scope != :provided) when :test yield jar end end end |