Sha256: f537d57683838f31793be3fc9509181f2a04e111e16d08858329bd9ec99bc0bd
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
class BowerVendor::Yarn < BowerVendor::Copy def full_vendor_src_dir(vendor) "node_modules/#{vendor}" end def accept_vendor?(vendor, vendor_data) vendor_data['yarn'] end def load_vendors versions = load_vendor_versions vendors_data = YAML.load_file 'vendor.yml' vendors_data.delete_if { |vendor, vendor_data| !accept_vendor?(vendor, vendor_data) } vendors_data.each do |vendor, vendor_data| version = versions[vendor] raise "YARN: missing vendor: #{vendor}" unless version vendor_data['version'] = version end vendors_data end def load_vendor_versions data = File.read 'yarn.lock' lines = data.split("\n") versions = {} vendor = nil lines.each do |line| next if line.start_with?('#') next if line.empty? if line.start_with?(' version') version = line.split(' ').last.tr('"', '') versions[vendor] = version vendor = nil elsif line.start_with?(' ') next else line = line.tr('"', '') vendor = line.split('@').select { |e| !e.empty? }.first vendor = "@#{vendor}" if line.start_with?('@') end end versions end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bower_vendor-0.1.4 | lib/bower_vendor/yarn.rb |