Sha256: 2f71d16368f09fceef1791eba5efa15a9d8cad2272016bd3c05a93fddcee7d39

Contents?: true

Size: 627 Bytes

Versions: 6

Compression:

Stored size: 627 Bytes

Contents

require 'rails/generators/base'

module SpiffyStoresApp
  module Generators
    class ViewsGenerator < Rails::Generators::Base
      source_root File.expand_path("../../../../..", __FILE__)

      def create_views
        views.each do |view|
          copy_file view
        end
      end

      private

      def views
        files_within_root('.', 'app/views/**/*.*')
      end

      def files_within_root(prefix, glob)
        root = "#{self.class.source_root}/#{prefix}"

        Dir["#{root}/#{glob}"].sort.map do |full_path|
          full_path.sub(root, '.').gsub('/./', '/')
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spiffy_stores_app-8.2.11 lib/generators/spiffy_stores_app/views/views_generator.rb
spiffy_stores_app-8.2.10 lib/generators/spiffy_stores_app/views/views_generator.rb
spiffy_stores_app-8.2.9 lib/generators/spiffy_stores_app/views/views_generator.rb
spiffy_stores_app-8.2.8 lib/generators/spiffy_stores_app/views/views_generator.rb
spiffy_stores_app-8.2.7 lib/generators/spiffy_stores_app/views/views_generator.rb
spiffy_stores_app-8.2.6 lib/generators/spiffy_stores_app/views/views_generator.rb