Class: LockJar::Runtime::Lock

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/lock_jar/runtime/lock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(runtime) ⇒ Lock

Returns a new instance of Lock.



10
11
12
13
14
# File 'lib/lock_jar/runtime/lock.rb', line 10

def initialize(runtime)
  super(runtime)

  @lockfile = LockJar::Domain::Lockfile.new
end

Instance Attribute Details

#jarfileObject

Returns the value of attribute jarfile.



8
9
10
# File 'lib/lock_jar/runtime/lock.rb', line 8

def jarfile
  @jarfile
end

#lockfileObject

Returns the value of attribute lockfile.



8
9
10
# File 'lib/lock_jar/runtime/lock.rb', line 8

def lockfile
  @lockfile
end

#optsObject

Returns the value of attribute opts.



8
9
10
# File 'lib/lock_jar/runtime/lock.rb', line 8

def opts
  @opts
end

Instance Method Details

#lock(jarfile_or_dsl, opts = {}, &blk) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/lock_jar/runtime/lock.rb', line 16

def lock(jarfile_or_dsl, opts = {}, &blk)
  @opts = { download: true }.merge(opts)

  create_dsl!(jarfile_or_dsl, &blk)

  apply_repositories!

  apply_maps!

  apply_excludes!

  apply_merged!

  artifacts = jarfile.artifacts.values.flatten
  apply_artifacts!(artifacts) unless artifacts.empty?

  lockfile.write(@opts[:lockfile] || 'Jarfile.lock')

  lockfile
end