Sha256: 896c92fb911c1480d223a73dcac9962f4f7bf11416e7e679d2879477f142861c

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

PUNK::Command.create "generate" do
  shortcut "g"
  description "Generate routes, actions, models, views, services or workers"

  def process
    case args.join(" ")
    when "route", "action", "model", "view", "service", "worker", "scaffold"
      "TBD"
    when "", "help"
      "? specify one of: routes, actions, models, views, services, scaffold"
    else
      "? unkown arguments: #{args.join(",")}"
    end
  end
end

__END__
{route}
# frozen_string_literal: true

PUNK.route('{pluralized_name}') do
  authorize!

  # route: GET|PATCH|DELETE /{pluralized_name}/:id
  on :id do |{name}_id|
    @{name} = {classified_name}[{name}_id.to_i]
    get { present {classified_name}View, {name}: @{name} }
    patch { perform Update{classified_name}, args.merge({name}: @{name}) }
    delete { perform Destroy{classified_name}, {name}: @{name} }
  end

  # route: GET|POST /{pluralized_name}
  get { perform List{pluralized_classified_name}
  post { perform Create{classified_name}, args }
end
{action}
{list_action}
{create_action}
{update_action}
{destroy_action}
{model}
{view}
{list_view}
{json_template}
{json_list_template}
{csv_template}
{csv_list_template}
{html_template}
{html_list_template}
{xml_template}
{xml_list_template}
{service}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
punk-0.4.1 lib/punk/commands/generate.rb