Sha256: 9dbea9e541632d572ed30bae23012e819342c11d2ddc6397c03f04c01474a5fb

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

module JsonVoorhees
	class EngineScaffoldGenerator < Rails::Generators::Base
	  source_root File.expand_path('../templates', __FILE__)
	  argument :module_name, :type => :string
	  argument :resource_name, :type => :string
	  argument :api_version, :type => :string, :default => "1"
	  argument :attributes, type: :array, default: [], banner: "field:type field:type"
	  class_option :arcadex, :type => :boolean, :default => true, :description => "Include authorization in controller"
		class_option :model, :type => :boolean, :default => true, :description => "Create namespaced model"

	  def sprint
	  	if options.arcadex?
		  	run "rails g json_voorhees:engine_create_controller #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
		  	run "rails g json_voorhees:engine_create_serializer #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
		  else
		  	run "rails g json_voorhees:engine_create_controller --skip-arcadex #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
	  		run "rails g json_voorhees:engine_create_serializer --skip-arcadex #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
		  end
		  if options.model?
		  	run "rails g json_voorhees:engine_create_model #{module_name} #{resource_name} #{api_version} #{attributes.join(" ")}"
	  	end
	  end

	  private

	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
json_voorhees-0.3.6 lib/generators/json_voorhees/engine_scaffold/engine_scaffold_generator.rb
json_voorhees-0.3.5 lib/generators/json_voorhees/engine_scaffold/engine_scaffold_generator.rb
json_voorhees-0.3.0 lib/generators/json_voorhees/engine_scaffold/engine_scaffold_generator.rb