Sha256: 9bcc79e6c502d024490b59cfbe054f98d29ff688f611d507545cf41e21fa648d

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

require 'thor/group'
require 'active_support'
require 'active_support/core_ext'
require 'active_support/core_ext/string/inflections'
require 'locomotive/wagon/version'

module Locomotive
  module Wagon
    module Generators
      module Site

        class Base < Thor::Group

          include Thor::Actions
          include Locomotive::Wagon::CLI::ForceColor

          argument :name
          argument :target_path

          def copy_sources
            copy_sources_from_generator
          end

          def self.source_root
            File.join(File.dirname(__FILE__), '..', '..', '..', '..', '..', 'generators')
          end

          protected

          def copy_sources_from_generator(generator_name: nil, options: {})
            _name = generator_name || self.class.name.demodulize.underscore

            directory(_name, self.destination, {
              recursive:  true,
              name:       self.name,
              version:    Locomotive::Wagon::VERSION
            }.merge(options))
          end

          def destination
            File.join(target_path, name)
          end

        end

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
locomotivecms_wagon-3.2.0.alpha2 lib/locomotive/wagon/generators/site/base.rb
locomotivecms_wagon-3.2.0.alpha1 lib/locomotive/wagon/generators/site/base.rb
locomotivecms_wagon-3.1.1 lib/locomotive/wagon/generators/site/base.rb
locomotivecms_wagon-3.1.0 lib/locomotive/wagon/generators/site/base.rb
locomotivecms_wagon-3.1.0.beta1 lib/locomotive/wagon/generators/site/base.rb
locomotivecms_wagon-3.0.5 lib/locomotive/wagon/generators/site/base.rb
locomotivecms_wagon-3.0.4 lib/locomotive/wagon/generators/site/base.rb
locomotivecms_wagon-3.0.3 lib/locomotive/wagon/generators/site/base.rb
locomotivecms_wagon-3.0.2 lib/locomotive/wagon/generators/site/base.rb