Sha256: 9e0a10f3b74773cdb69adee34eaf77ea2cbc2f2fe691546bf943df7167d36558
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require 'yaml' require 'fileutils' INSTALL_FILE = "Bukfile" LOCK_FILE = "#{INSTALL_FILE}.lock" class Bukin::Lockfile def initialize(*) if File.exist?(LOCK_FILE) @lockfile = YAML::load_file(LOCK_FILE) else @lockfile = { 'server' => {}, 'plugins' => {} } end end def set_server(name, version, file) self.server = { 'name' => name, 'version' => version, 'file' => file } end def add_plugin(name, version, *files) self.plugins[name] = { 'version' => version, 'files' => files } end def remove_plugin(name) plugins.delete(name) save end def plugins @lockfile['plugins'] end def plugins=(value) @lockfile['plugins'] = value save end def server @lockfile['server'] end def server=(value) @lockfile['server'] = value save end def save File.open(LOCK_FILE, "w") {|file| file.write @lockfile.to_yaml} end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bukin-0.0.1 | lib/bukin/lockfile.rb |