Class: LockJar::Runtime
- Inherits:
-
Object
- Object
- LockJar::Runtime
- Defined in:
- lib/lock_jar/runtime.rb,
lib/lock_jar/runtime/list.rb,
lib/lock_jar/runtime/load.rb,
lib/lock_jar/runtime/lock.rb,
lib/lock_jar/runtime/install.rb
Defined Under Namespace
Modules: Install, List, Load Classes: Lock
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#current_resolver ⇒ Object
readonly
Returns the value of attribute current_resolver.
Instance Method Summary collapse
-
#initialize ⇒ Runtime
constructor
A new instance of Runtime.
- #lock(jarfile_or_dsl, opts = {}, &blk) ⇒ Object
- #opts ⇒ Object
- #reset! ⇒ Object
- #resolver(opts = {}) ⇒ Object
Methods included from Install
Methods included from List
#build_lockfile, #dependencies_from_lockfile, #list
Methods included from Load
Constructor Details
#initialize ⇒ Runtime
Returns a new instance of Runtime.
39 40 41 42 |
# File 'lib/lock_jar/runtime.rb', line 39 def initialize @config = Config.load_config_file @current_resolver = nil end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
37 38 39 |
# File 'lib/lock_jar/runtime.rb', line 37 def config @config end |
#current_resolver ⇒ Object (readonly)
Returns the value of attribute current_resolver.
37 38 39 |
# File 'lib/lock_jar/runtime.rb', line 37 def current_resolver @current_resolver end |
Instance Method Details
#lock(jarfile_or_dsl, opts = {}, &blk) ⇒ Object
44 45 46 |
# File 'lib/lock_jar/runtime.rb', line 44 def lock(jarfile_or_dsl, opts = {}, &blk) Lock.new(self).lock(jarfile_or_dsl, opts, &blk) end |
#opts ⇒ Object
48 49 50 |
# File 'lib/lock_jar/runtime.rb', line 48 def opts current_resolver.opts if current_resolver end |
#reset! ⇒ Object
70 71 72 |
# File 'lib/lock_jar/runtime.rb', line 70 def reset! @current_resolver = nil end |
#resolver(opts = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/lock_jar/runtime.rb', line 52 def resolver(opts = {}) # XXX: Caches the resolver by the options. Passing in nil opts will replay # from the cache. This need to change. if !opts.nil? opts[:local_repo] = File.(opts[:local_repo]) if opts[:local_repo] elsif @current_resolver opts = @current_resolver.opts else opts = {} end if @current_resolver.nil? || opts != @current_resolver.opts @current_resolver = LockJar::Resolver.new(config, opts) end @current_resolver end |