class Transcriptic::Labfile
Public Class Methods
from_file(file)
click to toggle source
# File lib/transcriptic/labfile.rb, line 8 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
new(path)
click to toggle source
# File lib/transcriptic/labfile.rb, line 17 def initialize(path) @filepath = path @options = Hash.new @dependencies = [] end
Public Instance Methods
dependencies()
click to toggle source
# File lib/transcriptic/labfile.rb, line 73 def dependencies @dependencies end
dependency(group, name, version)
click to toggle source
# File lib/transcriptic/labfile.rb, line 65 def dependency(group, name, version) @dependencies << { group: group, name: name, version: version } end
description(desc)
click to toggle source
# File lib/transcriptic/labfile.rb, line 57 def description(desc) @options[:description] = desc end
email(email)
click to toggle source
# File lib/transcriptic/labfile.rb, line 49 def email(email) @options[:email] = email end
group(grp)
click to toggle source
# File lib/transcriptic/labfile.rb, line 61 def group(grp) @options[:group] = grp end
load(content)
click to toggle source
# File lib/transcriptic/labfile.rb, line 23 def load(content) begin instance_eval(content) rescue => e puts e raise LabfileReadError.new(e) end self end
name(name = nil)
click to toggle source
# File lib/transcriptic/labfile.rb, line 41 def name(name = nil) @options[:name] = name end
options()
click to toggle source
# File lib/transcriptic/labfile.rb, line 37 def options @options end
sha()
click to toggle source
# File lib/transcriptic/labfile.rb, line 33 def sha @sha ||= Digest::SHA1.hexdigest File.read(filepath.to_s) end
version(arg)
click to toggle source
# File lib/transcriptic/labfile.rb, line 53 def version(arg) @options[:version] = arg end