Sha256: 95da67c1146d9031e0bf1741eb44dee2d4ee9d257f663261ed4ac8c3568d2e53

Contents?: true

Size: 897 Bytes

Versions: 9

Compression:

Stored size: 897 Bytes

Contents

module ExceptionHandler
	class ViewsGenerator < Rails::Generators::Base

		#Views
		@@views = %w(views controllers models assets)

		#Options
		class_option :files, aliases: "-v", default: @@views, type: :array, desc: "Select file types (views, models, controllers, assets)"

		#Needed to reference files
		source_root File.expand_path("../../../../app", __FILE__) 

		###########################################

		#Files
		def create_files
			generate_files options.files
		end

		###########################################

		protected

		#File Generator
		def generate_files args

			#Valid?
			return raise args.inspect unless args.nil? || (args-@@views).empty?

			#Types
			for arg in args do
				directory arg, "app/#{arg}"
			end

			#Success
			puts "Files transferred successfully"
		end

		###########################################

	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
exception_handler-0.4.1 lib/generators/exception_handler/views_generator.rb
exception_handler-0.4 lib/generators/exception_handler/views_generator.rb
exception_handler-0.3.5 lib/generators/exception_handler/views_generator.rb
exception_handler-0.3.45 lib/generators/exception_handler/views_generator.rb
exception_handler-0.3.35 lib/generators/exception_handler/views_generator.rb
exception_handler-0.3.3 lib/generators/exception_handler/views_generator.rb
exception_handler-0.3.25 lib/generators/exception_handler/views_generator.rb
exception_handler-0.3.2 lib/generators/exception_handler/views_generator.rb
exception_handler-0.3.0 lib/generators/exception_handler/views_generator.rb