Sha256: b694ffc41b932ab47c4adcb51e2604850cb832edc5adeb8b8a2373c7ff49684c

Contents?: true

Size: 684 Bytes

Versions: 6

Compression:

Stored size: 684 Bytes

Contents

require 'rails/generators/base'

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

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

      private

      def controllers
        files_within_root('.', 'app/controllers/spiffy_stores_app/*.*')
      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/controllers/controllers_generator.rb
spiffy_stores_app-8.2.10 lib/generators/spiffy_stores_app/controllers/controllers_generator.rb
spiffy_stores_app-8.2.9 lib/generators/spiffy_stores_app/controllers/controllers_generator.rb
spiffy_stores_app-8.2.8 lib/generators/spiffy_stores_app/controllers/controllers_generator.rb
spiffy_stores_app-8.2.7 lib/generators/spiffy_stores_app/controllers/controllers_generator.rb
spiffy_stores_app-8.2.6 lib/generators/spiffy_stores_app/controllers/controllers_generator.rb