Sha256: e59e4e56c9231f0bd4120134786c841c86bc82682828731eacdc2f9dbc29ebb1
Contents?: true
Size: 1.31 KB
Versions: 1
Compression:
Stored size: 1.31 KB
Contents
#require 'transcriptic/downloader' module Transcriptic class Labfile extend Forwardable class << self def from_file(file) content = File.read(file) object = new(file) object.load(content) rescue Errno::ENOENT => e raise FileNotFound, "No Labfile found at: #{file}" end end def initialize(path) @filepath = path @options = Hash.new @dependencies = [] end def load(content) begin instance_eval(content) rescue => e puts e raise LabfileReadError.new(e) end self end def sha @sha ||= Digest::SHA1.hexdigest File.read(filepath.to_s) end def options @options end def name(name = nil) @options[:name] = name end def author(name) @options[:author] = name end def email(email) @options[:email] = email end def version(arg) @options[:version] = arg end def description(desc) @options[:description] = desc end def group(grp) @options[:group] = grp end def dependency(group, name, version) @dependencies << { group: group, name: name, version: version } end def dependencies @dependencies end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transcriptic-0.2.10 | lib/transcriptic/labfile.rb |