Sha256: f1ab2b727ba62ee450b96bfbf393b9c1f4eac1af8a9ccd28c0682301738e3756

Contents?: true

Size: 764 Bytes

Versions: 4

Compression:

Stored size: 764 Bytes

Contents

module GitCompound
  # Compound Domain Specific Language
  #
  module DSL
    # DSL for Manifest
    #
    class ManifestDSL
      def initialize(manifest, contents)
        @manifest = manifest
        instance_eval(contents)
      end

      def name(component_name)
        @manifest.name = component_name.to_sym
      end

      def maintainer(*component_maintainer)
        @manifest.maintainer = component_maintainer
      end

      def component(name, &block)
        @manifest.components.store(name.to_sym, Component.new(name, @manifest, &block))
      end

      def task(name, type = nil, &block)
        new_task = Task.factory(name, type, @manifest, &block)
        @manifest.tasks.store(name.to_sym, new_task) if new_task
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git_compound-0.2.2 lib/git_compound/dsl/manifest_dsl.rb
git_compound-0.2.1 lib/git_compound/dsl/manifest_dsl.rb
git_compound-0.2.0 lib/git_compound/dsl/manifest_dsl.rb
git_compound-0.1.2 lib/git_compound/dsl/manifest_dsl.rb