Sha256: 1f5c5970a45b74a45e30679eac658c6349c454ac31d9fe3f4fa53f6f7df034cf
Contents?: true
Size: 1.03 KB
Versions: 2
Compression:
Stored size: 1.03 KB
Contents
class Bukin::Bukfile FILE_NAME = 'Bukfile' attr_accessor :server_info, :plugins_info def self.from_file(path = nil) path ||= File.join(Dir.pwd, FILE_NAME) from_code(File.read(path)) end def self.from_block(&block) from_code(&block) end def self.from_code(code) bukfile = Bukin::Bukfile.new bukfile.instance_eval(code) bukfile end def initialize @plugins_info = [] end def server(name, *args) if @server_info abort("Error: There is more than one server declared in your #{FILE_NAME}") end options = args.last.is_a?(Hash) ? args.pop : {} version = args.pop || nil @server_info = { name: name, version: version }.merge(options) end def plugin(name, *args) if @plugins_info.find { |p| p[:name] == name } abort("Error: You declared the plugin #{name} more than once in your #{FILE_NAME}") end options = args.last.is_a?(Hash) ? args.pop : {} version = args.pop || nil @plugins_info << { name: name, version: version }.merge(options) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bukin-0.4.0 | lib/bukin/bukfile.rb |
bukin-0.3.0 | lib/bukin/bukfile.rb |