Sha256: 1d125d0181691acd351f05ef7be48d44c27c1363c097d342728aad602d265e3f

Contents?: true

Size: 657 Bytes

Versions: 4

Compression:

Stored size: 657 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 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.1.1 lib/git_compound/dsl/manifest_dsl.rb
git_compound-0.1.0 lib/git_compound/dsl/manifest_dsl.rb
git_compound-0.0.10 lib/git_compound/dsl/manifest_dsl.rb
git_compound-0.0.9 lib/git_compound/dsl/manifest_dsl.rb