houdini/lib/generators/api/resource/resource_generator.rb
2018-05-22 13:33:35 -05:00

10 lines
410 B
Ruby

class Api::ResourceGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
def copy_to_resource
template 'resource.rb.erb', File.join("app/api/houdini/v1", "#{name.underscore}.rb")
end
def add_to_root_api
inject_into_file "app/api/houdini/v1/api.rb", "\tmount Houdini::V1::#{ name.camelcase}\n", after: "class Houdini::V1::API < Grape::API\n"
end
end