Sha256: bd19967030686a7a055546c51042fc5e18e3f286f98367ef4eb49ce45ac62868

Contents?: true

Size: 918 Bytes

Versions: 2

Compression:

Stored size: 918 Bytes

Contents

module JsonVoorhees
	class AppMakeAuthorizationsGenerator < Rails::Generators::Base
	  source_root File.expand_path('../templates', __FILE__)
	  argument :module_name, :type => :string
	  argument :resource_name, :type => :string

	  def sprint
	  	template "auth_file.rb.erb", "gems/authorization/lib/authorization/#{module_name.underscore}/#{resource_singular}.rb"
	  	require_authfile
	  end

	  private

	  def require_authfile
      prepend_file 'gems/authorization/lib/authorization.rb', "require \'authorization/#{module_name.underscore}/#{resource_singular}\'\n"
	  end

	  def resource_singular
	  	resource_name.underscore.singularize
	  end

	  def resource_plural
	  	resource_name.underscore.pluralize
	  end

	  def resource_camel
	  	resource_name.camelize.singularize
	  end

	  def module_camel
	  	module_name.camelize
	  end

	  def module_snake
	  	module_name.underscore.downcase
	  end

	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
json_voorhees-0.0.2 lib/generators/json_voorhees/app_make_authorizations/app_make_authorizations_generator.rb
json_voorhees-0.0.1 lib/generators/json_voorhees/app_make_authorizations/app_make_authorizations_generator.rb