Sha256: f4c44b488fdb85ef8af99b560a7016a4b06b0bd00aa8468c8adac69bf9fe1ef9

Contents?: true

Size: 783 Bytes

Versions: 7

Compression:

Stored size: 783 Bytes

Contents

require "rails/generators"
require "fileutils"
require "pathname"

module Panda
  module Core
    module Generators
      class TemplatesGenerator < Rails::Generators::Base
        include Thor::Actions

        desc "Copies shared configuration templates from panda_core"

        source_root File.expand_path("templates", __dir__)

        def copy_templates
          Dir.glob(File.join(self.class.source_root, "**/{.*,*}"), File::FNM_DOTMATCH).each do |file|
            next if File.directory?(file)
            next if File.basename(file) == "." || File.basename(file) == ".."

            relative_path = Pathname.new(file).relative_path_from(Pathname.new(self.class.source_root)).to_s
            copy_file relative_path
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
panda-core-0.1.6 lib/generators/panda/core/templates_generator.rb
panda-core-0.1.5 lib/generators/panda/core/templates_generator.rb
panda-core-0.1.4 lib/generators/panda/core/templates_generator.rb
panda-core-0.1.3 lib/generators/panda/core/templates_generator.rb
panda-core-0.1.2 lib/generators/panda/core/templates_generator.rb
panda-core-0.1.1 lib/generators/panda/core/templates_generator.rb
panda-core-0.1.0 lib/generators/panda/core/templates_generator.rb