Sha256: 3fd40fa75fac80da218fea5b376f843eecb11a141ed39e7ae1000b76d718e1a5

Contents?: true

Size: 854 Bytes

Versions: 12

Compression:

Stored size: 854 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
        raise('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

12 entries across 12 versions & 1 rubygems

Version Path
reveal-ck-4.0.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.9.2 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.9.1 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.9.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.8.1 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.8.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.7.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.6.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.5.1 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.5.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.4.0 lib/reveal-ck/builders/creation_task.rb
reveal-ck-3.3.1 lib/reveal-ck/builders/creation_task.rb