Sha256: a1b989b78e3166a8b70004e7c5f579cd4cec46fa0faa368634df7b11150af7b5

Contents?: true

Size: 633 Bytes

Versions: 7

Compression:

Stored size: 633 Bytes

Contents

module Curupira
  module Generators
    class ControllersGenerator < Rails::Generators::Base
      source_root File.expand_path("../" * 5, __FILE__)

      def create_role_controller
        controllers.each do |controller|
          copy_file controller
        end
      end

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

      private

      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/controllers/controllers_generator.rb
curupira-0.1.6 lib/generators/curupira/controllers/controllers_generator.rb
curupira-0.1.4 lib/generators/curupira/controllers/controllers_generator.rb
curupira-0.1.3 lib/generators/curupira/controllers/controllers_generator.rb
curupira-0.1.2 lib/generators/curupira/controllers/controllers_generator.rb
curupira-0.1.1 lib/generators/curupira/controllers/controllers_generator.rb
curupira-0.1.0 lib/generators/curupira/controllers/controllers_generator.rb