Sha256: db3032b4146f2b4200b2522948a5d85c7fa94d611e4f536471dad2fc334a8fab

Contents?: true

Size: 579 Bytes

Versions: 7

Compression:

Stored size: 579 Bytes

Contents

module Curupira
  module Generators
    class ViewsGenerator < Rails::Generators::Base
      source_root File.expand_path("../" * 5, __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

7 entries across 7 versions & 1 rubygems

Version Path
curupira-0.1.7 lib/generators/curupira/views/views_generator.rb
curupira-0.1.6 lib/generators/curupira/views/views_generator.rb
curupira-0.1.4 lib/generators/curupira/views/views_generator.rb
curupira-0.1.3 lib/generators/curupira/views/views_generator.rb
curupira-0.1.2 lib/generators/curupira/views/views_generator.rb
curupira-0.1.1 lib/generators/curupira/views/views_generator.rb
curupira-0.1.0 lib/generators/curupira/views/views_generator.rb