Class: Berkshelf::Lockfile::LockfileLegacy
- Inherits:
-
Object
- Object
- Berkshelf::Lockfile::LockfileLegacy
- Defined in:
- lib/berkshelf/lockfile.rb
Overview
TODO:
Remove this class in Berkshelf 3.0.0
Legacy support for old lockfiles
Instance Attribute Summary collapse
-
#berksfile ⇒ Berkshelf::Berksfile
readonly
The berksfile.
-
#name ⇒ String
readonly
The name of this cookbook.
-
#options ⇒ Hash
readonly
The hash of options.
Class Method Summary collapse
-
.parse(berksfile, content) ⇒ Object
Read the old lockfile content and instance eval in context.
Instance Method Summary collapse
-
#cookbook(name, options = {}) ⇒ Object
Method defined in legacy lockfiles (since we are using instance_eval).
-
#initialize(berksfile, content) ⇒ LockfileLegacy
constructor
Create a new legacy lockfile for processing.
Constructor Details
#initialize(berksfile, content) ⇒ LockfileLegacy
Create a new legacy lockfile for processing
243 244 245 246 |
# File 'lib/berkshelf/lockfile.rb', line 243 def initialize(berksfile, content) @berksfile = berksfile instance_eval(content).to_hash end |
Instance Attribute Details
#berksfile ⇒ Berkshelf::Berksfile (readonly)
Returns the berksfile.
237 238 239 |
# File 'lib/berkshelf/lockfile.rb', line 237 def berksfile @berksfile end |
#name ⇒ String (readonly)
Returns the name of this cookbook.
233 234 235 |
# File 'lib/berkshelf/lockfile.rb', line 233 def name @name end |
#options ⇒ Hash (readonly)
Returns the hash of options.
229 230 231 |
# File 'lib/berkshelf/lockfile.rb', line 229 def @options end |
Class Method Details
.parse(berksfile, content) ⇒ Object
Read the old lockfile content and instance eval in context.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/berkshelf/lockfile.rb', line 211 def parse(berksfile, content) sources = {}.tap do |hash| content.split("\n").each do |line| next if line.empty? source = self.new(berksfile, line) hash[source.name] = source. end end { sources: sources, } end |
Instance Method Details
#cookbook(name, options = {}) ⇒ Object
Method defined in legacy lockfiles (since we are using instance_eval).
255 256 257 258 |
# File 'lib/berkshelf/lockfile.rb', line 255 def cookbook(name, = {}) @name = name @options = manipulate() end |