Sha256: adda4df673e11e560385a9b7f635e72c45bba8ebf7af4a61983c96b4a490e5b4
Contents?: true
Size: 1.61 KB
Versions: 3
Compression:
Stored size: 1.61 KB
Contents
module Roger # Loader for rogerfile class Rogerfile # This is the context for the rogerfile evaluation. It should be empty except for the # #roger method (and deprecated #mockup method). class Context def initialize(rogerfile) @_rogerfile = rogerfile end def roger @_rogerfile end # @deprecated Please use roger method instead. def mockup warn("The use of mockup has been deprecated; please use roger instead") warn(" on #{caller.first}") roger end def binding ::Kernel.binding end end # @attr :path [Pathname] The path of the rogerfile for this project attr_accessor :path, :project def initialize(project, path = nil) @project = project @path = (path && Pathname.new(path)) || Pathname.new(project.path + "Rogerfile") end # Actually load the rogerfile def load return unless File.exist?(@path) && !loaded? @source = File.read(@path) context = Context.new(self) eval @source, context.binding, @path.to_s, 1 # rubocop:disable Lint/Eval @loaded = true end # Wether or not the rogerfile has been loaded def loaded? @loaded end def release(options = {}) release = project.release(options) yield(release) if block_given? release end def serve(options = {}) server = project.server(options) yield(server) if block_given? server end alias server serve def test(options = {}) test = project.test(options) yield(test) if block_given? test end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
roger-1.8.0 | lib/roger/rogerfile.rb |
roger-1.7.2 | lib/roger/rogerfile.rb |
roger-1.7.1 | lib/roger/rogerfile.rb |