Sha256: 94887f2a96d1594782c18b8f8e7259e39da761269fd8766147bd5cdd11d1fdf9

Contents?: true

Size: 853 Bytes

Versions: 14

Compression:

Stored size: 853 Bytes

Contents

module RevealCK
  module Builders
    # Works within the context of Rake to setup a task for a given
    # name
    class CreationTask
      include Retrieve
      include RakeAware
      attr_reader :application, :things_to_create

      def initialize(args)
        @application = retrieve(:application, args)
        @things_to_create = Set.new
      end

      def setup
        fail('setup must be implemented by subclasses')
      end

      def name
        full_class_name = self.class.to_s
        class_name = full_class_name.gsub(/.*::/, '')
        add_underscores = class_name.gsub(/([A-Z])/, '_\1')
        trim_first_underscore = add_underscores[1..add_underscores.size]
        trim_first_underscore.downcase
      end

      def prepare
        setup
        task(name => things_to_create.to_a)
        name
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
reveal-ck-3.3.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.2.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.1.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.0.1 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.0.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.6.2 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.6.1 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.6.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.5.1 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.5.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.4.2 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.4.1 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.4.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-0.3.0 lib/reveal-ck/builders/creation_task.rb