Sha256: a959cba8813fa5d8d3ef309fa7cc48f1715954fa358cb6e6f2c114e1f7637e28

Contents?: true

Size: 964 Bytes

Versions: 2

Compression:

Stored size: 964 Bytes

Contents

require 'rake/tasklib'

module DataMapper
  module Visualizer
    module Rake
      class Task < ::Rake::TaskLib

        # Options for the DataMapper Visualizer.
        attr_reader :options

        #
        # Creates a new task.
        #
        # @param [Hash] options
        #   Options for the DataMapper Visualizer.
        #
        # @yield [task]
        #   The given block will be passed the newly created task.
        #   
        # @yieldparam [Task] task
        #   The new Task.
        #
        def initialize(options={})
          @options = {:bundle => File.file?('Gemfile')}
          @options.merge!(options)

          yield self if block_given?

          define()
        end

        #
        # Defines a task within the `dm:doc` namespace.
        #
        def define(&block)
          namespace :dm do
            namespace(:doc,&block)
          end

          task 'db:doc' => 'dm:doc'
        end

      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-visualizer-0.2.3 lib/dm-visualizer/rake/task.rb
dm-visualizer-0.2.2 lib/dm-visualizer/rake/task.rb