Sha256: 61247dcf0ba8e0e9e30570938635e64c4fa532e626cd2f978ec62c040df0ec5f

Contents?: true

Size: 934 Bytes

Versions: 2

Compression:

Stored size: 934 Bytes

Contents

module Cany
  class Specification
    class DSL
      def initialize(specification)
        @specification = specification
      end

      def exec(&block)
        instance_eval &block
      end

      def self.delegate(*methods)
        methods.each do |method|
          module_eval(<<-EOS, __FILE__, __LINE__)
            def #{method}(*args, &block)
              @specification.send :'#{method}=', *args, &block
            end
            EOS
        end
      end

      delegate :name, :description, :maintainer_name, :maintainer_email, :website, :licence, :version

      # This include the given recipe into the build process.
      # @param [Symbol] name The name of the recipe as symbol.
      def use(name)
        @specification.recipes << name
      end

      def build(&block)
        @specification.build = block
      end

      def binary(&block)
        @specification.binary = block
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cany-0.0.2 lib/cany/specification/dsl.rb
cany-0.0.1 lib/cany/specification/dsl.rb