Sha256: 6262d9ce80a6d14f6b0ca273bb1c0207711cb81e56a8e15ff5370ba1a3e4d5e0

Contents?: true

Size: 791 Bytes

Versions: 1

Compression:

Stored size: 791 Bytes

Contents

module ActionDispatch::Routing
  class Mapper

    # Create a front end in your rails router.
    def front_end(name, path = name, options = {})

      # Generic routes that have nothing to do with the app
      # name. Use this for testing or providing a non
      # app api endpoint.
      namespace :front_end_builds do
        resources :builds, only: [:index, :create]
      end

      # Create a new build for this app.
      post(
        "#{path}" => "front_end_builds/builds#create",
        defaults: {
          app_name: name
        }
      )

      # Fetch a build for this app.
      get(
        "/#{path}/(*path)" => "front_end_builds/builds#index",
        defaults: {
          branch: :master,
          app_name: name
        }.merge(options)
      )
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
front_end_builds-0.0.1 lib/front_end_builds/ext/routes.rb