CombinedText stringlengths 4 3.42M |
|---|
# encoding: utf-8
module CartoDB
module NamedMapsWrapper
class Presenter
NAMED_MAP_TYPE = 'namedmap'
LAYER_TYPES_TO_DECORATE = [ 'torque' ]
# @throws NamedMapsPresenterError
def initialize(visualization, layergroup, options, configuration)
@visualization = visualization
@options = options
@configuration = configuration
@layergroup_data = layergroup
@named_map_name = NamedMap.normalize_name(@visualization.id)
end
# Prepares additional data to decorate layers in the LAYER_TYPES_TO_DECORATE list
# - Parameters set inside as nil will remove the field itself from the layer data
# @throws NamedMapsPresenterError
def get_decoration_for_layer(layer_type, layer_index)
return {} unless LAYER_TYPES_TO_DECORATE.include? layer_type
{
'named_map' => {
'name' => @named_map_name,
'layer_index' => layer_index,
'params' => placeholders_data
},
'query' => nil #do not expose SQL query on Torque layers with named maps
}
end
# Prepare a PORO (Hash object) for easy JSONification
# @see https://github.com/CartoDB/cartodb.js/blob/privacy-maps/doc/vizjson_format.md
# @throws NamedMapsPresenterError
def to_poro
if @visualization.layers(:cartodb).size == 0
# When there are no layers don't return named map data
nil
else
{
type: NAMED_MAP_TYPE,
order: 1,
options: {
type: NAMED_MAP_TYPE,
user_name: @options.fetch(:user_name),
tiler_protocol: @visualization.password_protected? ?
@configuration[:tiler]['private']['protocol'] :
@configuration[:tiler]['public']['protocol'],
tiler_domain: @visualization.password_protected? ?
@configuration[:tiler]['private']['domain'] :
@configuration[:tiler]['public']['domain'],
tiler_port: @visualization.password_protected? ?
@configuration[:tiler]['private']['port'] :
@configuration[:tiler]['public']['port'],
cdn_url: @configuration.fetch(:cdn_url, nil),
dynamic_cdn: @options.fetch(:dynamic_cdn_enabled),
named_map: {
name: @named_map_name,
stat_tag: @visualization.id,
params: placeholders_data,
layers: configure_layers_data
}
}
}
end
end
private
def placeholders_data
data = {}
@layergroup_data.each { |layer|
data["layer#{layer[:index].to_s}".to_sym] = layer[:visible] ? 1: 0
}
data
end
# Extract relevant information from layers
def configure_layers_data
layers = @visualization.layers(:cartodb)
layers_data = Array.new
layers.each { |layer|
layer_vizjson = layer.get_presenter(@options, @configuration).to_vizjson_v2
data = {
layer_name: layer_vizjson[:options][:layer_name],
interactivity: layer_vizjson[:options][:interactivity],
visible: layer_vizjson[:visible]
}
if layer_vizjson.include?(:infowindow) && !layer_vizjson[:infowindow].nil? &&
layer_vizjson[:infowindow].fetch('fields').size > 0
data[:infowindow] = layer_vizjson[:infowindow]
end
if layer_vizjson.include?(:tooltip) && !layer_vizjson[:tooltip].nil? &&
layer_vizjson[:tooltip].fetch('fields').size > 0
data[:tooltip] = layer_vizjson[:tooltip]
end
if layer_vizjson.include?(:legend) && !layer_vizjson[:legend].nil? &&
layer_vizjson[:legend].fetch('type') != 'none'
data[:legend] = layer_vizjson[:legend]
end
layers_data.push(data)
}
layers_data
end
# Loads the data of a given named map
# It completes/overrides data from the children if visualization has a parent_id
def load_named_map_data
named_maps = NamedMaps.new(
{
name: @options.fetch(:user_name),
api_key: @options.fetch(:api_key)
},
{
protocol: @configuration[:tiler]['internal']['protocol'],
domain: @configuration[:tiler]['internal']['domain'],
port: @configuration[:tiler]['internal']['port'],
verifycert: (@configuration[:tiler]['internal']['verifycert'] rescue true)
}
)
@named_map = named_maps.get(NamedMap.normalize_name(@visualization.id))
unless @named_map.nil?
if @visualization.parent_id.nil?
@named_map_template = @named_map.template.fetch(:template)
else
parent_named_map = named_maps.get(NamedMap.normalize_name(@visualization.parent_id))
@named_map_template = parent_named_map.template.fetch(:template).merge(@named_map.template.fetch(:template))
end
end
@loaded = true
end
end
end
end
nil check before size > 0 fixes #1949
# encoding: utf-8
module CartoDB
module NamedMapsWrapper
class Presenter
NAMED_MAP_TYPE = 'namedmap'
LAYER_TYPES_TO_DECORATE = [ 'torque' ]
# @throws NamedMapsPresenterError
def initialize(visualization, layergroup, options, configuration)
@visualization = visualization
@options = options
@configuration = configuration
@layergroup_data = layergroup
@named_map_name = NamedMap.normalize_name(@visualization.id)
end
# Prepares additional data to decorate layers in the LAYER_TYPES_TO_DECORATE list
# - Parameters set inside as nil will remove the field itself from the layer data
# @throws NamedMapsPresenterError
def get_decoration_for_layer(layer_type, layer_index)
return {} unless LAYER_TYPES_TO_DECORATE.include? layer_type
{
'named_map' => {
'name' => @named_map_name,
'layer_index' => layer_index,
'params' => placeholders_data
},
'query' => nil #do not expose SQL query on Torque layers with named maps
}
end
# Prepare a PORO (Hash object) for easy JSONification
# @see https://github.com/CartoDB/cartodb.js/blob/privacy-maps/doc/vizjson_format.md
# @throws NamedMapsPresenterError
def to_poro
if @visualization.layers(:cartodb).size == 0
# When there are no layers don't return named map data
nil
else
{
type: NAMED_MAP_TYPE,
order: 1,
options: {
type: NAMED_MAP_TYPE,
user_name: @options.fetch(:user_name),
tiler_protocol: @visualization.password_protected? ?
@configuration[:tiler]['private']['protocol'] :
@configuration[:tiler]['public']['protocol'],
tiler_domain: @visualization.password_protected? ?
@configuration[:tiler]['private']['domain'] :
@configuration[:tiler]['public']['domain'],
tiler_port: @visualization.password_protected? ?
@configuration[:tiler]['private']['port'] :
@configuration[:tiler]['public']['port'],
cdn_url: @configuration.fetch(:cdn_url, nil),
dynamic_cdn: @options.fetch(:dynamic_cdn_enabled),
named_map: {
name: @named_map_name,
stat_tag: @visualization.id,
params: placeholders_data,
layers: configure_layers_data
}
}
}
end
end
private
def placeholders_data
data = {}
@layergroup_data.each { |layer|
data["layer#{layer[:index].to_s}".to_sym] = layer[:visible] ? 1: 0
}
data
end
# Extract relevant information from layers
def configure_layers_data
layers = @visualization.layers(:cartodb)
layers_data = Array.new
layers.each { |layer|
layer_vizjson = layer.get_presenter(@options, @configuration).to_vizjson_v2
data = {
layer_name: layer_vizjson[:options][:layer_name],
interactivity: layer_vizjson[:options][:interactivity],
visible: layer_vizjson[:visible]
}
if layer_vizjson.include?(:infowindow) && !layer_vizjson[:infowindow].nil? &&
layer_vizjson[:infowindow].fetch('fields').size > 0
data[:infowindow] = layer_vizjson[:infowindow]
end
if layer_vizjson.include?(:tooltip) && !layer_vizjson[:tooltip].nil? &&
!layer_vizjson[:tooltip].fetch('fields').nil? && layer_vizjson[:tooltip].fetch('fields').size > 0
data[:tooltip] = layer_vizjson[:tooltip]
end
if layer_vizjson.include?(:legend) && !layer_vizjson[:legend].nil? &&
layer_vizjson[:legend].fetch('type') != 'none'
data[:legend] = layer_vizjson[:legend]
end
layers_data.push(data)
}
layers_data
end
# Loads the data of a given named map
# It completes/overrides data from the children if visualization has a parent_id
def load_named_map_data
named_maps = NamedMaps.new(
{
name: @options.fetch(:user_name),
api_key: @options.fetch(:api_key)
},
{
protocol: @configuration[:tiler]['internal']['protocol'],
domain: @configuration[:tiler]['internal']['domain'],
port: @configuration[:tiler]['internal']['port'],
verifycert: (@configuration[:tiler]['internal']['verifycert'] rescue true)
}
)
@named_map = named_maps.get(NamedMap.normalize_name(@visualization.id))
unless @named_map.nil?
if @visualization.parent_id.nil?
@named_map_template = @named_map.template.fetch(:template)
else
parent_named_map = named_maps.get(NamedMap.normalize_name(@visualization.parent_id))
@named_map_template = parent_named_map.template.fetch(:template).merge(@named_map.template.fetch(:template))
end
end
@loaded = true
end
end
end
end
|
#
# Namespace for the Socializer engine
#
module Socializer
class Activity < ActiveRecord::Base
include ObjectTypeBase
default_scope { order(created_at: :desc) }
attr_accessible :verb, :circles, :actor_id, :activity_object_id, :target_id
# Relationships
belongs_to :parent, class_name: 'Activity', foreign_key: 'target_id'
belongs_to :activitable_actor, class_name: 'ActivityObject', foreign_key: 'actor_id'
belongs_to :activitable_object, class_name: 'ActivityObject', foreign_key: 'activity_object_id'
belongs_to :activitable_target, class_name: 'ActivityObject', foreign_key: 'target_id'
belongs_to :verb, inverse_of: :activities
has_one :activity_field, inverse_of: :activity
has_many :audiences # , dependent: :destroy
has_many :activity_objects, through: :audiences
has_many :children, class_name: 'Activity', foreign_key: 'target_id', dependent: :destroy
has_many :notifications
# Validations
validates :activitable_actor, presence: true
validates :activitable_object, presence: true
validates :verb, presence: true
delegate :content, to: :activity_field, prefix: true, allow_nil: true
delegate :name, to: :verb, prefix: true
# Returns true if activity has comments
#
# @example
# activity.comments?
#
# @return [TrueClass, FalseClass]
def comments?
comments.present?
end
# Retreives the comments for an activity
#
# @return [ActiveRecord::AssociationRelation] a collection of {Socializer::Activity} objects
def comments
# FIXME: Rails 4.2 - https://github.com/rails/rails/pull/13555 - Allows using relation name when querying joins/includes
# @comments ||= children.joins(:activitable_object).where(activity_objects: { activitable_type: 'Socializer::Comment' })
@comments ||= children.joins(:activitable_object).where(socializer_activity_objects: { activitable_type: 'Socializer::Comment' })
end
# The {Socializer::Person} that performed the activity.
#
# @return [Socializer::Person]
def actor
@actor ||= activitable_actor.activitable
end
# The primary object of the activity.
#
# @return the activitable object
def object
@object ||= activitable_object.activitable
end
# The target of the activity. The precise meaning of the activity target is dependent on the activities verb,
# but will often be the object the English preposition "to".
#
# @return the activitable target
def target
@target ||= activitable_target.activitable
end
# Add an audience to the activity
#
# @param object_ids [Array<Integer>] List of audiences to target
def add_audience(object_ids)
object_ids = object_ids.split(',') if %w(Fixnum String).include?(object_ids.class.name)
limited = Audience.privacy.find_value(:limited).value
not_limited = %W(#{Audience.privacy.find_value(:public).value} #{Audience.privacy.find_value(:circles).value})
object_ids.each do |object_id|
privacy = not_limited.include?(object_id) ? object_id : limited
audience = audiences.build(privacy: privacy)
audience.activity_object_id = object_id if privacy == limited
end
end
# Selects the activities that either the person made, that is public from a person in
# one of his circle, or that is shared to one of the circles he is part of.
#
# @example
# Activity.stream(provider: nil, actor_id: current_user.id, viewer_id: current_user.id)
#
# @param provider: nil [String] <tt>nil</tt>, <tt>activities</tt>, <tt>people</tt>, <tt>circles</tt>, <tt>groups</tt>
# @param actor_uid: [FixNum] unique identifier of the previously typed provider
# @param viewer_id: [FixNum] who wants to see the activity stream
#
# @return [ActiveRecord::Relation]
def self.stream(provider: nil, actor_uid:, viewer_id:)
viewer_id = Person.find_by(id: viewer_id).guid
query = build_query(viewer_id: viewer_id)
case provider
when nil
# this is your dashboard. display everything about people in circles and yourself.
query.distinct
when 'activities'
# we only want to display a single activity. make sure the viewer is allowed to do so.
query.where(id: actor_uid).distinct
when 'people'
# this is a user profile. display everything about him that you are allowed to see
person_id = Person.find_by(id: actor_uid).guid
query.where(actor_id: person_id).distinct
when 'circles'
# FIXME: Should display notes even if circle has no members and the owner is viewing it.
# Notes still don't show after adding people to the circles.
circles = Circle.select(:id).where(id: actor_uid, author_id: viewer_id)
followed = Tie.select(:contact_id).where(circle_id: circles)
query.where(actor_id: followed).distinct
when 'groups'
# this is a group. display everything that was posted to this group as audience
group_id = Group.find_by(id: actor_uid).guid
# FIXME: Rails 4.2 - https://github.com/rails/rails/pull/13555 - Allows using relation name when querying joins/includes
# query.where(audiences: { activity_object_id: group_id }).distinct
query.where(socializer_audiences: { activity_object_id: group_id }).distinct
else
fail 'Unknown stream provider.'
end
end
# Class Methods - Private
# CLEANUP: Remove old/unused code
def self.build_query(viewer_id:)
# for an activity to be interesting, it must correspond to one of these verbs
verbs_of_interest = %w(post share)
# privacy levels
privacy = Audience.privacy
privacy_public = privacy.find_value(:public).value
privacy_circles = privacy.find_value(:circles).value
privacy_limited = privacy.find_value(:limited).value
query = joins(:audiences, :verb).merge(Verb.by_name(verbs_of_interest)).where(target_id: nil)
# The arel_table method is technically private since it is marked :nodoc
audience ||= Audience.arel_table
viewer_literal ||= Arel::SqlLiteral.new("#{viewer_id}")
# TODO: Test: Generate the same SQL as below
query.where(audience[:privacy].eq(privacy_public)
.or(audience[:privacy].eq(privacy_circles)
.and(viewer_literal.in(build_circles_subquery)))
.or(audience[:privacy].eq(privacy_limited)
.and(viewer_literal.in(build_limited_circle_subquery))
.or(audience[:activity_object_id].in(build_limited_group_subquery(viewer_id)))
.or(audience[:activity_object_id].in(viewer_id)))
.or(arel_table[:actor_id].eq(viewer_id)))
# query.where { (audiences.privacy.eq(privacy_public)) |
# ((audiences.privacy.eq(privacy_circles)) & `#{viewer_id}`.in(my { build_circles_subquery })) |
# ((audiences.privacy.eq(privacy_limited)) & (
# # `#{viewer_id}`.in(my { build_limited_circle_subquery(viewer_id) }) |
# `#{viewer_id}`.in(my { build_limited_circle_subquery }) |
# audiences.activity_object_id.in(my { build_limited_group_subquery(viewer_id) }) |
# # audiences.activity_object_id.in(my { build_limited_viewer_subquery(viewer_id) })
# audiences.activity_object_id.in(viewer_id)
# )) |
# (actor_id.eq(viewer_id)) }
end
private_class_method :build_query
# Audience : CIRCLES
# Ensure the audience is CIRCLES and then make sure that the viewer is in those circles
def self.build_circles_subquery
# TODO: Verify this works correcly
# CLEANUP: Remove old code
# Retrieve the author's unique identifier
# The arel_table method is technically private since it is marked :nodoc
person ||= Person.arel_table
ao ||= ActivityObject.arel_table
subquery = ao.project(ao[:id]).join(person).on(person[:id].eq(ao[:activitable_id]).and(ao[:activitable_type].eq(Person.name)))
# subquery = ActivityObject.select { id }.joins { activitable(Person) }
Circle.select(:id).where(author_id: subquery).arel
# subquery = 'SELECT socializer_activity_objects.id ' \
# 'FROM socializer_activity_objects ' \
# 'INNER JOIN socializer_people ' \
# 'ON socializer_activity_objects.activitable_id = socializer_people.id ' \
# 'WHERE socializer_people.id = socializer_activities.actor_id'
#
# Circle.select { id }.where { author_id.in(`#{subquery}`) }
end
private_class_method :build_circles_subquery
# Audience : LIMITED
# Ensure that the audience is LIMITED and then make sure that the viewer is either
# part of a circle that is the target audience, or that the viewer is part of
# a group that is the target audience, or that the viewer is the target audience.
# CLEANUP: Remove old code
# TODO: Verify this works correcly
# def self.build_limited_circle_subquery(viewer_id)
def self.build_limited_circle_subquery
# Retrieve the circle's unique identifier related to the audience (when the audience
# is not a circle, this query will simply return nothing)
subquery = Circle.select(:id).joins(activity_object: :audiences)
Tie.select(:contact_id).where(circle_id: subquery).arel
# limited_circle_id_sql = 'SELECT socializer_circles.id ' \
# 'FROM socializer_circles ' \
# 'INNER JOIN socializer_activity_objects ' \
# 'ON socializer_circles.id = socializer_activity_objects.activitable_id ' \
# "AND socializer_activity_objects.activitable_type = 'Socializer::Circle' " \
# 'WHERE socializer_activity_objects.id = socializer_audiences.activity_object_id '
#
# # Retrieve all the contacts (people) that are part of those circles
# Tie.select { contact_id }.where { circle_id.in(`#{limited_circle_id_sql}`) }
#
# # Ensure that the audience is LIMITED and then make sure that the viewer is either
# # part of a circle that is the target audience, or that the viewer is part of
# # a group that is the target audience, or that the viewer is the target audience.
# # limited_sql = Audience.with_privacy(:limited).where{(`"#{viewer_id}"`.in(actor_circles_sql)) | (activity_object_id.in(limited_groups_sql)) | (activity_object_id.eq(viewer_id))}
end
private_class_method :build_limited_circle_subquery
# TODO: Verify this works correcly
def self.build_limited_group_subquery(viewer_id)
# The arel_table method is technically private since it is marked :nodoc
ao ||= ActivityObject.arel_table
membership ||= Membership.arel_table
group ||= Group.arel_table
ao.project(ao[:id]).join(group).on(group[:id].eq(ao[:activitable_id]).and(ao[:activitable_type].eq(Group.name)))
.join(membership).on(membership[:group_id].eq(group[:id]))
.where(membership[:member_id].eq(viewer_id))
# CLEANUP: Remove old code
# join = ao.join(group).on(group[:id].eq(ao[:activitable_id]).and(ao[:activitable_type].eq(Group.name)))
# .join(membership).on(membership[:group_id].eq(group[:id])).join_sql
# ActivityObject.select(:id).joins(join).where(membership[:member_id].eq(viewer_id)).arel
# ActivityObject.select { id }.joins { activitable(Group).memberships }.where { socializer_memberships.member_id.eq(viewer_id) }
end
private_class_method :build_limited_group_subquery
# CLEANUP: Remove old/unused code
# def self.build_limited_viewer_subquery(viewer_id)
# "( #{viewer_id} )"
# end
# private_class_method :build_limited_viewer_subquery
end
end
remove some old/unused code
#
# Namespace for the Socializer engine
#
module Socializer
class Activity < ActiveRecord::Base
include ObjectTypeBase
default_scope { order(created_at: :desc) }
attr_accessible :verb, :circles, :actor_id, :activity_object_id, :target_id
# Relationships
belongs_to :parent, class_name: 'Activity', foreign_key: 'target_id'
belongs_to :activitable_actor, class_name: 'ActivityObject', foreign_key: 'actor_id'
belongs_to :activitable_object, class_name: 'ActivityObject', foreign_key: 'activity_object_id'
belongs_to :activitable_target, class_name: 'ActivityObject', foreign_key: 'target_id'
belongs_to :verb, inverse_of: :activities
has_one :activity_field, inverse_of: :activity
has_many :audiences # , dependent: :destroy
has_many :activity_objects, through: :audiences
has_many :children, class_name: 'Activity', foreign_key: 'target_id', dependent: :destroy
has_many :notifications
# Validations
validates :activitable_actor, presence: true
validates :activitable_object, presence: true
validates :verb, presence: true
delegate :content, to: :activity_field, prefix: true, allow_nil: true
delegate :name, to: :verb, prefix: true
# Returns true if activity has comments
#
# @example
# activity.comments?
#
# @return [TrueClass, FalseClass]
def comments?
comments.present?
end
# Retreives the comments for an activity
#
# @return [ActiveRecord::AssociationRelation] a collection of {Socializer::Activity} objects
def comments
# FIXME: Rails 4.2 - https://github.com/rails/rails/pull/13555 - Allows using relation name when querying joins/includes
# @comments ||= children.joins(:activitable_object).where(activity_objects: { activitable_type: 'Socializer::Comment' })
@comments ||= children.joins(:activitable_object).where(socializer_activity_objects: { activitable_type: 'Socializer::Comment' })
end
# The {Socializer::Person} that performed the activity.
#
# @return [Socializer::Person]
def actor
@actor ||= activitable_actor.activitable
end
# The primary object of the activity.
#
# @return the activitable object
def object
@object ||= activitable_object.activitable
end
# The target of the activity. The precise meaning of the activity target is dependent on the activities verb,
# but will often be the object the English preposition "to".
#
# @return the activitable target
def target
@target ||= activitable_target.activitable
end
# Add an audience to the activity
#
# @param object_ids [Array<Integer>] List of audiences to target
def add_audience(object_ids)
object_ids = object_ids.split(',') if %w(Fixnum String).include?(object_ids.class.name)
limited = Audience.privacy.find_value(:limited).value
not_limited = %W(#{Audience.privacy.find_value(:public).value} #{Audience.privacy.find_value(:circles).value})
object_ids.each do |object_id|
privacy = not_limited.include?(object_id) ? object_id : limited
audience = audiences.build(privacy: privacy)
audience.activity_object_id = object_id if privacy == limited
end
end
# Selects the activities that either the person made, that is public from a person in
# one of his circle, or that is shared to one of the circles he is part of.
#
# @example
# Activity.stream(provider: nil, actor_id: current_user.id, viewer_id: current_user.id)
#
# @param provider: nil [String] <tt>nil</tt>, <tt>activities</tt>, <tt>people</tt>, <tt>circles</tt>, <tt>groups</tt>
# @param actor_uid: [FixNum] unique identifier of the previously typed provider
# @param viewer_id: [FixNum] who wants to see the activity stream
#
# @return [ActiveRecord::Relation]
def self.stream(provider: nil, actor_uid:, viewer_id:)
viewer_id = Person.find_by(id: viewer_id).guid
query = build_query(viewer_id: viewer_id)
case provider
when nil
# this is your dashboard. display everything about people in circles and yourself.
query.distinct
when 'activities'
# we only want to display a single activity. make sure the viewer is allowed to do so.
query.where(id: actor_uid).distinct
when 'people'
# this is a user profile. display everything about him that you are allowed to see
person_id = Person.find_by(id: actor_uid).guid
query.where(actor_id: person_id).distinct
when 'circles'
# FIXME: Should display notes even if circle has no members and the owner is viewing it.
# Notes still don't show after adding people to the circles.
circles = Circle.select(:id).where(id: actor_uid, author_id: viewer_id)
followed = Tie.select(:contact_id).where(circle_id: circles)
query.where(actor_id: followed).distinct
when 'groups'
# this is a group. display everything that was posted to this group as audience
group_id = Group.find_by(id: actor_uid).guid
# FIXME: Rails 4.2 - https://github.com/rails/rails/pull/13555 - Allows using relation name when querying joins/includes
# query.where(audiences: { activity_object_id: group_id }).distinct
query.where(socializer_audiences: { activity_object_id: group_id }).distinct
else
fail 'Unknown stream provider.'
end
end
# Class Methods - Private
# CLEANUP: Remove old/unused code
def self.build_query(viewer_id:)
# for an activity to be interesting, it must correspond to one of these verbs
verbs_of_interest = %w(post share)
# privacy levels
privacy = Audience.privacy
privacy_public = privacy.find_value(:public).value
privacy_circles = privacy.find_value(:circles).value
privacy_limited = privacy.find_value(:limited).value
query = joins(:audiences, :verb).merge(Verb.by_name(verbs_of_interest)).where(target_id: nil)
# The arel_table method is technically private since it is marked :nodoc
audience ||= Audience.arel_table
viewer_literal ||= Arel::SqlLiteral.new("#{viewer_id}")
# TODO: Test: Generate the same SQL as below
query.where(audience[:privacy].eq(privacy_public)
.or(audience[:privacy].eq(privacy_circles)
.and(viewer_literal.in(build_circles_subquery)))
.or(audience[:privacy].eq(privacy_limited)
.and(viewer_literal.in(build_limited_circle_subquery))
.or(audience[:activity_object_id].in(build_limited_group_subquery(viewer_id)))
.or(audience[:activity_object_id].in(viewer_id)))
.or(arel_table[:actor_id].eq(viewer_id)))
# query.where { (audiences.privacy.eq(privacy_public)) |
# ((audiences.privacy.eq(privacy_circles)) & `#{viewer_id}`.in(my { build_circles_subquery })) |
# ((audiences.privacy.eq(privacy_limited)) & (
# `#{viewer_id}`.in(my { build_limited_circle_subquery }) |
# audiences.activity_object_id.in(my { build_limited_group_subquery(viewer_id) }) |
# audiences.activity_object_id.in(viewer_id)
# )) |
# (actor_id.eq(viewer_id)) }
end
private_class_method :build_query
# Audience : CIRCLES
# Ensure the audience is CIRCLES and then make sure that the viewer is in those circles
def self.build_circles_subquery
# TODO: Verify this works correcly
# CLEANUP: Remove old code
# Retrieve the author's unique identifier
# The arel_table method is technically private since it is marked :nodoc
person ||= Person.arel_table
ao ||= ActivityObject.arel_table
subquery = ao.project(ao[:id]).join(person).on(person[:id].eq(ao[:activitable_id]).and(ao[:activitable_type].eq(Person.name)))
# subquery = ActivityObject.select { id }.joins { activitable(Person) }
Circle.select(:id).where(author_id: subquery).arel
# subquery = 'SELECT socializer_activity_objects.id ' \
# 'FROM socializer_activity_objects ' \
# 'INNER JOIN socializer_people ' \
# 'ON socializer_activity_objects.activitable_id = socializer_people.id ' \
# 'WHERE socializer_people.id = socializer_activities.actor_id'
#
# Circle.select { id }.where { author_id.in(`#{subquery}`) }
end
private_class_method :build_circles_subquery
# Audience : LIMITED
# Ensure that the audience is LIMITED and then make sure that the viewer is either
# part of a circle that is the target audience, or that the viewer is part of
# a group that is the target audience, or that the viewer is the target audience.
# CLEANUP: Remove old code
# TODO: Verify this works correcly
# def self.build_limited_circle_subquery(viewer_id)
def self.build_limited_circle_subquery
# Retrieve the circle's unique identifier related to the audience (when the audience
# is not a circle, this query will simply return nothing)
subquery = Circle.select(:id).joins(activity_object: :audiences)
Tie.select(:contact_id).where(circle_id: subquery).arel
# limited_circle_id_sql = 'SELECT socializer_circles.id ' \
# 'FROM socializer_circles ' \
# 'INNER JOIN socializer_activity_objects ' \
# 'ON socializer_circles.id = socializer_activity_objects.activitable_id ' \
# "AND socializer_activity_objects.activitable_type = 'Socializer::Circle' " \
# 'WHERE socializer_activity_objects.id = socializer_audiences.activity_object_id '
#
# # Retrieve all the contacts (people) that are part of those circles
# Tie.select { contact_id }.where { circle_id.in(`#{limited_circle_id_sql}`) }
#
# # Ensure that the audience is LIMITED and then make sure that the viewer is either
# # part of a circle that is the target audience, or that the viewer is part of
# # a group that is the target audience, or that the viewer is the target audience.
# # limited_sql = Audience.with_privacy(:limited).where{(`"#{viewer_id}"`.in(actor_circles_sql)) | (activity_object_id.in(limited_groups_sql)) | (activity_object_id.eq(viewer_id))}
end
private_class_method :build_limited_circle_subquery
# TODO: Verify this works correcly
def self.build_limited_group_subquery(viewer_id)
# The arel_table method is technically private since it is marked :nodoc
ao ||= ActivityObject.arel_table
membership ||= Membership.arel_table
group ||= Group.arel_table
ao.project(ao[:id]).join(group).on(group[:id].eq(ao[:activitable_id]).and(ao[:activitable_type].eq(Group.name)))
.join(membership).on(membership[:group_id].eq(group[:id]))
.where(membership[:member_id].eq(viewer_id))
# CLEANUP: Remove old code
# ActivityObject.select { id }.joins { activitable(Group).memberships }.where { socializer_memberships.member_id.eq(viewer_id) }
end
private_class_method :build_limited_group_subquery
end
end
|
module CartoDB
module UserDecorator
def data(options = {})
calls = self.get_api_calls(from: self.last_billing_cycle, to: Date.today)
calls.fill(0, calls.size..29)
data = {
id: self.id,
email: self.email,
username: self.username,
account_type: self.account_type,
table_quota: self.table_quota,
table_count: self.table_count,
public_visualization_count: self.public_visualization_count,
visualization_count: self.visualization_count,
failed_import_count: self.failed_import_count,
success_import_count: self.success_import_count,
import_count: self.import_count,
last_visualization_created_at: self.last_visualization_created_at,
quota_in_bytes: self.quota_in_bytes,
db_size_in_bytes: self.db_size_in_bytes,
db_size_in_megabytes: self.db_size_in_bytes / 1024.00,
remaining_table_quota: self.remaining_table_quota,
remaining_byte_quota: self.remaining_quota.to_f,
api_calls: calls,
api_calls_quota: self.organization_user? ? self.organization.map_view_quota : self.map_view_quota,
api_calls_block_price: self.organization_user? ? self.organization.map_view_block_price : self.map_view_block_price,
geocoding: {
quota: self.organization_user? ? self.organization.geocoding_quota : self.geocoding_quota,
block_price: self.organization_user? ? self.organization.geocoding_block_price : self.geocoding_block_price,
monthly_use: self.organization_user? ? self.organization.get_geocoding_calls : self.get_geocoding_calls,
hard_limit: self.hard_geocoding_limit?
},
billing_period: self.last_billing_cycle,
max_layers: self.max_layers,
api_key: self.api_key,
layers: self.layers.map(&:public_values),
trial_ends_at: self.trial_ends_at,
upgraded_at: self.upgraded_at,
show_trial_reminder: self.trial_ends_at.present?,
show_upgraded_message: (self.account_type.downcase != 'free' && self.upgraded_at && self.upgraded_at + 15.days > Date.today ? true : false),
actions: {
private_tables: self.private_tables_enabled,
private_maps: self.private_maps_enabled,
dedicated_support: self.dedicated_support?,
import_quota: self.import_quota,
remove_logo: self.remove_logo?,
sync_tables: self.sync_tables_enabled
},
notification: self.notification,
avatar_url: self.avatar_url
}
data[:organization] = self.organization.to_poro(self) if self.organization.present?
if options[:extended]
data.merge({
:real_table_count => self.real_tables.size,
:last_active_time => self.get_last_active_time
})
else
data
end
end
end
end
CDB-3284 Fix: db_size_in_megabytes was showing KB instead of MB
module CartoDB
module UserDecorator
def data(options = {})
calls = self.get_api_calls(from: self.last_billing_cycle, to: Date.today)
calls.fill(0, calls.size..29)
data = {
id: self.id,
email: self.email,
username: self.username,
account_type: self.account_type,
table_quota: self.table_quota,
table_count: self.table_count,
public_visualization_count: self.public_visualization_count,
visualization_count: self.visualization_count,
failed_import_count: self.failed_import_count,
success_import_count: self.success_import_count,
import_count: self.import_count,
last_visualization_created_at: self.last_visualization_created_at,
quota_in_bytes: self.quota_in_bytes,
db_size_in_bytes: self.db_size_in_bytes,
db_size_in_megabytes: (self.db_size_in_bytes / (1024.0 * 1024.0)).round(2),
remaining_table_quota: self.remaining_table_quota,
remaining_byte_quota: self.remaining_quota.to_f,
api_calls: calls,
api_calls_quota: self.organization_user? ? self.organization.map_view_quota : self.map_view_quota,
api_calls_block_price: self.organization_user? ? self.organization.map_view_block_price : self.map_view_block_price,
geocoding: {
quota: self.organization_user? ? self.organization.geocoding_quota : self.geocoding_quota,
block_price: self.organization_user? ? self.organization.geocoding_block_price : self.geocoding_block_price,
monthly_use: self.organization_user? ? self.organization.get_geocoding_calls : self.get_geocoding_calls,
hard_limit: self.hard_geocoding_limit?
},
billing_period: self.last_billing_cycle,
max_layers: self.max_layers,
api_key: self.api_key,
layers: self.layers.map(&:public_values),
trial_ends_at: self.trial_ends_at,
upgraded_at: self.upgraded_at,
show_trial_reminder: self.trial_ends_at.present?,
show_upgraded_message: (self.account_type.downcase != 'free' && self.upgraded_at && self.upgraded_at + 15.days > Date.today ? true : false),
actions: {
private_tables: self.private_tables_enabled,
private_maps: self.private_maps_enabled,
dedicated_support: self.dedicated_support?,
import_quota: self.import_quota,
remove_logo: self.remove_logo?,
sync_tables: self.sync_tables_enabled
},
notification: self.notification,
avatar_url: self.avatar_url
}
data[:organization] = self.organization.to_poro(self) if self.organization.present?
if options[:extended]
data.merge({
:real_table_count => self.real_tables.size,
:last_active_time => self.get_last_active_time
})
else
data
end
end
end
end
|
module CartoDB
module UserDecorator
include AccountTypeHelper
# Options:
# - show_api_calls: load api calls. Default: true.
# - extended: load real_table_count and last_active_time. Default: false.
def data(options = {})
calls = options.fetch(:show_api_calls, true) ? get_api_calls(from: last_billing_cycle, to: Date.today) : []
calls.fill(0, calls.size..29)
db_size_in_bytes = self.db_size_in_bytes
data = {
id: id,
email: email,
name: name,
username: username,
account_type: account_type,
account_type_display_name: plan_name(account_type),
table_quota: table_quota,
table_count: table_count,
public_visualization_count: public_visualization_count,
all_visualization_count: all_visualization_count,
visualization_count: visualization_count,
owned_visualization_count: owned_visualizations_count,
failed_import_count: failed_import_count,
success_import_count: success_import_count,
import_count: import_count,
last_visualization_created_at: last_visualization_created_at,
quota_in_bytes: quota_in_bytes,
db_size_in_bytes: db_size_in_bytes,
db_size_in_megabytes: db_size_in_bytes.present? ? (db_size_in_bytes / (1024.0 * 1024.0)).round(2) : nil,
remaining_table_quota: remaining_table_quota,
remaining_byte_quota: remaining_quota(false, db_size_in_bytes).to_f,
api_calls: calls,
api_calls_quota: organization_user? ? organization.map_view_quota : map_view_quota,
api_calls_block_price: organization_user? ? organization.map_view_block_price : map_view_block_price,
geocoding: {
quota: organization_user? ? organization.geocoding_quota : geocoding_quota,
block_price: organization_user? ? organization.geocoding_block_price : geocoding_block_price,
monthly_use: organization_user? ? organization.get_geocoding_calls : get_geocoding_calls,
hard_limit: hard_geocoding_limit?
},
here_isolines: {
quota: organization_user? ? organization.here_isolines_quota : here_isolines_quota,
block_price: organization_user? ? organization.here_isolines_block_price : here_isolines_block_price,
monthly_use: organization_user? ? organization.get_here_isolines_calls : get_here_isolines_calls,
hard_limit: hard_here_isolines_limit?
},
geocoder_provider: geocoder_provider,
isolines_provider: isolines_provider,
routing_provider: routing_provider,
obs_snapshot: {
quota: organization_user? ? organization.obs_snapshot_quota : obs_snapshot_quota,
block_price: organization_user? ? organization.obs_snapshot_block_price : obs_snapshot_block_price,
monthly_use: organization_user? ? organization.get_obs_snapshot_calls : get_obs_snapshot_calls,
hard_limit: hard_obs_snapshot_limit?
},
obs_general: {
quota: organization_user? ? organization.obs_general_quota : obs_general_quota,
block_price: organization_user? ? organization.obs_general_block_price : obs_general_block_price,
monthly_use: organization_user? ? organization.get_obs_general_calls : get_obs_general_calls,
hard_limit: hard_obs_general_limit?
},
twitter: {
enabled: organization_user? ? organization.twitter_datasource_enabled : twitter_datasource_enabled,
quota: organization_user? ? organization.twitter_datasource_quota : twitter_datasource_quota,
block_price: organization_user? ? organization.twitter_datasource_block_price : twitter_datasource_block_price,
block_size: organization_user? ? organization.twitter_datasource_block_size : twitter_datasource_block_size,
monthly_use: organization_user? ? organization.get_twitter_imports_count : get_twitter_imports_count,
hard_limit: hard_twitter_datasource_limit
},
mailchimp: {
enabled: Carto::AccountType.new.mailchimp?(@user)
},
mapzen_routing: {
quota: organization_user? ? organization.mapzen_routing_quota : mapzen_routing_quota,
block_price: organization_user? ? organization.mapzen_routing_block_price : mapzen_routing_block_price,
monthly_use: organization_user? ? organization.get_mapzen_routing_calls : get_mapzen_routing_calls,
hard_limit: hard_mapzen_routing_limit?
},
salesforce: {
enabled: organization_user? ? organization.salesforce_datasource_enabled : salesforce_datasource_enabled
},
billing_period: last_billing_cycle,
api_key: api_key,
layers: layers.map(&:public_values),
trial_ends_at: trial_ends_at,
upgraded_at: upgraded_at,
show_trial_reminder: trial_ends_at.present?,
show_upgraded_message: (account_type.downcase != 'free' && upgraded_at && upgraded_at + 15.days > Date.today ? true : false),
actions: {
private_tables: private_tables_enabled,
private_maps: private_maps_enabled?,
remove_logo: remove_logo?,
sync_tables: sync_tables_enabled,
google_maps_geocoder_enabled: google_maps_geocoder_enabled?,
google_maps_enabled: google_maps_enabled?,
engine_enabled: engine_enabled?,
builder_enabled: builder_enabled?
},
limits: {
concurrent_syncs: CartoDB::PlatformLimits::Importer::UserConcurrentSyncsAmount::MAX_SYNCS_PER_USER,
concurrent_imports: max_concurrent_import_count,
import_file_size: max_import_file_size,
import_table_rows: max_import_table_row_count,
max_layers: max_layers
},
notification: notification,
avatar_url: avatar,
feature_flags: feature_flags,
base_url: public_url,
needs_password_confirmation: needs_password_confirmation?,
viewer: viewer
}
if organization.present?
data[:organization] = organization.to_poro
data[:organization][:available_quota_for_user] = organization.unassigned_quota + quota_in_bytes
end
if !groups.nil?
data[:groups] = groups.map { |g| Carto::Api::GroupPresenter.new(g).to_poro }
end
if options[:extended]
data.merge(
real_table_count: real_tables.size,
last_active_time: get_last_active_time
)
else
data
end
end
end
end
@user not available in this context
module CartoDB
module UserDecorator
include AccountTypeHelper
# Options:
# - show_api_calls: load api calls. Default: true.
# - extended: load real_table_count and last_active_time. Default: false.
def data(options = {})
calls = options.fetch(:show_api_calls, true) ? get_api_calls(from: last_billing_cycle, to: Date.today) : []
calls.fill(0, calls.size..29)
db_size_in_bytes = self.db_size_in_bytes
data = {
id: id,
email: email,
name: name,
username: username,
account_type: account_type,
account_type_display_name: plan_name(account_type),
table_quota: table_quota,
table_count: table_count,
public_visualization_count: public_visualization_count,
all_visualization_count: all_visualization_count,
visualization_count: visualization_count,
owned_visualization_count: owned_visualizations_count,
failed_import_count: failed_import_count,
success_import_count: success_import_count,
import_count: import_count,
last_visualization_created_at: last_visualization_created_at,
quota_in_bytes: quota_in_bytes,
db_size_in_bytes: db_size_in_bytes,
db_size_in_megabytes: db_size_in_bytes.present? ? (db_size_in_bytes / (1024.0 * 1024.0)).round(2) : nil,
remaining_table_quota: remaining_table_quota,
remaining_byte_quota: remaining_quota(false, db_size_in_bytes).to_f,
api_calls: calls,
api_calls_quota: organization_user? ? organization.map_view_quota : map_view_quota,
api_calls_block_price: organization_user? ? organization.map_view_block_price : map_view_block_price,
geocoding: {
quota: organization_user? ? organization.geocoding_quota : geocoding_quota,
block_price: organization_user? ? organization.geocoding_block_price : geocoding_block_price,
monthly_use: organization_user? ? organization.get_geocoding_calls : get_geocoding_calls,
hard_limit: hard_geocoding_limit?
},
here_isolines: {
quota: organization_user? ? organization.here_isolines_quota : here_isolines_quota,
block_price: organization_user? ? organization.here_isolines_block_price : here_isolines_block_price,
monthly_use: organization_user? ? organization.get_here_isolines_calls : get_here_isolines_calls,
hard_limit: hard_here_isolines_limit?
},
geocoder_provider: geocoder_provider,
isolines_provider: isolines_provider,
routing_provider: routing_provider,
obs_snapshot: {
quota: organization_user? ? organization.obs_snapshot_quota : obs_snapshot_quota,
block_price: organization_user? ? organization.obs_snapshot_block_price : obs_snapshot_block_price,
monthly_use: organization_user? ? organization.get_obs_snapshot_calls : get_obs_snapshot_calls,
hard_limit: hard_obs_snapshot_limit?
},
obs_general: {
quota: organization_user? ? organization.obs_general_quota : obs_general_quota,
block_price: organization_user? ? organization.obs_general_block_price : obs_general_block_price,
monthly_use: organization_user? ? organization.get_obs_general_calls : get_obs_general_calls,
hard_limit: hard_obs_general_limit?
},
twitter: {
enabled: organization_user? ? organization.twitter_datasource_enabled : twitter_datasource_enabled,
quota: organization_user? ? organization.twitter_datasource_quota : twitter_datasource_quota,
block_price: organization_user? ? organization.twitter_datasource_block_price : twitter_datasource_block_price,
block_size: organization_user? ? organization.twitter_datasource_block_size : twitter_datasource_block_size,
monthly_use: organization_user? ? organization.get_twitter_imports_count : get_twitter_imports_count,
hard_limit: hard_twitter_datasource_limit
},
mailchimp: {
enabled: Carto::AccountType.new.mailchimp?(self)
},
mapzen_routing: {
quota: organization_user? ? organization.mapzen_routing_quota : mapzen_routing_quota,
block_price: organization_user? ? organization.mapzen_routing_block_price : mapzen_routing_block_price,
monthly_use: organization_user? ? organization.get_mapzen_routing_calls : get_mapzen_routing_calls,
hard_limit: hard_mapzen_routing_limit?
},
salesforce: {
enabled: organization_user? ? organization.salesforce_datasource_enabled : salesforce_datasource_enabled
},
billing_period: last_billing_cycle,
api_key: api_key,
layers: layers.map(&:public_values),
trial_ends_at: trial_ends_at,
upgraded_at: upgraded_at,
show_trial_reminder: trial_ends_at.present?,
show_upgraded_message: (account_type.downcase != 'free' && upgraded_at && upgraded_at + 15.days > Date.today ? true : false),
actions: {
private_tables: private_tables_enabled,
private_maps: private_maps_enabled?,
remove_logo: remove_logo?,
sync_tables: sync_tables_enabled,
google_maps_geocoder_enabled: google_maps_geocoder_enabled?,
google_maps_enabled: google_maps_enabled?,
engine_enabled: engine_enabled?,
builder_enabled: builder_enabled?
},
limits: {
concurrent_syncs: CartoDB::PlatformLimits::Importer::UserConcurrentSyncsAmount::MAX_SYNCS_PER_USER,
concurrent_imports: max_concurrent_import_count,
import_file_size: max_import_file_size,
import_table_rows: max_import_table_row_count,
max_layers: max_layers
},
notification: notification,
avatar_url: avatar,
feature_flags: feature_flags,
base_url: public_url,
needs_password_confirmation: needs_password_confirmation?,
viewer: viewer
}
if organization.present?
data[:organization] = organization.to_poro
data[:organization][:available_quota_for_user] = organization.unassigned_quota + quota_in_bytes
end
if !groups.nil?
data[:groups] = groups.map { |g| Carto::Api::GroupPresenter.new(g).to_poro }
end
if options[:extended]
data.merge(
real_table_count: real_tables.size,
last_active_time: get_last_active_time
)
else
data
end
end
end
end
|
module Util
class TableExporter
attr_reader :zipfile_name, :table_names
def initialize(tables=[],schema='')
@schema = schema
if @schema == 'beta'
@temp_dir = "#{Util::FileManager.new.dump_directory}/export_beta"
@zipfile_name = "#{@temp_dir}/#{Time.zone.now.strftime('%Y%m%d')}_beta_export.zip"
else
@temp_dir = "#{Util::FileManager.new.dump_directory}/export"
@zipfile_name = "#{@temp_dir}/#{Time.zone.now.strftime('%Y%m%d')}_export.zip"
end
@connection = ActiveRecord::Base.connection.raw_connection
@table_names = tables
create_temp_dir_if_none_exists!
end
def run(delimiter: '|', should_archive: true)
load_event = Support::LoadEvent.create({:event_type=>'table_export',:status=>'running',:description=>'',:problems=>''})
File.delete(@zipfile_name) if File.exist?(@zipfile_name)
begin
tempfiles = create_tempfiles(delimiter)
if delimiter == ','
system("zip -j -q #{@zipfile_name} #{@temp_dir}/*.csv")
else
system("zip -j -q #{@zipfile_name} #{@temp_dir}/*.txt")
end
if should_archive
archive(delimiter)
end
ensure
cleanup_tempfiles!
end
load_event.complete
end
private
def create_tempfiles(delimiter)
if !@table_names.empty?
tables=@table_names
else
tables=Util::DbManager.loadable_tables
end
tempfiles = tables.map { |table_name| delimiter == ',' ? "#{table_name}.csv" : "#{table_name}.txt" }
.map do |file_name|
path = "#{@temp_dir}/#{file_name}"
File.open(path, 'wb+') do |file|
export_table_to_csv(file, file_name, path, delimiter)
file
end
end
end
def export_table_to_csv(file, file_name, path, delimiter)
table = File.basename(file_name, delimiter == ',' ? '.csv' : '.txt')
@connection.copy_data("copy #{table} to STDOUT with delimiter '#{delimiter}' csv header") do
while row = @connection.get_copy_data
# convert all \n to ~. Then when you write to the file, convert last ~ back to \n
# to prevent it from concatenating all rows into one big long string
fixed_row=row.gsub(/\"\"/, '').gsub(/\n\s/, '~').gsub(/\n/, '~')
file.write(fixed_row.gsub(/\~$/,"\n"))
end
end
end
def cleanup_tempfiles!
Dir.entries(@temp_dir).each do |file|
file_with_path = "#{@temp_dir}/#{file}"
File.delete(file_with_path) if File.extname(file) == '.csv' || File.extname(file) == '.txt'
end
end
def create_temp_dir_if_none_exists!
unless Dir.exist?(@temp_dir)
Dir.mkdir(@temp_dir)
end
end
def archive(delimiter)
file_type = if delimiter == ','
"csv-export"
elsif delimiter == '|'
"pipe-delimited-export"
end
folder = Util::FileManager.new.flat_files_directory(@schema)
archive_file_name="#{folder}/#{Time.zone.now.strftime('%Y%m%d')}_#{file_type}.zip"
FileUtils.mv(@zipfile_name, archive_file_name)
end
end
end
removed mentions of beta from table_exporter
module Util
class TableExporter
attr_reader :zipfile_name, :table_names
def initialize(tables=[],schema='')
@schema = schema
@temp_dir = "#{Util::FileManager.new.dump_directory}/export"
@zipfile_name = "#{@temp_dir}/#{Time.zone.now.strftime('%Y%m%d')}_export.zip"
@connection = ActiveRecord::Base.connection.raw_connection
@table_names = tables
create_temp_dir_if_none_exists!
end
def run(delimiter: '|', should_archive: true)
load_event = Support::LoadEvent.create({:event_type=>'table_export',:status=>'running',:description=>'',:problems=>''})
File.delete(@zipfile_name) if File.exist?(@zipfile_name)
begin
tempfiles = create_tempfiles(delimiter)
if delimiter == ','
system("zip -j -q #{@zipfile_name} #{@temp_dir}/*.csv")
else
system("zip -j -q #{@zipfile_name} #{@temp_dir}/*.txt")
end
if should_archive
archive(delimiter)
end
ensure
cleanup_tempfiles!
end
load_event.complete
end
private
def create_tempfiles(delimiter)
if !@table_names.empty?
tables=@table_names
else
tables=Util::DbManager.loadable_tables
end
tempfiles = tables.map { |table_name| delimiter == ',' ? "#{table_name}.csv" : "#{table_name}.txt" }
.map do |file_name|
path = "#{@temp_dir}/#{file_name}"
File.open(path, 'wb+') do |file|
export_table_to_csv(file, file_name, path, delimiter)
file
end
end
end
def export_table_to_csv(file, file_name, path, delimiter)
table = File.basename(file_name, delimiter == ',' ? '.csv' : '.txt')
@connection.copy_data("copy #{table} to STDOUT with delimiter '#{delimiter}' csv header") do
while row = @connection.get_copy_data
# convert all \n to ~. Then when you write to the file, convert last ~ back to \n
# to prevent it from concatenating all rows into one big long string
fixed_row=row.gsub(/\"\"/, '').gsub(/\n\s/, '~').gsub(/\n/, '~')
file.write(fixed_row.gsub(/\~$/,"\n"))
end
end
end
def cleanup_tempfiles!
Dir.entries(@temp_dir).each do |file|
file_with_path = "#{@temp_dir}/#{file}"
File.delete(file_with_path) if File.extname(file) == '.csv' || File.extname(file) == '.txt'
end
end
def create_temp_dir_if_none_exists!
unless Dir.exist?(@temp_dir)
Dir.mkdir(@temp_dir)
end
end
def archive(delimiter)
file_type = if delimiter == ','
"csv-export"
elsif delimiter == '|'
"pipe-delimited-export"
end
folder = Util::FileManager.new.flat_files_directory(@schema)
archive_file_name="#{folder}/#{Time.zone.now.strftime('%Y%m%d')}_#{file_type}.zip"
FileUtils.mv(@zipfile_name, archive_file_name)
end
end
end
|
Pod::Spec.new do |s|
s.name = "HYPForms"
s.version = "0.66"
s.summary = "JSON driven forms"
s.description = <<-DESC
* JSON driven forms
DESC
s.homepage = "https://github.com/hyperoslo/HYPForms"
s.license = {
:type => 'MIT',
:file => 'LICENSE.md'
}
s.author = { "Hyper" => "teknologi@hyper.no" }
s.social_media_url = "http://twitter.com/hyperoslo"
s.platform = :ios, '7.0'
s.source = {
:git => 'https://github.com/hyperoslo/HYPForms.git',
:tag => s.version.to_s
}
s.source_files = 'Source/**/*.{h,m}'
s.frameworks = 'Foundation'
s.requires_arc = true
end
Update podspec
Pod::Spec.new do |s|
s.name = "HYPForms"
s.version = "0.67"
s.summary = "JSON driven forms"
s.description = <<-DESC
* JSON driven forms
DESC
s.homepage = "https://github.com/hyperoslo/HYPForms"
s.license = {
:type => 'MIT',
:file => 'LICENSE.md'
}
s.author = { "Hyper" => "teknologi@hyper.no" }
s.social_media_url = "http://twitter.com/hyperoslo"
s.platform = :ios, '7.0'
s.source = {
:git => 'https://github.com/hyperoslo/HYPForms.git',
:tag => s.version.to_s
}
s.source_files = 'Source/**/*.{h,m}'
s.frameworks = 'Foundation'
s.requires_arc = true
end
|
class ProjectObserver < ActiveRecord::Observer
observe :project
def before_validation(project)
unless project.permalink.present?
project.permalink = "#{project.name.parameterize.gsub(/\-/, '_')}_#{SecureRandom.hex(2)}"
end
end
def before_save(project)
if project.try(:online_days_changed?) || project.try(:expires_at).nil?
project.update_expires_at
end
project.video_embed_url = nil unless project.video_url.present?
end
def after_save(project)
if project.try(:video_url_changed?)
ProjectDownloaderWorker.perform_async(project.id)
end
end
def from_online_to_waiting_funds(project)
notify_admin_project_will_succeed(project) if project.reached_goal?
end
def from_waiting_funds_to_successful(project)
notify_admin_that_project_is_successful(project)
notify_users(project)
project.notify_owner(:project_success)
end
alias :from_online_to_successful :from_waiting_funds_to_successful
def from_draft_to_online(project)
project.update_expires_at
project.update_attributes(
published_ip: project.user.current_sign_in_ip,
audited_user_name: project.user.name,
audited_user_cpf: project.user.cpf,
audited_user_phone_number: project.user.phone_number)
UserBroadcastWorker.perform_async(
follow_id: project.user_id,
template_name: 'follow_project_online',
project_id: project.id)
FacebookScrapeReloadWorker.perform_async(project.direct_url)
end
def from_online_to_draft(project)
refund_all_payments(project)
end
def from_online_to_rejected(project)
refund_all_payments(project)
end
def from_online_to_deleted(project)
refund_all_payments(project)
end
def from_online_to_failed(project)
notify_users(project)
refund_all_payments(project)
end
def from_waiting_funds_to_failed(project)
from_online_to_failed(project)
end
private
def notify_admin_that_project_is_successful(project)
redbooth_user = User.find_by(email: CatarseSettings[:email_redbooth])
project.notify_once(:redbooth_task, redbooth_user) if redbooth_user
end
def notify_admin_project_will_succeed(project)
zendesk_user = User.find_by(email: CatarseSettings[:email_contact])
project.notify_once(:project_will_succeed, zendesk_user) if zendesk_user
end
def notify_users(project)
project.payments.with_state('paid').each do |payment|
template_name = project.successful? ? :contribution_project_successful : payment.notification_template_for_failed_project
payment.contribution.notify_to_contributor(template_name)
end
end
def refund_all_payments(project)
project.payments.with_state('paid').each do |payment|
payment.direct_refund
end
end
end
fix specs
class ProjectObserver < ActiveRecord::Observer
observe :project
def before_save(project)
if project.try(:online_days_changed?) || project.try(:expires_at).nil?
project.update_expires_at
end
unless project.permalink.present?
project.permalink = "#{project.name.parameterize.gsub(/\-/, '_')}_#{SecureRandom.hex(2)}"
end
project.video_embed_url = nil unless project.video_url.present?
end
def after_save(project)
if project.try(:video_url_changed?)
ProjectDownloaderWorker.perform_async(project.id)
end
end
def from_online_to_waiting_funds(project)
notify_admin_project_will_succeed(project) if project.reached_goal?
end
def from_waiting_funds_to_successful(project)
notify_admin_that_project_is_successful(project)
notify_users(project)
project.notify_owner(:project_success)
end
alias :from_online_to_successful :from_waiting_funds_to_successful
def from_draft_to_online(project)
project.update_expires_at
project.update_attributes(
published_ip: project.user.current_sign_in_ip,
audited_user_name: project.user.name,
audited_user_cpf: project.user.cpf,
audited_user_phone_number: project.user.phone_number)
UserBroadcastWorker.perform_async(
follow_id: project.user_id,
template_name: 'follow_project_online',
project_id: project.id)
FacebookScrapeReloadWorker.perform_async(project.direct_url)
end
def from_online_to_draft(project)
refund_all_payments(project)
end
def from_online_to_rejected(project)
refund_all_payments(project)
end
def from_online_to_deleted(project)
refund_all_payments(project)
end
def from_online_to_failed(project)
notify_users(project)
refund_all_payments(project)
end
def from_waiting_funds_to_failed(project)
from_online_to_failed(project)
end
private
def notify_admin_that_project_is_successful(project)
redbooth_user = User.find_by(email: CatarseSettings[:email_redbooth])
project.notify_once(:redbooth_task, redbooth_user) if redbooth_user
end
def notify_admin_project_will_succeed(project)
zendesk_user = User.find_by(email: CatarseSettings[:email_contact])
project.notify_once(:project_will_succeed, zendesk_user) if zendesk_user
end
def notify_users(project)
project.payments.with_state('paid').each do |payment|
template_name = project.successful? ? :contribution_project_successful : payment.notification_template_for_failed_project
payment.contribution.notify_to_contributor(template_name)
end
end
def refund_all_payments(project)
project.payments.with_state('paid').each do |payment|
payment.direct_refund
end
end
end
|
class CompletePurchase
def initialize(user, order, mailer=OrderMailer)
@user = user
@order = order
@mailer = mailer
end
def create(params, success, failure)
# start a transaction
transaction = @order.build_transaction(params)
if transaction.save
transaction_successfully_saved(transaction)
success.call(transaction)
else
failure.call
end
# end transaction
end
def transaction_successfully_saved(trans)
trans.pay!
@order.update(:user_id => @user.id) if @user
@mailer.order_confirmation(trans).deliver
end
end
add transaction to CompletePurchase#create
class CompletePurchase
def initialize(user, order, mailer=OrderMailer)
@user = user
@order = order
@mailer = mailer
end
def create(params, success, failure)
ActiveRecord::Base.transaction do
transaction = @order.build_transaction(params)
if transaction.save
transaction_successfully_saved(transaction)
success.call(transaction)
else
failure.call
end
end
end
def transaction_successfully_saved(trans)
trans.pay!
@order.update(:user_id => @user.id) if @user
@mailer.order_confirmation(trans).deliver
end
end
|
Add tool to automatically change most SLS files to use pkgrepo instead of .repo files
#!/usr/bin/env ruby
# encoding: UTF-8
require 'find'
require 'pathname'
require 'pp'
require 'uri'
starting_dir = if ARGV.length > 0 then ARGV[0] else "." end
def to_repo_hash(path)
content = File.read(path)
{
path: path,
content: content,
name: content.match('^\[(.+)\]$')[1],
baseurl: content.match('^baseurl=(.+)$', )[1],
priority: (content.match('^priority=(.+)$', ) || [nil]) [1],
gpgcheck: (content.match('^gpgcheck=(.+)$', ) || [nil]) [1],
gpgkey: (content.match('^gpgkey=(.+)$', ) || [nil]) [1]
}
end
repos = Find.find(starting_dir)
.select { |e| e =~ /\.repo$/ }
.map { |e| to_repo_hash(e) }
def to_sls_hash(path)
{
path: path,
content: File.read(path)
}
end
def to_declaration_hashes(sls_hash)
# os_pool_repo:
# file.managed:
# - name: /etc/zypp/repos.d/openSUSE-Leap-42.3-Pool.repo
# - source: salt://repos/repos.d/openSUSE-Leap-42.3-Pool.repo
# - template: jinja
raw_matches = sls_hash[:content].to_enum(:scan, /(.+):\n.*file.managed:\n((?:.* \- .*: .*\n)+)/).map { Regexp.last_match }
raw_matches
.select { |e| e[0] =~ /source: salt:\/\/.*.repo$/ }
.map { |e| {
id: e[1],
name: e[2].match(/name: (.*)/)[1],
source: e[2].match(/source: (.*)/)[1],
full: e[0],
path: sls_hash[:path]
}}
end
slss = Find.find(starting_dir)
.select { |e| e =~ /\.sls$/ }
.map { |e| to_sls_hash(e) }
declarations = slss
.map { |e| to_declaration_hashes(e) }
.flatten
def to_substitution_hash(repos, declaration)
matching_repo = repos
.select { |e| Pathname.new(e[:path]).basename == Pathname.new(URI.parse(declaration[:source]).path).basename }
.first
if matching_repo.nil?
return nil
end
gpgcheck = matching_repo[:gpgcheck]
gpgkey = matching_repo[:gpgkey]
priority = matching_repo[:priority]
new_header = <<-STRING_END
#{declaration[:id]}:
pkgrepo.managed:
- baseurl: #{matching_repo[:baseurl]}
STRING_END
new = new_header +
(if gpgcheck then " - gpgcheck: #{gpgcheck}\n" else "" end) +
(if gpgkey then " - gpgkey: #{gpgkey}\n" else "" end) +
(if priority then " - priority: #{priority}\n" else "" end)
{
path: declaration[:path],
original: declaration[:full],
new: new
}
end
substitutions = declarations
.map { |e| to_substitution_hash(repos, e) }
substitutions.each do |s|
text = File.read(s[:path])
new_text = text.gsub(s[:original], s[:new])
File.open(s[:path], "w") {|file| file.puts new_text }
end
|
class DocumentUploader < CarrierWave::Uploader::Base
end
stocke les documents uploadés dans un répertoire spécifique par projet
class DocumentUploader < CarrierWave::Uploader::Base
def store_dir
"./projets/#{model.id}/"
end
end
|
require 'json-schema'
class SchemaValidator
def initialize(type:, schema_name: nil, schema: nil)
@type = type
@schema = schema
@schema_name = schema_name
end
def validate(payload)
@payload = payload
return true if schema_name_exception?
errors = JSON::Validator.fully_validate(
schema,
payload,
errors_as_objects: true,
)
return true if errors.empty?
errors = errors.map { |e| present_error e }
Airbrake.notify_or_ignore(
{
error_class: "SchemaValidationError",
error_message: "Error validating payload against schema"
},
parameters: {
errors: errors,
message_data: payload
}
)
false
end
private
attr_reader :payload, :type
def present_error(error_hash)
# The schema key just contains an addressable, which is not informative as
# the schema in use should be clear from the error class and message
error_hash = error_hash.reject { |k,v| k == :schema }
if error_hash.has_key? :errors
error_hash[:errors] = Hash[
error_hash[:errors].map {|k,errors| [k,errors.map { |e| present_error e }]}
]
end
error_hash
end
def schema
@schema || JSON.load(File.read("govuk-content-schemas/formats/#{schema_name}/publisher_v2/#{type}.json"))
rescue Errno::ENOENT => error
Airbrake.notify_or_ignore(error, parameters: {
explanation: "#{payload} is missing schema_name #{schema_name} or type #{type}"
})
@schema = {}
end
def schema_name
@schema_name || payload[:schema_name] || payload[:format]
end
def schema_name_exception?
schema_name.to_s.match(/placeholder_/)
end
end
Just return a empty schema, instead of storing it
@schema should only be altered by the initialiser, as doing otherwise could
make the validation method not idempotent.
require 'json-schema'
class SchemaValidator
def initialize(type:, schema_name: nil, schema: nil)
@type = type
@schema = schema
@schema_name = schema_name
end
def validate(payload)
@payload = payload
return true if schema_name_exception?
errors = JSON::Validator.fully_validate(
schema,
payload,
errors_as_objects: true,
)
return true if errors.empty?
errors = errors.map { |e| present_error e }
Airbrake.notify_or_ignore(
{
error_class: "SchemaValidationError",
error_message: "Error validating payload against schema"
},
parameters: {
errors: errors,
message_data: payload
}
)
false
end
private
attr_reader :payload, :type
def present_error(error_hash)
# The schema key just contains an addressable, which is not informative as
# the schema in use should be clear from the error class and message
error_hash = error_hash.reject { |k,v| k == :schema }
if error_hash.has_key? :errors
error_hash[:errors] = Hash[
error_hash[:errors].map {|k,errors| [k,errors.map { |e| present_error e }]}
]
end
error_hash
end
def schema
@schema || JSON.load(File.read("govuk-content-schemas/formats/#{schema_name}/publisher_v2/#{type}.json"))
rescue Errno::ENOENT => error
Airbrake.notify_or_ignore(error, parameters: {
explanation: "#{payload} is missing schema_name #{schema_name} or type #{type}"
})
{}
end
def schema_name
@schema_name || payload[:schema_name] || payload[:format]
end
def schema_name_exception?
schema_name.to_s.match(/placeholder_/)
end
end
|
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
resources :reports
resources :users
resources :staff_members
resources :branches do
resources :centers do
resources :clients do
resources :loans do
resources :payments
end
end
end
end
resources :funders do
resources :funding_lines
end
# Adds the required routes for merb-auth using the password slice
slice(:merb_auth_slice_password, :name_prefix => nil, :path_prefix => "")
match('/data_entry').to(:namespace => 'data_entry', :controller => 'index').name(:data_entry)
namespace :data_entry, :name_prefix => 'enter' do # for url(:enter_payment) and the likes
match('/clients(/:action)').to(:controller => 'clients').name(:clients)
match('/loans(/:action)').to(:controller => 'loans').name(:loans)
match('/payments(/:action)').to(:controller => 'payments').name(:payments)
match('/attendancy(/:action)').to(:controller => 'attendancy').name(:attendancy)
end
match('/graph_data/:action(/:id)').to(:controller => 'graph_data').name(:graph_data)
match('/staff_members/:id/centers').to(:controller => 'staff_members', :action => 'show_centers').name(:show_staff_member_centers)
match('/branches/:id/today').to(:controller => 'branches', :action => 'today').name(:branch_today)
match('/entrance').to(:controller => 'entrance').name(:entrance)
match('/branches/:branch_id/centers/:center_id/clients/:client_id/test').to( :controller => 'loans', :action => 'test')
match('/staff_members/:id/day_sheet').to(:controller => 'staff_members', :action => 'day_sheet').name(:day_sheet)
# This is the default route for /:controller/:action/:id
# default_routes
# this uses the redirect_to_show methods on the controllers to redirect some models to their appropriate urls
match('/:controller/:id').to(:action => 'redirect_to_show').name(:quick_link)
match('/').to(:controller => 'entrance', :action =>'root')
end
default router activated
Merb.logger.info("Compiling routes...")
Merb::Router.prepare do
resources :reports
resources :users
resources :staff_members
resources :branches do
resources :centers do
resources :clients do
resources :loans do
resources :payments
end
end
end
end
resources :funders do
resources :funding_lines
end
# Adds the required routes for merb-auth using the password slice
slice(:merb_auth_slice_password, :name_prefix => nil, :path_prefix => "")
match('/data_entry').to(:namespace => 'data_entry', :controller => 'index').name(:data_entry)
namespace :data_entry, :name_prefix => 'enter' do # for url(:enter_payment) and the likes
match('/clients(/:action)').to(:controller => 'clients').name(:clients)
match('/loans(/:action)').to(:controller => 'loans').name(:loans)
match('/payments(/:action)').to(:controller => 'payments').name(:payments)
match('/attendancy(/:action)').to(:controller => 'attendancy').name(:attendancy)
end
match('/graph_data/:action(/:id)').to(:controller => 'graph_data').name(:graph_data)
match('/staff_members/:id/centers').to(:controller => 'staff_members', :action => 'show_centers').name(:show_staff_member_centers)
match('/branches/:id/today').to(:controller => 'branches', :action => 'today').name(:branch_today)
match('/entrance').to(:controller => 'entrance').name(:entrance)
match('/branches/:branch_id/centers/:center_id/clients/:client_id/test').to( :controller => 'loans', :action => 'test')
match('/staff_members/:id/day_sheet').to(:controller => 'staff_members', :action => 'day_sheet').name(:day_sheet)
# this uses the redirect_to_show methods on the controllers to redirect some models to their appropriate urls
match('/:controller/:id').to(:action => 'redirect_to_show').name(:quick_link)
match('/').to(:controller => 'entrance', :action =>'root')
# This is the default route for /:controller/:action/:id
default_routes
end
|
NewCurriculum::Application.routes.draw do
root :to => 'application#index'
match '/404', to: 'errors#not_found'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end
updating routes to rails 4 format
NewCurriculum::Application.routes.draw do
root 'application#index'
get '/404', to: 'errors#not_found'
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
end
|
Rails.application.routes.draw do
devise_for :users, controllers: {
sessions: 'sessions'
}
use_doorkeeper
root 'home#landing'
controller :home do
get '/home/doorkeeper'
end
controller :callbacks do
get '/callbacks/nmclis' => 'callbacks#nmclis'
end
scope '/api' do
scope :lookup do
get ':lookupmodel' => "lookup#dblookup"
end
get '__bulklookup' => "lookup#bulkrequest"
#list of module
get 'dashboard_info' => 'home#dashboard_info'
scope 'dpis' do
get '/search-bar/:searchkeyword' => 'patients#search_bar'
get '/:patientid' => 'patients#patient_info'
get '/search-patient' => 'patients#search_patient'
get '/load-mykad-picture/:imagename' => 'patients#load_mykad_picture'
get '/print-detail-patient/:patientid' => 'patients#print_detail_patient'
end
scope 'adt' do
post '/admit' => 'adt#admit'
get '/active-patient' => 'adt#list_active_patient'
get '/sign/:signaction/:clismodule/:tid' => 'adt#sign_patient'
get '/current_visit/:tid' => 'adt#get_current_patient_info'
end
scope 'opms' do
end
scope 'tca' do
end
scope 'pms' do
get '/search-bar/:searchkeyword' => 'warehouses#search_bar'
end
scope 'bms' do
end
scope 'labs' do
end
get 'lookup' => 'lookup#index'
end
end
update routes
Rails.application.routes.draw do
devise_for :users, controllers: {
sessions: 'users/sessions'
}
use_doorkeeper
root 'home#landing'
controller :home do
get '/home/doorkeeper'
end
controller :callbacks do
get '/callbacks/nmclis' => 'callbacks#nmclis'
end
scope '/api' do
scope :lookup do
get ':lookupmodel' => "lookup#dblookup"
end
get '__bulklookup' => "lookup#bulkrequest"
#list of module
get 'dashboard_info' => 'home#dashboard_info'
scope 'dpis' do
get '/search-bar/:searchkeyword' => 'patients#search_bar'
get '/:patientid' => 'patients#patient_info'
get '/search-patient' => 'patients#search_patient'
get '/load-mykad-picture/:imagename' => 'patients#load_mykad_picture'
get '/print-detail-patient/:patientid' => 'patients#print_detail_patient'
end
scope 'adt' do
post '/admit' => 'adt#admit'
get '/active-patient' => 'adt#list_active_patient'
get '/sign/:signaction/:clismodule/:tid' => 'adt#sign_patient'
get '/current_visit/:tid' => 'adt#get_current_patient_info'
end
scope 'opms' do
end
scope 'tca' do
end
scope 'pms' do
get '/search-bar/:searchkeyword' => 'warehouses#search_bar'
end
scope 'bms' do
end
scope 'labs' do
end
get 'lookup' => 'lookup#index'
end
end
|
FcrepoAdmin::Engine.routes.draw do
datastreams_resources = [:index, :show]
datastreams_resources += [:edit, :update] unless FcrepoAdmin.read_only
scope :module => "fcrepo_admin" do
resources :objects, :only => :show do
member do
get 'audit_trail'
get 'permissions'
end
resources :associations, :only => [:index, :show]
resources :datastreams, :only => datastreams_resources do
member do
get 'content'
get 'upload' unless FcrepoAdmin.read_only
get 'download' => 'download#show'
get 'history'
end
end
end
end
end
Added route to fcrepo_admin/objects#solr
FcrepoAdmin::Engine.routes.draw do
datastreams_resources = [:index, :show]
datastreams_resources += [:edit, :update] unless FcrepoAdmin.read_only
scope :module => "fcrepo_admin" do
resources :objects, :only => :show do
member do
get 'audit_trail'
get 'solr'
get 'permissions'
end
resources :associations, :only => [:index, :show]
resources :datastreams, :only => datastreams_resources do
member do
get 'content'
get 'upload' unless FcrepoAdmin.read_only
get 'download' => 'download#show'
get 'history'
end
end
end
end
end
|
Rails.application.routes.draw do
get 'authentication/status'
get 'authentication/redirect_target'
mount ActionCable.server => '/cable'
get 'users/username'
post 'users/username', to: "users#set_username"
get 'users/apps', to: 'users#apps'
delete 'users/revoke_app', to: 'users#revoke_app'
get 'review', to: "review#index"
post 'review/feedback', to: "review#add_feedback"
get 'stack_exchange_users/index'
get 'stackusers/:id', to: "stack_exchange_users#show", as: "stack_exchange_user"
get 'search', to: 'search#search_results'
get "graphs", to: "graphs#index"
get "status", to: "status#index"
get "users", to: 'admin#users'
get 'admin', to: 'admin#index'
get 'admin/invalidated', to: 'admin#recently_invalidated'
get 'admin/user_feedback', to: 'admin#user_feedback'
get 'admin/api_feedback', to: 'admin#api_feedback'
get 'admin/flagged', to: 'admin#flagged'
post 'admin/clear_flag', to: 'admin#clear_flag'
get 'admin/users', to: 'admin#users'
get 'admin/ignored_users', to: 'admin#ignored_users'
patch 'admin/ignore/:id', to: 'admin#ignore'
patch 'admin/unignore/:id', to: 'admin#unignore'
delete 'admin/destroy_ignored/:id', to: 'admin#destroy_ignored'
get 'admin/new_key', to: 'api_keys#new'
post 'admin/new_key', to: 'api_keys#create'
get 'admin/keys', to: 'api_keys#index'
delete 'admin/revoke_write', to: 'api_keys#revoke_write_tokens'
get "posts", to: "posts#index"
get "posts/latest", to: "posts#latest"
get "posts/by-url", to: "posts#by_url"
post 'posts/needs_admin', to: 'posts#needs_admin'
get "post/:id/feedback/clear", to: "feedbacks#clear", as: :clear_post_feedback
delete "feedback/:id/delete", to: "feedbacks#delete", as: :delete_feedback
get "post/:id", to: "posts#show"
get "post/:id/feedbacks.json", to: 'posts#feedbacksapi'
get "/users", to: "stack_exchange_users#index"
post 'feedbacks.json', to: "feedbacks#create"
post 'posts.json', to: "posts#create"
post 'deletion_logs.json', to: "deletion_logs#create"
post "status-update.json", to: "status#status_update"
get "dashboard", to: "dashboard#index"
get "reason/:id", to: "reasons#show"
get "posts/recent.json", to: "posts#recentpostsapi"
post "posts/add_feedback", to: "review#add_feedback"
get 'blacklist', to: 'blacklist#index'
get 'blacklist/add_website', to: 'blacklist#add_website'
post 'blacklist/add_website', to: 'blacklist#create_website'
delete 'blacklist/website/:id', to: 'blacklist#deactivate_website'
post 'github/hook'
root to: "dashboard#index"
get 'api/posts/url', :to => 'api#posts_by_url'
get 'api/posts/feedback', :to => 'api#posts_by_feedback'
get 'api/posts/:ids', :to => 'api#posts'
get 'api/post/:id/feedback', :to => 'api#post_feedback'
get 'api/post/:id/reasons', :to => 'api#post_reasons'
get 'api/reasons/:ids', :to => 'api#reasons'
get 'api/reasons/:id/posts', :to => 'api#reason_posts'
post 'api/w/post/:id/feedback', :to => 'api#create_feedback'
get 'oauth/request', :to => 'micro_auth#token_request'
post 'oauth/authorize', :to => 'micro_auth#authorize'
get 'oauth/authorized', :to => 'micro_auth#authorized'
get 'oauth/reject', :to => 'micro_auth#reject'
get 'oauth/token', :to => 'micro_auth#token'
get 'oauth/invalid_key', :to => 'micro_auth#invalid_key'
devise_for :users
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
routes
Rails.application.routes.draw do
get 'authentication/status'
get 'authentication/redirect_target'
mount ActionCable.server => '/cable'
get 'users/username'
post 'users/username', to: "users#set_username"
get 'users/apps', to: 'users#apps'
delete 'users/revoke_app', to: 'users#revoke_app'
get 'review', to: "review#index"
post 'review/feedback', to: "review#add_feedback"
get 'stack_exchange_users/index'
get 'stackusers/:id', to: "stack_exchange_users#show", as: "stack_exchange_user"
get 'search', to: 'search#search_results'
get "graphs", to: "graphs#index"
get "status", to: "status#index"
get "users", to: 'admin#users'
get 'admin', to: 'admin#index'
get 'admin/invalidated', to: 'admin#recently_invalidated'
get 'admin/user_feedback', to: 'admin#user_feedback'
get 'admin/api_feedback', to: 'admin#api_feedback'
get 'admin/flagged', to: 'admin#flagged'
post 'admin/clear_flag', to: 'admin#clear_flag'
get 'admin/users', to: 'admin#users'
get 'admin/ignored_users', to: 'admin#ignored_users'
patch 'admin/ignore/:id', to: 'admin#ignore'
patch 'admin/unignore/:id', to: 'admin#unignore'
delete 'admin/destroy_ignored/:id', to: 'admin#destroy_ignored'
get 'admin/new_key', to: 'api_keys#new'
post 'admin/new_key', to: 'api_keys#create'
get 'admin/keys', to: 'api_keys#index'
get 'admin/edit_key/:id', to: 'api_keys#edit'
patch 'admin/edit_key/:id', to: 'api_keys#update'
delete 'admin/revoke_write', to: 'api_keys#revoke_write_tokens'
get "posts", to: "posts#index"
get "posts/latest", to: "posts#latest"
get "posts/by-url", to: "posts#by_url"
post 'posts/needs_admin', to: 'posts#needs_admin'
get "post/:id/feedback/clear", to: "feedbacks#clear", as: :clear_post_feedback
delete "feedback/:id/delete", to: "feedbacks#delete", as: :delete_feedback
get "post/:id", to: "posts#show"
get "post/:id/feedbacks.json", to: 'posts#feedbacksapi'
get "/users", to: "stack_exchange_users#index"
post 'feedbacks.json', to: "feedbacks#create"
post 'posts.json', to: "posts#create"
post 'deletion_logs.json', to: "deletion_logs#create"
post "status-update.json", to: "status#status_update"
get "dashboard", to: "dashboard#index"
get "reason/:id", to: "reasons#show"
get "posts/recent.json", to: "posts#recentpostsapi"
post "posts/add_feedback", to: "review#add_feedback"
get 'blacklist', to: 'blacklist#index'
get 'blacklist/add_website', to: 'blacklist#add_website'
post 'blacklist/add_website', to: 'blacklist#create_website'
delete 'blacklist/website/:id', to: 'blacklist#deactivate_website'
post 'github/hook'
root to: "dashboard#index"
get 'api/posts/url', :to => 'api#posts_by_url'
get 'api/posts/feedback', :to => 'api#posts_by_feedback'
get 'api/posts/:ids', :to => 'api#posts'
get 'api/post/:id/feedback', :to => 'api#post_feedback'
get 'api/post/:id/reasons', :to => 'api#post_reasons'
get 'api/reasons/:ids', :to => 'api#reasons'
get 'api/reasons/:id/posts', :to => 'api#reason_posts'
post 'api/w/post/:id/feedback', :to => 'api#create_feedback'
get 'oauth/request', :to => 'micro_auth#token_request'
post 'oauth/authorize', :to => 'micro_auth#authorize'
get 'oauth/authorized', :to => 'micro_auth#authorized'
get 'oauth/reject', :to => 'micro_auth#reject'
get 'oauth/token', :to => 'micro_auth#token'
get 'oauth/invalid_key', :to => 'micro_auth#invalid_key'
devise_for :users
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
T4c::Application.routes.draw do
root 'home#index'
get 'audit' => 'home#audit'
resources :users, :only => [:show, :update, :index] do
collection do
get :login
end
member do
post :send_tips_back
end
end
resources :projects, :only => [:show, :index, :create, :edit, :update] do
resources :tips, :only => [:index]
member do
get :qrcode
get :decide_tip_amounts
patch :decide_tip_amounts
end
end
resources :tips, :only => [:index]
resources :withdrawals, :only => [:index]
devise_for :users,
:controllers => {
:omniauth_callbacks => "users/omniauth_callbacks"
}
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
remove clutter
Conflicts:
config/routes.rb
T4c::Application.routes.draw do
root 'home#index'
get 'audit' => 'home#audit'
resources :users, :only => [:show, :update, :index] do
collection do
get :login
end
member do
post :send_tips_back
end
end
resources :projects, :only => [:show, :index, :create, :edit, :update] do
resources :tips, :only => [:index]
member do
get :qrcode
get :decide_tip_amounts
patch :decide_tip_amounts
end
end
resources :tips, :only => [:index]
resources :withdrawals, :only => [:index]
devise_for :users,
:controllers => {
:omniauth_callbacks => "users/omniauth_callbacks"
}
end
|
Jobsworth::Application.routes.draw do
resources :snippets do
get :reorder
end
resources :service_level_agreements, :only => [:create, :destroy, :update]
resources :services, :except => [:show] do
collection do
get 'auto_complete_for_service_name'
end
end
devise_for :users,
:path_prefix => "auth",
:controllers => { :sessions => "auth/sessions",
:passwords => "auth/passwords" }
resources :users, :except => [:show] do
collection do
get :auto_complete_for_user_name
get :auto_complete_for_project_name
end
member do
match :access, :via => [:get, :put]
get :emails
get :projects
get :tasks
get :filters
match :workplan, :via => [:get, :put]
get :update_seen_news
get :project
end
end
get 'activities/index', as: 'activities'
root :to => 'activities#index'
get '/unified_search' => "customers#search"
resources :customers do
collection do
get :auto_complete_for_customer_name
end
end
resources :news_items, :except => [:show]
resources :projects do
collection do
get :add_default_user
get :list_completed
end
member do
get :ajax_remove_permission
get :ajax_add_permission
post :complete
post :revert
end
end
# task routes
get 'tasks/:id' => "tasks#edit", :constraints => {:id => /\d+/}
get "tasks/view/:id" => "tasks#edit", :as => :task_view
resources :tasks, :except => [:show] do
collection do
get :auto_complete_for_dependency_targets
get :get_default_watchers_for_customer
get :get_default_watchers_for_project
get :get_default_watchers
post :change_task_weight
get :get_customer
get :billable
get :planning
get :calendar
get :gantt
get :nextTasks
get :refresh_service_options
get :users_to_notify_popup
get :get_watcher
get :get_default_customers
get :dependency
end
member do
post :set_group
get :score
get :clone
end
end
resources :email_addresses, :except => [:show] do
member do
put :default
end
end
resources :resources do
collection do
get :attributes
get :auto_complete_for_resource_parent
end
get :show_password, :on => :member
end
resources :resource_types do
collection do
get :attribute
end
end
resources :organizational_units
resources :task_filters do
member do
get :toggle_status
get :select
post :select
end
collection do
get :search
get :update_current_filter
post :update_current_filter
get :set_single_task_filter
end
end
resources :todos do
match :toggle_done, :via => [:get, :post], :on => :member
end
resources :work_logs do
post :update_work_log, :on => :member
end
resources :tags do
collection do
get :auto_complete_for_tags
end
end
resources :work do
collection do
get :start
get :stop
get :cancel
get :pause
get :refresh
end
end
resources :properties do
collection do
get :remove_property_value_dialog
post :remove_property_value
end
end
resources :scm_projects
resources :triggers
post 'api/scm/:provider/:secret_key' => 'scm_changesets#create'
resources :projects, :customers, :property_values do
resources :score_rules
end
resources :milestones do
resources :score_rules
collection do
get :get_milestones
end
member do
post :revert
post :complete
end
end
resources :task_templates
resources :companies do
resources :score_rules
collection do
get :score_rules
get :custom_scripts
get :properties
end
member do
get :show_logo
end
end
resources :emails, only: [:create]
get 'timeline/list' => 'timeline#index'
get 'tasks/list' => 'tasks#index'
get 'feeds/rss/:id', :to => 'feeds#rss'
get 'feeds/ical/:id', :to => 'feeds#ical'
resources :admin_stats, :only => [:index]
resources :billing, :only => [:index] do
collection do
get :get_csv
end
end
resources :scm_changesets, :only => [:create] do
collection do
get :list
end
end
resources :widgets, :except => [:index, :new] do
collection do
get :add
post :save_order
end
member do
get :toggle_display
end
end
get 'wiki(/:id)', :to => 'wiki#show'
resources :wiki, :except => [:index, :new, :show] do
member do
get :versions
get :cancel
get :cancel_create
end
end
resources :project_files, :only => [:show] do
member do
get :download
get :thumbnail
delete :destroy_file
end
end
resources :custom_attributes, :only => [:index, :update] do
collection do
get :edit
get :fields
post :update
end
member do
get :choice
end
end
match ':controller/redirect_from_last' => :redirect_from_last, :via => [:get]
resources :scripts, only: :index
end
Fix routing error. Fixes #611
Jobsworth::Application.routes.draw do
resources :snippets do
get :reorder
end
resources :service_level_agreements, :only => [:create, :destroy, :update]
resources :services, :except => [:show] do
collection do
get 'auto_complete_for_service_name'
end
end
devise_for :users,
:path_prefix => "auth",
:controllers => { :sessions => "auth/sessions",
:passwords => "auth/passwords" }
resources :users, :except => [:show] do
collection do
get :auto_complete_for_user_name
get :auto_complete_for_project_name
end
member do
match :access, :via => [:get, :put]
get :emails
get :projects
get :tasks
get :filters
match :workplan, :via => [:get, :put]
get :update_seen_news
get :project
end
end
get 'activities/index', as: 'activities'
root :to => 'activities#index'
get '/unified_search' => "customers#search"
resources :customers do
collection do
get :auto_complete_for_customer_name
end
end
resources :news_items, :except => [:show]
resources :projects do
collection do
get :add_default_user
get :list_completed
end
member do
get :ajax_remove_permission
get :ajax_add_permission
post :complete
post :revert
end
end
# task routes
get 'tasks/:id' => "tasks#edit", :constraints => {:id => /\d+/}
get "tasks/view/:id" => "tasks#edit", :as => :task_view
resources :tasks, :except => [:show] do
collection do
get :auto_complete_for_dependency_targets
get :get_default_watchers_for_customer
get :get_default_watchers_for_project
get :get_default_watchers
post :change_task_weight
get :get_customer
get :billable
get :planning
get :calendar
get :gantt
get :nextTasks
get :refresh_service_options
get :users_to_notify_popup
get :get_watcher
get :get_default_customers
get :dependency
end
member do
post :set_group
get :score
get :clone
end
end
resources :email_addresses, :except => [:show] do
member do
put :default
end
end
resources :resources do
collection do
get :attributes
get :auto_complete_for_resource_parent
end
get :show_password, :on => :member
end
resources :resource_types do
collection do
get :attribute
end
end
resources :organizational_units
resources :task_filters do
member do
get :toggle_status
get :select
post :select
end
collection do
get :search
get :update_current_filter
post :update_current_filter
get :set_single_task_filter
end
end
resources :todos do
match :toggle_done, :via => [:get, :post], :on => :member
end
resources :work_logs do
post :update_work_log, :on => :member
end
resources :tags do
collection do
get :auto_complete_for_tags
end
end
resources :work do
collection do
get :start
get :stop
get :cancel
get :pause
get :refresh
end
end
resources :properties do
collection do
get :remove_property_value_dialog
post :remove_property_value
end
end
resources :scm_projects
resources :triggers
post 'api/scm/:provider/:secret_key' => 'scm_changesets#create'
resources :projects, :customers, :property_values do
resources :score_rules
end
resources :milestones do
resources :score_rules
collection do
get :get_milestones
end
member do
post :revert
post :complete
end
end
resources :task_templates
resources :companies do
resources :score_rules
collection do
get :score_rules
get :custom_scripts
get :properties
end
member do
get :show_logo
end
end
resources :emails, only: [:create]
get 'timeline/list' => 'timeline#index'
get 'tasks/list' => 'tasks#index'
get 'feeds/rss/:id', :to => 'feeds#rss'
get 'feeds/ical/:id', :to => 'feeds#ical'
resources :admin_stats, :only => [:index]
resources :billing, :only => [:index] do
collection do
get :get_csv
end
end
resources :scm_changesets, :only => [:create] do
collection do
get :list
end
end
resources :widgets, :except => [:index, :new] do
collection do
get :add
post :save_order
end
member do
get :toggle_display
end
end
get 'wiki/show(/:id)', :to => 'wiki#show'
resources :wiki, :except => [:index, :new, :show] do
member do
get :versions
get :cancel
get :cancel_create
end
end
resources :project_files, :only => [:show] do
member do
get :download
get :thumbnail
delete :destroy_file
end
end
resources :custom_attributes, :only => [:index, :update] do
collection do
get :edit
get :fields
post :update
end
member do
get :choice
end
end
match ':controller/redirect_from_last' => :redirect_from_last, :via => [:get]
resources :scripts, only: :index
end
|
Rails.application.routes.draw do
get 'leaderboard/users'
get 'leaderboard/projects'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Added root url
Rails.application.routes.draw do
get 'leaderboard/users'
get 'leaderboard/projects'
root 'leaderboard#users'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
TrlnArgon::Engine.routes.draw do
scope module: 'trln_argon' do
resources :healthchecks, path: '/health', action: :index
end
mount BlacklightAdvancedSearch::Engine => '/'
get 'advanced_trln' => 'advanced_trln#index', as: 'advanced_trln'
get 'suggest/:category', to: 'suggest#show'
get 'catalog_count_only', to: 'catalog#count_only', as: 'catalog_count_only'
get 'trln_count_only', to: 'trln#count_only', as: 'trln_count_only'
get 'hathitrust/:oclc_numbers', to: 'hathitrust#show', as: 'hathitrust'
get 'internet_archive/:internet_archive_ids', to: 'internet_archive#show', as: 'internet_archive'
end
Fix suggest route
TrlnArgon::Engine.routes.draw do
scope module: 'trln_argon' do
resources :healthchecks, path: '/health', action: :index
end
mount BlacklightAdvancedSearch::Engine => '/'
get 'advanced_trln' => 'advanced_trln#index', as: 'advanced_trln'
get ':controller/suggest/:category', to: 'catalog#suggest'
get 'catalog_count_only', to: 'catalog#count_only', as: 'catalog_count_only'
get 'trln_count_only', to: 'trln#count_only', as: 'trln_count_only'
get 'hathitrust/:oclc_numbers', to: 'hathitrust#show', as: 'hathitrust'
get 'internet_archive/:internet_archive_ids', to: 'internet_archive#show', as: 'internet_archive'
end
|
require 'sidekiq/web' if defined? Sidekiq
require Rails.root.join('lib', 'router_constraints.rb')
Specroutes.define(Ontohub::Application.routes) do
resources :filetypes, only: :create
# IRI Routing #
###############
# as per Loc/Id definition
# Special (/ref-based) Loc/Id routes
specified_get '/ref/:reference/:repository_id/*locid' => 'api/v1/ontology_versions#show',
as: :ontology_iri_versioned,
constraints: [
RefLocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
] do
accept 'application/json', constraint: true
accept 'text/plain', constraint: true
# reroute_on_mime 'application/json', to: 'api/v1/ontology_versions#show'
doc title: 'Ontology IRI (loc/id) with version reference',
body: <<-BODY
Will return a representation of the ontology at a
ontology version referenced by the {reference}.
BODY
end
specified_get '/ref/:reference/:repository_id/*locid' => 'ontologies#show',
as: :ontology_iri_versioned,
constraints: [
RefLocIdRouterConstraint.new(Ontology, ontology: :id),
] do
accept 'text/html'
doc title: 'Ontology IRI (loc/id) with version reference',
body: <<-BODY
Will return a representation of the ontology at a
ontology version referenced by the {reference}.
BODY
end
# MMT-Support
specified_get '/ref/mmt/:repository_id/*path' => 'ontologies#show',
as: :ontology_iri_mmt,
constraints: [
MMTRouterConstraint.new(Ontology, ontology: :id),
] do
accept 'text/html'
reroute_on_mime 'text/plain', to: 'api/v1/ontologies#show'
reroute_on_mime 'application/json', to: 'api/v1/ontologies#show'
doc title: 'MMT reference to an ontology',
body: <<-BODY
Will return a representation of the ontology. The ontology
is determined according to the *path and to the MMT-query-string.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'mappings#show',
as: :mapping_iri_mmt,
constraints: [
MMTRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/mappings#show'
doc title: 'MMT reference to a mapping',
body: <<-BODY
Will return a representation of the mapping. The mapping
is determined according to the *path and to the MMT-query-string.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'symbols#index',
as: :symbol_iri_mmt,
constraints: [
MMTRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/symbols#show'
doc title: 'MMT reference to a symbol',
body: <<-BODY
Will return a representation of the symbol. The symbol
is determined according to the *path and to the MMT-query-string.
Currently the representation ist a list of all symbols in the ontology.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'api/v1/sentences#show',
as: :sentence_iri_mmt,
constraints: [
MMTRouterConstraint.new(Sentence, ontology: :ontology_id),
] do
accept 'application/json'
doc title: 'MMT reference to a sentence',
body: <<-BODY
Will return a representation of the sentence. The sentence
is determined according to the *path and to the MMT-query-string.
Currently the representation is a list of all sentences in the ontology.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'axioms#index',
as: :axiom_iri_mmt,
constraints: [
MMTRouterConstraint.new(Axiom, ontology: :ontology_id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/axioms#show'
doc title: 'MMT reference to a axiom',
body: <<-BODY
Will return a representation of the axiom. The axiom
is determined according to the *path and to the MMT-query-string.
Currently the representation is a list of all axioms in the ontology.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'theorems#show',
as: :theorem_iri_mmt,
constraints: [
MMTRouterConstraint.new(Theorem, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
doc title: 'MMT reference to a theorem',
body: <<-BODY
Will return a representation of the theorem. The theorem
is determined according to the *path and to the MMT-query-string.
Currently the representation is a list of all theorems in the ontology.
BODY
end
# Subsites for ontologies
ontology_subsites = %i(
comments metadata graphs
projects categories tasks
)
ontology_api_subsites = %i(
mappings symbols children
axioms theorems
ontology_versions
license_models formality_levels
)
ontology_subsites.each do |category|
specified_get "/:repository_id/*locid///#{category}" => "#{category}#index",
as: :"ontology_iri_#{category}",
constraints: [
LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
] do
accept 'text/html'
doc title: "Ontology subsite about #{category.to_s.gsub(/_/, ' ')}",
body: <<-BODY
Will provide a subsite of a specific ontology.
BODY
end
end
ontology_api_subsites.each do |category|
specified_get "/:repository_id/*locid///#{category}" => "#{category}#index",
as: :"ontology_iri_#{category}",
constraints: [
LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: "api/v1/#{category}#index"
doc title: "Ontology subsite about #{category.to_s.gsub(/_/, ' ')}",
body: <<-BODY
Will provide a subsite of a specific ontology.
BODY
end
end
specified_get "/:repository_id/*locid///sentences" => "api/v1/sentences#index",
as: :"ontology_iri_sentences",
constraints: [
LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
] do
accept 'application/json'
doc title: "Ontology subsite about sentences",
body: <<-BODY
Will provide a subsite of a specific ontology.
BODY
end
# Loc/Id-Show(-equivalent) routes
######
specified_get '/:repository_id/*locid' => 'ontologies#show',
as: :ontology_iri,
constraints: [
LocIdRouterConstraint.new(Ontology, ontology: :id),
] do
accept 'text/html'
reroute_on_mime 'text/plain', to: 'api/v1/ontologies#show'
reroute_on_mime 'application/json', to: 'api/v1/ontologies#show'
doc title: 'loc/id reference to an ontology',
body: <<-BODY
Will return a representation of the ontology. The ontology
is determined according to the *locid.
BODY
end
specified_get '/:repository_id/*locid' => 'mappings#show',
as: :mapping_iri,
constraints: [
LocIdRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/mappings#show'
doc title: 'loc/id reference to a mapping',
body: <<-BODY
Will return a representation of the mapping. The mapping
is determined according to the *locid.
BODY
end
specified_get '/:repository_id/*locid' => 'symbols#index',
as: :symbol_iri,
constraints: [
LocIdRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/symbols#show'
doc title: 'loc/id reference to a symbol',
body: <<-BODY
Will return a representation of the symbol. The symbol
is determined according to the *locid.
Currently this will return the list of all symbols of the ontology.
BODY
end
specified_get '/:repository_id/*locid' => 'api/v1/sentences#show',
as: :sentence_iri,
constraints: [
LocIdRouterConstraint.new(Sentence, ontology: :ontology_id, element: :id),
] do
accept 'application/json'
doc title: 'loc/id reference to a sentence',
body: <<-BODY
Will return a representation of the sentence. The sentence
is determined according to the *locid.
Currently this will return the list of all sentence of the ontology.
BODY
end
specified_get '/:repository_id/*locid' => 'axioms#index',
as: :axiom_iri,
constraints: [
LocIdRouterConstraint.new(Axiom, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/axioms#show'
doc title: 'loc/id reference to an axiom',
body: <<-BODY
Will return a representation of the axiom. The axiom
is determined according to the *locid.
Currently this will return the list of all axiom of the ontology.
BODY
end
specified_get '/ontology_types/:id' => 'ontology_types#show',
as: :ontology_type do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/ontology_types#show'
doc title: 'IRI of an ontology type',
body: <<-BODY
Will return a representation of the ontology type.
BODY
end
specified_get '/logics/:id' => 'logics#show',
as: :logic do
accept 'text/html'
reroute_on_mime 'text/xml', to: 'api/v1/logics#show'
reroute_on_mime 'application/xml', to: 'api/v1/logics#show'
reroute_on_mime 'application/rdf+xml', to: 'api/v1/logics#show'
reroute_on_mime 'application/json', to: 'api/v1/logics#show'
doc title: 'IRI of a logic',
body: <<-BODY
Will return a representation of the logic.
BODY
end
specified_get '/license_models/:id' => 'license_models#show',
as: :license_model do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/license_models#show'
doc title: 'IRI of a license model',
body: <<-BODY
Will return a representation of the license model.
BODY
end
specified_get '/formality_levels/:id' => 'formality_levels#show',
as: :formality_level do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/formality_levels#show'
doc title: 'IRI of a formality level',
body: <<-BODY
Will return a representation of the formality level.
BODY
end
specified_get '/:repository_id/*locid' => 'theorems#show',
as: :mapping_iri,
constraints: [
LocIdRouterConstraint.new(Theorem, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/theorems#show'
doc title: 'loc/id reference to a theorem',
body: <<-BODY
Will return a representation of the theorem. The theorem
is determined according to the *locid.
BODY
end
#
###############
get '/after_signup', to: 'home#show' , as: 'after_sign_up'
devise_for :users, controllers: {
confirmations: 'users/confirmations',
registrations: 'users/registrations'
}
resources :users, only: :show
resources :keys, except: [:show, :edit, :update]
resources :logics, only: [:index, :show] do
resources :supports, :only => [:create, :update, :destroy, :index]
resources :graphs, :only => [:index]
end
resources :languages do
resources :supports, :only => [:create, :update, :destroy, :index]
end
resources :language_mappings
resources :logic_mappings
resources :mappings, only: :index
resources :categories, :only => [:index, :show]
resources :projects
resources :tasks
resources :license_models
resources :formality_levels
resources :language_adjoints
resources :logic_adjoints
resources :serializations
namespace :admin do
resources :teams, :only => :index
resources :users
resources :jobs, :only => :index
resources :status, only: :index
end
authenticate :user, lambda { |u| u.admin? } do
mount Sidekiq::Web => 'admin/sidekiq'
end
resources :ontologies, only: [:index] do
collection do
get 'search' => 'ontology_search#search'
end
end
resources :mappings do
get 'update_version', :on => :member
end
resources :teams do
resources :permissions, :only => [:index], :controller => 'teams/permissions'
resources :team_users, :only => [:index, :create, :update, :destroy], :path => 'users'
end
get 'autocomplete' => 'autocomplete#index'
get 'symbols_search' => 'symbols_search#index'
resources :repositories do
post 'undestroy',
controller: :repositories,
action: :undestroy,
as: :undestroy
resources :s_s_h_access, :only => :index, path: 'ssh_access'
resources :permissions, :only => [:index, :create, :update, :destroy]
resources :url_maps, except: :show
resources :errors, :only => :index
resources :repository_settings, :only => :index
resources :ontologies, only: [:index, :show, :edit, :update, :destroy] do
collection do
post 'retry_failed' => 'ontologies#retry_failed'
get 'search' => 'ontology_search#search'
end
member do
post 'retry_failed' => 'ontologies#retry_failed'
end
resources :children, :only => :index
resources :symbols, only: %i(index show)
resources :axioms, only: %i(index show)
resources :theorems, only: %i(index show) do
resources :proof_attempts, only: :show
end
post '/prove', controller: :prove, action: :create
resources :mappings do
get 'update_version', :on => :member
end
resources :ontology_versions, :only => [:index, :show, :new, :create], :path => 'versions' do
resource :oops_request, :only => [:show, :create]
end
resources :categories
resources :tasks
resources :license_models
resources :tools
resources :projects
resources :metadata, :only => [:index, :create, :destroy]
resources :comments, :only => [:index, :create, :destroy]
resources :graphs, :only => [:index]
resources :formality_levels
end
resources :files, only: [:new, :create]
resources :repository_directories, only: [:create]
get ':ref/files(/*path)',
controller: :files,
action: :show,
as: :ref,
constraints: FilesRouterConstraint.new
get ':ref/history(/:path)',
controller: :history,
action: :show,
as: :history,
constraints: { path: /.*/ }
get ':ref/diff',
controller: :diffs,
action: :show,
as: :diffs
# action: entries_info
get ':ref/:action(/:path)',
controller: :files,
as: :ref,
constraints: { path: /.*/ }
end
specified_get '/:id' => 'api/v1/repositories#show',
as: :repository_iri do
accept 'application/json', constraint: true
doc title: 'loc/id reference to a repository',
body: <<-BODY
Will return a representation of the repository. The repository
is determined according to its path, which is considered as
{id}.
BODY
end
post ':repository_id/:path',
controller: :files,
action: :update,
as: :repository_tree,
constraints: { path: /.*/ }
get ':repository_id(/*path)',
controller: :files,
action: :show,
as: :repository_tree,
constraints: FilesRouterConstraint.new
get '*path',
controller: :ontologies,
action: :show,
as: :iri,
constraints: IRIRouterConstraint.new
root :to => 'home#index'
end
Fix typo in specroutes doc.
require 'sidekiq/web' if defined? Sidekiq
require Rails.root.join('lib', 'router_constraints.rb')
Specroutes.define(Ontohub::Application.routes) do
resources :filetypes, only: :create
# IRI Routing #
###############
# as per Loc/Id definition
# Special (/ref-based) Loc/Id routes
specified_get '/ref/:reference/:repository_id/*locid' => 'api/v1/ontology_versions#show',
as: :ontology_iri_versioned,
constraints: [
RefLocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
] do
accept 'application/json', constraint: true
accept 'text/plain', constraint: true
# reroute_on_mime 'application/json', to: 'api/v1/ontology_versions#show'
doc title: 'Ontology IRI (loc/id) with version reference',
body: <<-BODY
Will return a representation of the ontology at a
ontology version referenced by the {reference}.
BODY
end
specified_get '/ref/:reference/:repository_id/*locid' => 'ontologies#show',
as: :ontology_iri_versioned,
constraints: [
RefLocIdRouterConstraint.new(Ontology, ontology: :id),
] do
accept 'text/html'
doc title: 'Ontology IRI (loc/id) with version reference',
body: <<-BODY
Will return a representation of the ontology at a
ontology version referenced by the {reference}.
BODY
end
# MMT-Support
specified_get '/ref/mmt/:repository_id/*path' => 'ontologies#show',
as: :ontology_iri_mmt,
constraints: [
MMTRouterConstraint.new(Ontology, ontology: :id),
] do
accept 'text/html'
reroute_on_mime 'text/plain', to: 'api/v1/ontologies#show'
reroute_on_mime 'application/json', to: 'api/v1/ontologies#show'
doc title: 'MMT reference to an ontology',
body: <<-BODY
Will return a representation of the ontology. The ontology
is determined according to the *path and to the MMT-query-string.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'mappings#show',
as: :mapping_iri_mmt,
constraints: [
MMTRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/mappings#show'
doc title: 'MMT reference to a mapping',
body: <<-BODY
Will return a representation of the mapping. The mapping
is determined according to the *path and to the MMT-query-string.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'symbols#index',
as: :symbol_iri_mmt,
constraints: [
MMTRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/symbols#show'
doc title: 'MMT reference to a symbol',
body: <<-BODY
Will return a representation of the symbol. The symbol
is determined according to the *path and to the MMT-query-string.
Currently the representation ist a list of all symbols in the ontology.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'api/v1/sentences#show',
as: :sentence_iri_mmt,
constraints: [
MMTRouterConstraint.new(Sentence, ontology: :ontology_id),
] do
accept 'application/json'
doc title: 'MMT reference to a sentence',
body: <<-BODY
Will return a representation of the sentence. The sentence
is determined according to the *path and to the MMT-query-string.
Currently the representation is a list of all sentences in the ontology.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'axioms#index',
as: :axiom_iri_mmt,
constraints: [
MMTRouterConstraint.new(Axiom, ontology: :ontology_id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/axioms#show'
doc title: 'MMT reference to a axiom',
body: <<-BODY
Will return a representation of the axiom. The axiom
is determined according to the *path and to the MMT-query-string.
Currently the representation is a list of all axioms in the ontology.
BODY
end
specified_get '/ref/mmt/:repository_id/*path' => 'theorems#show',
as: :theorem_iri_mmt,
constraints: [
MMTRouterConstraint.new(Theorem, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
doc title: 'MMT reference to a theorem',
body: <<-BODY
Will return a representation of the theorem. The theorem
is determined according to the *path and to the MMT-query-string.
Currently the representation is a list of all theorems in the ontology.
BODY
end
# Subsites for ontologies
ontology_subsites = %i(
comments metadata graphs
projects categories tasks
)
ontology_api_subsites = %i(
mappings symbols children
axioms theorems
ontology_versions
license_models formality_levels
)
ontology_subsites.each do |category|
specified_get "/:repository_id/*locid///#{category}" => "#{category}#index",
as: :"ontology_iri_#{category}",
constraints: [
LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
] do
accept 'text/html'
doc title: "Ontology subsite about #{category.to_s.gsub(/_/, ' ')}",
body: <<-BODY
Will provide a subsite of a specific ontology.
BODY
end
end
ontology_api_subsites.each do |category|
specified_get "/:repository_id/*locid///#{category}" => "#{category}#index",
as: :"ontology_iri_#{category}",
constraints: [
LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: "api/v1/#{category}#index"
doc title: "Ontology subsite about #{category.to_s.gsub(/_/, ' ')}",
body: <<-BODY
Will provide a subsite of a specific ontology.
BODY
end
end
specified_get "/:repository_id/*locid///sentences" => "api/v1/sentences#index",
as: :"ontology_iri_sentences",
constraints: [
LocIdRouterConstraint.new(Ontology, ontology: :ontology_id),
] do
accept 'application/json'
doc title: "Ontology subsite about sentences",
body: <<-BODY
Will provide a subsite of a specific ontology.
BODY
end
# Loc/Id-Show(-equivalent) routes
######
specified_get '/:repository_id/*locid' => 'ontologies#show',
as: :ontology_iri,
constraints: [
LocIdRouterConstraint.new(Ontology, ontology: :id),
] do
accept 'text/html'
reroute_on_mime 'text/plain', to: 'api/v1/ontologies#show'
reroute_on_mime 'application/json', to: 'api/v1/ontologies#show'
doc title: 'loc/id reference to an ontology',
body: <<-BODY
Will return a representation of the ontology. The ontology
is determined according to the *locid.
BODY
end
specified_get '/:repository_id/*locid' => 'mappings#show',
as: :mapping_iri,
constraints: [
LocIdRouterConstraint.new(Mapping, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/mappings#show'
doc title: 'loc/id reference to a mapping',
body: <<-BODY
Will return a representation of the mapping. The mapping
is determined according to the *locid.
BODY
end
specified_get '/:repository_id/*locid' => 'symbols#index',
as: :symbol_iri,
constraints: [
LocIdRouterConstraint.new(OntologyMember::Symbol, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/symbols#show'
doc title: 'loc/id reference to a symbol',
body: <<-BODY
Will return a representation of the symbol. The symbol
is determined according to the *locid.
Currently this will return the list of all symbols of the ontology.
BODY
end
specified_get '/:repository_id/*locid' => 'api/v1/sentences#show',
as: :sentence_iri,
constraints: [
LocIdRouterConstraint.new(Sentence, ontology: :ontology_id, element: :id),
] do
accept 'application/json'
doc title: 'loc/id reference to a sentence',
body: <<-BODY
Will return a representation of the sentence. The sentence
is determined according to the *locid.
Currently this will return the list of all sentences of the ontology.
BODY
end
specified_get '/:repository_id/*locid' => 'axioms#index',
as: :axiom_iri,
constraints: [
LocIdRouterConstraint.new(Axiom, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/axioms#show'
doc title: 'loc/id reference to an axiom',
body: <<-BODY
Will return a representation of the axiom. The axiom
is determined according to the *locid.
Currently this will return the list of all axiom of the ontology.
BODY
end
specified_get '/ontology_types/:id' => 'ontology_types#show',
as: :ontology_type do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/ontology_types#show'
doc title: 'IRI of an ontology type',
body: <<-BODY
Will return a representation of the ontology type.
BODY
end
specified_get '/logics/:id' => 'logics#show',
as: :logic do
accept 'text/html'
reroute_on_mime 'text/xml', to: 'api/v1/logics#show'
reroute_on_mime 'application/xml', to: 'api/v1/logics#show'
reroute_on_mime 'application/rdf+xml', to: 'api/v1/logics#show'
reroute_on_mime 'application/json', to: 'api/v1/logics#show'
doc title: 'IRI of a logic',
body: <<-BODY
Will return a representation of the logic.
BODY
end
specified_get '/license_models/:id' => 'license_models#show',
as: :license_model do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/license_models#show'
doc title: 'IRI of a license model',
body: <<-BODY
Will return a representation of the license model.
BODY
end
specified_get '/formality_levels/:id' => 'formality_levels#show',
as: :formality_level do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/formality_levels#show'
doc title: 'IRI of a formality level',
body: <<-BODY
Will return a representation of the formality level.
BODY
end
specified_get '/:repository_id/*locid' => 'theorems#show',
as: :mapping_iri,
constraints: [
LocIdRouterConstraint.new(Theorem, ontology: :ontology_id, element: :id),
] do
accept 'text/html'
reroute_on_mime 'application/json', to: 'api/v1/theorems#show'
doc title: 'loc/id reference to a theorem',
body: <<-BODY
Will return a representation of the theorem. The theorem
is determined according to the *locid.
BODY
end
#
###############
get '/after_signup', to: 'home#show' , as: 'after_sign_up'
devise_for :users, controllers: {
confirmations: 'users/confirmations',
registrations: 'users/registrations'
}
resources :users, only: :show
resources :keys, except: [:show, :edit, :update]
resources :logics, only: [:index, :show] do
resources :supports, :only => [:create, :update, :destroy, :index]
resources :graphs, :only => [:index]
end
resources :languages do
resources :supports, :only => [:create, :update, :destroy, :index]
end
resources :language_mappings
resources :logic_mappings
resources :mappings, only: :index
resources :categories, :only => [:index, :show]
resources :projects
resources :tasks
resources :license_models
resources :formality_levels
resources :language_adjoints
resources :logic_adjoints
resources :serializations
namespace :admin do
resources :teams, :only => :index
resources :users
resources :jobs, :only => :index
resources :status, only: :index
end
authenticate :user, lambda { |u| u.admin? } do
mount Sidekiq::Web => 'admin/sidekiq'
end
resources :ontologies, only: [:index] do
collection do
get 'search' => 'ontology_search#search'
end
end
resources :mappings do
get 'update_version', :on => :member
end
resources :teams do
resources :permissions, :only => [:index], :controller => 'teams/permissions'
resources :team_users, :only => [:index, :create, :update, :destroy], :path => 'users'
end
get 'autocomplete' => 'autocomplete#index'
get 'symbols_search' => 'symbols_search#index'
resources :repositories do
post 'undestroy',
controller: :repositories,
action: :undestroy,
as: :undestroy
resources :s_s_h_access, :only => :index, path: 'ssh_access'
resources :permissions, :only => [:index, :create, :update, :destroy]
resources :url_maps, except: :show
resources :errors, :only => :index
resources :repository_settings, :only => :index
resources :ontologies, only: [:index, :show, :edit, :update, :destroy] do
collection do
post 'retry_failed' => 'ontologies#retry_failed'
get 'search' => 'ontology_search#search'
end
member do
post 'retry_failed' => 'ontologies#retry_failed'
end
resources :children, :only => :index
resources :symbols, only: %i(index show)
resources :axioms, only: %i(index show)
resources :theorems, only: %i(index show) do
resources :proof_attempts, only: :show
end
post '/prove', controller: :prove, action: :create
resources :mappings do
get 'update_version', :on => :member
end
resources :ontology_versions, :only => [:index, :show, :new, :create], :path => 'versions' do
resource :oops_request, :only => [:show, :create]
end
resources :categories
resources :tasks
resources :license_models
resources :tools
resources :projects
resources :metadata, :only => [:index, :create, :destroy]
resources :comments, :only => [:index, :create, :destroy]
resources :graphs, :only => [:index]
resources :formality_levels
end
resources :files, only: [:new, :create]
resources :repository_directories, only: [:create]
get ':ref/files(/*path)',
controller: :files,
action: :show,
as: :ref,
constraints: FilesRouterConstraint.new
get ':ref/history(/:path)',
controller: :history,
action: :show,
as: :history,
constraints: { path: /.*/ }
get ':ref/diff',
controller: :diffs,
action: :show,
as: :diffs
# action: entries_info
get ':ref/:action(/:path)',
controller: :files,
as: :ref,
constraints: { path: /.*/ }
end
specified_get '/:id' => 'api/v1/repositories#show',
as: :repository_iri do
accept 'application/json', constraint: true
doc title: 'loc/id reference to a repository',
body: <<-BODY
Will return a representation of the repository. The repository
is determined according to its path, which is considered as
{id}.
BODY
end
post ':repository_id/:path',
controller: :files,
action: :update,
as: :repository_tree,
constraints: { path: /.*/ }
get ':repository_id(/*path)',
controller: :files,
action: :show,
as: :repository_tree,
constraints: FilesRouterConstraint.new
get '*path',
controller: :ontologies,
action: :show,
as: :iri,
constraints: IRIRouterConstraint.new
root :to => 'home#index'
end
|
# Required for filtering locale prefixed requests
require 'routing_filter'
Markus::Application.routes.draw do
filter :locale
# Install the default routes as the lowest priority.
root :controller => "main", :action => "login"
# API routes
namespace :api do
resources :test_results
resources :submission_downloads
resources :users
resources :main_api
end
resources :admins do
collection do
post 'populate'
end
end
resources :assignments do
collection do
get 'download_csv_grades_report'
get 'update_group_properties_on_persist'
get 'delete_rejected'
post 'update_collected_submissions'
end
member do
get 'refresh_graph'
get 'student_interface'
get 'update_group_properties_on_persist'
post 'invite_member'
get 'creategroup'
get 'join_group'
get 'deletegroup'
get 'decline_invitation'
post 'disinvite_member'
end
resources :rubrics do
member do
get 'move_criterion'
end
collection do
get 'update_positions'
get 'csv_upload'
get 'yml_upload'
get 'download_csv'
get 'download_yml'
end
end
resources :flexible_criteria do
collection do
get 'upload'
get 'update_positions'
get 'move_criterion'
get 'download'
end
end
resources :automated_tests do
collection do
get 'manage'
post 'update' # because of collection
post 'update_positions'
get 'update_positions'
get 'upload'
get 'download'
get 'move_criterion'
end
end
resources :groups do
collection do
post 'populate'
post 'populate_students'
get 'use_another_assignment_groups'
get 'manage'
post 'csv_upload'
get 'add_csv_group'
get 'download_grouplist'
get 'create_groups_when_students_work_alone'
get 'valid_grouping'
get 'invalid_grouping'
get 'global_actions'
get 'remove_group'
get 'rename_group'
post 'global_actions'
end
end
resources :submissions do
collection do
get 'file_manager'
get 'browse'
post 'populate_file_manager'
get 'collect_all_submissions'
get 'download_simple_csv_report'
get 'download_detailed_csv_report'
get 'download_svn_export_list'
get 'download_svn_export_commands'
get 'download_svn_repo_list'
get 'collect_ta_submissions'
get 'update_submissions'
post 'populate_repo_browser'
post 'update_converted_pdfs'
get 'updated_files'
get 'replace_files'
get 'delete_files'
post 'update_files'
post 'server_time'
get 'download'
end
member do
get 'collect_and_begin_grading'
get 'manually_collect_and_begin_grading'
get 'repo_browser'
end
resources :results do
collection do
get 'update_mark'
get 'expand_criteria'
end
member do
get 'add_extra_marks'
get 'add_extra_mark'
get 'download'
get 'cancel_remark_request'
get 'codeviewer'
get 'collapse_criteria'
get 'add_extra_mark'
get 'next_grouping'
get 'remove_extra_mark'
get 'expand_unmarked_criteria'
get 'set_released_to_students'
get 'update_overall_comment'
get 'update_overall_remark_comment'
get 'update_marking_state'
get 'update_remark_request'
get 'render_test_result'
get 'update_positions'
get 'update_mark'
get 'expand_criteria'
get 'view_marks'
end
end
end
resources :graders do
collection do
get 'add_grader_to_grouping'
post 'csv_upload_grader_groups_mapping'
post 'csv_upload_grader_criteria_mapping'
get 'download_grader_groupings_mapping'
get 'download_grader_criteria_mapping'
get 'download_dialog'
get 'download_grouplist'
get 'grader_criteria_dialog'
get 'global_actions'
get 'groups_coverage_dialog'
post 'populate_graders'
post 'populate'
post 'populate_criteria'
get 'set_assign_criteria'
get 'random_assign'
get 'upload_dialog'
get 'unassign'
post 'global_actions'
end
end
resources :annotation_categories do
member do
get 'get_annotations'
delete 'delete_annotation_category'
delete 'delete_annotation_text'
get 'add_annotation_text'
post 'add_annotation_text'
put 'update_annotation'
end
collection do
get 'add_annotation_category'
get 'csv_upload'
get 'delete_annotation_category'
get 'download'
get 'yml_upload'
post 'update_annotation_category'
end
end
end
resources :grade_entry_forms do
collection do
post 'student_interface'
end
member do
get 'grades'
get 'g_table_paginate'
get 'csv_download'
get 'csv_upload'
post 'update_grade'
post 'student_interface'
post 'update_grade_entry_students'
end
end
resources :notes do
collection do
post 'noteable_object_selector'
get 'add_note'
get 'new_update_groupings'
post 'new_update_groupings'
end
member do
get 'student_interface'
get 'notes_dialog'
post 'grades'
end
end
resources :sections
resources :annotations do
collection do
post 'add_existing_annotation'
post 'update_annotation'
post 'update_comment'
end
end
resources :students do
collection do
post 'populate'
get 'manage'
get 'download_student_list'
get 'upload_student_list'
end
end
resources :tas do
collection do
post 'populate'
get 'upload_ta_list'
get 'download_ta_list'
end
end
resources :main do
collection do
get 'logout'
get 'about'
get 'login_as'
get 'clear_role_switch_session'
post 'reset_api_key'
end
end
match 'main', :controller => 'main', :action => 'index'
match 'main/about', :controller => 'main', :action => 'about'
match 'main/logout', :controller => 'main', :action => 'logout'
# Return a 404 when no route is match
match '*path', :controller => 'main', :action => 'page_not_found'
end
Fixing broken groups_controller functional test cases
# Required for filtering locale prefixed requests
require 'routing_filter'
Markus::Application.routes.draw do
filter :locale
# Install the default routes as the lowest priority.
root :controller => "main", :action => "login"
# API routes
namespace :api do
resources :test_results
resources :submission_downloads
resources :users
resources :main_api
end
resources :admins do
collection do
post 'populate'
end
end
resources :assignments do
collection do
get 'download_csv_grades_report'
get 'update_group_properties_on_persist'
get 'delete_rejected'
post 'update_collected_submissions'
end
member do
get 'refresh_graph'
get 'student_interface'
get 'update_group_properties_on_persist'
post 'invite_member'
get 'creategroup'
get 'join_group'
get 'deletegroup'
get 'decline_invitation'
post 'disinvite_member'
end
resources :rubrics do
member do
get 'move_criterion'
end
collection do
get 'update_positions'
get 'csv_upload'
get 'yml_upload'
get 'download_csv'
get 'download_yml'
end
end
resources :flexible_criteria do
collection do
get 'upload'
get 'update_positions'
get 'move_criterion'
get 'download'
end
end
resources :automated_tests do
collection do
get 'manage'
post 'update' # because of collection
post 'update_positions'
get 'update_positions'
get 'upload'
get 'download'
get 'move_criterion'
end
end
resources :groups do
collection do
post 'populate'
post 'populate_students'
get 'add_group'
get 'use_another_assignment_groups'
get 'manage'
post 'csv_upload'
get 'add_csv_group'
get 'download_grouplist'
get 'create_groups_when_students_work_alone'
get 'valid_grouping'
get 'invalid_grouping'
get 'global_actions'
get 'remove_group'
get 'rename_group'
post 'add_group'
post 'global_actions'
end
end
resources :submissions do
collection do
get 'file_manager'
get 'browse'
post 'populate_file_manager'
get 'collect_all_submissions'
get 'download_simple_csv_report'
get 'download_detailed_csv_report'
get 'download_svn_export_list'
get 'download_svn_export_commands'
get 'download_svn_repo_list'
get 'collect_ta_submissions'
get 'update_submissions'
post 'populate_repo_browser'
post 'update_converted_pdfs'
get 'updated_files'
get 'replace_files'
get 'delete_files'
post 'update_files'
post 'server_time'
get 'download'
end
member do
get 'collect_and_begin_grading'
get 'manually_collect_and_begin_grading'
get 'repo_browser'
end
resources :results do
collection do
get 'update_mark'
get 'expand_criteria'
end
member do
get 'add_extra_marks'
get 'add_extra_mark'
get 'download'
get 'cancel_remark_request'
get 'codeviewer'
get 'collapse_criteria'
get 'add_extra_mark'
get 'next_grouping'
get 'remove_extra_mark'
get 'expand_unmarked_criteria'
get 'set_released_to_students'
get 'update_overall_comment'
get 'update_overall_remark_comment'
get 'update_marking_state'
get 'update_remark_request'
get 'render_test_result'
get 'update_positions'
get 'update_mark'
get 'expand_criteria'
get 'view_marks'
end
end
end
resources :graders do
collection do
get 'add_grader_to_grouping'
post 'csv_upload_grader_groups_mapping'
post 'csv_upload_grader_criteria_mapping'
get 'download_grader_groupings_mapping'
get 'download_grader_criteria_mapping'
get 'download_dialog'
get 'download_grouplist'
get 'grader_criteria_dialog'
get 'global_actions'
get 'groups_coverage_dialog'
post 'populate_graders'
post 'populate'
post 'populate_criteria'
get 'set_assign_criteria'
get 'random_assign'
get 'upload_dialog'
get 'unassign'
post 'global_actions'
end
end
resources :annotation_categories do
member do
get 'get_annotations'
delete 'delete_annotation_category'
delete 'delete_annotation_text'
get 'add_annotation_text'
post 'add_annotation_text'
put 'update_annotation'
end
collection do
get 'add_annotation_category'
get 'csv_upload'
get 'delete_annotation_category'
get 'download'
get 'yml_upload'
post 'update_annotation_category'
end
end
end
resources :grade_entry_forms do
collection do
post 'student_interface'
end
member do
get 'grades'
get 'g_table_paginate'
get 'csv_download'
get 'csv_upload'
post 'update_grade'
post 'student_interface'
post 'update_grade_entry_students'
end
end
resources :notes do
collection do
post 'noteable_object_selector'
get 'add_note'
get 'new_update_groupings'
post 'new_update_groupings'
end
member do
get 'student_interface'
get 'notes_dialog'
post 'grades'
end
end
resources :sections
resources :annotations do
collection do
post 'add_existing_annotation'
post 'update_annotation'
post 'update_comment'
end
end
resources :students do
collection do
post 'populate'
get 'manage'
get 'download_student_list'
get 'upload_student_list'
end
end
resources :tas do
collection do
post 'populate'
get 'upload_ta_list'
get 'download_ta_list'
end
end
resources :main do
collection do
get 'logout'
get 'about'
get 'login_as'
get 'clear_role_switch_session'
post 'reset_api_key'
end
end
match 'main', :controller => 'main', :action => 'index'
match 'main/about', :controller => 'main', :action => 'about'
match 'main/logout', :controller => 'main', :action => 'logout'
# Return a 404 when no route is match
match '*path', :controller => 'main', :action => 'page_not_found'
end
|
Namepending::Application.routes.draw do
root 'index#show'
resources :courses
resources :course_terms do
collection do
get 'active'
end
get 'students'
get 'admins'
get 'leaders'
resources :assignments
end
resources :assignments do
resources :submissions
end
resources :people do
get 'course_terms'
end
resources :sections do
get 'leaders'
get 'students'
end
resources :submissions do
resources 'comments'
end
resources :comments
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Miniscule whitespace change to config/routes.rb
Namepending::Application.routes.draw do
root 'index#show'
resources :courses
resources :course_terms do
collection do
get 'active'
end
get 'students'
get 'admins'
get 'leaders'
resources :assignments
end
resources :assignments do
resources :submissions
end
resources :people do
get 'course_terms'
end
resources :sections do
get 'leaders'
get 'students'
end
resources :submissions do
resources :comments
end
resources :comments
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
RailsAngularSkeleton::Application.routes.draw do
root 'application#index'
get '/data', to: 'data#index'
get '*path' => 'application#index'
end
add rails routes back in
RailsAngularSkeleton::Application.routes.draw do
root 'application#index'
get '/data', to: 'data#index'
get '/locations', to: 'location#index'
get '/users', to: 'user#index'
get '/transactions', to: 'transaction#index'
get '*path' => 'application#index'
end
|
Temporarily added view for member RSS feed
xml.instruct! :xml, :version => "1.0"
xml.rss :version => "2.0" do
xml.channel do
xml.title "#{@user.login}'s Books at Sutton Bookshare"
xml.description ""
xml.link url_for :controller => :members, :action => :show, :login => @user.login, :only_path => false
for title in @user.titles.reverse[1..15]
xml.item do
xml.title title.title_and_author
xml.description title.description
xml.pubDate title.created_at.to_s(:rfc822)
xml.link title_url(title)
xml.guid title_url(title)
end
end
end
end |
Rapporteur::Engine.routes.draw do
get '/(.:format)', to: 'statuses#show', as: :status
end
Add backward-compatible auto-mounting of Rails Engine.
Rapporteur::Engine.routes.draw do
get '/(.:format)', to: 'statuses#show', as: :status
end
unless Rails.application.routes.routes.any? { |r| Rapporteur::Engine == r.app.app }
ActiveSupport::Deprecation.warn('Rapporteur was not explicitly mounted in your application. Please add an explicit mount call to your /config/routes.rb. Automatically mounted Rapporteur::Engine to /status for backward compatibility. This will be no longer automatically mount in Rapporteur 4.')
Rails.application.routes.draw do
mount Rapporteur::Engine, at: '/status'
end
end
|
ActionController::Routing::Routes.draw do |map|
# API
map.connect "api/capabilities", :controller => 'api', :action => 'capabilities'
map.connect "api/#{API_VERSION}/capabilities", :controller => 'api', :action => 'capabilities'
map.connect "api/#{API_VERSION}/changeset/create", :controller => 'changeset', :action => 'create'
map.connect "api/#{API_VERSION}/changeset/:id/upload", :controller => 'changeset', :action => 'upload', :id => /\d+/
map.connect "api/#{API_VERSION}/changeset/:id/download", :controller => 'changeset', :action => 'download', :id => /\d+/
map.connect "api/#{API_VERSION}/changeset/:id/expand_bbox", :controller => 'changeset', :action => 'expand_bbox', :id => /\d+/
map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/changeset/:id/close", :controller => 'changeset', :action => 'close', :id =>/\d+/
map.connect "api/#{API_VERSION}/changesets", :controller => 'changeset', :action => 'query'
map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
map.connect "api/#{API_VERSION}/node/:id/ways", :controller => 'way', :action => 'ways_for_node', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/relations", :controller => 'relation', :action => 'relations_for_node', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/history", :controller => 'old_node', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/:version", :controller => 'old_node', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/nodes", :controller => 'node', :action => 'nodes', :id => nil
map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/full", :controller => 'way', :action => 'full', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/relations", :controller => 'relation', :action => 'relations_for_way', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/:version", :controller => 'old_way', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/ways", :controller => 'way', :action => 'ways', :id => nil
map.connect "api/#{API_VERSION}/relation/create", :controller => 'relation', :action => 'create'
map.connect "api/#{API_VERSION}/relation/:id/relations", :controller => 'relation', :action => 'relations_for_relation', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/history", :controller => 'old_relation', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/full", :controller => 'relation', :action => 'full', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/:version", :controller => 'old_relation', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/relations", :controller => 'relation', :action => 'relations', :id => nil
map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'
map.connect "api/#{API_VERSION}/trackpoints", :controller => 'api', :action => 'trackpoints'
map.connect "api/#{API_VERSION}/changes", :controller => 'api', :action => 'changes'
map.connect "api/#{API_VERSION}/search", :controller => 'search', :action => 'search_all'
map.connect "api/#{API_VERSION}/ways/search", :controller => 'search', :action => 'search_ways'
map.connect "api/#{API_VERSION}/relations/search", :controller => 'search', :action => 'search_relations'
map.connect "api/#{API_VERSION}/nodes/search", :controller => 'search', :action => 'search_nodes'
map.connect "api/#{API_VERSION}/user/details", :controller => 'user', :action => 'api_details'
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'read', :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'read_one', :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'update', :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'update_one', :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'delete_one', :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/user/gpx_files", :controller => 'user', :action => 'api_gpx_files'
map.connect "api/#{API_VERSION}/gpx/create", :controller => 'trace', :action => 'api_create'
map.connect "api/#{API_VERSION}/gpx/:id/details", :controller => 'trace', :action => 'api_details'
map.connect "api/#{API_VERSION}/gpx/:id/data", :controller => 'trace', :action => 'api_data'
# AMF (ActionScript) API
map.connect "api/#{API_VERSION}/amf/read", :controller =>'amf', :action =>'amf_read'
map.connect "api/#{API_VERSION}/amf/write", :controller =>'amf', :action =>'amf_write'
map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
# Data browsing
map.connect '/browse', :controller => 'changeset', :action => 'list'
map.connect '/browse/start', :controller => 'browse', :action => 'start'
map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
map.connect '/browse/node/:id', :controller => 'browse', :action => 'node', :id => /\d+/
map.connect '/browse/node/:id/history', :controller => 'browse', :action => 'node_history', :id => /\d+/
map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
map.connect '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
# web site
map.root :controller => 'site', :action => 'index'
map.connect '/', :controller => 'site', :action => 'index'
map.connect '/edit', :controller => 'site', :action => 'edit'
map.connect '/history', :controller => 'changeset', :action => 'list_bbox'
map.connect '/export', :controller => 'site', :action => 'export'
map.connect '/login', :controller => 'user', :action => 'login'
map.connect '/logout', :controller => 'user', :action => 'logout'
map.connect '/offline', :controller => 'site', :action => 'offline'
map.connect '/key', :controller => 'site', :action => 'key'
map.connect '/user/new', :controller => 'user', :action => 'new'
map.connect '/user/save', :controller => 'user', :action => 'save'
map.connect '/user/confirm', :controller => 'user', :action => 'confirm'
map.connect '/user/confirm-email', :controller => 'user', :action => 'confirm_email'
map.connect '/user/go_public', :controller => 'user', :action => 'go_public'
map.connect '/user/reset-password', :controller => 'user', :action => 'reset_password'
map.connect '/user/upload-image', :controller => 'user', :action => 'upload_image'
map.connect '/user/delete-image', :controller => 'user', :action => 'delete_image'
map.connect '/user/forgot-password', :controller => 'user', :action => 'lost_password'
map.connect '/index.html', :controller => 'site', :action => 'index'
map.connect '/edit.html', :controller => 'site', :action => 'edit'
map.connect '/history.html', :controller => 'changeset', :action => 'list_bbox'
map.connect '/export.html', :controller => 'site', :action => 'export'
map.connect '/search.html', :controller => 'way_tag', :action => 'search'
map.connect '/login.html', :controller => 'user', :action => 'login'
map.connect '/logout.html', :controller => 'user', :action => 'logout'
map.connect '/create-account.html', :controller => 'user', :action => 'new'
map.connect '/forgot-password.html', :controller => 'user', :action => 'lost_password'
# permalink
map.connect '/go/:code', :controller => 'site', :action => 'permalink', :code => /[a-zA-Z0-9_@]+=*/
# traces
map.connect '/traces', :controller => 'trace', :action => 'list'
map.connect '/traces/page/:page', :controller => 'trace', :action => 'list'
map.connect '/traces/rss', :controller => 'trace', :action => 'georss'
map.connect '/traces/tag/:tag', :controller => 'trace', :action => 'list'
map.connect '/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
map.connect '/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
map.connect '/traces/mine', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine/page/:page', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine/tag/:tag', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine/tag/:tag/page/:page', :controller => 'trace', :action => 'mine'
map.connect '/trace/create', :controller => 'trace', :action => 'create'
map.connect '/trace/:id/data', :controller => 'trace', :action => 'data'
map.connect '/trace/:id/data.:format', :controller => 'trace', :action => 'data'
map.connect '/trace/:id/edit', :controller => 'trace', :action => 'edit'
map.connect '/trace/:id/delete', :controller => 'trace', :action => 'delete'
map.connect '/trace/:id/make_public', :controller => 'trace', :action => 'make_public'
map.connect '/user/:display_name/traces', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/page/:page', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/rss', :controller => 'trace', :action => 'georss'
map.connect '/user/:display_name/traces/tag/:tag', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
map.connect '/user/:display_name/traces/:id', :controller => 'trace', :action => 'view'
map.connect '/user/:display_name/traces/:id/picture', :controller => 'trace', :action => 'picture'
map.connect '/user/:display_name/traces/:id/icon', :controller => 'trace', :action => 'icon'
# user pages
map.connect '/user/:display_name', :controller => 'user', :action => 'view'
map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list_user'
map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'
map.connect '/user/:display_name/diary/:id', :controller => 'diary_entry', :action => 'view', :id => /\d+/
map.connect '/user/:display_name/diary/:id/newcomment', :controller => 'diary_entry', :action => 'comment', :id => /\d+/
map.connect '/user/:display_name/diary/rss', :controller => 'diary_entry', :action => 'rss'
map.connect '/user/:display_name/diary/new', :controller => 'diary_entry', :action => 'new'
map.connect '/user/:display_name/diary/:id/edit', :controller => 'diary_entry', :action => 'edit', :id => /\d+/
map.connect '/user/:display_name/account', :controller => 'user', :action => 'account'
map.connect '/user/:display_name/set_home', :controller => 'user', :action => 'set_home'
map.connect '/diary', :controller => 'diary_entry', :action => 'list'
map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
# test pages
map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'
map.connect '/test/populate/:table/:count', :controller => 'test', :action => 'populate', :from => 1
# geocoder
map.connect '/geocoder/search', :controller => 'geocoder', :action => 'search'
map.connect '/geocoder/search_latlon', :controller => 'geocoder', :action => 'search_latlon'
map.connect '/geocoder/search_us_postcode', :controller => 'geocoder', :action => 'search_uk_postcode'
map.connect '/geocoder/search_uk_postcode', :controller => 'geocoder', :action => 'search_us_postcode'
map.connect '/geocoder/search_ca_postcode', :controller => 'geocoder', :action => 'search_ca_postcode'
map.connect '/geocoder/search_osm_namefinder', :controller => 'geocoder', :action => 'search_osm_namefinder'
map.connect '/geocoder/search_geonames', :controller => 'geocoder', :action => 'search_geonames'
map.connect '/geocoder/description', :controller => 'geocoder', :action => 'description'
map.connect '/geocoder/description_osm_namefinder', :controller => 'geocoder', :action => 'description_osm_namefinder'
map.connect '/geocoder/description_geonames', :controller => 'geocoder', :action => 'description_geonames'
# export
map.connect '/export/start', :controller => 'export', :action => 'start'
map.connect '/export/finish', :controller => 'export', :action => 'finish'
# messages
map.connect '/user/:display_name/inbox', :controller => 'message', :action => 'inbox'
map.connect '/user/:display_name/outbox', :controller => 'message', :action => 'outbox'
map.connect '/message/new/:display_name', :controller => 'message', :action => 'new'
map.connect '/message/read/:message_id', :controller => 'message', :action => 'read'
map.connect '/message/mark/:message_id', :controller => 'message', :action => 'mark'
map.connect '/message/reply/:message_id', :controller => 'message', :action => 'reply'
# fall through
map.connect ':controller/:id/:action'
map.connect ':controller/:action'
end
Changeset [16271] changed "=" in the shortlink to "-" but didn't
update the routes to match.
Change the regex to accept [=-]* ("=" since we want to be backwards
compatable)
ActionController::Routing::Routes.draw do |map|
# API
map.connect "api/capabilities", :controller => 'api', :action => 'capabilities'
map.connect "api/#{API_VERSION}/capabilities", :controller => 'api', :action => 'capabilities'
map.connect "api/#{API_VERSION}/changeset/create", :controller => 'changeset', :action => 'create'
map.connect "api/#{API_VERSION}/changeset/:id/upload", :controller => 'changeset', :action => 'upload', :id => /\d+/
map.connect "api/#{API_VERSION}/changeset/:id/download", :controller => 'changeset', :action => 'download', :id => /\d+/
map.connect "api/#{API_VERSION}/changeset/:id/expand_bbox", :controller => 'changeset', :action => 'expand_bbox', :id => /\d+/
map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/changeset/:id", :controller => 'changeset', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/changeset/:id/close", :controller => 'changeset', :action => 'close', :id =>/\d+/
map.connect "api/#{API_VERSION}/changesets", :controller => 'changeset', :action => 'query'
map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
map.connect "api/#{API_VERSION}/node/:id/ways", :controller => 'way', :action => 'ways_for_node', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/relations", :controller => 'relation', :action => 'relations_for_node', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/history", :controller => 'old_node', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/node/:id/:version", :controller => 'old_node', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/nodes", :controller => 'node', :action => 'nodes', :id => nil
map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/full", :controller => 'way', :action => 'full', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/relations", :controller => 'relation', :action => 'relations_for_way', :id => /\d+/
map.connect "api/#{API_VERSION}/way/:id/:version", :controller => 'old_way', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/way/:id", :controller => 'way', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/ways", :controller => 'way', :action => 'ways', :id => nil
map.connect "api/#{API_VERSION}/relation/create", :controller => 'relation', :action => 'create'
map.connect "api/#{API_VERSION}/relation/:id/relations", :controller => 'relation', :action => 'relations_for_relation', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/history", :controller => 'old_relation', :action => 'history', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/full", :controller => 'relation', :action => 'full', :id => /\d+/
map.connect "api/#{API_VERSION}/relation/:id/:version", :controller => 'old_relation', :action => 'version', :id => /\d+/, :version => /\d+/
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'update', :id => /\d+/, :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/relation/:id", :controller => 'relation', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/relations", :controller => 'relation', :action => 'relations', :id => nil
map.connect "api/#{API_VERSION}/map", :controller => 'api', :action => 'map'
map.connect "api/#{API_VERSION}/trackpoints", :controller => 'api', :action => 'trackpoints'
map.connect "api/#{API_VERSION}/changes", :controller => 'api', :action => 'changes'
map.connect "api/#{API_VERSION}/search", :controller => 'search', :action => 'search_all'
map.connect "api/#{API_VERSION}/ways/search", :controller => 'search', :action => 'search_ways'
map.connect "api/#{API_VERSION}/relations/search", :controller => 'search', :action => 'search_relations'
map.connect "api/#{API_VERSION}/nodes/search", :controller => 'search', :action => 'search_nodes'
map.connect "api/#{API_VERSION}/user/details", :controller => 'user', :action => 'api_details'
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'read', :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'read_one', :conditions => { :method => :get }
map.connect "api/#{API_VERSION}/user/preferences", :controller => 'user_preference', :action => 'update', :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'update_one', :conditions => { :method => :put }
map.connect "api/#{API_VERSION}/user/preferences/:preference_key", :controller => 'user_preference', :action => 'delete_one', :conditions => { :method => :delete }
map.connect "api/#{API_VERSION}/user/gpx_files", :controller => 'user', :action => 'api_gpx_files'
map.connect "api/#{API_VERSION}/gpx/create", :controller => 'trace', :action => 'api_create'
map.connect "api/#{API_VERSION}/gpx/:id/details", :controller => 'trace', :action => 'api_details'
map.connect "api/#{API_VERSION}/gpx/:id/data", :controller => 'trace', :action => 'api_data'
# AMF (ActionScript) API
map.connect "api/#{API_VERSION}/amf/read", :controller =>'amf', :action =>'amf_read'
map.connect "api/#{API_VERSION}/amf/write", :controller =>'amf', :action =>'amf_write'
map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
# Data browsing
map.connect '/browse', :controller => 'changeset', :action => 'list'
map.connect '/browse/start', :controller => 'browse', :action => 'start'
map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
map.connect '/browse/node/:id', :controller => 'browse', :action => 'node', :id => /\d+/
map.connect '/browse/node/:id/history', :controller => 'browse', :action => 'node_history', :id => /\d+/
map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
map.connect '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
# web site
map.root :controller => 'site', :action => 'index'
map.connect '/', :controller => 'site', :action => 'index'
map.connect '/edit', :controller => 'site', :action => 'edit'
map.connect '/history', :controller => 'changeset', :action => 'list_bbox'
map.connect '/export', :controller => 'site', :action => 'export'
map.connect '/login', :controller => 'user', :action => 'login'
map.connect '/logout', :controller => 'user', :action => 'logout'
map.connect '/offline', :controller => 'site', :action => 'offline'
map.connect '/key', :controller => 'site', :action => 'key'
map.connect '/user/new', :controller => 'user', :action => 'new'
map.connect '/user/save', :controller => 'user', :action => 'save'
map.connect '/user/confirm', :controller => 'user', :action => 'confirm'
map.connect '/user/confirm-email', :controller => 'user', :action => 'confirm_email'
map.connect '/user/go_public', :controller => 'user', :action => 'go_public'
map.connect '/user/reset-password', :controller => 'user', :action => 'reset_password'
map.connect '/user/upload-image', :controller => 'user', :action => 'upload_image'
map.connect '/user/delete-image', :controller => 'user', :action => 'delete_image'
map.connect '/user/forgot-password', :controller => 'user', :action => 'lost_password'
map.connect '/index.html', :controller => 'site', :action => 'index'
map.connect '/edit.html', :controller => 'site', :action => 'edit'
map.connect '/history.html', :controller => 'changeset', :action => 'list_bbox'
map.connect '/export.html', :controller => 'site', :action => 'export'
map.connect '/search.html', :controller => 'way_tag', :action => 'search'
map.connect '/login.html', :controller => 'user', :action => 'login'
map.connect '/logout.html', :controller => 'user', :action => 'logout'
map.connect '/create-account.html', :controller => 'user', :action => 'new'
map.connect '/forgot-password.html', :controller => 'user', :action => 'lost_password'
# permalink
map.connect '/go/:code', :controller => 'site', :action => 'permalink', :code => /[a-zA-Z0-9_@]+[=-]*/
# traces
map.connect '/traces', :controller => 'trace', :action => 'list'
map.connect '/traces/page/:page', :controller => 'trace', :action => 'list'
map.connect '/traces/rss', :controller => 'trace', :action => 'georss'
map.connect '/traces/tag/:tag', :controller => 'trace', :action => 'list'
map.connect '/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
map.connect '/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
map.connect '/traces/mine', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine/page/:page', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine/tag/:tag', :controller => 'trace', :action => 'mine'
map.connect '/traces/mine/tag/:tag/page/:page', :controller => 'trace', :action => 'mine'
map.connect '/trace/create', :controller => 'trace', :action => 'create'
map.connect '/trace/:id/data', :controller => 'trace', :action => 'data'
map.connect '/trace/:id/data.:format', :controller => 'trace', :action => 'data'
map.connect '/trace/:id/edit', :controller => 'trace', :action => 'edit'
map.connect '/trace/:id/delete', :controller => 'trace', :action => 'delete'
map.connect '/trace/:id/make_public', :controller => 'trace', :action => 'make_public'
map.connect '/user/:display_name/traces', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/page/:page', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/rss', :controller => 'trace', :action => 'georss'
map.connect '/user/:display_name/traces/tag/:tag', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
map.connect '/user/:display_name/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
map.connect '/user/:display_name/traces/:id', :controller => 'trace', :action => 'view'
map.connect '/user/:display_name/traces/:id/picture', :controller => 'trace', :action => 'picture'
map.connect '/user/:display_name/traces/:id/icon', :controller => 'trace', :action => 'icon'
# user pages
map.connect '/user/:display_name', :controller => 'user', :action => 'view'
map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list_user'
map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'
map.connect '/user/:display_name/diary/:id', :controller => 'diary_entry', :action => 'view', :id => /\d+/
map.connect '/user/:display_name/diary/:id/newcomment', :controller => 'diary_entry', :action => 'comment', :id => /\d+/
map.connect '/user/:display_name/diary/rss', :controller => 'diary_entry', :action => 'rss'
map.connect '/user/:display_name/diary/new', :controller => 'diary_entry', :action => 'new'
map.connect '/user/:display_name/diary/:id/edit', :controller => 'diary_entry', :action => 'edit', :id => /\d+/
map.connect '/user/:display_name/account', :controller => 'user', :action => 'account'
map.connect '/user/:display_name/set_home', :controller => 'user', :action => 'set_home'
map.connect '/diary', :controller => 'diary_entry', :action => 'list'
map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
# test pages
map.connect '/test/populate/:table/:from/:count', :controller => 'test', :action => 'populate'
map.connect '/test/populate/:table/:count', :controller => 'test', :action => 'populate', :from => 1
# geocoder
map.connect '/geocoder/search', :controller => 'geocoder', :action => 'search'
map.connect '/geocoder/search_latlon', :controller => 'geocoder', :action => 'search_latlon'
map.connect '/geocoder/search_us_postcode', :controller => 'geocoder', :action => 'search_uk_postcode'
map.connect '/geocoder/search_uk_postcode', :controller => 'geocoder', :action => 'search_us_postcode'
map.connect '/geocoder/search_ca_postcode', :controller => 'geocoder', :action => 'search_ca_postcode'
map.connect '/geocoder/search_osm_namefinder', :controller => 'geocoder', :action => 'search_osm_namefinder'
map.connect '/geocoder/search_geonames', :controller => 'geocoder', :action => 'search_geonames'
map.connect '/geocoder/description', :controller => 'geocoder', :action => 'description'
map.connect '/geocoder/description_osm_namefinder', :controller => 'geocoder', :action => 'description_osm_namefinder'
map.connect '/geocoder/description_geonames', :controller => 'geocoder', :action => 'description_geonames'
# export
map.connect '/export/start', :controller => 'export', :action => 'start'
map.connect '/export/finish', :controller => 'export', :action => 'finish'
# messages
map.connect '/user/:display_name/inbox', :controller => 'message', :action => 'inbox'
map.connect '/user/:display_name/outbox', :controller => 'message', :action => 'outbox'
map.connect '/message/new/:display_name', :controller => 'message', :action => 'new'
map.connect '/message/read/:message_id', :controller => 'message', :action => 'read'
map.connect '/message/mark/:message_id', :controller => 'message', :action => 'mark'
map.connect '/message/reply/:message_id', :controller => 'message', :action => 'reply'
# fall through
map.connect ':controller/:id/:action'
map.connect ':controller/:action'
end
|
Rails.application.routes.draw do
use_doorkeeper
root 'welcome#index'
scope '/auth' do
devise_for :users, controllers: { omniauth_callbacks: 'auth/omniauth_callbacks' }
end
namespace :auth do
resource :viisp, controller: :viisp, only: [:new, :create]
end
defaults format: :json do
resource :me, controller: :users, only: :show
resources :cities, only: [:index]
resources :reports
resources :report_statuses, only: [:index]
resources :report_types, only: [:index]
resources :tokens, only: [:create]
resources :report_photos, only: [:create]
resource :guest_migration, only: [:create]
end
end
Change scope to app for devise routes (#96)
Rails.application.routes.draw do
use_doorkeeper
root 'welcome#index'
scope '/app' do
devise_for :users, controllers: { omniauth_callbacks: 'auth/omniauth_callbacks' }
end
namespace :auth do
resource :viisp, controller: :viisp, only: [:new, :create]
end
defaults format: :json do
resource :me, controller: :users, only: :show
resources :cities, only: [:index]
resources :reports
resources :report_statuses, only: [:index]
resources :report_types, only: [:index]
resources :tokens, only: [:create]
resources :report_photos, only: [:create]
resource :guest_migration, only: [:create]
end
end
|
Rails.application.routes.draw do
root 'nokogiri#index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
removing nokogiri index from routes
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'welcome#index'
get 'signin' => 'sessions#login'
post 'signin' => 'sessions#signin'
get 'signup' => 'sessions#new'
post 'signup' => 'sessions#create'
get 'signout' => 'sessions#signout'
resources :profiles
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Add member show route
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'welcome#index'
get 'signin' => 'sessions#login'
post 'signin' => 'sessions#signin'
get 'signup' => 'sessions#new'
post 'signup' => 'sessions#create'
get 'signout' => 'sessions#signout'
resources :profiles
get 'members/show' => 'members#show'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
module Gdk
class Loader < GObjectIntrospection::Loader
private
def pre_load(repository, namespace)
setup_pending_constants
define_keyval_module
load_cairo_rectangle_int
end
def define_keyval_module
@keyval_module = Module.new
@base_module.const_set("Keyval", @keyval_module)
end
def load_cairo_rectangle_int
info = find_cairo_rectangle_int_info
klass = self.class.define_class(info.gtype,
"Rectangle",
@base_module,
:size => info.size)
load_fields(info, klass)
load_methods(info, klass)
end
def find_cairo_rectangle_int_info
repository = GObjectIntrospection::Repository.default
repository.each("cairo") do |info|
if info.name == "RectangleInt"
return info
end
end
nil
end
def post_load(repository, namespace)
apply_pending_constants
require_libraries
end
def setup_pending_constants
@pending_constants = []
end
def apply_pending_constants
@pending_constants.each do |info|
case info.name
when /\AEVENT_/
Gdk::Event.const_set($POSTMATCH, info.value)
end
end
end
def require_libraries
require "gdk3/color"
require "gdk3/rectangle"
require "gdk3/rgba"
require "gdk3/window-attr"
require "gdk3/deprecated"
end
def load_function_info(info)
name = info.name
case name
when "init", /_get_type\z/
# ignore
when /\Arectangle_/
define_rectangle_method(info, $POSTMATCH)
else
super
end
end
def define_rectangle_method(function_info, name)
target_module = Gdk::Rectangle
unlock_gvl = should_unlock_gvl?(function_info, target_module)
validate = lambda do |arguments|
method_name = "#{target_module}\##{name}"
validate_arguments(function_info, method_name, arguments)
end
target_module.module_eval do
define_method(name) do |*arguments, &block|
arguments = [self] + arguments
validate.call(arguments, &block)
function_info.invoke({
:arguments => arguments,
:unlock_gvl => unlock_gvl,
},
&block)
end
end
end
def load_struct_info(info)
return if info.gtype_struct?
options = {}
case info.name
when /\AEvent/
options[:parent] = Gdk::Event
end
define_struct(info, options)
end
def define_enum(info)
case info.name
when /\AWindowWindow/
self.class.define_class(info.gtype, $POSTMATCH, Gdk::Window)
when /\AWindow/
self.class.define_class(info.gtype, $POSTMATCH, Gdk::Window)
when "EventType"
self.class.register_constant_rename_map("2BUTTON_PRESS",
"BUTTON2_PRESS")
self.class.register_constant_rename_map("3BUTTON_PRESS",
"BUTTON3_PRESS")
super
else
super
end
end
def load_constant_info(info)
case info.name
when /\AEVENT_/
@pending_constants << info
when /\AKEY_/
@keyval_module.const_set(info.name, info.value)
else
super
end
end
end
end
gdk3: define Gdk::Pixbuf singleton_methods
# Copyright (C) 2013-2014 Ruby-GNOME2 Project Team
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
module Gdk
class Loader < GObjectIntrospection::Loader
private
def pre_load(repository, namespace)
setup_pending_constants
define_keyval_module
load_cairo_rectangle_int
end
def define_keyval_module
@keyval_module = Module.new
@base_module.const_set("Keyval", @keyval_module)
end
def load_cairo_rectangle_int
info = find_cairo_rectangle_int_info
klass = self.class.define_class(info.gtype,
"Rectangle",
@base_module,
:size => info.size)
load_fields(info, klass)
load_methods(info, klass)
end
def find_cairo_rectangle_int_info
repository = GObjectIntrospection::Repository.default
repository.each("cairo") do |info|
if info.name == "RectangleInt"
return info
end
end
nil
end
def post_load(repository, namespace)
apply_pending_constants
require_libraries
end
def setup_pending_constants
@pending_constants = []
end
def apply_pending_constants
@pending_constants.each do |info|
case info.name
when /\AEVENT_/
Gdk::Event.const_set($POSTMATCH, info.value)
end
end
end
def require_libraries
require "gdk3/color"
require "gdk3/rectangle"
require "gdk3/rgba"
require "gdk3/window-attr"
require "gdk3/deprecated"
end
def load_function_info(info)
name = info.name
case name
when "init", /_get_type\z/
# ignore
when /\Arectangle_/
define_rectangle_method(info, $POSTMATCH)
when /\Apixbuf_/
define_pixbuf_singleton_method(info, $POSTMATCH)
else
super
end
end
def define_pixbuf_singleton_method(function_info, name)
target_module = Gdk::Pixbuf
unlock_gvl = should_unlock_gvl?(function_info, target_module)
validate = lambda do |arguments|
validate_arguments(function_info, "#{target_module}.#{name}", arguments)
end
singleton_class = (class << target_module; self; end)
singleton_class.__send__(:define_method, name) do |*arguments, &block|
validate.call(arguments, &block)
if block.nil? and function_info.require_callback?
Enumerator.new(self, name, *arguments)
else
function_info.invoke({
:arguments => arguments,
:unlock_gvl => unlock_gvl,
},
&block)
end
end
end
def define_rectangle_method(function_info, name)
target_module = Gdk::Rectangle
unlock_gvl = should_unlock_gvl?(function_info, target_module)
validate = lambda do |arguments|
method_name = "#{target_module}\##{name}"
validate_arguments(function_info, method_name, arguments)
end
target_module.module_eval do
define_method(name) do |*arguments, &block|
arguments = [self] + arguments
validate.call(arguments, &block)
function_info.invoke({
:arguments => arguments,
:unlock_gvl => unlock_gvl,
},
&block)
end
end
end
def load_struct_info(info)
return if info.gtype_struct?
options = {}
case info.name
when /\AEvent/
options[:parent] = Gdk::Event
end
define_struct(info, options)
end
def define_enum(info)
case info.name
when /\AWindowWindow/
self.class.define_class(info.gtype, $POSTMATCH, Gdk::Window)
when /\AWindow/
self.class.define_class(info.gtype, $POSTMATCH, Gdk::Window)
when "EventType"
self.class.register_constant_rename_map("2BUTTON_PRESS",
"BUTTON2_PRESS")
self.class.register_constant_rename_map("3BUTTON_PRESS",
"BUTTON3_PRESS")
super
else
super
end
end
def load_constant_info(info)
case info.name
when /\AEVENT_/
@pending_constants << info
when /\AKEY_/
@keyval_module.const_set(info.name, info.value)
else
super
end
end
end
end
|
# frozen_string_literal: true
Rails.application.routes.draw do
devise_for :users, controllers: {
omniauth_callbacks: 'users/omniauth_callbacks',
}
root 'pages#index'
namespace :api do
resources :users, except: %i(delete edit)
resources :invitations, only: %i(create index destroy)
resources :transfers, only: %i(index create) do
member do
put :accept
put :reject
end
end
resources :balances, only: [:index]
resources :orders, except: %i(new edit) do
resources :dishes, except: %i(new edit) do
post :copy, on: :member
end
member do
put :change_status
end
collection do
get :latest
end
end
end
resources :invitations, only: %i(show)
### Single Page App ###
%w(
orders
orders/today
orders/today/:order_id
orders/new
orders/:order_id/edit
orders/:order_id/dishes/:dish_id/edit
orders/:order_id/dishes/new
account_numbers
settings
transfers
transfers/new
members
you
).each do |route|
get route, to: 'dashboard#index'
end
# separate to have named routes
get 'orders/:order_id', to: 'dashboard#index', as: 'order'
end
Route root to SPA
# frozen_string_literal: true
Rails.application.routes.draw do
devise_for :users, controllers: {
omniauth_callbacks: 'users/omniauth_callbacks',
}
root 'dashboard#index'
namespace :api do
resources :users, except: %i(delete edit)
resources :invitations, only: %i(create index destroy)
resources :transfers, only: %i(index create) do
member do
put :accept
put :reject
end
end
resources :balances, only: [:index]
resources :orders, except: %i(new edit) do
resources :dishes, except: %i(new edit) do
post :copy, on: :member
end
member do
put :change_status
end
collection do
get :latest
end
end
end
resources :invitations, only: %i(show)
### Single Page App ###
%w(
orders
orders/today
orders/today/:order_id
orders/new
orders/:order_id/edit
orders/:order_id/dishes/:dish_id/edit
orders/:order_id/dishes/new
account_numbers
settings
transfers
transfers/new
members
you
).each do |route|
get route, to: 'dashboard#index'
end
# separate to have named routes
get 'orders/:order_id', to: 'dashboard#index', as: 'order'
end
|
Rails.application.routes.draw do
root 'assignments#index'
resources :rosters, except: %i(show) do
resources :assignments, except: :show do
collection do
post :generate_rotation
get :rotation_generator
end
end
resources :users, except: :show do
collection do
post :transfer
end
end
get 'twilio/call', to: 'twilio#call', as: :twilio_call
get 'twilio/text', to: 'twilio#text', as: :twilio_text
end
get 'changes/:id/undo', to: 'changes#undo', as: :undo_change
unless Rails.env.production?
get 'sessions/dev_login', to: 'sessions#dev_login', as: :dev_login
post 'sessions/dev_login', to: 'sessions#dev_login'
end
get 'sessions/unauthenticated', to: 'sessions#unauthenticated', as: :unauthenticated_session
get 'sessions/destroy', to: 'sessions#destroy', as: :destroy_session
end
Temporarily restore old twilio routes
call/text IT if a request comes in for the old routes
Rails.application.routes.draw do
root 'assignments#index'
resources :rosters, except: %i(show) do
resources :assignments, except: :show do
collection do
post :generate_rotation
get :rotation_generator
end
end
resources :users, except: :show do
collection do
post :transfer
end
end
get 'twilio/call', to: 'twilio#call', as: :twilio_call
get 'twilio/text', to: 'twilio#text', as: :twilio_text
end
# Temporary, remove when IT twilio number is fixed:
get 'twilio/call', to: 'twilio#call', defaults: {roster_id: 1}
get 'twilio/text', to: 'twilio#text', defaults: {roster_id: 1}
get 'changes/:id/undo', to: 'changes#undo', as: :undo_change
unless Rails.env.production?
get 'sessions/dev_login', to: 'sessions#dev_login', as: :dev_login
post 'sessions/dev_login', to: 'sessions#dev_login'
end
get 'sessions/unauthenticated', to: 'sessions#unauthenticated', as: :unauthenticated_session
get 'sessions/destroy', to: 'sessions#destroy', as: :destroy_session
end
|
require 'sinatra/twitter-bootstrap'
require 'sass'
require 'airbrake'
class SassEngine < Sinatra::Base
set :views, File.dirname(__FILE__) + '/../assets/stylesheets'
get '/scss/*.css' do
filename = params[:splat].first
scss filename.to_sym
end
end
class DistrictApp < Sinatra::Base
require 'geocoder'
require 'sequel'
use SassEngine
register Sinatra::Twitter::Bootstrap::Assets
configure :production do
Airbrake.configure do |config|
config.api_key = "16c86611790122f558f3467f09bdcc4f"
end
use Airbrake::Rack
enable :raise_errors
end
get '/' do
haml :index
end
get '/results' do
@address = params[:address].strip
geocode = get_geocode(@address + " Lexington KY")
@address_split = split_address(@address)
@council = CouncilDistrict.first_for_geocode(geocode)
@magistrate = MagistrateDistrict.first_for_geocode(geocode)
@school_board = SchoolBoardDistrict.first_for_geocode(geocode)
@elem_school = ElementarySchoolDistrict.first_for_geocode(geocode)
@middle_school = MiddleSchoolDistrict.first_for_geocode(geocode)
@high_school = HighSchoolDistrict.first_for_geocode(geocode)
@senate = SenateDistrict.first_for_geocode(geocode)
@house = HouseDistrict.first_for_geocode(geocode)
@voting = VotingDistrict.first_for_geocode(geocode)
@neighborhoods = NeighborhoodAssociation.all_for_geocode(geocode)
haml :results
end
private
def get_geocode address
geocode_results = Geocoder.search(address)
location = geocode_results.first.geometry['location']
Geocode.new(location['lat'], location['lng'])
end
# return an array of the address split by spaces?
def split_address(address)
ary = address.split(' ')
street_types = {lane:"LN",
street:"ST",
drive:"DR",
road:"RD",
highway:"HWY",
cove:"CV",
avenue:"AVE",
circle:"CIR",
court:"CT",
trail:"TRL",
way:"WAY",
boulevard:"BLVD",
alley:"ALY"}
number = ary.shift
street_type = ary.pop
street_name = ary.join(' ')
street_type = street_types[street_type.downcase.to_sym]
[number, street_name.upcase, street_type.upcase]
end
end
hmm. fixed up a bit
require 'sinatra/twitter-bootstrap'
require 'sass'
require 'airbrake'
class SassEngine < Sinatra::Base
set :views, File.dirname(__FILE__) + '/../assets/stylesheets'
get '/scss/*.css' do
filename = params[:splat].first
scss filename.to_sym
end
end
class DistrictApp < Sinatra::Base
require 'geocoder'
require 'sequel'
use SassEngine
register Sinatra::Twitter::Bootstrap::Assets
configure :production do
Airbrake.configure do |config|
config.api_key = "16c86611790122f558f3467f09bdcc4f"
end
use Airbrake::Rack
enable :raise_errors
end
get '/' do
haml :index
end
get '/results' do
@address = params[:address].strip
geocode = get_geocode(@address + " Lexington KY")
@address_split = split_address(@address)
@council = CouncilDistrict.first_for_geocode(geocode)
@magistrate = MagistrateDistrict.first_for_geocode(geocode)
@school_board = SchoolBoardDistrict.first_for_geocode(geocode)
@elem_school = ElementarySchoolDistrict.first_for_geocode(geocode)
@middle_school = MiddleSchoolDistrict.first_for_geocode(geocode)
@high_school = HighSchoolDistrict.first_for_geocode(geocode)
@senate = SenateDistrict.first_for_geocode(geocode)
@house = HouseDistrict.first_for_geocode(geocode)
@voting = VotingDistrict.first_for_geocode(geocode)
@neighborhoods = NeighborhoodAssociation.all_for_geocode(geocode)
haml :results
end
private
def get_geocode address
geocode_results = Geocoder.search(address)
location = geocode_results.first.geometry['location']
Geocode.new(location['lat'], location['lng'])
end
# return an array of the address split by spaces?
def split_address(address)
ary = address.split(/\s+/)
street_types = {
lane:"LN",
street:"ST",
drive:"DR",
road:"RD",
highway:"HWY",
cove:"CV",
avenue:"AVE",
circle:"CIR",
court:"CT",
trail:"TRL",
way:"WAY",
boulevard:"BLVD",
alley:"ALY"
}
number = ary.shift
street_type = ary.pop.downcase.to_sym
street_name = ary.join(' ')
if street_types.key?(street_type)
street_type = street_types[street_type]
end
[number, street_name.upcase, street_type.to_s.upcase]
end
end
|
Rails.application.routes.draw do
resources :people
root to: "application#show"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Added Location scaffold
Rails.application.routes.draw do
resources :locations
resources :people
root to: "application#show"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Rails.application.routes.draw do
get '/items', to: 'items#index'
get '/items/new', to: 'items#new'
get '/items/:id', to: 'items#show', as: 'item'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
Name the get /items/new route "new_item" using the as keyword
Rails.application.routes.draw do
get '/items', to: 'items#index'
get '/items/new', to: 'items#new', as: 'new_item'
get '/items/:id', to: 'items#show', as: 'item'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
|
Moebooru::Application.routes.draw do
# Admin
match 'admin(/index)' => 'admin#index'
match 'admin/edit_user'
match 'admin/reset_password'
# Advertisements
resources :advertisements do
collection do
post :update_multiple
end
member do
get :redirect
end
end
# Artist
match 'artist(/index)(.:format)' => 'artist#index'
match 'artist/create(.:format)'
match 'artist/destroy(.:format)(/:id)' => 'artist#destroy'
match 'artist/preview'
match 'artist/show(/:id)' => 'artist#show'
match 'artist/update(.:format)(/:id)' => 'artist#update'
# Banned
match 'banned(/index)' => 'banned#index'
# Batch
match 'batch(/index)' => 'batch#index'
match 'batch/create'
post 'batch/enqueue'
post 'batch/update'
# Blocks
post 'blocks/block_ip'
post 'blocks/unblock_ip'
# Comment
match 'comment(/index)' => 'comment#index'
match 'comment/edit(/:id)' => 'comment#edit'
match 'comment/moderate'
match 'comment/search'
match 'comment/show(.:format)(/:id)' => 'comment#show'
match 'comment/destroy(.:format)(/:id)' => 'comment#destroy', :via => [:post, :delete]
match 'comment/update(/:id)' => 'comment/update', :via => [:post, :put]
post 'comment/create(.:format)'
post 'comment/mark_as_spam(/:id)' => 'comment#mark_as_spam'
# Dmail
match 'dmail(/inbox)' => 'dmail#inbox'
match 'dmail/auto_complete_for_dmail_to_name'
match 'dmail/compose'
match 'dmail/preview'
match 'dmail/show(/:id)' => 'dmail#show'
match 'dmail/show_previous_messages'
post 'dmail/create'
post 'dmail/mark_all_read'
# Favorite
match 'favorite/list_users(.:format)'
# Forum
match 'forum(/index)(.:format)' => 'forum#index'
match 'forum/preview'
match 'forum/new'
match 'forum/add'
match 'forum/edit(/:id)' => 'forum#edit'
match 'forum/show(/:id)' => 'forum#show'
match 'forum/search'
match 'forum/mark_all_read'
match 'forum/lock', :via => [:post, :put]
match 'forum/stick(/:id)' => 'forum#stick', :via => [:post, :put]
match 'forum/unlock(/:id)' => 'forum#unlock', :via => [:post, :put]
match 'forum/unstick(/:id)' => 'forum#unstick', :via => [:post, :put]
match 'forum/update(/:id)' => 'forum#update', :via => [:post, :put]
match 'forum/destroy(/:id)' => 'forum#destroy', :via => [:post, :delete]
post 'forum/create'
# Help
match 'help/:action' => 'help#:action'
# History
match 'history(/index)' => 'history#index'
post 'history/undo'
# Inline
match 'inline/create'
match 'inline/index'
match 'inline/add_image'
match 'inline/edit'
match 'inline/crop'
match 'inline/copy', :via => [:post, :put]
match 'inline/update', :via => [:post, :put]
match 'inline/delete', :via => [:post, :delete]
match 'inline/delete_image', :via => [:post, :delete]
# JobTask
match 'job_task/index'
match 'job_task/show'
match 'job_task/destroy'
match 'job_task/restart'
# Note
match 'note/search'
match 'note/index'
match 'note/history'
match 'note/revert'
match 'note/update'
# Pool
match 'pool/index'
match 'pool/show'
match 'pool/update'
match 'pool/create'
match 'pool/copy'
match 'pool/destroy'
match 'pool/add_post'
match 'pool/remove_post'
match 'pool/order'
match 'pool/import'
match 'pool/select'
match 'pool/zip'
match 'pool/transfer_metadata'
# Post
match 'post/verify_action(options)'
match 'post/activate'
match 'post/upload_problem'
match 'post/upload'
match 'post/create'
match 'post/moderate'
match 'post/update'
match 'post/update_batch'
match 'post/delete'
match 'post/destroy'
match 'post/deleted_index'
match 'post/acknowledge_new_deleted_posts'
match 'post/index'
match 'post/atom'
match 'post/piclens'
match 'post/show'
match 'post/browse'
match 'post/view'
match 'post/popular_recent'
match 'post/popular_by_day'
match 'post/popular_by_week'
match 'post/popular_by_month'
match 'post/revert_tags'
match 'post/vote'
match 'post/flag'
match 'post/random'
match 'post/similar'
match 'post/search(params)'
match 'post/undelete'
match 'post/error'
match 'post/exception'
match 'post/download'
match 'post/histogram'
# PostTagHistory
match 'post_tag_history/index'
# Report
match 'report/tag_updates'
match 'report/note_updates'
match 'report/wiki_updates'
match 'report/post_uploads'
match 'report/votes'
match 'report/set_dates'
# Static
match 'static/index'
# TagAlias
match 'tag_alias/create'
match 'tag_alias/index'
match 'tag_alias/update'
# Tag
match 'tag/cloud'
match 'tag/summary'
match 'tag/index'
match 'tag/mass_edit'
match 'tag/edit_preview'
match 'tag/edit'
match 'tag/update'
match 'tag/related'
match 'tag/popular_by_day'
match 'tag/popular_by_week'
match 'tag/popular_by_month'
match 'tag/show'
# TagImplication
match 'tag_implication/create'
match 'tag_implication/update'
match 'tag_implication/index'
# TagSubscription
match 'tag_subscription/create'
match 'tag_subscription/update'
match 'tag_subscription/index'
match 'tag_subscription/destroy'
# User
match 'user/save_cookies(user)'
match 'user/change_password'
match 'user/change_email'
match 'user/auto_complete_for_member_name'
match 'user/show'
match 'user/invites'
match 'user/home'
match 'user/index'
match 'user/authenticate'
match 'user/check'
match 'user/login'
match 'user/create'
match 'user/signup'
match 'user/logout'
match 'user/update'
match 'user/modify_blacklist'
match 'user/remove_from_blacklist'
match 'user/edit'
match 'user/reset_password'
match 'user/block'
match 'user/unblock'
match 'user/show_blocked_users'
match 'user/resend_confirmation'
match 'user/activate_user'
match 'user/set_avatar'
match 'user/error'
match 'user/get_view_name_for_edit(param)'
# UserRecord
match 'user_record/index'
match 'user_record/create'
match 'user_record/destroy'
# Wiki
match 'wiki/destroy'
match 'wiki/lock'
match 'wiki/unlock'
match 'wiki/index'
match 'wiki/preview'
match 'wiki/add'
match 'wiki/create'
match 'wiki/edit'
match 'wiki/update'
match 'wiki/show'
match 'wiki/revert'
match 'wiki/recent_changes'
match 'wiki/history'
match 'wiki/diff'
match 'wiki/rename'
# API 1.13.0
scope :defaults => { :format => 'html' }, :constraints => { :format => /(json|xml|html)/, :id => /\d+/ } do
# Posts
match 'post(/index)(.:format)' => 'post#index'
match 'post/create(.:format)' => 'post#create', :via => :post
match 'post/update(.:format)' => 'post#update', :via => [:post, :put]
match 'post/revert_tags(.:format)' => 'post#revert_tags', :via => [:post, :put]
match 'post/vote(.:format)' => 'post#vote', :via => [:post, :put]
match 'post/destroy(.:format)' => 'post#destroy', :via => [:post, :delete]
# Tags
match 'tag(/index)(.:format)' => 'tag#index'
match 'tag/related(.:format)' => 'tag#related'
match 'tag/update(.:format)' => 'tag#update', :via => [:post, :put]
# Wiki
match 'wiki(/index)(.:format)' => 'wiki#index'
match 'wiki/show(.:format)' => 'wiki#show'
match 'wiki/history(.:format)' => 'wiki#history'
match 'wiki/create(.:format)' => 'wiki#create', :via => :post
match 'wiki/update(.:format)' => 'wiki#update', :via => [:post, :put]
match 'wiki/lock(.:format)' => 'wiki#lock', :via => [:post, :put]
match 'wiki/unlock(.:format)' => 'wiki#unlock', :via => [:post, :put]
match 'wiki/revert(.:format)' => 'wiki#revert', :via => [:post, :put]
match 'wiki/destroy(.:format)' => 'wiki#destroy', :via => [:post, :delete]
# Notes
match 'note(/index)(.:format)' => 'note#index'
match 'note/search(.:format)' => 'note#search'
match 'note/history(.:format)' => 'note#history'
match 'note/revert(.:format)' => 'note#revert', :via => [:post, :put]
match 'note/update(.:format)' => 'note#update', :via => [:post, :put]
# Users
match 'user(/index)(.:format)' => 'user#index'
# Pools
match 'pool(/index)(.:format)' => 'pool#index'
match 'pool/create(.:format)' => 'pool#create', :via => :post
match 'pool/show(.:format)(/:id)' => 'pool#show'
match 'pool/update(.:format)(/:id)' => 'pool#update', :via => [:post, :put]
match 'pool/destroy(.:format)(/:id)' => 'pool#destroy', :via => [:post, :delete]
match 'pool/add_post(.:format)' => 'pool#add_post', :via => [:post, :put]
match 'pool/remove_post(.:format)' => 'pool#remove_post', :via => [:post, :put]
end
# Atom
match 'post/atom(.xml)' => 'post#atom'
match 'post/atom.feed' => 'post#atom'
match 'atom' => 'post#atom'
match 'post/show/:id(/*tag_title)' => 'post#show', :constraints => { :id => /\d+/ }, :format => false
match 'pool/zip/:id/:filename' => 'pool#zip', :constraints => { :id => /\d+/, :filename => /.*/ }
match 'histogram' => 'post#histogram'
match 'download' => 'post#download'
root :to => 'static#index'
end
WIP: Default for /inline.
Moebooru::Application.routes.draw do
# Admin
match 'admin(/index)' => 'admin#index'
match 'admin/edit_user'
match 'admin/reset_password'
# Advertisements
resources :advertisements do
collection do
post :update_multiple
end
member do
get :redirect
end
end
# Artist
match 'artist(/index)(.:format)' => 'artist#index'
match 'artist/create(.:format)'
match 'artist/destroy(.:format)(/:id)' => 'artist#destroy'
match 'artist/preview'
match 'artist/show(/:id)' => 'artist#show'
match 'artist/update(.:format)(/:id)' => 'artist#update'
# Banned
match 'banned(/index)' => 'banned#index'
# Batch
match 'batch(/index)' => 'batch#index'
match 'batch/create'
post 'batch/enqueue'
post 'batch/update'
# Blocks
post 'blocks/block_ip'
post 'blocks/unblock_ip'
# Comment
match 'comment(/index)' => 'comment#index'
match 'comment/edit(/:id)' => 'comment#edit'
match 'comment/moderate'
match 'comment/search'
match 'comment/show(.:format)(/:id)' => 'comment#show'
match 'comment/destroy(.:format)(/:id)' => 'comment#destroy', :via => [:post, :delete]
match 'comment/update(/:id)' => 'comment/update', :via => [:post, :put]
post 'comment/create(.:format)'
post 'comment/mark_as_spam(/:id)' => 'comment#mark_as_spam'
# Dmail
match 'dmail(/inbox)' => 'dmail#inbox'
match 'dmail/auto_complete_for_dmail_to_name'
match 'dmail/compose'
match 'dmail/preview'
match 'dmail/show(/:id)' => 'dmail#show'
match 'dmail/show_previous_messages'
post 'dmail/create'
post 'dmail/mark_all_read'
# Favorite
match 'favorite/list_users(.:format)'
# Forum
match 'forum(/index)(.:format)' => 'forum#index'
match 'forum/preview'
match 'forum/new'
match 'forum/add'
match 'forum/edit(/:id)' => 'forum#edit'
match 'forum/show(/:id)' => 'forum#show'
match 'forum/search'
match 'forum/mark_all_read'
match 'forum/lock', :via => [:post, :put]
match 'forum/stick(/:id)' => 'forum#stick', :via => [:post, :put]
match 'forum/unlock(/:id)' => 'forum#unlock', :via => [:post, :put]
match 'forum/unstick(/:id)' => 'forum#unstick', :via => [:post, :put]
match 'forum/update(/:id)' => 'forum#update', :via => [:post, :put]
match 'forum/destroy(/:id)' => 'forum#destroy', :via => [:post, :delete]
post 'forum/create'
# Help
match 'help/:action' => 'help#:action'
# History
match 'history(/index)' => 'history#index'
post 'history/undo'
# Inline
match 'inline(/index)' => 'inline#index'
match 'inline/create'
match 'inline/add_image'
match 'inline/edit'
match 'inline/crop'
match 'inline/copy', :via => [:post, :put]
match 'inline/update', :via => [:post, :put]
match 'inline/delete', :via => [:post, :delete]
match 'inline/delete_image', :via => [:post, :delete]
# JobTask
match 'job_task/index'
match 'job_task/show'
match 'job_task/destroy'
match 'job_task/restart'
# Note
match 'note/search'
match 'note/index'
match 'note/history'
match 'note/revert'
match 'note/update'
# Pool
match 'pool/index'
match 'pool/show'
match 'pool/update'
match 'pool/create'
match 'pool/copy'
match 'pool/destroy'
match 'pool/add_post'
match 'pool/remove_post'
match 'pool/order'
match 'pool/import'
match 'pool/select'
match 'pool/zip'
match 'pool/transfer_metadata'
# Post
match 'post/verify_action(options)'
match 'post/activate'
match 'post/upload_problem'
match 'post/upload'
match 'post/create'
match 'post/moderate'
match 'post/update'
match 'post/update_batch'
match 'post/delete'
match 'post/destroy'
match 'post/deleted_index'
match 'post/acknowledge_new_deleted_posts'
match 'post/index'
match 'post/atom'
match 'post/piclens'
match 'post/show'
match 'post/browse'
match 'post/view'
match 'post/popular_recent'
match 'post/popular_by_day'
match 'post/popular_by_week'
match 'post/popular_by_month'
match 'post/revert_tags'
match 'post/vote'
match 'post/flag'
match 'post/random'
match 'post/similar'
match 'post/search(params)'
match 'post/undelete'
match 'post/error'
match 'post/exception'
match 'post/download'
match 'post/histogram'
# PostTagHistory
match 'post_tag_history/index'
# Report
match 'report/tag_updates'
match 'report/note_updates'
match 'report/wiki_updates'
match 'report/post_uploads'
match 'report/votes'
match 'report/set_dates'
# Static
match 'static/index'
# TagAlias
match 'tag_alias/create'
match 'tag_alias/index'
match 'tag_alias/update'
# Tag
match 'tag/cloud'
match 'tag/summary'
match 'tag/index'
match 'tag/mass_edit'
match 'tag/edit_preview'
match 'tag/edit'
match 'tag/update'
match 'tag/related'
match 'tag/popular_by_day'
match 'tag/popular_by_week'
match 'tag/popular_by_month'
match 'tag/show'
# TagImplication
match 'tag_implication/create'
match 'tag_implication/update'
match 'tag_implication/index'
# TagSubscription
match 'tag_subscription/create'
match 'tag_subscription/update'
match 'tag_subscription/index'
match 'tag_subscription/destroy'
# User
match 'user/save_cookies(user)'
match 'user/change_password'
match 'user/change_email'
match 'user/auto_complete_for_member_name'
match 'user/show'
match 'user/invites'
match 'user/home'
match 'user/index'
match 'user/authenticate'
match 'user/check'
match 'user/login'
match 'user/create'
match 'user/signup'
match 'user/logout'
match 'user/update'
match 'user/modify_blacklist'
match 'user/remove_from_blacklist'
match 'user/edit'
match 'user/reset_password'
match 'user/block'
match 'user/unblock'
match 'user/show_blocked_users'
match 'user/resend_confirmation'
match 'user/activate_user'
match 'user/set_avatar'
match 'user/error'
match 'user/get_view_name_for_edit(param)'
# UserRecord
match 'user_record/index'
match 'user_record/create'
match 'user_record/destroy'
# Wiki
match 'wiki/destroy'
match 'wiki/lock'
match 'wiki/unlock'
match 'wiki/index'
match 'wiki/preview'
match 'wiki/add'
match 'wiki/create'
match 'wiki/edit'
match 'wiki/update'
match 'wiki/show'
match 'wiki/revert'
match 'wiki/recent_changes'
match 'wiki/history'
match 'wiki/diff'
match 'wiki/rename'
# API 1.13.0
scope :defaults => { :format => 'html' }, :constraints => { :format => /(json|xml|html)/, :id => /\d+/ } do
# Posts
match 'post(/index)(.:format)' => 'post#index'
match 'post/create(.:format)' => 'post#create', :via => :post
match 'post/update(.:format)' => 'post#update', :via => [:post, :put]
match 'post/revert_tags(.:format)' => 'post#revert_tags', :via => [:post, :put]
match 'post/vote(.:format)' => 'post#vote', :via => [:post, :put]
match 'post/destroy(.:format)' => 'post#destroy', :via => [:post, :delete]
# Tags
match 'tag(/index)(.:format)' => 'tag#index'
match 'tag/related(.:format)' => 'tag#related'
match 'tag/update(.:format)' => 'tag#update', :via => [:post, :put]
# Wiki
match 'wiki(/index)(.:format)' => 'wiki#index'
match 'wiki/show(.:format)' => 'wiki#show'
match 'wiki/history(.:format)' => 'wiki#history'
match 'wiki/create(.:format)' => 'wiki#create', :via => :post
match 'wiki/update(.:format)' => 'wiki#update', :via => [:post, :put]
match 'wiki/lock(.:format)' => 'wiki#lock', :via => [:post, :put]
match 'wiki/unlock(.:format)' => 'wiki#unlock', :via => [:post, :put]
match 'wiki/revert(.:format)' => 'wiki#revert', :via => [:post, :put]
match 'wiki/destroy(.:format)' => 'wiki#destroy', :via => [:post, :delete]
# Notes
match 'note(/index)(.:format)' => 'note#index'
match 'note/search(.:format)' => 'note#search'
match 'note/history(.:format)' => 'note#history'
match 'note/revert(.:format)' => 'note#revert', :via => [:post, :put]
match 'note/update(.:format)' => 'note#update', :via => [:post, :put]
# Users
match 'user(/index)(.:format)' => 'user#index'
# Pools
match 'pool(/index)(.:format)' => 'pool#index'
match 'pool/create(.:format)' => 'pool#create', :via => :post
match 'pool/show(.:format)(/:id)' => 'pool#show'
match 'pool/update(.:format)(/:id)' => 'pool#update', :via => [:post, :put]
match 'pool/destroy(.:format)(/:id)' => 'pool#destroy', :via => [:post, :delete]
match 'pool/add_post(.:format)' => 'pool#add_post', :via => [:post, :put]
match 'pool/remove_post(.:format)' => 'pool#remove_post', :via => [:post, :put]
end
# Atom
match 'post/atom(.xml)' => 'post#atom'
match 'post/atom.feed' => 'post#atom'
match 'atom' => 'post#atom'
match 'post/show/:id(/*tag_title)' => 'post#show', :constraints => { :id => /\d+/ }, :format => false
match 'pool/zip/:id/:filename' => 'pool#zip', :constraints => { :id => /\d+/, :filename => /.*/ }
match 'histogram' => 'post#histogram'
match 'download' => 'post#download'
root :to => 'static#index'
end
|
# -*- encoding : utf-8 -*-
Suelos::Application.routes.draw do
get "inicio/index"
devise_for :usuarios
# Podría matchear con
# get ':controller/:action/:atributo', :constraints => {:action => /ajax/}
# pero tendría que filtrar específicamente los atributos que permito en cada modelo
get 'grupos/ajax/:atributo' => 'grupos#ajax'
get 'fases/ajax/:atributo' => 'fases#ajax'
# Para limitar las vistas a las calicatas que son modales
get '/series' => 'calicatas#index', :as => 'series'
resources :calicatas
resources :horizontes
resources :analisis
resources :grupos
resources :fases
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => 'inicio#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end
rutas en castellano
# -*- encoding : utf-8 -*-
Suelos::Application.routes.draw do
get "inicio/index"
# Autenticación en rack
devise_for :usuarios
# Podría matchear con
# get ':controller/:action/:atributo', :constraints => {:action => /ajax/}
# pero tendría que filtrar específicamente los atributos que permito en cada modelo
get 'grupos/ajax/:atributo' => 'grupos#ajax'
get 'fases/ajax/:atributo' => 'fases#ajax'
# Para limitar las vistas a las calicatas que son modales
get '/series' => 'calicatas#index', :as => 'series'
# Rutas en castellano (i.e. calicatas/nueva, calicatas/2/editar)
scope(:path_names => { :new => "nuevo", :edit => "editar" }) do
resources :horizontes
resources :analisis
resources :grupos
end
scope(:path_names => { :new => "nueva", :edit => "editar" }) do
resources :calicatas
resources :fases
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
root :to => 'inicio#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end
|
Spree::Core::Engine.routes.draw do
namespace :admin do
resource :avatax_settings do
get :ping_my_service, :get_file_content_txt_svc, :get_file_content_post_avatax, :get_file_content_avatax_ord
end
resources :avalara_use_code_items do
end
end
# get '/admin/log/tax_svc', :to => send_file('/log/tax_svc.txt')
#redirect('../log/tax_svc.txt')
end
removed commented out code
Spree::Core::Engine.routes.draw do
namespace :admin do
resource :avatax_settings do
get :ping_my_service, :get_file_content_txt_svc, :get_file_content_post_avatax, :get_file_content_avatax_ord
end
resources :avalara_use_code_items do
end
end
end
|
Rails.application.routes.draw do
controller :sessions do
get 'login' => :new
post 'login' => :create
delete 'logout' => :destroy
end
resources :users, :tasks
controller :dashboard do
get 'dashboard' => :show
get 'dashboard/edit' => :edit
post 'dashboard/update' => :update
end
root 'tasks#index', as: 'tasks_index'
end
Fixed the routes. Dashboard edit now has the PATCH verb.
Rails.application.routes.draw do
controller :sessions do
get 'login' => :new
post 'login' => :create
delete 'logout' => :destroy
end
resources :users, :tasks
controller :dashboard do
get 'dashboard' => :show
get 'dashboard/edit' => :edit
patch 'dashboard/update' => :update
end
root 'tasks#index', as: 'tasks_index'
end
|
require 'httpclient'
require 'json'
require 'stringio'
module Plugin::Mastodon
class APIResult
attr_reader :value
attr_reader :header
def initialize(value, header = nil)
@value = value
@header = header
end
def [](idx)
@value[idx]
end
def []=(idx, val)
@value[idx] = val
end
def to_h
@value.to_h
end
def to_a
@value.to_a
end
end
class API
ExceptionResponse = Struct.new(:body) do
def code
0
end
end
class << self
def build_query_recurse(params, results = [], files = [], prefix = '', to_multipart = false)
if params.is_a? Hash
# key-value pairs
params.each do |key, val|
inner_prefix = "#{prefix}[#{key.to_s}]"
results, files, to_multipart = build_query_recurse(val, results, files, inner_prefix, to_multipart)
end
elsif params.is_a? Array
params.each_index do |i|
inner_prefix = "#{prefix}[#{i}]"
results, files, to_multipart = build_query_recurse(params[i], results, files, inner_prefix, to_multipart)
end
elsif params.is_a? Set
results, files, to_multipart = build_query_recurse(params.to_a, results, files, prefix, to_multipart)
else
key = "#{prefix}".sub('[', '').sub(']', '')
/^(.*)\[\d+\]$/.match(key) do |m|
key = "#{m[1]}[]"
end
value = params
if value.is_a?(Pathname) || value.is_a?(Plugin::Photo::Photo)
to_multipart = true
end
case value
when Pathname
# multipart/form-data にするが、POSTリクエストではない可能性がある(PATCH等)ため、ある程度自力でつくる。
# boundary作成や実際のbody構築はhttpclientに任せる。
filename = value.basename.to_s
disposition = "form-data; name=\"#{key}\"; filename=\"#{filename}\""
f = File.open(value.to_s, 'rb')
files << f
results << {
"Content-Type" => "application/octet-stream",
"Content-Disposition" => disposition,
:content => f,
}
when Plugin::Photo::Photo
filename = Pathname(value.perma_link.path).basename.to_s
disposition = "form-data; name=\"#{key}\"; filename=\"#{filename}\""
results << {
"Content-Type" => "application/octet-stream",
"Content-Disposition" => "form-data; name=\"#{key}\"; filename=\"#{filename}\"",
:content => StringIO.new(value.blob, 'r'),
}
else
if to_multipart
results << {
"Content-Type" => "application/octet-stream",
"Content-Disposition" => "form-data; name=\"#{key}\"",
:content => value,
}
else
results << [key, value]
end
end
end
[results, files, to_multipart]
end
# httpclient向けにパラメータHashを変換する
def build_query(params, headers)
results, files, to_multipart = build_query_recurse(params)
if to_multipart
headers << ["Content-Type", "multipart/form-data"]
end
[results, headers, files]
end
# APIアクセスを行うhttpclientのラッパメソッド
def call(method, domain, path = nil, access_token = nil, opts = {}, headers = [], **params)
Thread.new do
call!(method, domain, path, access_token, opts, headers, **params)
end
end
def call!(method, domain, path = nil, access_token = nil, opts = {}, headers = [], **params)
uri = domain_path_to_uri(domain, path)
resp = raw_response!(method, uri, access_token, headers, **params)
case resp&.status
when 200
parse_link(resp, JSON.parse(resp.content, symbolize_names: true))
end
end
def raw_response!(method, uri, access_token, headers, **params)
if access_token && !access_token.empty?
headers += [["Authorization", "Bearer " + access_token]]
end
query_timer(method, uri, params, headers) do
send_request(method, params, headers, uri)
end
end
private def domain_path_to_uri(domain, path)
if domain.is_a? Diva::URI
domain
else
Diva::URI.new('https://' + domain + path)
end
end
private def query_timer(method, uri, params, headers, &block)
start_time = Time.new.freeze
serial = uri.to_s.hash ^ params.freeze.hash
Plugin.call(:query_start,
serial: serial,
method: method,
path: uri,
options: params,
headers: headers,
start_time: start_time)
result = block.call
Plugin.call(:query_end,
serial: serial,
method: method,
path: uri,
options: params,
start_time: start_time,
end_time: Time.new.freeze,
res: result)
result
rescue => exc
Plugin.call(:query_end,
serial: serial,
method: method,
path: uri,
options: params,
start_time: start_time,
end_time: Time.new.freeze,
res: ExceptionResponse.new("#{exc.message}\n" + exc.backtrace.join("\n")))
raise
end
private def send_request(method, params, headers, uri)
query, headers, files = build_query(params, headers)
body = nil
if method != :get # :post, :patch
body = query
query = nil
end
notice "Mastodon::API.call #{method.to_s} #{uri} #{headers.to_s} #{query.to_s} #{body.to_s}"
HTTPClient.new.request(method, uri.to_s, query, body, headers)
ensure
files&.each(&:close)
end
def parse_link(resp, hash)
link = resp.header['Link'].first
return APIResult.new(hash) if ((!hash.is_a? Array) || link.nil?)
header =
link
.split(', ')
.map do |line|
/^<(.*)>; rel="(.*)"$/.match(line) do |m|
[$2.to_sym, Diva::URI.new($1)]
end
end
.to_h
APIResult.new(hash, header)
end
def status(domain, id)
call(:get, domain, '/api/v1/statuses/' + id.to_s)
end
def status!(domain, id)
call!(:get, domain, '/api/v1/statuses/' + id.to_s)
end
def status_by_url(domain, access_token, url)
call(:get, domain, '/api/v2/search', access_token, q: url.to_s, resolve: true).next{ |resp|
resp[:statuses]
}
end
def status_by_url!(domain, access_token, url)
call!(:get, domain, '/api/v2/search', access_token, q: url.to_s, resolve: true).next{ |resp|
resp[:statuses]
}
end
def account_by_url(domain, access_token, url)
call(:get, domain, '/api/v2/search', access_token, q: url.to_s, resolve: true).next{ |resp|
resp[:accounts]
}
end
# _world_ における、 _status_ のIDを検索して返す。
# _status_ が _world_ の所属するのと同じサーバに投稿されたものなら、 _status_ のID。
# 異なるサーバの _status_ なら、 _world_ のサーバに問い合わせて、そのIDを返すDeferredをリクエストする。
# ==== Args
# [world] World Model
# [status] トゥート
# ==== Return
# [Delayer::Deferred] _status_ のローカルにおけるID
def get_local_status_id(world, status)
if world.domain == status.domain
Delayer::Deferred.new{ status.id }
else
status_by_url(world.domain, world.access_token, status.url).next{ |statuses|
statuses.dig(0, :id).tap do |id|
raise 'Status id does not found.' unless id
end
}
end
end
# _world_ における、 _account_ のIDを検索して返す。
# _account_ が _world_ の所属するのと同じサーバに投稿されたものなら、 _account_ のID。
# 異なるサーバの _account_ なら、 _world_ のサーバに問い合わせて、そのIDを返すDeferredをリクエストする。
# ==== Args
# [world] World Model
# [account] アカウント (Plugin::Mastodon::Account)
# ==== Return
# [Delayer::Deferred] _account_ のローカルにおけるID
def get_local_account_id(world, account)
if world.domain == account.domain
Delayer::Deferred.new{ account.id }
else
account_by_url(world.domain, world.access_token, account.url).next{ |accounts|
accounts&.dig(0, :id)
}
end
end
# Link headerがあるAPIを連続的に叩いて1要素ずつyieldする
# ==== Args
# [method] HTTPメソッド
# [domain] 対象ドメイン
# [path] APIパス
# [access_token] トークン
# [opts] オプション
# [:direction] :next or :prev
# [:wait] APIコール間にsleepで待機する秒数
# [headers] 追加ヘッダ
# [params] GET/POSTパラメータ
def all!(method, domain, path = nil, access_token = nil, opts = {}, headers = [], **params)
opts[:direction] ||= :next
opts[:wait] ||= 1
while true
list = API.call!(method, domain, path, access_token, opts, headers, **params)
if list && list.value.is_a?(Array)
list.value.each { |hash| yield hash }
end
break unless list.header.has_key?(opts[:direction])
url = list.header[opts[:direction]]
params = URI.decode_www_form(url.query).to_h.symbolize
sleep opts[:wait]
end
end
def all_with_world!(world, method, path = nil, opts = {}, headers = [], **params, &block)
all!(method, world.domain, path, world.access_token, opts, headers, **params, &block)
end
end
end
end
リクエストログのnoticeを削除refs #1379
require 'httpclient'
require 'json'
require 'stringio'
module Plugin::Mastodon
class APIResult
attr_reader :value
attr_reader :header
def initialize(value, header = nil)
@value = value
@header = header
end
def [](idx)
@value[idx]
end
def []=(idx, val)
@value[idx] = val
end
def to_h
@value.to_h
end
def to_a
@value.to_a
end
end
class API
ExceptionResponse = Struct.new(:body) do
def code
0
end
end
class << self
def build_query_recurse(params, results = [], files = [], prefix = '', to_multipart = false)
if params.is_a? Hash
# key-value pairs
params.each do |key, val|
inner_prefix = "#{prefix}[#{key.to_s}]"
results, files, to_multipart = build_query_recurse(val, results, files, inner_prefix, to_multipart)
end
elsif params.is_a? Array
params.each_index do |i|
inner_prefix = "#{prefix}[#{i}]"
results, files, to_multipart = build_query_recurse(params[i], results, files, inner_prefix, to_multipart)
end
elsif params.is_a? Set
results, files, to_multipart = build_query_recurse(params.to_a, results, files, prefix, to_multipart)
else
key = "#{prefix}".sub('[', '').sub(']', '')
/^(.*)\[\d+\]$/.match(key) do |m|
key = "#{m[1]}[]"
end
value = params
if value.is_a?(Pathname) || value.is_a?(Plugin::Photo::Photo)
to_multipart = true
end
case value
when Pathname
# multipart/form-data にするが、POSTリクエストではない可能性がある(PATCH等)ため、ある程度自力でつくる。
# boundary作成や実際のbody構築はhttpclientに任せる。
filename = value.basename.to_s
disposition = "form-data; name=\"#{key}\"; filename=\"#{filename}\""
f = File.open(value.to_s, 'rb')
files << f
results << {
"Content-Type" => "application/octet-stream",
"Content-Disposition" => disposition,
:content => f,
}
when Plugin::Photo::Photo
filename = Pathname(value.perma_link.path).basename.to_s
disposition = "form-data; name=\"#{key}\"; filename=\"#{filename}\""
results << {
"Content-Type" => "application/octet-stream",
"Content-Disposition" => "form-data; name=\"#{key}\"; filename=\"#{filename}\"",
:content => StringIO.new(value.blob, 'r'),
}
else
if to_multipart
results << {
"Content-Type" => "application/octet-stream",
"Content-Disposition" => "form-data; name=\"#{key}\"",
:content => value,
}
else
results << [key, value]
end
end
end
[results, files, to_multipart]
end
# httpclient向けにパラメータHashを変換する
def build_query(params, headers)
results, files, to_multipart = build_query_recurse(params)
if to_multipart
headers << ["Content-Type", "multipart/form-data"]
end
[results, headers, files]
end
# APIアクセスを行うhttpclientのラッパメソッド
def call(method, domain, path = nil, access_token = nil, opts = {}, headers = [], **params)
Thread.new do
call!(method, domain, path, access_token, opts, headers, **params)
end
end
def call!(method, domain, path = nil, access_token = nil, opts = {}, headers = [], **params)
uri = domain_path_to_uri(domain, path)
resp = raw_response!(method, uri, access_token, headers, **params)
case resp&.status
when 200
parse_link(resp, JSON.parse(resp.content, symbolize_names: true))
end
end
def raw_response!(method, uri, access_token, headers, **params)
if access_token && !access_token.empty?
headers += [["Authorization", "Bearer " + access_token]]
end
query_timer(method, uri, params, headers) do
send_request(method, params, headers, uri)
end
end
private def domain_path_to_uri(domain, path)
if domain.is_a? Diva::URI
domain
else
Diva::URI.new('https://' + domain + path)
end
end
private def query_timer(method, uri, params, headers, &block)
start_time = Time.new.freeze
serial = uri.to_s.hash ^ params.freeze.hash
Plugin.call(:query_start,
serial: serial,
method: method,
path: uri,
options: params,
headers: headers,
start_time: start_time)
result = block.call
Plugin.call(:query_end,
serial: serial,
method: method,
path: uri,
options: params,
start_time: start_time,
end_time: Time.new.freeze,
res: result)
result
rescue => exc
Plugin.call(:query_end,
serial: serial,
method: method,
path: uri,
options: params,
start_time: start_time,
end_time: Time.new.freeze,
res: ExceptionResponse.new("#{exc.message}\n" + exc.backtrace.join("\n")))
raise
end
private def send_request(method, params, headers, uri)
query, headers, files = build_query(params, headers)
body = nil
if method != :get # :post, :patch
body = query
query = nil
end
HTTPClient.new.request(method, uri.to_s, query, body, headers)
ensure
files&.each(&:close)
end
def parse_link(resp, hash)
link = resp.header['Link'].first
return APIResult.new(hash) if ((!hash.is_a? Array) || link.nil?)
header =
link
.split(', ')
.map do |line|
/^<(.*)>; rel="(.*)"$/.match(line) do |m|
[$2.to_sym, Diva::URI.new($1)]
end
end
.to_h
APIResult.new(hash, header)
end
def status(domain, id)
call(:get, domain, '/api/v1/statuses/' + id.to_s)
end
def status!(domain, id)
call!(:get, domain, '/api/v1/statuses/' + id.to_s)
end
def status_by_url(domain, access_token, url)
call(:get, domain, '/api/v2/search', access_token, q: url.to_s, resolve: true).next{ |resp|
resp[:statuses]
}
end
def status_by_url!(domain, access_token, url)
call!(:get, domain, '/api/v2/search', access_token, q: url.to_s, resolve: true).next{ |resp|
resp[:statuses]
}
end
def account_by_url(domain, access_token, url)
call(:get, domain, '/api/v2/search', access_token, q: url.to_s, resolve: true).next{ |resp|
resp[:accounts]
}
end
# _world_ における、 _status_ のIDを検索して返す。
# _status_ が _world_ の所属するのと同じサーバに投稿されたものなら、 _status_ のID。
# 異なるサーバの _status_ なら、 _world_ のサーバに問い合わせて、そのIDを返すDeferredをリクエストする。
# ==== Args
# [world] World Model
# [status] トゥート
# ==== Return
# [Delayer::Deferred] _status_ のローカルにおけるID
def get_local_status_id(world, status)
if world.domain == status.domain
Delayer::Deferred.new{ status.id }
else
status_by_url(world.domain, world.access_token, status.url).next{ |statuses|
statuses.dig(0, :id).tap do |id|
raise 'Status id does not found.' unless id
end
}
end
end
# _world_ における、 _account_ のIDを検索して返す。
# _account_ が _world_ の所属するのと同じサーバに投稿されたものなら、 _account_ のID。
# 異なるサーバの _account_ なら、 _world_ のサーバに問い合わせて、そのIDを返すDeferredをリクエストする。
# ==== Args
# [world] World Model
# [account] アカウント (Plugin::Mastodon::Account)
# ==== Return
# [Delayer::Deferred] _account_ のローカルにおけるID
def get_local_account_id(world, account)
if world.domain == account.domain
Delayer::Deferred.new{ account.id }
else
account_by_url(world.domain, world.access_token, account.url).next{ |accounts|
accounts&.dig(0, :id)
}
end
end
# Link headerがあるAPIを連続的に叩いて1要素ずつyieldする
# ==== Args
# [method] HTTPメソッド
# [domain] 対象ドメイン
# [path] APIパス
# [access_token] トークン
# [opts] オプション
# [:direction] :next or :prev
# [:wait] APIコール間にsleepで待機する秒数
# [headers] 追加ヘッダ
# [params] GET/POSTパラメータ
def all!(method, domain, path = nil, access_token = nil, opts = {}, headers = [], **params)
opts[:direction] ||= :next
opts[:wait] ||= 1
while true
list = API.call!(method, domain, path, access_token, opts, headers, **params)
if list && list.value.is_a?(Array)
list.value.each { |hash| yield hash }
end
break unless list.header.has_key?(opts[:direction])
url = list.header[opts[:direction]]
params = URI.decode_www_form(url.query).to_h.symbolize
sleep opts[:wait]
end
end
def all_with_world!(world, method, path = nil, opts = {}, headers = [], **params, &block)
all!(method, world.domain, path, world.access_token, opts, headers, **params, &block)
end
end
end
end
|
Odms::Application.routes.draw do
# rather than try to get multiple route files working,
# just conditionally add this testing route.
if Rails.env == 'test'
resource :fake_session, :only => [:new,:create]
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
#
#
# http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/
#
# http://guides.rubyonrails.org/routing.html
#
#
root :to => 'odms#show'
resources :address_types
resources :bc_requests, :except => :show do
collection { get :confirm }
member { put :update_status }
end
resources :birth_data, :except => [:new,:create,:edit,:update,:destroy]
resources :candidate_controls, :only => [:edit,:update,:index,:show]
# Removing RAF forms and creating a single RAF-like form
resources :cases, :only => [:index] do
collection { put :assign_selected_for_interview }
end
resources :controls, :only => [:new,:create,:index] do
collection { get :assign_selected_for_interview }
end
resources :data_sources
resources :diagnoses
resources :document_types
resources :document_versions
resources :follow_up_types
resources :guides
resources :hospitals
resources :icf_master_ids, :only => [:index,:show]
resources :instrument_types
resources :instrument_versions
resources :ineligible_reasons
resources :instruments
resources :interview_methods
resources :interview_outcomes
resources :languages
resources :locales, :only => :show
resources :odms_exceptions, :except => [:new,:create]
resources :operational_event_types do
collection { get 'options' }
end
resources :organizations
resources :pages do
collection do
get :all
post :order
end
end
resources :people
resources :phone_types
resources :project_outcomes
resources :projects
resources :rafs, :only => [:new,:create,:edit,:update,:show]
resources :races
resource :receive_sample, :only => [:new,:create]
resources :refusal_reasons
resources :sample_formats
resources :sample_locations
resources :sample_outcomes
resources :sample_temperatures
resources :sample_transfers, :only => [:index,:destroy] do
collection { put :confirm }
member { put :update_status }
end
resources :sample_types
resources :sections
resources :subject_relationships
resources :subject_types
resources :tracing_statuses
resources :units
resources :vital_statuses
resources :zip_codes, :only => [ :index ]
match 'logout', :to => 'sessions#destroy'
resources :users, :only => [:destroy,:show,:index] do
resources :roles, :only => [:update,:destroy]
end
resource :session, :only => [ :destroy ]
# Route declaration order matters.
# This MUST be BEFORE the declaration of
# study_subject.resources :samples
# or 'dashboard' will be treated as a sample id.
resources :samples, :only => [] do
collection do
get :dashboard
get :find
get :followup
get :reports
get :manifest
end
end
resources :interviews, :only => [] do
collection do
get :dashboard
get :find
get :followup
get :reports
end
end
resources :studies, :only => [] do
collection { get :dashboard }
end
# I think that these MUST come before the study subject sub routes
# resources :abstracts, :except => [:new,:create] do
resources :abstracts, :only => [:index] do
# specify custom location controllers to avoid conflict
# with app controllers ( just diagnoses now )
# also looks cleaner
# using scope as it seems to clean this up
# module adds controller namespace of 'Abstract::'
# and path prefix '/abstracts/:abstract_id'
# fortunately, scope also takes :only
# this seems to work like "with_options" without needing to pass hash
scope :module => :abstract, :only => [:edit,:update,:show] do
resource :identifying_datum
resource :bone_marrow
resource :cbc
resource :cerebrospinal_fluid
resource :checklist
resource :chest_imaging
resource :clinical_chemo_protocol
resource :cytogenetic
resource :diagnosis
resource :discharge
resource :flow_cytometry
resource :histocompatibility
resource :name
resource :tdt
resource :therapy_response
end # scope :module => :abstract do
end
resources :study_subjects, :only => [:edit,:update,:show,:index] do
member do
get :next
get :prev
end
collection do
get :first
get :last
get :by
get :dashboard
get :find
get :followup
get :reports
end
# using scope as it seems to clean this up
# module adds controller namespace
scope :module => :study_subject do
resource :patient
resources :birth_records, :only => :index
# TEMP ADD DESTROY FOR DEV OF PHONE AND ADDRESS ONLY!
resources :phone_numbers, :except => [:index,:show]
resources :addressings, :except => [:index,:show]
resources :enrollments, :except => :destroy
resource :consent,
:only => [:show,:edit,:update]
resources :samples
resources :events
resources :contacts, :only => :index
resources :interviews, :only => :index
# resources :documents, :only => :index
# resources :notes, :only => :index
resources :related_subjects, :only => [:index]
#
# Add index action and set custom controller name
#
# resources :abstracts, :only => [:new,:create,:index],
# :controller => 'study_subject_abstracts' do
# resources :abstracts, :only => [:new,:create,:edit,:update,:index] do
resources :abstracts, :except => [:edit, :update] do
collection do
get :compare
post :merge
end
end
end # scope :module => :study_subject do
end
# format seems to be required in the url? UNLESS wrapped in ()!
# match 'study_subject_reports/:action(.:format)' => 'study_subject_reports'
match 'charts/:action.:format' => 'charts'
namespace :sunspot do
resources :subjects, :only => :index
resources :samples, :only => :index
end
# namespace :api do
# resources :study_subjects, :only => :index
# resources :patients, :only => :index
# resources :projects, :only => :index
# resources :enrollments, :only => :index
# resources :addresses, :only => :index
# resources :addressings, :only => :index
# resources :phone_numbers, :only => :index
# end
# Create named routes for expected pages so can avoid
# needing to append the relative_url_root prefix manually.
# ActionController::Base.relative_url_root + '/admin',
# with_options :controller => "pages", :action => "show" do |page|
# page.admin '/admin', :path => ["admin"]
# page.faqs '/faqs', :path => ["faqs"]
# page.reports '/reports', :path => ["reports"]
# end
# TODO can't seem to duplicate the above. Boo.
# TODO don't think this is quite right
# match 'admin' => 'pages#show', :as => 'admin', :path => ["admin"]
# match 'admin', :to => 'pages#show', :as => 'admin'
# match '*path', :to => 'pages', :as => 'admin'
## match 'admin', :to => { :controller => :pages, :action => :show, :path => ["admin"] }, :as => 'admin'
# match 'faqs' => 'pages', :as => 'faqs'
# match 'reports' => 'pages', :as => 'reports'
# controller :pages
# MUST BE LAST OR WILL BLOCK ALL OTHER ROUTES!
# catch all route to manage admin created pages.
# connect '*path', :controller => 'pages', :action => 'show'
# TODO don't know if this is right either
get '*path' => 'pages#show'
end
__END__
Changed assign_selected_for_interview back to put.
Odms::Application.routes.draw do
# rather than try to get multiple route files working,
# just conditionally add this testing route.
if Rails.env == 'test'
resource :fake_session, :only => [:new,:create]
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => 'welcome#index'
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id))(.:format)'
#
#
# http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/
#
# http://guides.rubyonrails.org/routing.html
#
#
root :to => 'odms#show'
resources :address_types
resources :bc_requests, :except => :show do
collection { get :confirm }
member { put :update_status }
end
resources :birth_data, :except => [:new,:create,:edit,:update,:destroy]
resources :candidate_controls, :only => [:edit,:update,:index,:show]
# Removing RAF forms and creating a single RAF-like form
resources :cases, :only => [:index] do
collection { put :assign_selected_for_interview }
end
resources :controls, :only => [:new,:create,:index] do
collection { put :assign_selected_for_interview }
end
resources :data_sources
resources :diagnoses
resources :document_types
resources :document_versions
resources :follow_up_types
resources :guides
resources :hospitals
resources :icf_master_ids, :only => [:index,:show]
resources :instrument_types
resources :instrument_versions
resources :ineligible_reasons
resources :instruments
resources :interview_methods
resources :interview_outcomes
resources :languages
resources :locales, :only => :show
resources :odms_exceptions, :except => [:new,:create]
resources :operational_event_types do
collection { get 'options' }
end
resources :organizations
resources :pages do
collection do
get :all
post :order
end
end
resources :people
resources :phone_types
resources :project_outcomes
resources :projects
resources :rafs, :only => [:new,:create,:edit,:update,:show]
resources :races
resource :receive_sample, :only => [:new,:create]
resources :refusal_reasons
resources :sample_formats
resources :sample_locations
resources :sample_outcomes
resources :sample_temperatures
resources :sample_transfers, :only => [:index,:destroy] do
collection { put :confirm }
member { put :update_status }
end
resources :sample_types
resources :sections
resources :subject_relationships
resources :subject_types
resources :tracing_statuses
resources :units
resources :vital_statuses
resources :zip_codes, :only => [ :index ]
match 'logout', :to => 'sessions#destroy'
resources :users, :only => [:destroy,:show,:index] do
resources :roles, :only => [:update,:destroy]
end
resource :session, :only => [ :destroy ]
# Route declaration order matters.
# This MUST be BEFORE the declaration of
# study_subject.resources :samples
# or 'dashboard' will be treated as a sample id.
resources :samples, :only => [] do
collection do
get :dashboard
get :find
get :followup
get :reports
get :manifest
end
end
resources :interviews, :only => [] do
collection do
get :dashboard
get :find
get :followup
get :reports
end
end
resources :studies, :only => [] do
collection { get :dashboard }
end
# I think that these MUST come before the study subject sub routes
# resources :abstracts, :except => [:new,:create] do
resources :abstracts, :only => [:index] do
# specify custom location controllers to avoid conflict
# with app controllers ( just diagnoses now )
# also looks cleaner
# using scope as it seems to clean this up
# module adds controller namespace of 'Abstract::'
# and path prefix '/abstracts/:abstract_id'
# fortunately, scope also takes :only
# this seems to work like "with_options" without needing to pass hash
scope :module => :abstract, :only => [:edit,:update,:show] do
resource :identifying_datum
resource :bone_marrow
resource :cbc
resource :cerebrospinal_fluid
resource :checklist
resource :chest_imaging
resource :clinical_chemo_protocol
resource :cytogenetic
resource :diagnosis
resource :discharge
resource :flow_cytometry
resource :histocompatibility
resource :name
resource :tdt
resource :therapy_response
end # scope :module => :abstract do
end
resources :study_subjects, :only => [:edit,:update,:show,:index] do
member do
get :next
get :prev
end
collection do
get :first
get :last
get :by
get :dashboard
get :find
get :followup
get :reports
end
# using scope as it seems to clean this up
# module adds controller namespace
scope :module => :study_subject do
resource :patient
resources :birth_records, :only => :index
# TEMP ADD DESTROY FOR DEV OF PHONE AND ADDRESS ONLY!
resources :phone_numbers, :except => [:index,:show]
resources :addressings, :except => [:index,:show]
resources :enrollments, :except => :destroy
resource :consent,
:only => [:show,:edit,:update]
resources :samples
resources :events
resources :contacts, :only => :index
resources :interviews, :only => :index
# resources :documents, :only => :index
# resources :notes, :only => :index
resources :related_subjects, :only => [:index]
#
# Add index action and set custom controller name
#
# resources :abstracts, :only => [:new,:create,:index],
# :controller => 'study_subject_abstracts' do
# resources :abstracts, :only => [:new,:create,:edit,:update,:index] do
resources :abstracts, :except => [:edit, :update] do
collection do
get :compare
post :merge
end
end
end # scope :module => :study_subject do
end
# format seems to be required in the url? UNLESS wrapped in ()!
# match 'study_subject_reports/:action(.:format)' => 'study_subject_reports'
match 'charts/:action.:format' => 'charts'
namespace :sunspot do
resources :subjects, :only => :index
resources :samples, :only => :index
end
# namespace :api do
# resources :study_subjects, :only => :index
# resources :patients, :only => :index
# resources :projects, :only => :index
# resources :enrollments, :only => :index
# resources :addresses, :only => :index
# resources :addressings, :only => :index
# resources :phone_numbers, :only => :index
# end
# Create named routes for expected pages so can avoid
# needing to append the relative_url_root prefix manually.
# ActionController::Base.relative_url_root + '/admin',
# with_options :controller => "pages", :action => "show" do |page|
# page.admin '/admin', :path => ["admin"]
# page.faqs '/faqs', :path => ["faqs"]
# page.reports '/reports', :path => ["reports"]
# end
# TODO can't seem to duplicate the above. Boo.
# TODO don't think this is quite right
# match 'admin' => 'pages#show', :as => 'admin', :path => ["admin"]
# match 'admin', :to => 'pages#show', :as => 'admin'
# match '*path', :to => 'pages', :as => 'admin'
## match 'admin', :to => { :controller => :pages, :action => :show, :path => ["admin"] }, :as => 'admin'
# match 'faqs' => 'pages', :as => 'faqs'
# match 'reports' => 'pages', :as => 'reports'
# controller :pages
# MUST BE LAST OR WILL BLOCK ALL OTHER ROUTES!
# catch all route to manage admin created pages.
# connect '*path', :controller => 'pages', :action => 'show'
# TODO don't know if this is right either
get '*path' => 'pages#show'
end
__END__
|
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane_core/version'
Gem::Specification.new do |spec|
spec.name = "fastlane_core"
spec.version = FastlaneCore::VERSION
spec.authors = ["Felix Krause"]
spec.email = ["fastlanecore@krausefx.com"]
spec.summary = %q{Contains all shared code/dependencies of the fastlane.tools}
spec.description = %q{Contains all shared code/dependencies of the fastlane.tools}
spec.homepage = "https://fastlane.tools"
spec.license = "MIT"
spec.required_ruby_version = '>= 2.0.0'
spec.files = Dir["lib/**/*"] + %w{ README.md LICENSE }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_dependency 'json' # Because sometimes it's just not installed
spec.add_dependency 'multi_json' # Because sometimes it's just not installed
spec.add_dependency 'highline', '>= 1.7.2' # user inputs (e.g. passwords)
spec.add_dependency 'colored' # coloured terminal output
spec.add_dependency 'commander', '>= 4.3.4' # CLI parser
spec.add_dependency 'babosa' # transliterate strings
spec.add_dependency 'excon', '~> 0.45.0' # Great HTTP Client
spec.add_dependency 'rubyzip', '~> 1.1.6' # needed for extracting the ipa file
spec.add_dependency 'credentials_manager', '>= 0.7.1' # fastlane password manager
# Frontend Scripting
spec.add_dependency 'phantomjs', '~> 1.9.8' # dependency for poltergeist
spec.add_dependency 'capybara', '~> 2.4.3' # for controlling iTC
spec.add_dependency 'poltergeist', '~> 1.5.1' # headless Javascript browser for controlling iTC
# Development only
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.1.0'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'yard', '~> 0.8.7.4'
spec.add_development_dependency 'webmock', '~> 1.19.0'
spec.add_development_dependency 'coveralls'
end
Updated commander dependency
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'fastlane_core/version'
Gem::Specification.new do |spec|
spec.name = "fastlane_core"
spec.version = FastlaneCore::VERSION
spec.authors = ["Felix Krause"]
spec.email = ["fastlanecore@krausefx.com"]
spec.summary = %q{Contains all shared code/dependencies of the fastlane.tools}
spec.description = %q{Contains all shared code/dependencies of the fastlane.tools}
spec.homepage = "https://fastlane.tools"
spec.license = "MIT"
spec.required_ruby_version = '>= 2.0.0'
spec.files = Dir["lib/**/*"] + %w{ README.md LICENSE }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.add_dependency 'json' # Because sometimes it's just not installed
spec.add_dependency 'multi_json' # Because sometimes it's just not installed
spec.add_dependency 'highline', '>= 1.7.2' # user inputs (e.g. passwords)
spec.add_dependency 'colored' # coloured terminal output
spec.add_dependency 'commander', '>= 4.3.5' # CLI parser
spec.add_dependency 'babosa' # transliterate strings
spec.add_dependency 'excon', '~> 0.45.0' # Great HTTP Client
spec.add_dependency 'rubyzip', '~> 1.1.6' # needed for extracting the ipa file
spec.add_dependency 'credentials_manager', '>= 0.7.1' # fastlane password manager
# Frontend Scripting
spec.add_dependency 'phantomjs', '~> 1.9.8' # dependency for poltergeist
spec.add_dependency 'capybara', '~> 2.4.3' # for controlling iTC
spec.add_dependency 'poltergeist', '~> 1.5.1' # headless Javascript browser for controlling iTC
# Development only
spec.add_development_dependency 'bundler'
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec', '~> 3.1.0'
spec.add_development_dependency 'pry'
spec.add_development_dependency 'yard', '~> 0.8.7.4'
spec.add_development_dependency 'webmock', '~> 1.19.0'
spec.add_development_dependency 'coveralls'
end
|
Debitos::Application.routes.draw do
devise_for :users
devise_scope :user do
get '/login', to: "devise/cas_sessions#new"
post '/logout', to: "devise/cas_sessions#destroy"
end
# resources :users do
# Hacer que sea para cada usuario.
# collection { get :main }
# end
resources :accounts do
resources :alumnos do
collection { get :plans }
collection { post :import }
collection { post :edit_multiple}
collection { post :update_multiple}
collection { post :delete_multiple}
collection { post :set_multiple_inactive}
end
resources :presentations
resources :card_companies do
resources :presentations
end
end
resources :responsibles
resources :card_companies
# resources :sessions, only: [:new, :create, :destroy]
resources :summaries do
collection {get "download"}
end
resources :google_users, only: [:new, :create, :destroy]
root to: 'accounts#index'
# match '/signup', to: 'users#new'
# match '/signin', to: 'sessions#new'
# match '/signout', to: 'sessions#destroy', via: :delete
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
match '/news', to: 'static_pages#news'
match '/visa_credito', to:'summaries#visa_cred'
match '/visa_debito', to:'summaries#visa_deb'
match '/master_credito', to:'summaries#master_cred'
match '/master_debito', to:'summaries#master_deb'
match '/american_express_credito', to:'summaries#amex_cred'
match '/american_express_debito', to:'summaries#amex_deb'
end
[#104852730] add route to synch_with_contacts
Debitos::Application.routes.draw do
devise_for :users
devise_scope :user do
get '/login', to: "devise/cas_sessions#new"
post '/logout', to: "devise/cas_sessions#destroy"
end
# resources :users do
# Hacer que sea para cada usuario.
# collection { get :main }
# end
resources :accounts do
resources :alumnos do
collection { get :plans }
collection { post :import }
collection { post :edit_multiple}
collection { post :update_multiple}
collection { post :delete_multiple}
collection { post :set_multiple_inactive}
collection { get :synch_with_contacts }
end
resources :presentations
resources :card_companies do
resources :presentations
end
end
resources :responsibles
resources :card_companies
# resources :sessions, only: [:new, :create, :destroy]
resources :summaries do
collection {get "download"}
end
resources :google_users, only: [:new, :create, :destroy]
root to: 'accounts#index'
# match '/signup', to: 'users#new'
# match '/signin', to: 'sessions#new'
# match '/signout', to: 'sessions#destroy', via: :delete
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#about'
match '/contact', to: 'static_pages#contact'
match '/news', to: 'static_pages#news'
match '/visa_credito', to:'summaries#visa_cred'
match '/visa_debito', to:'summaries#visa_deb'
match '/master_credito', to:'summaries#master_cred'
match '/master_debito', to:'summaries#master_deb'
match '/american_express_credito', to:'summaries#amex_cred'
match '/american_express_debito', to:'summaries#amex_deb'
end
|
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
devise_for :users
root :to => 'pages#index'
# Frontend
resources :users, :except => :show
namespace :api do
namespace :v3 do
resources :areas, :only => [:index, :show]
resources :scenarios, :only => [:show, :create, :update] do
member do
get :batch
get :application_demands, to: 'export#application_demands'
get :production_parameters, to: 'export#production_parameters'
get :energy_flow, to: 'export#energy_flow'
get :molecule_flow, to: 'export#molecule_flow'
get :merit
put :dashboard
post :interpolate
end
collection do
post :merge
end
get :templates, :on => :collection
resources :nodes, :only => :show do
get :topology, :on => :collection
post :stats, :on => :collection
end
get 'converters', to: redirect('/api/v3/scenarios/%{scenario_id}/nodes')
get 'converters/:id', to: redirect('/api/v3/scenarios/%{scenario_id}/nodes/%{id}')
resources :inputs, :only => [:index, :show]
# Flexibility orders have been removed. Endpoint returns a 404 with a useful message.
get '/flexibility_order', to: 'removed_features#flexibility_order'
put '/flexibility_order', to: 'removed_features#flexibility_order'
patch '/flexibility_order', to: 'removed_features#flexibility_order'
resource :heat_network_order, only: [:show, :update], controller: :heat_network_orders
resources :custom_curves, only: %i[index show update destroy],
constraints: { id: %r{[a-z\d_\-/]+} }
resource :esdl_file, only: %i[show update]
get 'curves/buildings_heat',
to: 'curves#buildings_heat_curves',
as: :curves_buildings_heat_download
get 'curves/merit_order',
to: 'curves#merit_order',
as: :curves_merit_order_download
get 'curves/electricity_price',
to: 'curves#electricity_price',
as: :curves_electricity_price_download
get 'curves/heat_network',
to: 'curves#heat_network',
as: :curves_heat_network_download
get 'curves/household_heat',
to: 'curves#household_heat_curves',
as: :curves_household_heat_download
get 'curves/hydrogen',
to: 'curves#hydrogen',
as: :curves_hydrogen_download
get 'curves/network_gas',
to: 'curves#network_gas',
as: :curves_network_gas_download
end
resources :nodes, :only => :show do
get :topology, :on => :collection
end
get 'converters', to: redirect('/api/v3/nodes')
get 'converters/*rest', to: redirect('/api/v3/nodes/%{rest}')
resources :inputs, :only => [:index, :show] do
get :list, :on => :collection
end
end
end
namespace :mechanical_turk do
root :to => 'turks#index'
resource :factory, :only => [:new, :create, :show]
resources :turks, :only => [:index, :show]
end
namespace :inspect do
get '/' => 'pages#start_inspect'
get '/redirect' => "base#redirect", :as => 'redirect'
get 'search.js' => 'search#index', as: :search_autocomplete
scope '/:api_scenario_id' do
root :to => "pages#index"
post '/clear_cache' => 'pages#clear_cache', :as => 'clear_cache'
# The Graphviz
resources :layouts, :except => [:new, :index, :create, :destroy] do
member { get 'yaml' }
end
get 'layout', to: redirect("api/v3/scenarios/%{api_scenario_id}/layout/energy")
resources :gqueries, :only => [:index, :show] do
get :result, :on => :member
collection do
get :test
post :test
get :result
end
end
scope '/graphs/:graph_name' do
resources :nodes, :only => [:index, :show]
end
resources :carriers, :only => [:index, :show]
resource :area, :as => :area, :only => :show
resources :query_tables
resources :query_table_cells, :except => [:show, :index]
resources :inputs, :only => [:index, :show]
resources :scenarios, :only => [:index, :show, :edit, :update, :new, :create] do
put :fix, :on => :member
end
get '/checks/share_groups' => 'checks#share_groups'
get '/checks/gquery_results' => 'checks#gquery_results'
get '/checks/loops' => 'checks#loops'
get '/checks/expected_demand' => 'checks#expected_demand'
get '/checks/index' => 'checks#index'
get '/debug/merit_order' => 'debug#merit_order'
get '/debug/calculation' => 'debug#calculation'
get '/debug/gquery' => 'debug#gquery', :as => :debug_gql
get '/gql' => "gql#index"
get '/gql/search' => "gql#search", :as => :gql_search
get '/gql/log' => "gql#log", :as => :gql_log
get '/gql/warnings' => "gql#warnings", :as => :gql_warnings
get '/merit' => 'merit#index'
get '/merit/download',
to: redirect("api/v3/scenarios/%{api_scenario_id}/merit/loads.csv")
get '/merit/download_prices',
to: redirect("api/v3/scenarios/%{api_scenario_id}/merit/price.csv")
get 'converters', to: redirect('/inspect/%{api_scenario_id}/nodes')
get 'converters/:id', to: redirect('/inspect/%{api_scenario_id}/nodes/%{id}')
get 'search' => 'search#index', :as => :search
end
end
get '/data', to: redirect('/inspect', status: 302)
get '/data/*rest',
to: redirect(status: 302) { |params| "/inspect/#{params[:rest]}" }
namespace :etsource do
root :to => 'commits#index'
resources :commits, :only => [:index] do
get :import, :on => :member
end
end
end
Remove top-level /api/v3/nodes endpoint
This would use the most-recently created scenario which would not return
consistent results, and leaks information about other users' scenarios.
Sentry: ETENGINE-76
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
devise_for :users
root :to => 'pages#index'
# Frontend
resources :users, :except => :show
namespace :api do
namespace :v3 do
resources :areas, :only => [:index, :show]
resources :scenarios, :only => [:show, :create, :update] do
member do
get :batch
get :application_demands, to: 'export#application_demands'
get :production_parameters, to: 'export#production_parameters'
get :energy_flow, to: 'export#energy_flow'
get :molecule_flow, to: 'export#molecule_flow'
get :merit
put :dashboard
post :interpolate
end
collection do
post :merge
end
get :templates, :on => :collection
resources :nodes, :only => :show do
get :topology, :on => :collection
post :stats, :on => :collection
end
get 'converters', to: redirect('/api/v3/scenarios/%{scenario_id}/nodes')
get 'converters/:id', to: redirect('/api/v3/scenarios/%{scenario_id}/nodes/%{id}')
resources :inputs, :only => [:index, :show]
# Flexibility orders have been removed. Endpoint returns a 404 with a useful message.
get '/flexibility_order', to: 'removed_features#flexibility_order'
put '/flexibility_order', to: 'removed_features#flexibility_order'
patch '/flexibility_order', to: 'removed_features#flexibility_order'
resource :heat_network_order, only: [:show, :update], controller: :heat_network_orders
resources :custom_curves, only: %i[index show update destroy],
constraints: { id: %r{[a-z\d_\-/]+} }
resource :esdl_file, only: %i[show update]
get 'curves/buildings_heat',
to: 'curves#buildings_heat_curves',
as: :curves_buildings_heat_download
get 'curves/merit_order',
to: 'curves#merit_order',
as: :curves_merit_order_download
get 'curves/electricity_price',
to: 'curves#electricity_price',
as: :curves_electricity_price_download
get 'curves/heat_network',
to: 'curves#heat_network',
as: :curves_heat_network_download
get 'curves/household_heat',
to: 'curves#household_heat_curves',
as: :curves_household_heat_download
get 'curves/hydrogen',
to: 'curves#hydrogen',
as: :curves_hydrogen_download
get 'curves/network_gas',
to: 'curves#network_gas',
as: :curves_network_gas_download
end
resources :inputs, :only => [:index, :show] do
get :list, :on => :collection
end
end
end
namespace :mechanical_turk do
root :to => 'turks#index'
resource :factory, :only => [:new, :create, :show]
resources :turks, :only => [:index, :show]
end
namespace :inspect do
get '/' => 'pages#start_inspect'
get '/redirect' => "base#redirect", :as => 'redirect'
get 'search.js' => 'search#index', as: :search_autocomplete
scope '/:api_scenario_id' do
root :to => "pages#index"
post '/clear_cache' => 'pages#clear_cache', :as => 'clear_cache'
# The Graphviz
resources :layouts, :except => [:new, :index, :create, :destroy] do
member { get 'yaml' }
end
get 'layout', to: redirect("api/v3/scenarios/%{api_scenario_id}/layout/energy")
resources :gqueries, :only => [:index, :show] do
get :result, :on => :member
collection do
get :test
post :test
get :result
end
end
scope '/graphs/:graph_name' do
resources :nodes, :only => [:index, :show]
end
resources :carriers, :only => [:index, :show]
resource :area, :as => :area, :only => :show
resources :query_tables
resources :query_table_cells, :except => [:show, :index]
resources :inputs, :only => [:index, :show]
resources :scenarios, :only => [:index, :show, :edit, :update, :new, :create] do
put :fix, :on => :member
end
get '/checks/share_groups' => 'checks#share_groups'
get '/checks/gquery_results' => 'checks#gquery_results'
get '/checks/loops' => 'checks#loops'
get '/checks/expected_demand' => 'checks#expected_demand'
get '/checks/index' => 'checks#index'
get '/debug/merit_order' => 'debug#merit_order'
get '/debug/calculation' => 'debug#calculation'
get '/debug/gquery' => 'debug#gquery', :as => :debug_gql
get '/gql' => "gql#index"
get '/gql/search' => "gql#search", :as => :gql_search
get '/gql/log' => "gql#log", :as => :gql_log
get '/gql/warnings' => "gql#warnings", :as => :gql_warnings
get '/merit' => 'merit#index'
get '/merit/download',
to: redirect("api/v3/scenarios/%{api_scenario_id}/merit/loads.csv")
get '/merit/download_prices',
to: redirect("api/v3/scenarios/%{api_scenario_id}/merit/price.csv")
get 'converters', to: redirect('/inspect/%{api_scenario_id}/nodes')
get 'converters/:id', to: redirect('/inspect/%{api_scenario_id}/nodes/%{id}')
get 'search' => 'search#index', :as => :search
end
end
get '/data', to: redirect('/inspect', status: 302)
get '/data/*rest',
to: redirect(status: 302) { |params| "/inspect/#{params[:rest]}" }
namespace :etsource do
root :to => 'commits#index'
resources :commits, :only => [:index] do
get :import, :on => :member
end
end
end
|
ActionController::Routing::Routes.draw do |map|
map.root :controller => 'home', :action => 'home'
map.resources :architectures
map.resources :articles
map.resources :categories, :collection => {:show_tree => :get}
map.connect '/debs/bundle/:id', :controller => 'debs', :action => 'bundle'
map.connect '/debs/generate_bundle/:id', :controller => 'debs', :action => 'generate_bundle'
map.resources :debs, :collections => {:generate => :get, :generate_all =>:get}
map.resources :derivatives
map.connect '/distributions/migrate/:id', :controller => 'distributions', :action => 'migrate'
map.connect '/distributions/migrate_bundels/:id', :controller => 'distributions', :action => 'migrate_bundles'
map.connect '/distributions/make_visible/:id', :controller => 'distributions', :action => 'make_visible'
map.connect '/distributions/make_final/:id', :controller => 'distributions', :action => 'make_final'
map.resources :distributions do |dist|
dist.resources :metapackages
dist.resources :packages
dist.resources :repositories
end
# home controller
map.connect '/home', :controller => 'home', :action => 'home'
map.connect '/faq', :controller => 'home', :action => 'faq'
map.connect '/mail/:navi', :controller => 'home', :action => 'mail'
map.connect '/about', :controller => 'home', :action => 'about'
map.connect '/contact_us', :controller => 'home', :action => 'contact_us'
map.connect '/cancel', :controller => 'home', :action => 'cancel'
map.connect '/success', :controller => 'home', :action => 'success'
map.connect '/users/spam_users_delete', :controller => 'users', :action => 'spam_users_delete'
map.resources :livecds, :member => { :remaster => :get, :remaster_new => :get, :start_vm => :get, :stop_vm => :get }
map.connect '/metapackages/:id/publish', :controller => "metapackages", :action => "publish", :method => :put
map.connect '/metapackages/:id/unpublish', :controller => "metapackages", :action => "unpublish", :method => :put
map.connect '/metapackages/:id/edit_packages', :controller => "metapackages", :action => "edit_packages", :method => :put
map.connect '/metapackages/:id/edit_action', :controller => 'metapackages', :action => 'edit_action'
map.resources :metapackages, :collection => {:save => :get, :immediate_conflicts => :get, :conflicts => :get,
:rdepends => :get, :action => :get, :changed => :get, :migrate => :get,
:finish_migrate => :get, :health_status => :get}
map.resources :messages, :member => { :reply => :get, :forward => :get }
map.resources :packages, :collection => {:packagelist => :get, :rdepends => :get, :search => :get, :section => :get, :bundle => :get}
map.connect '/bundle', :controller => 'packages', :action => 'bundle'
map.resource :password
map.connect '/rating/rate', :controller => 'rating', :action => 'rate'
map.resources :repositories
map.resources :searches
map.resources :sections
map.resource :session
map.resources :sent, :mailbox
map.resources :videos
map.connect '/user_profiles/create_livecd/:id', :controller => 'user_profiles', :action => 'create_livecd'
map.connect '/user_profiles/test_livecd/:id', :controller => 'user_profiles', :action => 'test_livecd'
map.connect '/users/anonymous_login', :controller => 'users', :action => 'anonymous_login'
map.resources :users, :member => { :enable => :put, :anonymous_login => :get} do |users|
users.resource :user_profile
users.resource :account
users.resources :roles
end
# URLs should be adpated to controllers
map.connect '/users/:distribution_id/suggestion', :controller => 'suggestion', :action => 'show'
map.connect '/users/:id/suggestion/install', :controller => 'suggestion', :action => 'install'
map.connect '/users/:id/suggestion/install_new', :controller => 'suggestion', :action => 'install_new'
map.connect '/users/:id/suggestion/install_sources', :controller => 'suggestion', :action => 'install_sources'
map.connect '/users/:id/suggestion/install_package_sources/:pid', :controller => 'suggestion', :action => 'install_package_sources'
map.connect '/users/:id/suggestion/install_bundle_sources/:mid', :controller => 'suggestion', :action => 'install_bundle_sources'
map.connect '/users/:id/suggestion/bundle_to_livecd/:mid', :controller => 'suggestion', :action => 'bundle_to_livecd'
map.connect '/users/:id/suggestion/quick_install/:mid', :controller => 'suggestion', :action => 'quick_install'
map.connect '/users/:id/suggestion/shownew', :controller => 'suggestion', :action => 'shownew'
map.connect '/users/:user_id/metapackages/:id', :controller => 'users', :action => 'metapackages'
map.connect '/users/:user_id/user_profile/edit', :controller => 'user_profiles', :action => 'edit'
map.connect '/users/:user_id/user_profile/installation', :controller => 'user_profiles', :action => 'installation'
map.connect '/users/:user_id/user_profile/update_data', :controller => 'user_profiles', :action => 'update_data'
map.connect '/users/:user_id/user_profile/update_ratings', :controller => 'user_profiles', :action => 'update_ratings'
map.connect '/users/:user_id/user_profile/settings', :controller => 'user_profiles', :action => 'settings'
map.connect '/users/:user_id/user_profile/sources', :controller => 'user_profiles', :action => 'sources'
map.connect '/users/:user_id/user_profile/livecd', :controller => 'user_profiles', :action => 'livecd'
map.connect '/users/:user_id/user_profile/bundle_to_livecd/:id', :controller => 'user_profiles', :action => 'bundle_to_livecd'
map.connect '/users/:user_id/user_profile/create_livecd_from_bundle/:id', :controller => 'user_profiles', :action => 'create_livecd_from_bundle'
map.connect '/users/:id/destroy', :controller => 'users', :action => 'destroy'
map.connect '/users/:id/show', :controller => 'users', :action => 'show'
map.connect '/users/:id/cart/:action/:id', :controller => 'cart'
# from authenticated plugin
map.activate '/activate/:id', :controller => 'accounts', :action => 'show'
map.forgot_password '/forgot_password', :controller => 'passwords', :action => 'new'
map.reset_password '/reset_password/:id', :controller => 'passwords', :action => 'edit'
map.change_password '/change_password', :controller => 'accounts', :action => 'edit'
map.signup '/signup', :controller => 'users', :action => 'new'
map.login '/login', :controller => 'sessions', :action => 'new'
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.admin '/admin', :controller => 'admin'
map.inbox '/inbox', :controller => "mailbox", :action => "show"
# default rules
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
start and stop vm through web interface
git-svn-id: e70f47238a868777ecefe75ba01929cffb2d8127@1894 d8b24053-1f83-4035-b5c3-ce8b92cd91ad
ActionController::Routing::Routes.draw do |map|
map.root :controller => 'home', :action => 'home'
map.resources :architectures
map.resources :articles
map.resources :categories, :collection => {:show_tree => :get}
map.connect '/debs/bundle/:id', :controller => 'debs', :action => 'bundle'
map.connect '/debs/generate_bundle/:id', :controller => 'debs', :action => 'generate_bundle'
map.resources :debs, :collections => {:generate => :get, :generate_all =>:get}
map.resources :derivatives
map.connect '/distributions/migrate/:id', :controller => 'distributions', :action => 'migrate'
map.connect '/distributions/migrate_bundels/:id', :controller => 'distributions', :action => 'migrate_bundles'
map.connect '/distributions/make_visible/:id', :controller => 'distributions', :action => 'make_visible'
map.connect '/distributions/make_final/:id', :controller => 'distributions', :action => 'make_final'
map.resources :distributions do |dist|
dist.resources :metapackages
dist.resources :packages
dist.resources :repositories
end
# home controller
map.connect '/home', :controller => 'home', :action => 'home'
map.connect '/faq', :controller => 'home', :action => 'faq'
map.connect '/mail/:navi', :controller => 'home', :action => 'mail'
map.connect '/about', :controller => 'home', :action => 'about'
map.connect '/contact_us', :controller => 'home', :action => 'contact_us'
map.connect '/cancel', :controller => 'home', :action => 'cancel'
map.connect '/success', :controller => 'home', :action => 'success'
map.connect '/users/spam_users_delete', :controller => 'users', :action => 'spam_users_delete'
map.resources :livecds, :member => { :remaster => :get, :remaster_new => :get }
map.connect '/livecds/start_vm', :controller => 'livecds', :action => 'start_vm'
map.connect '/livecds/stop_vm', :controller => 'livecds', :action => 'stop_vm'
map.connect '/metapackages/:id/publish', :controller => "metapackages", :action => "publish", :method => :put
map.connect '/metapackages/:id/unpublish', :controller => "metapackages", :action => "unpublish", :method => :put
map.connect '/metapackages/:id/edit_packages', :controller => "metapackages", :action => "edit_packages", :method => :put
map.connect '/metapackages/:id/edit_action', :controller => 'metapackages', :action => 'edit_action'
map.resources :metapackages, :collection => {:save => :get, :immediate_conflicts => :get, :conflicts => :get,
:rdepends => :get, :action => :get, :changed => :get, :migrate => :get,
:finish_migrate => :get, :health_status => :get}
map.resources :messages, :member => { :reply => :get, :forward => :get }
map.resources :packages, :collection => {:packagelist => :get, :rdepends => :get, :search => :get, :section => :get, :bundle => :get}
map.connect '/bundle', :controller => 'packages', :action => 'bundle'
map.resource :password
map.connect '/rating/rate', :controller => 'rating', :action => 'rate'
map.resources :repositories
map.resources :searches
map.resources :sections
map.resource :session
map.resources :sent, :mailbox
map.resources :videos
map.connect '/user_profiles/create_livecd/:id', :controller => 'user_profiles', :action => 'create_livecd'
map.connect '/user_profiles/test_livecd/:id', :controller => 'user_profiles', :action => 'test_livecd'
map.connect '/users/anonymous_login', :controller => 'users', :action => 'anonymous_login'
map.resources :users, :member => { :enable => :put, :anonymous_login => :get} do |users|
users.resource :user_profile
users.resource :account
users.resources :roles
end
# URLs should be adpated to controllers
map.connect '/users/:distribution_id/suggestion', :controller => 'suggestion', :action => 'show'
map.connect '/users/:id/suggestion/install', :controller => 'suggestion', :action => 'install'
map.connect '/users/:id/suggestion/install_new', :controller => 'suggestion', :action => 'install_new'
map.connect '/users/:id/suggestion/install_sources', :controller => 'suggestion', :action => 'install_sources'
map.connect '/users/:id/suggestion/install_package_sources/:pid', :controller => 'suggestion', :action => 'install_package_sources'
map.connect '/users/:id/suggestion/install_bundle_sources/:mid', :controller => 'suggestion', :action => 'install_bundle_sources'
map.connect '/users/:id/suggestion/bundle_to_livecd/:mid', :controller => 'suggestion', :action => 'bundle_to_livecd'
map.connect '/users/:id/suggestion/quick_install/:mid', :controller => 'suggestion', :action => 'quick_install'
map.connect '/users/:id/suggestion/shownew', :controller => 'suggestion', :action => 'shownew'
map.connect '/users/:user_id/metapackages/:id', :controller => 'users', :action => 'metapackages'
map.connect '/users/:user_id/user_profile/edit', :controller => 'user_profiles', :action => 'edit'
map.connect '/users/:user_id/user_profile/installation', :controller => 'user_profiles', :action => 'installation'
map.connect '/users/:user_id/user_profile/update_data', :controller => 'user_profiles', :action => 'update_data'
map.connect '/users/:user_id/user_profile/update_ratings', :controller => 'user_profiles', :action => 'update_ratings'
map.connect '/users/:user_id/user_profile/settings', :controller => 'user_profiles', :action => 'settings'
map.connect '/users/:user_id/user_profile/sources', :controller => 'user_profiles', :action => 'sources'
map.connect '/users/:user_id/user_profile/livecd', :controller => 'user_profiles', :action => 'livecd'
map.connect '/users/:user_id/user_profile/bundle_to_livecd/:id', :controller => 'user_profiles', :action => 'bundle_to_livecd'
map.connect '/users/:user_id/user_profile/create_livecd_from_bundle/:id', :controller => 'user_profiles', :action => 'create_livecd_from_bundle'
map.connect '/users/:id/destroy', :controller => 'users', :action => 'destroy'
map.connect '/users/:id/show', :controller => 'users', :action => 'show'
map.connect '/users/:id/cart/:action/:id', :controller => 'cart'
# from authenticated plugin
map.activate '/activate/:id', :controller => 'accounts', :action => 'show'
map.forgot_password '/forgot_password', :controller => 'passwords', :action => 'new'
map.reset_password '/reset_password/:id', :controller => 'passwords', :action => 'edit'
map.change_password '/change_password', :controller => 'accounts', :action => 'edit'
map.signup '/signup', :controller => 'users', :action => 'new'
map.login '/login', :controller => 'sessions', :action => 'new'
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.admin '/admin', :controller => 'admin'
map.inbox '/inbox', :controller => "mailbox", :action => "show"
# default rules
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
|
Rails.application.routes.draw do
resources :event_rules
resources :signatures do
member do
get 'pcap'
delete 'destroy_events'
end
end
resources :events do
member do
get 'packet'
end
end
mount Wobauth::Engine, at: '/'
root 'events#index'
end
set root to signature with current sigs
Rails.application.routes.draw do
resources :event_rules
resources :signatures do
member do
get 'pcap'
delete 'destroy_events'
end
end
resources :events do
member do
get 'packet'
end
end
mount Wobauth::Engine, at: '/'
root 'signatures#index', filter: 'current'
end
|
Rails.application.routes.draw do
resources :categories, only: [:index] do
resources :places, except: [:destroy] do
resources :votes
resources :reviews do
resources :votes
end
end
end
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
>>>>>>> master
end
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
model spec added
Rails.application.routes.draw do
resources :categories, only: [:index] do
resources :places, except: [:destroy] do
resources :votes
resources :reviews do
resources :votes
end
end
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
>>>>>>> master
end
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
|
Rails.application.routes.draw do
devise_for :users, skip: [:sessions, :registrations]
devise_scope :user do
get 'login' => 'devise/sessions#new', as: :new_user_session
post 'login' => 'devise/sessions#create', as: :user_session
delete 'logout' => 'devise/sessions#destroy', as: :destroy_user_session
get 'register' => 'devise/registrations#new', as: :new_user_registration
post 'register' => 'devise/registrations#create', as: :user_registration
end
get '/settings', to: redirect('/settings/account')
namespace :settings do
resource :account, only: [:show, :update]
resource :profile, only: [:show, :update]
resource :password, only: [:show, :update]
end
resources :categories, only: [:index, :show]
resources :users, only: [:show, :edit, :update]
resources :questions, only: [:index, :show, :new, :create] do
resources :answers, only: [:new, :create]
end
root 'questions#index'
end
remove redundant routes
Rails.application.routes.draw do
devise_for :users, skip: [:sessions, :registrations]
devise_scope :user do
get 'login' => 'devise/sessions#new', as: :new_user_session
post 'login' => 'devise/sessions#create', as: :user_session
delete 'logout' => 'devise/sessions#destroy', as: :destroy_user_session
get 'register' => 'devise/registrations#new', as: :new_user_registration
post 'register' => 'devise/registrations#create', as: :user_registration
end
get '/settings', to: redirect('/settings/account')
namespace :settings do
resource :account, only: [:show, :update]
resource :profile, only: [:show, :update]
resource :password, only: [:show, :update]
end
resources :categories, only: [:index, :show]
resources :users, only: [:show]
resources :questions, only: [:index, :show, :new, :create] do
resources :answers, only: [:new, :create]
end
root 'questions#index'
end
|
Rails.application.routes.draw do
namespace :api, defaults: {format: 'json'} do
namespace :v1 do
resources :questionnaires, only: [:index], defaults: { format: 'json' }
resources :questionnaire_details, only: [:show], defaults: { format: 'json' }
get 'test_exception_notifier', controller: :base, action: :test_exception_notifier
end
end
apipie
resources :user_sessions
get 'login', to: "user_sessions#new", as: 'login'
get 'logout', to: "user_sessions#destroy", as: 'logout'
resources :users
get 'signup', to: 'users#new', as: 'signup'
post 'generate_new_token', to: 'users#generate_new_token', as: 'generate_new_token'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root to: "home#index"
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Changed questionnaire_details url to questionnaires/:id
Rails.application.routes.draw do
namespace :api, defaults: {format: 'json'} do
namespace :v1 do
resources :questionnaires, only: [:index], defaults: { format: 'json' }
get "/questionnaires/:id" => "questionnaire_details#show", defaults: { format: 'json' }
get 'test_exception_notifier', controller: :base, action: :test_exception_notifier
end
end
apipie
resources :user_sessions
get 'login', to: "user_sessions#new", as: 'login'
get 'logout', to: "user_sessions#destroy", as: 'logout'
resources :users
get 'signup', to: 'users#new', as: 'signup'
post 'generate_new_token', to: 'users#generate_new_token', as: 'generate_new_token'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root to: "home#index"
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Cypress::Application.routes.draw do
root :to => "vendors#index"
#match "/delayed_job" => DelayedJobMongoidWeb, :anchor => false
devise_for :users
get '/admin' => 'admin#index'
get "/admin/index"
get "/admin/users"
post "/admin/promote"
post "/admin/demote"
post "/admin/approve"
post "/admin/disable"
post "/admin/import_bundle"
post "/admin/activate_bundle"
get "/admin/delete_bundle"
post "/admin/clear_database"
resources :vendors, :products
resources :vendors do
resources :products do
resources :product_tests do
resources :patient_population
resources :test_executions
end
end
end
resources :measures do
get 'definition'
end
resources :test_executions do
member do
get 'download'
end
end
resources :product_tests do
resources :test_executions
member do
get 'download'
post 'process_pqri'
post 'add_note'
delete 'delete_note'
post 'email'
get 'qrda_cat3'
get 'status'
get 'generate_cat1_test'
end
resources :patients
resources :measures do
member do
get 'patients'
end
end
end
resources :patients do
member do
get 'download'
end
collection do
get 'table'
get 'table_all'
get 'table_measure'
get 'download'
end
end
resources :measures do
member do
get 'patients'
end
end
get "/information/about"
get "/information/feedback"
get "/information/help"
get '/services/index'
get '/services/validate_pqri'
post '/services/validate_pqri'
match '/measures/minimal_set' => 'measures#minimal_set', via: [:post]
match '/measures/by_type' => 'measures#by_type', via: [:post]
match '/product_tests/period', :to=>'product_tests#period', :as => :period, :via=> :post
unless Rails.application.config.consider_all_requests_local
match '*not_found', to: 'errors#error_404'
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
#match ':controller(/:action(/:id(.:format)))'
end
Updated match statement in routes.rb that I was missing by always running in development
Cypress::Application.routes.draw do
root :to => "vendors#index"
#match "/delayed_job" => DelayedJobMongoidWeb, :anchor => false
devise_for :users
get '/admin' => 'admin#index'
get "/admin/index"
get "/admin/users"
post "/admin/promote"
post "/admin/demote"
post "/admin/approve"
post "/admin/disable"
post "/admin/import_bundle"
post "/admin/activate_bundle"
get "/admin/delete_bundle"
post "/admin/clear_database"
resources :vendors, :products
resources :vendors do
resources :products do
resources :product_tests do
resources :patient_population
resources :test_executions
end
end
end
resources :measures do
get 'definition'
end
resources :test_executions do
member do
get 'download'
end
end
resources :product_tests do
resources :test_executions
member do
get 'download'
post 'process_pqri'
post 'add_note'
delete 'delete_note'
post 'email'
get 'qrda_cat3'
get 'status'
get 'generate_cat1_test'
end
resources :patients
resources :measures do
member do
get 'patients'
end
end
end
resources :patients do
member do
get 'download'
end
collection do
get 'table'
get 'table_all'
get 'table_measure'
get 'download'
end
end
resources :measures do
member do
get 'patients'
end
end
get "/information/about"
get "/information/feedback"
get "/information/help"
get '/services/index'
get '/services/validate_pqri'
post '/services/validate_pqri'
match '/measures/minimal_set' => 'measures#minimal_set', via: [:post]
match '/measures/by_type' => 'measures#by_type', via: [:post]
match '/product_tests/period', :to=>'product_tests#period', :as => :period, :via=> :post
unless Rails.application.config.consider_all_requests_local
match '*not_found', to: 'errors#error_404', :via => :get
end
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
#match ':controller(/:action(/:id(.:format)))'
end
|
Etm::Application.routes.draw do
get "gql/search"
root :to => 'pages#root'
post '/' => 'pages#root'
get '/scaled', :to => 'pages#scaled'
get '/choose' => 'pages#choose'
get '/info/:ctrl/:act' => "pages#info", :as => :tab_info
get '/texts/:id' => 'texts#show'
get 'login' => 'user_sessions#new', :as => :login
get 'logout' => 'user_sessions#destroy', :as => :logout
resources :descriptions, :only => :show
get '/descriptions/charts/:id' => 'descriptions#charts'
resources :user_sessions
resources :users, :except => [:index, :show, :destroy]
get '/users/:id/unsubscribe' => 'users#unsubscribe', as: :unsubscribe
resource :user, :only => [:edit, :update]
# Old partner paths.
get '/partners/:id', to: redirect("#{Partner::REMOTE_URL}/partners/%{id}")
get '/partners', to: redirect("#{Partner::REMOTE_URL}/partners")
resources :constraints, :only => :show
resource :settings, :only => [:edit, :update]
get '/settings/dashboard', :to => 'settings#dashboard'
put '/settings/dashboard', :to => 'settings#update_dashboard'
namespace :admin do
root :to => 'pages#index'
get 'map', :to => 'pages#map', :as => :map
get 'clear_cache' => 'pages#clear_cache', :as => :clear_cache
resources :predictions,
:sidebar_items,
:output_elements,
:output_element_series,
:general_user_notifications,
:constraints,
:users
resources :texts, :except => [:show]
resources :areas, :only => [:index, :show]
resources :tabs do
resources :sidebar_items
end
resources :sidebar_items do
resources :slides
end
resources :slides, :except => :show do
resources :input_elements
end
resources :gql do
collection do
get :search
end
end
resources :input_elements, :except => :show
end
resources :scenarios, :except => [:edit, :update] do
collection do
post :load
get :compare
post :merge
get :weighted_merge
post :weighted_merge, to: :perform_weighted_merge
end
get :load, :on => :member
end
get '/scenario/new' => 'scenarios#new'
get '/scenario/reset' => 'scenarios#reset'
get '/scenario/grid_investment_needed' => 'scenarios#grid_investment_needed'
# This is the main action
get '/scenario(/:tab(/:sidebar(/:slide)))' => 'scenarios#play', :as => :play
resources :output_elements, :only => [:index, :show] do
collection do
get 'visible/:id', action: :visible
get 'invisible/:id', action: :invisible
end
get :zoom, :on => :member
end
resources :predictions, :only => [:index, :show] do
member do
get :share
end
end
match '/ete(/*url)', to: 'api_proxy#default', via: :all
match '/ete_proxy(/*url)', to: 'api_proxy#default', via: :all
get '/select_movie/:id' => 'pages#select_movie', :defaults => {:format => :js}
get '/units' => 'pages#units'
get '/about' => 'pages#about'
get '/feedback' => 'pages#feedback', :as => :feedback
get '/tutorial/(:tab)(/:sidebar)' => 'pages#tutorial', :as => :tutorial
get '/prominent_users' => 'pages#prominent_users'
get '/disclaimer' => 'pages#disclaimer'
get '/privacy_statement' => 'pages#privacy_statement'
get '/show_all_countries' => 'pages#show_all_countries'
get '/show_flanders' => 'pages#show_flanders'
get '/sitemap(.:format)' => 'pages#sitemap', :defaults => {:format => :xml}
get '/known_issues' => 'pages#bugs', :as => :bugs
get '/quality_control' => 'pages#quality', :as => :quality
get '/set_locale(/:locale)' => 'pages#set_locale', :as => :set_locale
get '/browser_support' => 'pages#browser_support'
get '/update_footer' => 'pages#update_footer'
get "/404", :to => "pages#404"
get "/500", :to => "pages#500"
end
part of previous commit
Etm::Application.routes.draw do
root to: 'pages#root'
post '/' => 'pages#root'
get "gql/search"
get '/scaled', to: 'pages#scaled'
get '/choose' => 'pages#choose'
get '/info/:ctrl/:act' => "pages#info", as: :tab_info
get '/texts/:id' => 'texts#show'
get 'login' => 'user_sessions#new', as: :login
get 'logout' => 'user_sessions#destroy', as: :logout
resources :descriptions, only: :show
get '/descriptions/charts/:id' => 'descriptions#charts'
resources :user_sessions
resources :users, except: [:index, :show, :destroy]
get '/users/:id/unsubscribe' => 'users#unsubscribe', as: :unsubscribe
resource :user, only: [:edit, :update]
# Old partner paths.
get '/partners/:id', to: redirect("#{Partner::REMOTE_URL}/partners/%{id}")
get '/partners', to: redirect("#{Partner::REMOTE_URL}/partners")
resources :constraints, only: :show
resource :settings, only: [:edit, :update]
get '/settings/dashboard', to: 'settings#dashboard'
put '/settings/dashboard', to: 'settings#update_dashboard'
namespace :admin do
root to: 'pages#index'
get 'map', to: 'pages#map', as: :map
get 'clear_cache' => 'pages#clear_cache', as: :clear_cache
resources :predictions,
:sidebar_items,
:output_elements,
:output_element_series,
:general_user_notifications,
:constraints,
:users
resources :texts, except: [:show]
resources :areas, only: [:index, :show]
resources :tabs do
resources :sidebar_items
end
resources :sidebar_items do
resources :slides
end
resources :slides, except: :show do
resources :input_elements
end
resources :gql do
collection do
get :search
end
end
resources :input_elements, except: :show
end
resources :scenarios, except: [:edit, :update] do
collection do
post :load
get :compare
post :merge
get :weighted_merge
post :weighted_merge, to: :perform_weighted_merge
end
get :load, on: :member
end
get '/scenario/new' => 'scenarios#new'
get '/scenario/reset' => 'scenarios#reset'
get '/scenario/grid_investment_needed' => 'scenarios#grid_investment_needed'
# This is the main action
get '/scenario(/:tab(/:sidebar(/:slide)))' => 'scenarios#play', as: :play
resources :output_elements, only: [:index, :show] do
collection do
get 'visible/:id', action: :visible
get 'invisible/:id', action: :invisible
end
get :zoom, on: :member
end
resources :predictions, only: [:index, :show] do
member do
get :share
end
end
match '/ete(/*url)', to: 'api_proxy#default', via: :all
match '/ete_proxy(/*url)', to: 'api_proxy#default', via: :all
get '/select_movie/:id' => 'pages#select_movie', defaults: {format: :js}
get '/units' => 'pages#units'
get '/about' => 'pages#about'
get '/feedback' => 'pages#feedback', as: :feedback
get '/tutorial/(:tab)(/:sidebar)' => 'pages#tutorial', as: :tutorial
get '/prominent_users' => 'pages#prominent_users'
get '/disclaimer' => 'pages#disclaimer'
get '/privacy_statement' => 'pages#privacy_statement'
get '/show_all_countries' => 'pages#show_all_countries'
get '/show_flanders' => 'pages#show_flanders'
get '/sitemap(.:format)' => 'pages#sitemap', defaults: {format: :xml}
get '/known_issues' => 'pages#bugs', as: :bugs
get '/quality_control' => 'pages#quality', as: :quality
get '/set_locale(/:locale)' => 'pages#set_locale', as: :set_locale
get '/browser_support' => 'pages#browser_support'
get '/update_footer' => 'pages#update_footer'
get "/404", to: "pages#404"
get "/500", to: "pages#500"
end
|
Pod::Spec.new do |spec|
spec.name = 'Heimdall'
spec.version = '2.0-alpha.1'
spec.authors = {
'Felix Jendrusch' => 'felix@rheinfabrik.de',
'Tim Brückmann' => 'tim@rheinfabrik.de'
}
spec.license = {
:type => 'Apache License, Version 2.0',
:file => 'LICENSE'
}
spec.homepage = 'https://github.com/rheinfabrik/Heimdall.swift'
spec.source = {
:git => 'https://github.com/rheinfabrik/Heimdall.swift.git',
:branch => 'feature/swift-2.0'
}
spec.summary = 'Easy to use OAuth 2 library for iOS, written in Swift'
spec.description = 'Heimdall is an OAuth 2.0 client specifically designed for easy usage. It currently supports the resource owner password credentials grant flow, refreshing an access token as well as extension grants.'
spec.platform = :ios, '8.0'
spec.dependency 'Argo', '~> 2.0'
spec.dependency 'KeychainAccess', '~> 2.0'
spec.dependency 'Result', '0.6-beta.1'
spec.framework = 'Foundation'
spec.source_files = 'Heimdall/**/*.{h,swift}'
end
Bump version in Heimdall.podspec
Pod::Spec.new do |spec|
spec.name = 'Heimdall'
spec.version = '2.0-alpha.2'
spec.authors = {
'Felix Jendrusch' => 'felix@rheinfabrik.de',
'Tim Brückmann' => 'tim@rheinfabrik.de'
}
spec.license = {
:type => 'Apache License, Version 2.0',
:file => 'LICENSE'
}
spec.homepage = 'https://github.com/rheinfabrik/Heimdall.swift'
spec.source = {
:git => 'https://github.com/rheinfabrik/Heimdall.swift.git',
:branch => 'feature/swift-2.0'
}
spec.summary = 'Easy to use OAuth 2 library for iOS, written in Swift'
spec.description = 'Heimdall is an OAuth 2.0 client specifically designed for easy usage. It currently supports the resource owner password credentials grant flow, refreshing an access token as well as extension grants.'
spec.platform = :ios, '8.0'
spec.dependency 'Argo', '~> 2.0'
spec.dependency 'KeychainAccess', '~> 2.0'
spec.dependency 'Result', '0.6-beta.1'
spec.framework = 'Foundation'
spec.source_files = 'Heimdall/**/*.{h,swift}'
end
|
# s t a g e s
set :stages, %w(integration staging production)
require 'capistrano/ext/multistage'
set :stage, nil
set :default_stage, "integration"
# v e r s i o n c o n t r o l
set :scm, :git
# r e m o t e s e r v e r
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
set :git_enable_submodules, 1
set :use_sudo, false
set :keep_releases, 2
set (:document_root) {"#{deploy_to}/current/public"}
set (:server_cache_dir) {"#{current_release}/application/data/cache"}
set :ssh_keys, File.read("garp/application/configs/authorized_keys")
# d e p l o y
after "deploy:update_code", "deploy:cleanup"
namespace :deploy do
desc "Set up server instance"
task :setup do
transaction do
add_public_ssh_keys
find_webroot
mark_git_server_safe
create_deploy_dirs
set_shared_dirs_permissions
create_webroot_reroute_htaccess
install_crontab
prompt_to_set_newly_found_deploy_dir
end
end
desc "Deploy project"
task :update do
transaction do
update_code
create_system_cache_dirs
create_static_cache_dir
create_log_dir
set_blackhole_path_symlink_fix
_spawn
update_version
env_setup
set_webroot_permissions
symlink
end
end
# Overwritten because cap looks for Rails directories (javascripts, stylesheets, images)
desc "Finalize update"
task :finalize_update do
transaction do
# zzzz
end
end
# ------- P R I V A T E S E T U P M E T H O D S
desc "Add public SSH keys"
task :add_public_ssh_keys do
run "if [ ! -d '~/.ssh' ]; then mkdir -p ~/.ssh; fi"
run "chmod 700 ~/.ssh"
run "printf \'#{ssh_keys}\' > ~/.ssh/authorized_keys"
run "chmod 700 ~/.ssh/authorized_keys"
end
desc "Find webroot dir"
task :find_webroot do
if deploy_to.start_with?('/u/apps/')
# deploy_to is not set yet
set :pwd, capture("pwd").strip
if capture("[ -d #{pwd}/web ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/web"
set :unset_deploy_to, deploy_to
elsif capture("[ -d #{pwd}/public ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/public"
set :unset_deploy_to, deploy_to
elsif capture("[ -d #{pwd}/html ] && echo '1' || echo '0'").strip == '1'
find_servers_for_task(current_task).each do |current_server|
set :domain_dir, "#{pwd}/html/#{current_server.host}"
if capture("[ -d #{domain_dir} ] && echo '1' || echo '0'").strip == '1' and capture("[ -d #{domain_dir}/public ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{domain_dir}/public"
set :unset_deploy_to, deploy_to
else
raise "Can't autodetect the webroot dir, I know it's not: #{domain_dir}/public"
end
end
elsif capture("[ -d #{pwd}/httpdocs ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/httpdocs"
set :unset_deploy_to, deploy_to
else
raise "Oops! :deploy_to is not set, and I can't seem to find the webroot directory myself..."
end
end
end
desc "Mark Git server as safe"
task :mark_git_server_safe do
run "touch ~/.ssh/known_hosts && ssh-keyscan -t rsa,dsa flow.grrr.nl 2>&1 | sort -u - ~/.ssh/known_hosts > ~/.ssh/tmp_hosts && cat ~/.ssh/tmp_hosts > ~/.ssh/known_hosts && rm ~/.ssh/tmp_hosts"
end
desc "Create essential deploy directories"
task :create_deploy_dirs do
run "if [ ! -d '#{deploy_to}/releases' ]; then mkdir -p #{deploy_to}/releases; fi"
run "if [ ! -d '#{deploy_to}/shared/backup/db' ]; then mkdir -p #{deploy_to}/shared/backup/db; fi"
run "if [ ! -d '#{deploy_to}/shared/uploads/documents' ]; then mkdir -p #{deploy_to}/shared/uploads/documents; fi"
run "if [ ! -d '#{deploy_to}/shared/uploads/images' ]; then mkdir -p #{deploy_to}/shared/uploads/images; fi"
run "if [ ! -d '#{deploy_to}/shared/logs' ]; then mkdir -p #{deploy_to}/shared/logs; fi"
end
desc "Set permissions on essential deploy directories"
task :set_shared_dirs_permissions do
run "chmod -R g+w #{deploy_to}/shared/backup/db"
run "chmod -R g+w,o+rx #{deploy_to}/shared/uploads/documents"
run "chmod -R g+w,o+rx #{deploy_to}/shared/uploads/images"
run "chmod -R g+w,o+rx #{deploy_to}/shared/logs"
end
desc "Install crontab"
task :install_crontab do
php_exec = "/usr/bin/php"
garp_exec = "#{deploy_to}/current/garp/scripts/garp.php"
tab_frequent = "*/5 * * * * #{php_exec} #{garp_exec} cron frequently --e=#{garp_env} >/dev/null 2>&1"
tab_hourly = "0 * * * * #{php_exec} #{garp_exec} cron hourly --e=#{garp_env} >/dev/null 2>&1"
tab_daily = "0 4 * * * #{php_exec} #{garp_exec} cron daily --e=#{garp_env} >/dev/null 2>&1"
cron_tmp_file = ".crontab-tmp-output"
cmd_output_cron = "crontab -l > #{cron_tmp_file}"
cmd_append = 'if [ ! "`cat %s | grep \'%s\'`" ]; then echo "%s" | tee -a %s; fi;'
cmd_install = "crontab #{cron_tmp_file}"
cmd_remove_cron_output = "rm #{cron_tmp_file}"
cmd_frequent = sprintf cmd_append, cron_tmp_file, 'cron frequently', tab_frequent, cron_tmp_file
cmd_hourly = sprintf cmd_append, cron_tmp_file, 'cron hourly', tab_hourly, cron_tmp_file
cmd_daily = sprintf cmd_append, cron_tmp_file, 'cron daily', tab_daily, cron_tmp_file
begin
run cmd_output_cron
rescue Exception => error
puts "No cronjob present yet"
end
# run cmd_output_cron
run cmd_frequent
run cmd_hourly
run cmd_daily
run cmd_install
run cmd_remove_cron_output
end
desc "Create .htaccess file to reroute webroot"
task :create_webroot_reroute_htaccess do
run "printf '<IfModule mod_rewrite.c>\\n\\tRewriteEngine on\\n\\tRewriteRule ^(.*)$ current/public/$1 [L]\\n</IfModule>' > #{deploy_to}/.htaccess"
end
task :prompt_to_set_newly_found_deploy_dir do
if exists?(:unset_deploy_to)
puts("\033[1;31mDone. Now please set :deploy_to in deploy.rb to:\n#{unset_deploy_to}\033[0m")
end
end
# ------- P R I V A T E D E P L O Y M E T H O D S
desc "Create backend cache directories"
task :create_system_cache_dirs do
run "if [ ! -d '#{server_cache_dir}' ]; then mkdir -p #{server_cache_dir}; fi";
run "if [ ! -d '#{server_cache_dir}/URI' ]; then mkdir -p #{server_cache_dir}/URI; fi";
run "if [ ! -d '#{server_cache_dir}/HTML' ]; then mkdir -p #{server_cache_dir}/HTML; fi";
run "if [ ! -d '#{server_cache_dir}/CSS' ]; then mkdir -p #{server_cache_dir}/CSS; fi";
run "if [ ! -d '#{server_cache_dir}/tags' ]; then mkdir -p #{server_cache_dir}/tags; fi";
# run "echo '<?php' > #{server_cache_dir}/pluginLoaderCache.php"
end
desc "Create static html cache directory"
task :create_static_cache_dir do
run "if [ ! -d '#{current_release}/public/cached' ]; then mkdir -p #{current_release}/public/cached; fi";
end
desc "Make sure the log file directory is present"
task :create_log_dir do
run "if [ ! -d '#{current_release}/application/data/logs' ]; then mkdir -p #{current_release}/application/data/logs; fi";
end
desc "Fix casing"
task :set_blackhole_path_symlink_fix do
run "ln -nfs BlackHole.php #{current_release}/library/Zend/Cache/Backend/Blackhole.php"
end
desc "Spawn models"
task :_spawn do
run "php #{current_release}/garp/scripts/garp.php Spawn --e=#{garp_env}"
end
desc "Update the application and Garp version numbers"
task :update_version do
run "php #{current_release}/garp/scripts/garp.php Version update --e=#{garp_env}"
run "php #{current_release}/garp/scripts/garp.php Version update garp --e=#{garp_env}"
end
desc "Perform administrative tasks after deploy"
task :env_setup do
run "php #{current_release}/garp/scripts/garp.php Env setup --e=#{garp_env}"
end
desc "Set webroot directory permissions"
task :set_webroot_permissions do
run "chmod -R g+w #{releases_path}/#{release_name}"
end
desc "Point the webroot symlink to the current release"
task :symlink do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
end
end
desc "Throw a warning when deploying to production"
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to deploy to a live, public server.
Please confirm that your work is ready for that.
========================================================================
WARN
answer = Capistrano::CLI.ui.ask " Are you sure? (y) "
if answer == 'y' then true else false end
end
unless fetch(:confirmed)
puts "\nDeploy cancelled!"
exit
end
end
before 'production', :ask_production_confirmation
fixed bash replace cronjob
# s t a g e s
set :stages, %w(integration staging production)
require 'capistrano/ext/multistage'
set :stage, nil
set :default_stage, "integration"
# v e r s i o n c o n t r o l
set :scm, :git
# r e m o t e s e r v e r
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
set :git_enable_submodules, 1
set :use_sudo, false
set :keep_releases, 2
set (:document_root) {"#{deploy_to}/current/public"}
set (:server_cache_dir) {"#{current_release}/application/data/cache"}
set :ssh_keys, File.read("garp/application/configs/authorized_keys")
# d e p l o y
after "deploy:update_code", "deploy:cleanup"
namespace :deploy do
desc "Set up server instance"
task :setup do
transaction do
add_public_ssh_keys
find_webroot
mark_git_server_safe
create_deploy_dirs
set_shared_dirs_permissions
create_webroot_reroute_htaccess
install_crontab
prompt_to_set_newly_found_deploy_dir
end
end
desc "Deploy project"
task :update do
transaction do
update_code
create_system_cache_dirs
create_static_cache_dir
create_log_dir
set_blackhole_path_symlink_fix
_spawn
update_version
env_setup
set_webroot_permissions
symlink
end
end
# Overwritten because cap looks for Rails directories (javascripts, stylesheets, images)
desc "Finalize update"
task :finalize_update do
transaction do
# zzzz
end
end
# ------- P R I V A T E S E T U P M E T H O D S
desc "Add public SSH keys"
task :add_public_ssh_keys do
run "if [ ! -d '~/.ssh' ]; then mkdir -p ~/.ssh; fi"
run "chmod 700 ~/.ssh"
run "printf \'#{ssh_keys}\' > ~/.ssh/authorized_keys"
run "chmod 700 ~/.ssh/authorized_keys"
end
desc "Find webroot dir"
task :find_webroot do
if deploy_to.start_with?('/u/apps/')
# deploy_to is not set yet
set :pwd, capture("pwd").strip
if capture("[ -d #{pwd}/web ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/web"
set :unset_deploy_to, deploy_to
elsif capture("[ -d #{pwd}/public ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/public"
set :unset_deploy_to, deploy_to
elsif capture("[ -d #{pwd}/html ] && echo '1' || echo '0'").strip == '1'
find_servers_for_task(current_task).each do |current_server|
set :domain_dir, "#{pwd}/html/#{current_server.host}"
if capture("[ -d #{domain_dir} ] && echo '1' || echo '0'").strip == '1' and capture("[ -d #{domain_dir}/public ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{domain_dir}/public"
set :unset_deploy_to, deploy_to
else
raise "Can't autodetect the webroot dir, I know it's not: #{domain_dir}/public"
end
end
elsif capture("[ -d #{pwd}/httpdocs ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/httpdocs"
set :unset_deploy_to, deploy_to
else
raise "Oops! :deploy_to is not set, and I can't seem to find the webroot directory myself..."
end
end
end
desc "Mark Git server as safe"
task :mark_git_server_safe do
run "touch ~/.ssh/known_hosts && ssh-keyscan -t rsa,dsa flow.grrr.nl 2>&1 | sort -u - ~/.ssh/known_hosts > ~/.ssh/tmp_hosts && cat ~/.ssh/tmp_hosts > ~/.ssh/known_hosts && rm ~/.ssh/tmp_hosts"
end
desc "Create essential deploy directories"
task :create_deploy_dirs do
run "if [ ! -d '#{deploy_to}/releases' ]; then mkdir -p #{deploy_to}/releases; fi"
run "if [ ! -d '#{deploy_to}/shared/backup/db' ]; then mkdir -p #{deploy_to}/shared/backup/db; fi"
run "if [ ! -d '#{deploy_to}/shared/uploads/documents' ]; then mkdir -p #{deploy_to}/shared/uploads/documents; fi"
run "if [ ! -d '#{deploy_to}/shared/uploads/images' ]; then mkdir -p #{deploy_to}/shared/uploads/images; fi"
run "if [ ! -d '#{deploy_to}/shared/logs' ]; then mkdir -p #{deploy_to}/shared/logs; fi"
end
desc "Set permissions on essential deploy directories"
task :set_shared_dirs_permissions do
run "chmod -R g+w #{deploy_to}/shared/backup/db"
run "chmod -R g+w,o+rx #{deploy_to}/shared/uploads/documents"
run "chmod -R g+w,o+rx #{deploy_to}/shared/uploads/images"
run "chmod -R g+w,o+rx #{deploy_to}/shared/logs"
end
desc "Install crontab"
task :install_crontab do
php_exec = "/usr/bin/php"
garp_exec = "#{deploy_to}/current/garp/scripts/garp.php"
tab_frequent = "*/5 * * * * #{php_exec} #{garp_exec} cron frequently --e=#{garp_env} >/dev/null 2>&1"
tab_hourly = "0 * * * * #{php_exec} #{garp_exec} cron hourly --e=#{garp_env} >/dev/null 2>&1"
tab_daily = "0 4 * * * #{php_exec} #{garp_exec} cron daily --e=#{garp_env} >/dev/null 2>&1"
cron_tmp_file = ".crontab-tmp-output"
cmd_output_cron = "crontab -l > #{cron_tmp_file}"
cmd_append = 'if [ ! "`cat %s | grep \'%s\'`" ]; then echo "%s" | tee -a %s; fi;'
cmd_install = "crontab #{cron_tmp_file}"
cmd_remove_cron_output = "rm #{cron_tmp_file}"
cmd_frequent = sprintf cmd_append, cron_tmp_file, "cron frequently --e=#{garp_env}", tab_frequent, cron_tmp_file
cmd_hourly = sprintf cmd_append, cron_tmp_file, "cron hourly --e=#{garp_env}", tab_hourly, cron_tmp_file
cmd_daily = sprintf cmd_append, cron_tmp_file, "cron daily --e=#{garp_env}", tab_daily, cron_tmp_file
begin
run cmd_output_cron
rescue Exception => error
puts "No cronjob present yet"
end
# run cmd_output_cron
run cmd_frequent
run cmd_hourly
run cmd_daily
run cmd_install
run cmd_remove_cron_output
end
desc "Create .htaccess file to reroute webroot"
task :create_webroot_reroute_htaccess do
run "printf '<IfModule mod_rewrite.c>\\n\\tRewriteEngine on\\n\\tRewriteRule ^(.*)$ current/public/$1 [L]\\n</IfModule>' > #{deploy_to}/.htaccess"
end
task :prompt_to_set_newly_found_deploy_dir do
if exists?(:unset_deploy_to)
puts("\033[1;31mDone. Now please set :deploy_to in deploy.rb to:\n#{unset_deploy_to}\033[0m")
end
end
# ------- P R I V A T E D E P L O Y M E T H O D S
desc "Create backend cache directories"
task :create_system_cache_dirs do
run "if [ ! -d '#{server_cache_dir}' ]; then mkdir -p #{server_cache_dir}; fi";
run "if [ ! -d '#{server_cache_dir}/URI' ]; then mkdir -p #{server_cache_dir}/URI; fi";
run "if [ ! -d '#{server_cache_dir}/HTML' ]; then mkdir -p #{server_cache_dir}/HTML; fi";
run "if [ ! -d '#{server_cache_dir}/CSS' ]; then mkdir -p #{server_cache_dir}/CSS; fi";
run "if [ ! -d '#{server_cache_dir}/tags' ]; then mkdir -p #{server_cache_dir}/tags; fi";
# run "echo '<?php' > #{server_cache_dir}/pluginLoaderCache.php"
end
desc "Create static html cache directory"
task :create_static_cache_dir do
run "if [ ! -d '#{current_release}/public/cached' ]; then mkdir -p #{current_release}/public/cached; fi";
end
desc "Make sure the log file directory is present"
task :create_log_dir do
run "if [ ! -d '#{current_release}/application/data/logs' ]; then mkdir -p #{current_release}/application/data/logs; fi";
end
desc "Fix casing"
task :set_blackhole_path_symlink_fix do
run "ln -nfs BlackHole.php #{current_release}/library/Zend/Cache/Backend/Blackhole.php"
end
desc "Spawn models"
task :_spawn do
run "php #{current_release}/garp/scripts/garp.php Spawn --e=#{garp_env}"
end
desc "Update the application and Garp version numbers"
task :update_version do
run "php #{current_release}/garp/scripts/garp.php Version update --e=#{garp_env}"
run "php #{current_release}/garp/scripts/garp.php Version update garp --e=#{garp_env}"
end
desc "Perform administrative tasks after deploy"
task :env_setup do
run "php #{current_release}/garp/scripts/garp.php Env setup --e=#{garp_env}"
end
desc "Set webroot directory permissions"
task :set_webroot_permissions do
run "chmod -R g+w #{releases_path}/#{release_name}"
end
desc "Point the webroot symlink to the current release"
task :symlink do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
end
end
desc "Throw a warning when deploying to production"
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to deploy to a live, public server.
Please confirm that your work is ready for that.
========================================================================
WARN
answer = Capistrano::CLI.ui.ask " Are you sure? (y) "
if answer == 'y' then true else false end
end
unless fetch(:confirmed)
puts "\nDeploy cancelled!"
exit
end
end
before 'production', :ask_production_confirmation
|
# frozen_string_literal: true
require 'sidekiq_unique_jobs/web'
require 'sidekiq-scheduler/web'
Rails.application.routes.draw do
# Paths of routes on the web app that to not require to be indexed or
# have alternative format representations requiring separate controllers
web_app_paths = %w(
/getting-started
/keyboard-shortcuts
/home
/public
/public/local
/conversations
/lists/(*any)
/notifications
/favourites
/bookmarks
/pinned
/start
/directory
/explore/(*any)
/search
/publish
/follow_requests
/blocks
/domain_blocks
/mutes
).freeze
root 'home#index'
mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
get 'health', to: 'health#show'
authenticate :user, lambda { |u| u.role&.can?(:view_devops) } do
mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
mount PgHero::Engine, at: 'pghero', as: :pghero
end
use_doorkeeper do
controllers authorizations: 'oauth/authorizations',
authorized_applications: 'oauth/authorized_applications',
tokens: 'oauth/tokens'
end
get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' }
get '.well-known/nodeinfo', to: 'well_known/nodeinfo#index', as: :nodeinfo, defaults: { format: 'json' }
get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger
get '.well-known/change-password', to: redirect('/auth/edit')
get '/nodeinfo/2.0', to: 'well_known/nodeinfo#show', as: :nodeinfo_schema
get 'manifest', to: 'manifests#show', defaults: { format: 'json' }
get 'intent', to: 'intents#show'
get 'custom.css', to: 'custom_css#show', as: :custom_css
resource :instance_actor, path: 'actor', only: [:show] do
resource :inbox, only: [:create], module: :activitypub
resource :outbox, only: [:show], module: :activitypub
end
devise_scope :user do
get '/invite/:invite_code', to: 'auth/registrations#new', as: :public_invite
namespace :auth do
resource :setup, only: [:show, :update], controller: :setup
resource :challenge, only: [:create], controller: :challenges
get 'sessions/security_key_options', to: 'sessions#webauthn_options'
end
end
devise_for :users, path: 'auth', controllers: {
omniauth_callbacks: 'auth/omniauth_callbacks',
sessions: 'auth/sessions',
registrations: 'auth/registrations',
passwords: 'auth/passwords',
confirmations: 'auth/confirmations',
}
get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? }
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
resources :accounts, path: 'users', only: [:show], param: :username do
resources :statuses, only: [:show] do
member do
get :activity
get :embed
end
resources :replies, only: [:index], module: :activitypub
end
resources :followers, only: [:index], controller: :follower_accounts
resources :following, only: [:index], controller: :following_accounts
resource :follow, only: [:create], controller: :account_follow
resource :unfollow, only: [:create], controller: :account_unfollow
resource :outbox, only: [:show], module: :activitypub
resource :inbox, only: [:create], module: :activitypub
resource :claim, only: [:create], module: :activitypub
resources :collections, only: [:show], module: :activitypub
resource :followers_synchronization, only: [:show], module: :activitypub
end
resource :inbox, only: [:create], module: :activitypub
constraints(username: /[^@\/.]+/) do
get '/@:username', to: 'accounts#show', as: :short_account
get '/@:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
get '/@:username/media', to: 'accounts#show', as: :short_account_media
get '/@:username/tagged/:tag', to: 'accounts#show', as: :short_account_tag
end
constraints(account_username: /[^@\/.]+/) do
get '/@:account_username/following', to: 'following_accounts#index'
get '/@:account_username/followers', to: 'follower_accounts#index'
get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
get '/@:account_username/:id/embed', to: 'statuses#embed', as: :embed_short_account_status
end
get '/@:username_with_domain/(*any)', to: 'home#index', constraints: { username_with_domain: /([^\/])+?/ }, format: false
get '/settings', to: redirect('/settings/profile')
namespace :settings do
resource :profile, only: [:show, :update] do
resources :pictures, only: :destroy
end
get :preferences, to: redirect('/settings/preferences/appearance')
namespace :preferences do
resource :appearance, only: [:show, :update], controller: :appearance
resource :notifications, only: [:show, :update]
resource :other, only: [:show, :update], controller: :other
end
resource :import, only: [:show, :create]
resource :export, only: [:show, :create]
namespace :exports, constraints: { format: :csv } do
resources :follows, only: :index, controller: :following_accounts
resources :blocks, only: :index, controller: :blocked_accounts
resources :mutes, only: :index, controller: :muted_accounts
resources :lists, only: :index, controller: :lists
resources :domain_blocks, only: :index, controller: :blocked_domains
resources :bookmarks, only: :index, controller: :bookmarks
end
resources :two_factor_authentication_methods, only: [:index] do
collection do
post :disable
end
end
resource :otp_authentication, only: [:show, :create], controller: 'two_factor_authentication/otp_authentication'
resources :webauthn_credentials, only: [:index, :new, :create, :destroy],
path: 'security_keys',
controller: 'two_factor_authentication/webauthn_credentials' do
collection do
get :options
end
end
namespace :two_factor_authentication do
resources :recovery_codes, only: [:create]
resource :confirmation, only: [:new, :create]
end
resources :applications, except: [:edit] do
member do
post :regenerate
end
end
resource :delete, only: [:show, :destroy]
resource :migration, only: [:show, :create]
namespace :migration do
resource :redirect, only: [:new, :create, :destroy]
end
resources :aliases, only: [:index, :create, :destroy]
resources :sessions, only: [:destroy]
resources :featured_tags, only: [:index, :create, :destroy]
resources :login_activities, only: [:index]
end
namespace :disputes do
resources :strikes, only: [:show, :index] do
resource :appeal, only: [:create]
end
end
resources :media, only: [:show] do
get :player
end
resources :tags, only: [:show]
resources :emojis, only: [:show]
resources :invites, only: [:index, :create, :destroy]
resources :filters, except: [:show] do
resources :statuses, only: [:index], controller: 'filters/statuses' do
collection do
post :batch
end
end
end
resource :relationships, only: [:show, :update]
resource :statuses_cleanup, controller: :statuses_cleanup, only: [:show, :update]
get '/media_proxy/:id/(*any)', to: 'media_proxy#show', as: :media_proxy
resource :authorize_interaction, only: [:show, :create]
resource :share, only: [:show, :create]
namespace :admin do
get '/dashboard', to: 'dashboard#index'
resources :domain_allows, only: [:new, :create, :show, :destroy]
resources :domain_blocks, only: [:new, :create, :destroy, :update, :edit]
resources :email_domain_blocks, only: [:index, :new, :create] do
collection do
post :batch
end
end
resources :action_logs, only: [:index]
resources :warning_presets, except: [:new]
resources :announcements, except: [:show] do
member do
post :publish
post :unpublish
end
end
get '/settings', to: redirect('/admin/settings/branding')
get '/settings/edit', to: redirect('/admin/settings/branding')
namespace :settings do
resource :branding, only: [:show, :update], controller: 'branding'
resource :registrations, only: [:show, :update], controller: 'registrations'
resource :content_retention, only: [:show, :update], controller: 'content_retention'
resource :about, only: [:show, :update], controller: 'about'
resource :appearance, only: [:show, :update], controller: 'appearance'
resource :discovery, only: [:show, :update], controller: 'discovery'
end
resources :site_uploads, only: [:destroy]
resources :invites, only: [:index, :create, :destroy] do
collection do
post :deactivate_all
end
end
resources :relays, only: [:index, :new, :create, :destroy] do
member do
post :enable
post :disable
end
end
resources :instances, only: [:index, :show, :destroy], constraints: { id: /[^\/]+/ } do
member do
post :clear_delivery_errors
post :restart_delivery
post :stop_delivery
end
end
resources :rules
resources :webhooks do
member do
post :enable
post :disable
end
resource :secret, only: [], controller: 'webhooks/secrets' do
post :rotate
end
end
resources :reports, only: [:index, :show] do
resources :actions, only: [:create], controller: 'reports/actions'
member do
post :assign_to_self
post :unassign
post :reopen
post :resolve
end
end
resources :report_notes, only: [:create, :destroy]
resources :accounts, only: [:index, :show, :destroy] do
member do
post :enable
post :unsensitive
post :unsilence
post :unsuspend
post :redownload
post :remove_avatar
post :remove_header
post :memorialize
post :approve
post :reject
post :unblock_email
end
collection do
post :batch
end
resource :change_email, only: [:show, :update]
resource :reset, only: [:create]
resource :action, only: [:new, :create], controller: 'account_actions'
resources :statuses, only: [:index, :show] do
collection do
post :batch
end
end
resources :relationships, only: [:index]
resource :confirmation, only: [:create] do
collection do
post :resend
end
end
end
resources :users, only: [] do
resource :two_factor_authentication, only: [:destroy], controller: 'users/two_factor_authentications'
resource :role, only: [:show, :update], controller: 'users/roles'
end
resources :custom_emojis, only: [:index, :new, :create] do
collection do
post :batch
end
end
resources :ip_blocks, only: [:index, :new, :create] do
collection do
post :batch
end
end
resources :roles, except: [:show]
resources :account_moderation_notes, only: [:create, :destroy]
resource :follow_recommendations, only: [:show, :update]
resources :tags, only: [:show, :update]
namespace :trends do
resources :links, only: [:index] do
collection do
post :batch
end
end
resources :tags, only: [:index] do
collection do
post :batch
end
end
resources :statuses, only: [:index] do
collection do
post :batch
end
end
namespace :links do
resources :preview_card_providers, only: [:index], path: :publishers do
collection do
post :batch
end
end
end
end
namespace :disputes do
resources :appeals, only: [:index] do
member do
post :approve
post :reject
end
end
end
end
get '/admin', to: redirect('/admin/dashboard', status: 302)
namespace :api do
# OEmbed
get '/oembed', to: 'oembed#show', as: :oembed
# JSON / REST API
namespace :v1 do
resources :statuses, only: [:create, :show, :update, :destroy] do
scope module: :statuses do
resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
resources :favourited_by, controller: :favourited_by_accounts, only: :index
resource :reblog, only: :create
post :unreblog, to: 'reblogs#destroy'
resource :favourite, only: :create
post :unfavourite, to: 'favourites#destroy'
resource :bookmark, only: :create
post :unbookmark, to: 'bookmarks#destroy'
resource :mute, only: :create
post :unmute, to: 'mutes#destroy'
resource :pin, only: :create
post :unpin, to: 'pins#destroy'
resource :history, only: :show
resource :source, only: :show
post :translate, to: 'translations#create'
end
member do
get :context
end
end
namespace :timelines do
resource :home, only: :show, controller: :home
resource :public, only: :show, controller: :public
resources :tag, only: :show
resources :list, only: :show
end
resources :streaming, only: [:index]
resources :custom_emojis, only: [:index]
resources :suggestions, only: [:index, :destroy]
resources :scheduled_statuses, only: [:index, :show, :update, :destroy]
resources :preferences, only: [:index]
resources :announcements, only: [:index] do
scope module: :announcements do
resources :reactions, only: [:update, :destroy]
end
member do
post :dismiss
end
end
# namespace :crypto do
# resources :deliveries, only: :create
# namespace :keys do
# resource :upload, only: [:create]
# resource :query, only: [:create]
# resource :claim, only: [:create]
# resource :count, only: [:show]
# end
# resources :encrypted_messages, only: [:index] do
# collection do
# post :clear
# end
# end
# end
resources :conversations, only: [:index, :destroy] do
member do
post :read
end
end
resources :media, only: [:create, :update, :show]
resources :blocks, only: [:index]
resources :mutes, only: [:index]
resources :favourites, only: [:index]
resources :bookmarks, only: [:index]
resources :reports, only: [:create]
resources :trends, only: [:index], controller: 'trends/tags'
resources :filters, only: [:index, :create, :show, :update, :destroy] do
resources :keywords, only: [:index, :create], controller: 'filters/keywords'
resources :statuses, only: [:index, :create], controller: 'filters/statuses'
end
resources :endorsements, only: [:index]
resources :markers, only: [:index, :create]
namespace :filters do
resources :keywords, only: [:show, :update, :destroy]
resources :statuses, only: [:show, :destroy]
end
namespace :apps do
get :verify_credentials, to: 'credentials#show'
end
resources :apps, only: [:create]
namespace :trends do
resources :links, only: [:index]
resources :tags, only: [:index]
resources :statuses, only: [:index]
end
namespace :emails do
resources :confirmations, only: [:create]
end
resource :instance, only: [:show] do
resources :peers, only: [:index], controller: 'instances/peers'
resources :rules, only: [:index], controller: 'instances/rules'
resources :domain_blocks, only: [:index], controller: 'instances/domain_blocks'
resource :privacy_policy, only: [:show], controller: 'instances/privacy_policies'
resource :extended_description, only: [:show], controller: 'instances/extended_descriptions'
resource :activity, only: [:show], controller: 'instances/activity'
end
resource :domain_blocks, only: [:show, :create, :destroy]
resource :directory, only: [:show]
resources :follow_requests, only: [:index] do
member do
post :authorize
post :reject
end
end
resources :notifications, only: [:index, :show] do
collection do
post :clear
end
member do
post :dismiss
end
end
namespace :accounts do
get :verify_credentials, to: 'credentials#show'
patch :update_credentials, to: 'credentials#update'
resource :search, only: :show, controller: :search
resource :lookup, only: :show, controller: :lookup
resources :relationships, only: :index
resources :familiar_followers, only: :index
end
resources :accounts, only: [:create, :show] do
resources :statuses, only: :index, controller: 'accounts/statuses'
resources :followers, only: :index, controller: 'accounts/follower_accounts'
resources :following, only: :index, controller: 'accounts/following_accounts'
resources :lists, only: :index, controller: 'accounts/lists'
resources :identity_proofs, only: :index, controller: 'accounts/identity_proofs'
resources :featured_tags, only: :index, controller: 'accounts/featured_tags'
member do
post :follow
post :unfollow
post :remove_from_followers
post :block
post :unblock
post :mute
post :unmute
end
resource :pin, only: :create, controller: 'accounts/pins'
post :unpin, to: 'accounts/pins#destroy'
resource :note, only: :create, controller: 'accounts/notes'
end
resources :tags, only: [:show] do
member do
post :follow
post :unfollow
end
end
resources :followed_tags, only: [:index]
resources :lists, only: [:index, :create, :show, :update, :destroy] do
resource :accounts, only: [:show, :create, :destroy], controller: 'lists/accounts'
end
namespace :featured_tags do
get :suggestions, to: 'suggestions#index'
end
resources :featured_tags, only: [:index, :create, :destroy]
resources :polls, only: [:create, :show] do
resources :votes, only: :create, controller: 'polls/votes'
end
namespace :push do
resource :subscription, only: [:create, :show, :update, :destroy]
end
namespace :admin do
resources :accounts, only: [:index, :show, :destroy] do
member do
post :enable
post :unsensitive
post :unsilence
post :unsuspend
post :approve
post :reject
end
resource :action, only: [:create], controller: 'account_actions'
end
resources :reports, only: [:index, :update, :show] do
member do
post :assign_to_self
post :unassign
post :reopen
post :resolve
end
end
resources :domain_allows, only: [:index, :show, :create, :destroy]
resources :domain_blocks, only: [:index, :show, :update, :create, :destroy]
resources :email_domain_blocks, only: [:index, :show, :create, :destroy]
resources :ip_blocks, only: [:index, :show, :update, :create, :destroy]
namespace :trends do
resources :tags, only: [:index]
resources :links, only: [:index]
resources :statuses, only: [:index]
end
post :measures, to: 'measures#create'
post :dimensions, to: 'dimensions#create'
post :retention, to: 'retention#create'
resources :canonical_email_blocks, only: [:index, :create, :show, :destroy] do
collection do
post :test
end
end
end
end
namespace :v2 do
get '/search', to: 'search#index', as: :search
resources :media, only: [:create]
resources :suggestions, only: [:index]
resources :filters, only: [:index, :create, :show, :update, :destroy]
resource :instance, only: [:show]
namespace :admin do
resources :accounts, only: [:index]
end
end
namespace :web do
resource :settings, only: [:update]
resource :embed, only: [:create]
resources :push_subscriptions, only: [:create] do
member do
put :update
end
end
end
end
web_app_paths.each do |path|
get path, to: 'home#index'
end
get '/web/(*any)', to: redirect('/%{any}', status: 302), as: :web
get '/about', to: 'about#show'
get '/about/more', to: redirect('/about')
get '/privacy-policy', to: 'privacy#show', as: :privacy_policy
get '/terms', to: redirect('/privacy-policy')
match '/', via: [:post, :put, :patch, :delete], to: 'application#raise_not_found', format: false
match '*unmatched_route', via: :all, to: 'application#raise_not_found', format: false
end
Fix `/web` prefix (#19468)
# frozen_string_literal: true
require 'sidekiq_unique_jobs/web'
require 'sidekiq-scheduler/web'
Rails.application.routes.draw do
# Paths of routes on the web app that to not require to be indexed or
# have alternative format representations requiring separate controllers
web_app_paths = %w(
/getting-started
/keyboard-shortcuts
/home
/public
/public/local
/conversations
/lists/(*any)
/notifications
/favourites
/bookmarks
/pinned
/start
/directory
/explore/(*any)
/search
/publish
/follow_requests
/blocks
/domain_blocks
/mutes
).freeze
root 'home#index'
mount LetterOpenerWeb::Engine, at: 'letter_opener' if Rails.env.development?
get 'health', to: 'health#show'
authenticate :user, lambda { |u| u.role&.can?(:view_devops) } do
mount Sidekiq::Web, at: 'sidekiq', as: :sidekiq
mount PgHero::Engine, at: 'pghero', as: :pghero
end
use_doorkeeper do
controllers authorizations: 'oauth/authorizations',
authorized_applications: 'oauth/authorized_applications',
tokens: 'oauth/tokens'
end
get '.well-known/host-meta', to: 'well_known/host_meta#show', as: :host_meta, defaults: { format: 'xml' }
get '.well-known/nodeinfo', to: 'well_known/nodeinfo#index', as: :nodeinfo, defaults: { format: 'json' }
get '.well-known/webfinger', to: 'well_known/webfinger#show', as: :webfinger
get '.well-known/change-password', to: redirect('/auth/edit')
get '/nodeinfo/2.0', to: 'well_known/nodeinfo#show', as: :nodeinfo_schema
get 'manifest', to: 'manifests#show', defaults: { format: 'json' }
get 'intent', to: 'intents#show'
get 'custom.css', to: 'custom_css#show', as: :custom_css
resource :instance_actor, path: 'actor', only: [:show] do
resource :inbox, only: [:create], module: :activitypub
resource :outbox, only: [:show], module: :activitypub
end
devise_scope :user do
get '/invite/:invite_code', to: 'auth/registrations#new', as: :public_invite
namespace :auth do
resource :setup, only: [:show, :update], controller: :setup
resource :challenge, only: [:create], controller: :challenges
get 'sessions/security_key_options', to: 'sessions#webauthn_options'
end
end
devise_for :users, path: 'auth', controllers: {
omniauth_callbacks: 'auth/omniauth_callbacks',
sessions: 'auth/sessions',
registrations: 'auth/registrations',
passwords: 'auth/passwords',
confirmations: 'auth/confirmations',
}
get '/users/:username', to: redirect('/@%{username}'), constraints: lambda { |req| req.format.nil? || req.format.html? }
get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" }
resources :accounts, path: 'users', only: [:show], param: :username do
resources :statuses, only: [:show] do
member do
get :activity
get :embed
end
resources :replies, only: [:index], module: :activitypub
end
resources :followers, only: [:index], controller: :follower_accounts
resources :following, only: [:index], controller: :following_accounts
resource :follow, only: [:create], controller: :account_follow
resource :unfollow, only: [:create], controller: :account_unfollow
resource :outbox, only: [:show], module: :activitypub
resource :inbox, only: [:create], module: :activitypub
resource :claim, only: [:create], module: :activitypub
resources :collections, only: [:show], module: :activitypub
resource :followers_synchronization, only: [:show], module: :activitypub
end
resource :inbox, only: [:create], module: :activitypub
constraints(username: /[^@\/.]+/) do
get '/@:username', to: 'accounts#show', as: :short_account
get '/@:username/with_replies', to: 'accounts#show', as: :short_account_with_replies
get '/@:username/media', to: 'accounts#show', as: :short_account_media
get '/@:username/tagged/:tag', to: 'accounts#show', as: :short_account_tag
end
constraints(account_username: /[^@\/.]+/) do
get '/@:account_username/following', to: 'following_accounts#index'
get '/@:account_username/followers', to: 'follower_accounts#index'
get '/@:account_username/:id', to: 'statuses#show', as: :short_account_status
get '/@:account_username/:id/embed', to: 'statuses#embed', as: :embed_short_account_status
end
get '/@:username_with_domain/(*any)', to: 'home#index', constraints: { username_with_domain: /([^\/])+?/ }, format: false
get '/settings', to: redirect('/settings/profile')
namespace :settings do
resource :profile, only: [:show, :update] do
resources :pictures, only: :destroy
end
get :preferences, to: redirect('/settings/preferences/appearance')
namespace :preferences do
resource :appearance, only: [:show, :update], controller: :appearance
resource :notifications, only: [:show, :update]
resource :other, only: [:show, :update], controller: :other
end
resource :import, only: [:show, :create]
resource :export, only: [:show, :create]
namespace :exports, constraints: { format: :csv } do
resources :follows, only: :index, controller: :following_accounts
resources :blocks, only: :index, controller: :blocked_accounts
resources :mutes, only: :index, controller: :muted_accounts
resources :lists, only: :index, controller: :lists
resources :domain_blocks, only: :index, controller: :blocked_domains
resources :bookmarks, only: :index, controller: :bookmarks
end
resources :two_factor_authentication_methods, only: [:index] do
collection do
post :disable
end
end
resource :otp_authentication, only: [:show, :create], controller: 'two_factor_authentication/otp_authentication'
resources :webauthn_credentials, only: [:index, :new, :create, :destroy],
path: 'security_keys',
controller: 'two_factor_authentication/webauthn_credentials' do
collection do
get :options
end
end
namespace :two_factor_authentication do
resources :recovery_codes, only: [:create]
resource :confirmation, only: [:new, :create]
end
resources :applications, except: [:edit] do
member do
post :regenerate
end
end
resource :delete, only: [:show, :destroy]
resource :migration, only: [:show, :create]
namespace :migration do
resource :redirect, only: [:new, :create, :destroy]
end
resources :aliases, only: [:index, :create, :destroy]
resources :sessions, only: [:destroy]
resources :featured_tags, only: [:index, :create, :destroy]
resources :login_activities, only: [:index]
end
namespace :disputes do
resources :strikes, only: [:show, :index] do
resource :appeal, only: [:create]
end
end
resources :media, only: [:show] do
get :player
end
resources :tags, only: [:show]
resources :emojis, only: [:show]
resources :invites, only: [:index, :create, :destroy]
resources :filters, except: [:show] do
resources :statuses, only: [:index], controller: 'filters/statuses' do
collection do
post :batch
end
end
end
resource :relationships, only: [:show, :update]
resource :statuses_cleanup, controller: :statuses_cleanup, only: [:show, :update]
get '/media_proxy/:id/(*any)', to: 'media_proxy#show', as: :media_proxy
resource :authorize_interaction, only: [:show, :create]
resource :share, only: [:show, :create]
namespace :admin do
get '/dashboard', to: 'dashboard#index'
resources :domain_allows, only: [:new, :create, :show, :destroy]
resources :domain_blocks, only: [:new, :create, :destroy, :update, :edit]
resources :email_domain_blocks, only: [:index, :new, :create] do
collection do
post :batch
end
end
resources :action_logs, only: [:index]
resources :warning_presets, except: [:new]
resources :announcements, except: [:show] do
member do
post :publish
post :unpublish
end
end
get '/settings', to: redirect('/admin/settings/branding')
get '/settings/edit', to: redirect('/admin/settings/branding')
namespace :settings do
resource :branding, only: [:show, :update], controller: 'branding'
resource :registrations, only: [:show, :update], controller: 'registrations'
resource :content_retention, only: [:show, :update], controller: 'content_retention'
resource :about, only: [:show, :update], controller: 'about'
resource :appearance, only: [:show, :update], controller: 'appearance'
resource :discovery, only: [:show, :update], controller: 'discovery'
end
resources :site_uploads, only: [:destroy]
resources :invites, only: [:index, :create, :destroy] do
collection do
post :deactivate_all
end
end
resources :relays, only: [:index, :new, :create, :destroy] do
member do
post :enable
post :disable
end
end
resources :instances, only: [:index, :show, :destroy], constraints: { id: /[^\/]+/ } do
member do
post :clear_delivery_errors
post :restart_delivery
post :stop_delivery
end
end
resources :rules
resources :webhooks do
member do
post :enable
post :disable
end
resource :secret, only: [], controller: 'webhooks/secrets' do
post :rotate
end
end
resources :reports, only: [:index, :show] do
resources :actions, only: [:create], controller: 'reports/actions'
member do
post :assign_to_self
post :unassign
post :reopen
post :resolve
end
end
resources :report_notes, only: [:create, :destroy]
resources :accounts, only: [:index, :show, :destroy] do
member do
post :enable
post :unsensitive
post :unsilence
post :unsuspend
post :redownload
post :remove_avatar
post :remove_header
post :memorialize
post :approve
post :reject
post :unblock_email
end
collection do
post :batch
end
resource :change_email, only: [:show, :update]
resource :reset, only: [:create]
resource :action, only: [:new, :create], controller: 'account_actions'
resources :statuses, only: [:index, :show] do
collection do
post :batch
end
end
resources :relationships, only: [:index]
resource :confirmation, only: [:create] do
collection do
post :resend
end
end
end
resources :users, only: [] do
resource :two_factor_authentication, only: [:destroy], controller: 'users/two_factor_authentications'
resource :role, only: [:show, :update], controller: 'users/roles'
end
resources :custom_emojis, only: [:index, :new, :create] do
collection do
post :batch
end
end
resources :ip_blocks, only: [:index, :new, :create] do
collection do
post :batch
end
end
resources :roles, except: [:show]
resources :account_moderation_notes, only: [:create, :destroy]
resource :follow_recommendations, only: [:show, :update]
resources :tags, only: [:show, :update]
namespace :trends do
resources :links, only: [:index] do
collection do
post :batch
end
end
resources :tags, only: [:index] do
collection do
post :batch
end
end
resources :statuses, only: [:index] do
collection do
post :batch
end
end
namespace :links do
resources :preview_card_providers, only: [:index], path: :publishers do
collection do
post :batch
end
end
end
end
namespace :disputes do
resources :appeals, only: [:index] do
member do
post :approve
post :reject
end
end
end
end
get '/admin', to: redirect('/admin/dashboard', status: 302)
namespace :api do
# OEmbed
get '/oembed', to: 'oembed#show', as: :oembed
# JSON / REST API
namespace :v1 do
resources :statuses, only: [:create, :show, :update, :destroy] do
scope module: :statuses do
resources :reblogged_by, controller: :reblogged_by_accounts, only: :index
resources :favourited_by, controller: :favourited_by_accounts, only: :index
resource :reblog, only: :create
post :unreblog, to: 'reblogs#destroy'
resource :favourite, only: :create
post :unfavourite, to: 'favourites#destroy'
resource :bookmark, only: :create
post :unbookmark, to: 'bookmarks#destroy'
resource :mute, only: :create
post :unmute, to: 'mutes#destroy'
resource :pin, only: :create
post :unpin, to: 'pins#destroy'
resource :history, only: :show
resource :source, only: :show
post :translate, to: 'translations#create'
end
member do
get :context
end
end
namespace :timelines do
resource :home, only: :show, controller: :home
resource :public, only: :show, controller: :public
resources :tag, only: :show
resources :list, only: :show
end
resources :streaming, only: [:index]
resources :custom_emojis, only: [:index]
resources :suggestions, only: [:index, :destroy]
resources :scheduled_statuses, only: [:index, :show, :update, :destroy]
resources :preferences, only: [:index]
resources :announcements, only: [:index] do
scope module: :announcements do
resources :reactions, only: [:update, :destroy]
end
member do
post :dismiss
end
end
# namespace :crypto do
# resources :deliveries, only: :create
# namespace :keys do
# resource :upload, only: [:create]
# resource :query, only: [:create]
# resource :claim, only: [:create]
# resource :count, only: [:show]
# end
# resources :encrypted_messages, only: [:index] do
# collection do
# post :clear
# end
# end
# end
resources :conversations, only: [:index, :destroy] do
member do
post :read
end
end
resources :media, only: [:create, :update, :show]
resources :blocks, only: [:index]
resources :mutes, only: [:index]
resources :favourites, only: [:index]
resources :bookmarks, only: [:index]
resources :reports, only: [:create]
resources :trends, only: [:index], controller: 'trends/tags'
resources :filters, only: [:index, :create, :show, :update, :destroy] do
resources :keywords, only: [:index, :create], controller: 'filters/keywords'
resources :statuses, only: [:index, :create], controller: 'filters/statuses'
end
resources :endorsements, only: [:index]
resources :markers, only: [:index, :create]
namespace :filters do
resources :keywords, only: [:show, :update, :destroy]
resources :statuses, only: [:show, :destroy]
end
namespace :apps do
get :verify_credentials, to: 'credentials#show'
end
resources :apps, only: [:create]
namespace :trends do
resources :links, only: [:index]
resources :tags, only: [:index]
resources :statuses, only: [:index]
end
namespace :emails do
resources :confirmations, only: [:create]
end
resource :instance, only: [:show] do
resources :peers, only: [:index], controller: 'instances/peers'
resources :rules, only: [:index], controller: 'instances/rules'
resources :domain_blocks, only: [:index], controller: 'instances/domain_blocks'
resource :privacy_policy, only: [:show], controller: 'instances/privacy_policies'
resource :extended_description, only: [:show], controller: 'instances/extended_descriptions'
resource :activity, only: [:show], controller: 'instances/activity'
end
resource :domain_blocks, only: [:show, :create, :destroy]
resource :directory, only: [:show]
resources :follow_requests, only: [:index] do
member do
post :authorize
post :reject
end
end
resources :notifications, only: [:index, :show] do
collection do
post :clear
end
member do
post :dismiss
end
end
namespace :accounts do
get :verify_credentials, to: 'credentials#show'
patch :update_credentials, to: 'credentials#update'
resource :search, only: :show, controller: :search
resource :lookup, only: :show, controller: :lookup
resources :relationships, only: :index
resources :familiar_followers, only: :index
end
resources :accounts, only: [:create, :show] do
resources :statuses, only: :index, controller: 'accounts/statuses'
resources :followers, only: :index, controller: 'accounts/follower_accounts'
resources :following, only: :index, controller: 'accounts/following_accounts'
resources :lists, only: :index, controller: 'accounts/lists'
resources :identity_proofs, only: :index, controller: 'accounts/identity_proofs'
resources :featured_tags, only: :index, controller: 'accounts/featured_tags'
member do
post :follow
post :unfollow
post :remove_from_followers
post :block
post :unblock
post :mute
post :unmute
end
resource :pin, only: :create, controller: 'accounts/pins'
post :unpin, to: 'accounts/pins#destroy'
resource :note, only: :create, controller: 'accounts/notes'
end
resources :tags, only: [:show] do
member do
post :follow
post :unfollow
end
end
resources :followed_tags, only: [:index]
resources :lists, only: [:index, :create, :show, :update, :destroy] do
resource :accounts, only: [:show, :create, :destroy], controller: 'lists/accounts'
end
namespace :featured_tags do
get :suggestions, to: 'suggestions#index'
end
resources :featured_tags, only: [:index, :create, :destroy]
resources :polls, only: [:create, :show] do
resources :votes, only: :create, controller: 'polls/votes'
end
namespace :push do
resource :subscription, only: [:create, :show, :update, :destroy]
end
namespace :admin do
resources :accounts, only: [:index, :show, :destroy] do
member do
post :enable
post :unsensitive
post :unsilence
post :unsuspend
post :approve
post :reject
end
resource :action, only: [:create], controller: 'account_actions'
end
resources :reports, only: [:index, :update, :show] do
member do
post :assign_to_self
post :unassign
post :reopen
post :resolve
end
end
resources :domain_allows, only: [:index, :show, :create, :destroy]
resources :domain_blocks, only: [:index, :show, :update, :create, :destroy]
resources :email_domain_blocks, only: [:index, :show, :create, :destroy]
resources :ip_blocks, only: [:index, :show, :update, :create, :destroy]
namespace :trends do
resources :tags, only: [:index]
resources :links, only: [:index]
resources :statuses, only: [:index]
end
post :measures, to: 'measures#create'
post :dimensions, to: 'dimensions#create'
post :retention, to: 'retention#create'
resources :canonical_email_blocks, only: [:index, :create, :show, :destroy] do
collection do
post :test
end
end
end
end
namespace :v2 do
get '/search', to: 'search#index', as: :search
resources :media, only: [:create]
resources :suggestions, only: [:index]
resources :filters, only: [:index, :create, :show, :update, :destroy]
resource :instance, only: [:show]
namespace :admin do
resources :accounts, only: [:index]
end
end
namespace :web do
resource :settings, only: [:update]
resource :embed, only: [:create]
resources :push_subscriptions, only: [:create] do
member do
put :update
end
end
end
end
web_app_paths.each do |path|
get path, to: 'home#index'
end
get '/web/(*any)', to: redirect('/%{any}', status: 302), as: :web, defaults: { any: '' }
get '/about', to: 'about#show'
get '/about/more', to: redirect('/about')
get '/privacy-policy', to: 'privacy#show', as: :privacy_policy
get '/terms', to: redirect('/privacy-policy')
match '/', via: [:post, :put, :patch, :delete], to: 'application#raise_not_found', format: false
match '*unmatched_route', via: :all, to: 'application#raise_not_found', format: false
end
|
# s t a g e s
set :stages, %w(integration staging production)
require 'capistrano/ext/multistage'
set :stage, nil
set :default_stage, "integration"
# v e r s i o n c o n t r o l
set :scm, :git
# r e m o t e s e r v e r
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
set :git_enable_submodules, 1
set :use_sudo, false
set :keep_releases, 3
set (:document_root) {"#{deploy_to}/current/public"}
set (:server_cache_dir) {"#{current_release}/application/data/cache"}
set :ssh_keys, File.read("garp/application/configs/authorized_keys")
# d e p l o y
after "deploy:update_code", "deploy:cleanup"
namespace :deploy do
desc "Set up server instance"
task :setup do
transaction do
# add_public_ssh_keys
find_webroot
# mark_git_server_safe
# create_deploy_dirs
# set_shared_dirs_permissions
# create_webroot_reroute_htaccess
prompt_to_set_newly_found_deploy_dir
end
end
desc "Deploy project"
task :update do
transaction do
update_code
create_system_cache_dirs
create_static_cache_dir
create_log_dir
set_blackhole_path_symlink_fix
spawn
update_version
set_webroot_permissions
symlink
end
end
# ------- P R I V A T E S E T U P M E T H O D S
desc "Add public SSH keys"
task :add_public_ssh_keys do
run "if [ ! -d '~/.ssh' ]; then mkdir -p ~/.ssh; fi"
run "chmod 700 ~/.ssh"
run "echo -e \'#{ssh_keys}\' > ~/.ssh/authorized_keys"
run "chmod 700 ~/.ssh/authorized_keys"
end
desc "Find webroot dir"
task :find_webroot do
if capture("[ -d #{deploy_to} ] && echo '1' || echo '0'").strip == '0'
# deploy_to webroot dir does not exist on the server
set :pwd, capture("pwd").strip
if capture("[ -d #{pwd}/web ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/web"
set :unset_deploy_to, deploy_to
elsif capture("[ -d #{pwd}/public ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/public"
set :unset_deploy_to, deploy_to
elsif capture("[ -d #{pwd}/httpdocs ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/httpdocs"
set :unset_deploy_to, deploy_to
end
end
end
desc "Mark Git server as safe"
task :mark_git_server_safe do
run "touch ~/.ssh/known_hosts && ssh-keyscan -t rsa,dsa flow.grrr.nl 2>&1 | sort -u - ~/.ssh/known_hosts > ~/.ssh/tmp_hosts && cat ~/.ssh/tmp_hosts > ~/.ssh/known_hosts && rm ~/.ssh/tmp_hosts"
end
desc "Create essential deploy directories"
task :create_deploy_dirs do
run "if [ ! -d '#{deploy_to}/releases' ]; then mkdir -p #{deploy_to}/releases; fi"
run "if [ ! -d '#{deploy_to}/shared/uploads/documents' ]; then mkdir -p #{deploy_to}/shared/uploads/documents; fi"
run "if [ ! -d '#{deploy_to}/shared/uploads/images' ]; then mkdir -p #{deploy_to}/shared/uploads/images; fi"
end
desc "Set permissions on essential deploy directories"
task :set_shared_dirs_permissions do
run "chmod -R g+w #{deploy_to}/shared/uploads/documents"
run "chmod -R g+w #{deploy_to}/shared/uploads/images"
end
desc "Create .htaccess file to reroute webroot"
task :create_webroot_reroute_htaccess do
run "echo -e '<IfModule mod_rewrite.c>\\n\\tRewriteEngine on\\n\\tRewriteRule ^(.*)$ current/public/$1 [L]\\n</IfModule>' > #{deploy_to}/.htaccess"
end
task :prompt_to_set_newly_found_deploy_dir do
if exists?(:unset_deploy_to)
puts("\033[1;31mPlease set :deploy_to in deploy.rb to #{unset_deploy_to}\033[0m")
end
end
# ------- P R I V A T E D E P L O Y M E T H O D S
desc "Create backend cache directories"
task :create_system_cache_dirs do
run "if [ ! -d '#{server_cache_dir}' ]; then mkdir -p #{server_cache_dir}; fi";
run "if [ ! -d '#{server_cache_dir}/URI' ]; then mkdir -p #{server_cache_dir}/URI; fi";
run "if [ ! -d '#{server_cache_dir}/HTML' ]; then mkdir -p #{server_cache_dir}/HTML; fi";
run "if [ ! -d '#{server_cache_dir}/CSS' ]; then mkdir -p #{server_cache_dir}/CSS; fi";
run "if [ ! -d '#{server_cache_dir}/tags' ]; then mkdir -p #{server_cache_dir}/tags; fi";
# run "echo '<?php' > #{server_cache_dir}/pluginLoaderCache.php"
end
desc "Create static html cache directory"
task :create_static_cache_dir do
run "if [ ! -d '#{current_release}/public/cached' ]; then mkdir -p #{current_release}/public/cached; fi";
end
desc "Make sure the log file directory is present"
task :create_log_dir do
run "if [ ! -d '#{current_release}/application/data/logs' ]; then mkdir -p #{current_release}/application/data/logs; fi";
end
desc "Fix casing"
task :set_blackhole_path_symlink_fix do
run "ln -nfs BlackHole.php #{current_release}/library/Zend/Cache/Backend/Blackhole.php"
end
desc "Spawn models"
task :spawn do
run "php #{current_release}/garp/scripts/garp.php Spawn --e=#{garp_env}"
end
desc "Update the application and Garp version numbers"
task :update_version do
run "php #{current_release}/garp/scripts/garp.php Version update --e=#{garp_env}"
run "php #{current_release}/garp/scripts/garp.php Version update garp --e=#{garp_env}"
end
desc "Set webroot directory permissions"
task :set_webroot_permissions do
run "chmod -R g+w #{releases_path}/#{release_name}"
end
desc "Point the webroot symlink to the current release"
task :symlink do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
end
end
desc "Throw a warning when deploying to production"
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to deploy to a live, public server.
Please confirm that your work is ready for that.
========================================================================
WARN
answer = Capistrano::CLI.ui.ask " Are you sure? (y) "
if answer == 'y' then true else false end
end
unless fetch(:confirmed)
puts "\nDeploy cancelled!"
exit
end
end
before 'production', :ask_production_confirmation
goed spul ingecomment
# s t a g e s
set :stages, %w(integration staging production)
require 'capistrano/ext/multistage'
set :stage, nil
set :default_stage, "integration"
# v e r s i o n c o n t r o l
set :scm, :git
# r e m o t e s e r v e r
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
set :git_enable_submodules, 1
set :use_sudo, false
set :keep_releases, 3
set (:document_root) {"#{deploy_to}/current/public"}
set (:server_cache_dir) {"#{current_release}/application/data/cache"}
set :ssh_keys, File.read("garp/application/configs/authorized_keys")
# d e p l o y
after "deploy:update_code", "deploy:cleanup"
namespace :deploy do
desc "Set up server instance"
task :setup do
transaction do
add_public_ssh_keys
find_webroot
mark_git_server_safe
create_deploy_dirs
set_shared_dirs_permissions
create_webroot_reroute_htaccess
prompt_to_set_newly_found_deploy_dir
end
end
desc "Deploy project"
task :update do
transaction do
update_code
create_system_cache_dirs
create_static_cache_dir
create_log_dir
set_blackhole_path_symlink_fix
spawn
update_version
set_webroot_permissions
symlink
end
end
# ------- P R I V A T E S E T U P M E T H O D S
desc "Add public SSH keys"
task :add_public_ssh_keys do
run "if [ ! -d '~/.ssh' ]; then mkdir -p ~/.ssh; fi"
run "chmod 700 ~/.ssh"
run "echo -e \'#{ssh_keys}\' > ~/.ssh/authorized_keys"
run "chmod 700 ~/.ssh/authorized_keys"
end
desc "Find webroot dir"
task :find_webroot do
if capture("[ -d #{deploy_to} ] && echo '1' || echo '0'").strip == '0'
# deploy_to webroot dir does not exist on the server
set :pwd, capture("pwd").strip
if capture("[ -d #{pwd}/web ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/web"
set :unset_deploy_to, deploy_to
elsif capture("[ -d #{pwd}/public ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/public"
set :unset_deploy_to, deploy_to
elsif capture("[ -d #{pwd}/httpdocs ] && echo '1' || echo '0'").strip == '1'
set :deploy_to, "#{pwd}/httpdocs"
set :unset_deploy_to, deploy_to
end
end
end
desc "Mark Git server as safe"
task :mark_git_server_safe do
run "touch ~/.ssh/known_hosts && ssh-keyscan -t rsa,dsa flow.grrr.nl 2>&1 | sort -u - ~/.ssh/known_hosts > ~/.ssh/tmp_hosts && cat ~/.ssh/tmp_hosts > ~/.ssh/known_hosts && rm ~/.ssh/tmp_hosts"
end
desc "Create essential deploy directories"
task :create_deploy_dirs do
run "if [ ! -d '#{deploy_to}/releases' ]; then mkdir -p #{deploy_to}/releases; fi"
run "if [ ! -d '#{deploy_to}/shared/uploads/documents' ]; then mkdir -p #{deploy_to}/shared/uploads/documents; fi"
run "if [ ! -d '#{deploy_to}/shared/uploads/images' ]; then mkdir -p #{deploy_to}/shared/uploads/images; fi"
end
desc "Set permissions on essential deploy directories"
task :set_shared_dirs_permissions do
run "chmod -R g+w #{deploy_to}/shared/uploads/documents"
run "chmod -R g+w #{deploy_to}/shared/uploads/images"
end
desc "Create .htaccess file to reroute webroot"
task :create_webroot_reroute_htaccess do
run "echo -e '<IfModule mod_rewrite.c>\\n\\tRewriteEngine on\\n\\tRewriteRule ^(.*)$ current/public/$1 [L]\\n</IfModule>' > #{deploy_to}/.htaccess"
end
task :prompt_to_set_newly_found_deploy_dir do
if exists?(:unset_deploy_to)
puts("\033[1;31mPlease set :deploy_to in deploy.rb to #{unset_deploy_to}\033[0m")
end
end
# ------- P R I V A T E D E P L O Y M E T H O D S
desc "Create backend cache directories"
task :create_system_cache_dirs do
run "if [ ! -d '#{server_cache_dir}' ]; then mkdir -p #{server_cache_dir}; fi";
run "if [ ! -d '#{server_cache_dir}/URI' ]; then mkdir -p #{server_cache_dir}/URI; fi";
run "if [ ! -d '#{server_cache_dir}/HTML' ]; then mkdir -p #{server_cache_dir}/HTML; fi";
run "if [ ! -d '#{server_cache_dir}/CSS' ]; then mkdir -p #{server_cache_dir}/CSS; fi";
run "if [ ! -d '#{server_cache_dir}/tags' ]; then mkdir -p #{server_cache_dir}/tags; fi";
# run "echo '<?php' > #{server_cache_dir}/pluginLoaderCache.php"
end
desc "Create static html cache directory"
task :create_static_cache_dir do
run "if [ ! -d '#{current_release}/public/cached' ]; then mkdir -p #{current_release}/public/cached; fi";
end
desc "Make sure the log file directory is present"
task :create_log_dir do
run "if [ ! -d '#{current_release}/application/data/logs' ]; then mkdir -p #{current_release}/application/data/logs; fi";
end
desc "Fix casing"
task :set_blackhole_path_symlink_fix do
run "ln -nfs BlackHole.php #{current_release}/library/Zend/Cache/Backend/Blackhole.php"
end
desc "Spawn models"
task :spawn do
run "php #{current_release}/garp/scripts/garp.php Spawn --e=#{garp_env}"
end
desc "Update the application and Garp version numbers"
task :update_version do
run "php #{current_release}/garp/scripts/garp.php Version update --e=#{garp_env}"
run "php #{current_release}/garp/scripts/garp.php Version update garp --e=#{garp_env}"
end
desc "Set webroot directory permissions"
task :set_webroot_permissions do
run "chmod -R g+w #{releases_path}/#{release_name}"
end
desc "Point the webroot symlink to the current release"
task :symlink do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
end
end
desc "Throw a warning when deploying to production"
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to deploy to a live, public server.
Please confirm that your work is ready for that.
========================================================================
WARN
answer = Capistrano::CLI.ui.ask " Are you sure? (y) "
if answer == 'y' then true else false end
end
unless fetch(:confirmed)
puts "\nDeploy cancelled!"
exit
end
end
before 'production', :ask_production_confirmation
|
Rails.application.routes.draw do
devise_for :users
get '/pages/home', to: 'pages#home'
get '/pages/game', to: 'pages#game'
get '/pages/chat', to: 'pages#chat'
end
add routes for oauth authentication
Rails.application.routes.draw do
devise_for :users, :controllers => { omniauth_callbacks: 'omniauth_callbacks' }
get '/pages/home', to: 'pages#home'
get '/pages/game', to: 'pages#game'
get '/pages/chat', to: 'pages#chat'
end
|
Hcking::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
devise_for :users
resources :users, only: [:show] do
resources :tags,
controller: :user_tags,
path: ":kind",
constraints: { id: /.*/, kind: /(like|hate)/ },
only: [:create, :destroy]
end
match "tags/:tagname" => "tags#show", constraints: { tagname: /.*/ }
resources :tags, constraints: { id: /.*/ }, only: [:show, :index]
resources :comments, only: [:index]
resources :events do
resources :comments, except: [:new]
namespace "schedule" do
resources :exdates, only: [:destroy]
resources :rules, only: [:create, :destroy]
end
resources :single_events, path: "dates" do
member do
put :participate
put :unparticipate
end
resources :comments, except: [:new]
end
# This is duplicate code, but the old routes with single_events must
# keep on working
resources :single_events do
member do
put :participate
put :unparticipate
end
resources :comments, except: [:new]
end
end
match "ical" => "ical#general"
match "personalized_ical/:guid" => "ical#personalized"
match "user_ical/:guid" => "ical#like_welcome_page"
match "single_event_ical/:id" => "ical#for_single_event"
match "event_ical/:id" => "ical#for_event"
match "tag_ical/:id" => "ical#for_tag"
match "abonnieren" => "subscribe#index"
match ":page_name" => "pages#show"
root to: "welcome#index"
end
simplify routes of single_events
Hcking::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
devise_for :users
resources :users, only: [:show] do
resources :tags,
controller: :user_tags,
path: ":kind",
constraints: { id: /.*/, kind: /(like|hate)/ },
only: [:create, :destroy]
end
match "tags/:tagname" => "tags#show", constraints: { tagname: /.*/ }
resources :tags, constraints: { id: /.*/ }, only: [:show, :index]
resources :comments, only: [:index]
resources :events do
resources :comments, except: [:new]
namespace "schedule" do
resources :exdates, only: [:destroy]
resources :rules, only: [:create, :destroy]
end
resources :single_events, path: "dates" do
member do
put :participate
put :unparticipate
end
resources :comments, except: [:new]
end
# to hold old url on life
get "single_events/:id" => redirect { |params, request| "/events/#{params[:event_id]}/dates/#{params[:id]}" }
end
match "ical" => "ical#general"
match "personalized_ical/:guid" => "ical#personalized"
match "user_ical/:guid" => "ical#like_welcome_page"
match "single_event_ical/:id" => "ical#for_single_event"
match "event_ical/:id" => "ical#for_event"
match "tag_ical/:id" => "ical#for_tag"
match "abonnieren" => "subscribe#index"
match ":page_name" => "pages#show"
root to: "welcome#index"
end
|
Vmdb::Application.routes.draw do
# rubocop:disable AlignHash
# rubocop:disable MultilineOperationIndentation
# grouped routes
adv_search_post = %w(
adv_search_button
adv_search_clear
adv_search_load_choice
adv_search_name_typed
adv_search_toggle
)
button_post = %w(
button_create
button_update
)
compare_get = %w(
compare_miq
compare_to_csv
compare_to_pdf
compare_to_txt
)
compare_post = %w(
compare_choose_base
compare_compress
compare_miq
compare_miq_all
compare_miq_differences
compare_miq_same
compare_mode
compare_remove
compare_set_state
)
dialog_runner_post = %w(
dialog_field_changed
dialog_form_button_pressed
dynamic_checkbox_refresh
dynamic_date_refresh
dynamic_radio_button_refresh
dynamic_text_box_refresh
)
discover_get_post = %w(
discover
discover_field_changed
)
drift_get = %w(
drift
drift_history
drift_to_csv
drift_to_pdf
drift_to_txt
)
drift_post = %w(
drift_all
drift_compress
drift_differences
drift_history
drift_mode
drift_same
)
exp_post = %w(
exp_button
exp_changed
exp_token_pressed
)
evm_relationship_post = %w(
evm_relationship_field_changed
evm_relationship_update
)
ownership_post = %w(
ownership
ownership_field_changed
ownership_update
)
perf_post = %w(
perf_chart_chooser
perf_top_chart
)
policy_post = %w(
policy_options
policy_show_options
policy_sim
policy_sim_add
policy_sim_remove
)
pre_prov_post = %w(
pre_prov
pre_prov_continue
)
save_post = %w(
save_default_search
)
snap_post = %w(
snap_pressed
snap_vm
)
x_post = %w(
x_button
x_history
x_search_by_name
x_show
)
controller_routes = {
:alert => {
:get => %w(
index
rss
show_list
),
:post => %w(
role_selected
start_rss
),
},
:auth_key_pair_cloud => {
:get => %w(
download_data
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed,
ems_form_choices
) + compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + compare_post + exp_post + save_post
},
:availability_zone => {
:get => %w(
download_data
index
perf_top_chart
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
panel_control
quick_search
sections_field_changed
show
show_list
tagging_edit
tag_edit_form_field_changed
tl_chooser
wait_for_task
) + adv_search_post + compare_post + exp_post + perf_post
},
:catalog => {
:get => %w(
download_data
explorer
ot_edit
ot_show
show
),
:post => %w(
ab_group_reorder
accordion_select
ae_tree_select
ae_tree_select_discard
ae_tree_select_toggle
atomic_form_field_changed
atomic_st_edit
automate_button_field_changed
explorer
get_ae_tree_edit_key
group_create
group_form_field_changed
group_reorder_field_changed
group_update
identify_catalog
orchestration_template_add
orchestration_template_copy
orchestration_template_edit
ot_add_form_field_changed
ot_add_submit
ot_copy_submit
ot_edit_submit
ot_form_field_changed
ot_tags_edit
process_sts
prov_field_changed
reload
resolve
resource_delete
service_dialog_from_ot_submit
servicetemplate_edit
sort_ds_grid
sort_host_grid
sort_iso_img_grid
sort_pxe_img_grid
sort_vc_grid
sort_vm_grid
st_catalog_edit
st_catalog_form_field_changed
st_delete
st_edit
st_form_field_changed
st_tags_edit
st_upload_image
svc_catalog_provision
tag_edit_form_field_changed
tree_autoload_dynatree
tree_select
x_button
x_history
x_show
) +
button_post +
dialog_runner_post
},
:chargeback => {
:get => %w(
explorer
index
render_csv
render_pdf
render_txt
report_only
),
:post => %w(
accordion_select
explorer
cb_assign_field_changed
cb_assign_update
cb_rate_edit
cb_rate_form_field_changed
cb_rate_show
cb_rates_delete
cb_rates_list
cb_tier_add
cb_tier_remove
saved_report_paging
tree_autoload_dynatree
tree_select
x_button
x_show
)
},
:consumption => {
:get => %w(
show
)
},
:cloud_object_store_container => {
:get => %w(
download_data
index
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_get,
:post => %w(
button
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_post + adv_search_post + exp_post + save_post
},
:cloud_tenant => {
:get => %w(
download_data
edit
index
protect
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
protect
sections_field_changed
show
show_list
tagging_edit
tag_edit_form_field_changed
update
panel_control
) +
compare_post
},
:cloud_object_store_object => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
update
) + compare_post + adv_search_post + exp_post + save_post
},
:cloud_volume => {
:get => %w(
download_data
attach
detach
edit
cloud_volume_form_fields
cloud_volume_tenants
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_get,
:post => %w(
attach_volume
detach_volume
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
update
) + compare_post + adv_search_post + exp_post + save_post
},
:cloud_volume_snapshot => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
update
) + compare_post + adv_search_post + exp_post + save_post
},
:configuration => {
# TODO: routes for new/edit/copy buttons need to be revisited
# TODO: so they can be changed to send up POST request instead of GET
:get => %w(
change_tab
index
show
timeprofile_copy
timeprofile_edit
timeprofile_new
),
:post => %w(
button
filters_field_changed
form_field_changed
theme_changed
timeprofile_create
timeprofile_delete
timeprofile_field_changed
timeprofile_update
tree_autoload_dynatree
update
view_selected
)
},
:container => {
:get => %w(
download_data
explorer
perf_top_chart
show
tl_chooser
wait_for_task
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
accordion_select
button
container_edit
container_form_field_changed
explorer
tl_chooser
wait_for_task
quick_search
reload
tree_autoload_dynatree
tree_select
container_tag
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post +
x_post
},
:container_group => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_node => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_replicator => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_image => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
guest_applications
openscap_rule_results
openscap_html
protect
squash_toggle
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
guest_applications
openscap_rule_results
protect
squash_toggle
) + adv_search_post + exp_post + save_post
},
:container_image_registry => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
},
:container_service => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_project => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_route => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
},
:persistent_volume => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
},
:container_build => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
},
:container_topology => {
:get => %w(
show
data
)
},
:middleware_topology => {
:get => %w(
show
data
)
},
:network_topology => {
:get => %w(
show
data
)
},
:container_dashboard => {
:get => %w(
show
data
)
},
:dashboard => {
:get => %w(
auth_error
iframe
change_tab
index
login
logout
saml_login
maintab
render_csv
render_pdf
render_txt
render_chart
report_only
show
timeline
timeline_data
widget_to_pdf
),
:post => %w(
kerberos_authenticate
initiate_saml_login
authenticate
change_group
csp_report
timeline_data
login_retry
panel_control
reset_widgets
resize_layout
show_timeline
tl_generate
wait_for_task
widget_add
widget_close
widget_dd_done
widget_toggle_minmax
widget_zoom
window_sizes
)
},
:ems_cloud => {
:get => %w(
dialog_load
discover
download_data
ems_cloud_form_fields
protect
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
dynamic_list_refresh
dynamic_radio_button_refresh
dynamic_text_box_refresh
form_field_changed
listnav_search_selected
panel_control
protect
provider_type_field_changed
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
tl_chooser
update
wait_for_task
) +
adv_search_post +
compare_post +
dialog_runner_post +
discover_get_post +
exp_post +
save_post
},
:ems_cluster => {
:get => %w(
columns_json
dialog_load
download_data
index
perf_top_chart
protect
rows_json
show
show_list
tagging_edit
) +
compare_get +
drift_get,
:post => %w(
button
listnav_search_selected
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
tl_chooser
tree_autoload_dynatree
tree_autoload_quads
wait_for_task
) +
adv_search_post +
compare_post +
dialog_runner_post +
drift_post +
exp_post +
perf_post +
save_post
},
:ems_infra => {
:get => %w(
dialog_load
discover
download_data
ems_infra_form_fields
protect
show_list
tagging_edit
scaling
scaledown
) +
compare_get,
:post => %w(
button
create
form_field_changed
listnav_search_selected
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
tl_chooser
tree_autoload_dynatree
tree_autoload_quads
update
wait_for_task
scaling
scaledown
x_show
) +
adv_search_post +
compare_post +
dialog_runner_post +
discover_get_post +
exp_post +
save_post
},
:ems_container => {
:get => %w(
download_data
perf_top_chart
protect
show_list
tagging_edit
ems_container_form_fields
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
protect
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
perf_post +
save_post
},
:ems_middleware => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:middleware_server => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
perf_chart_chooser
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:middleware_deployment => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:middleware_datasource => {
:get => %w(
download_data
edit
index
new
perf_chart_chooser
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
perf_chart_chooser
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:ems_network => {
:get => %w(
dialog_load
download_data
edit
ems_network_form_fields
index
new
protect
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
dynamic_list_refresh
dynamic_radio_button_refresh
dynamic_text_box_refresh
form_field_changed
listnav_search_selected
panel_control
protect
provider_type_field_changed
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
tl_chooser
update
wait_for_task
) +
adv_search_post +
compare_post +
dialog_runner_post +
exp_post +
save_post
},
:security_group => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:floating_ip => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:cloud_subnet => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:cloud_network => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:network_port => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:network_router => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:flavor => {
# FIXME: Change tagging_edit to POST only; We need to remove the redirects
# in app/controllers/application_controller/tags.rb#tag that are used in
# a role of a method call.
# Then remove this route from all other controllers too.
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:host => {
:get => %w(
advanced_settings
dialog_load
download_data
edit
filesystem_download
filesystems
firewall_rules
timeline_data
groups
guest_applications
host_form_fields
host_services
host_cloud_services
index
list
new
patches
perf_top_chart
protect
show
show_association
show_details
show_list
start
tagging_edit
users
) +
compare_get +
discover_get_post +
drift_get,
:post => %w(
advanced_settings
button
create
drift_all
drift_compress
drift_differences
drift_mode
drift_same
filesystems
firewall_rules
firewallrules
form_field_changed
groups
guest_applications
host_services
host_cloud_services
listnav_search_selected
quick_search
panel_control
patches
protect
sections_field_changed
show
show_list
squash_toggle
tag_edit_form_field_changed
tagging_edit
tl_chooser
tree_autoload_dynatree
update
users
wait_for_task
) +
adv_search_post +
compare_post +
dialog_runner_post +
discover_get_post +
exp_post +
perf_post +
save_post
},
:miq_ae_class => {
:get => %w(
explorer
),
:post => %w(
ae_tree_select
ae_tree_select_toggle
change_tab
copy_objects
create
create_instance
create_method
create_ns
domains_priority_edit
explorer
expand_toggle
field_accept
field_delete
field_method_accept
field_method_delete
field_method_select
field_select
fields_form_field_changed
fields_seq_edit
fields_seq_field_changed
form_copy_objects_field_changed
form_field_changed
form_instance_field_changed
form_method_field_changed
form_ns_field_changed
priority_form_field_changed
reload
tree_select
tree_autoload_dynatree
update
update_fields
update_instance
update_method
update_ns
validate_method_data
x_button
x_history
x_show
)
},
:miq_ae_customization => {
:get => %w(
dialog_accordion_json
explorer
export_service_dialogs
),
:post => %w(
ab_group_reorder
ae_tree_select
ae_tree_select_toggle
accordion_select
automate_button_field_changed
cancel_import
change_tab
dialog_edit
dialog_form_field_changed
dialog_list
dialog_res_remove
dialog_res_reorder
explorer
field_value_accept
field_value_delete
field_value_select
group_create
group_form_field_changed
group_reorder_field_changed
group_update
import_service_dialogs
old_dialogs_form_field_changed
old_dialogs_list
old_dialogs_update
reload
resolve
tree_autoload_dynatree
tree_select
upload_import_file
x_button
x_history
x_show
) +
button_post
},
:miq_ae_tools => {
:get => %w(
automate_json
export_datastore
fetch_log
import_export
log
resolve
review_import
),
:post => %w(
button
cancel_import
form_field_changed
import_automate_datastore
reset_datastore
resolve
upload
upload_import_file
wait_for_task
)
},
:miq_capacity => {
:get => %w(
bottlenecks
timeline_data
index
planning
planning_report_download
util_report_download
utilization
),
:post => %w(
bottleneck_tl_chooser
change_tab
optimize_tree_select
planning
planning_option_changed
reload
tree_autoload_dynatree
util_chart_chooser
wait_for_task
)
},
:miq_policy => {
:get => %w(
explorer
export
fetch_log
fetch_yaml
get_json
import
index
log
rsop
),
:post => %w(
accordion_select
action_edit
action_field_changed
action_get_all
action_tag_pressed
alert_delete
alert_edit
alert_field_changed
alert_get_all
alert_profile_assign
alert_profile_assign_changed
alert_profile_delete
alert_profile_edit
alert_profile_field_changed
button
condition_edit
condition_field_changed
event_edit
export
export_field_changed
import
panel_control
policy_edit
policy_get_all
policy_field_changed
profile_edit
profile_field_changed
quick_search
reload
rsop
rsop_option_changed
rsop_show_options
rsop_toggle
tree_autoload_dynatree
tree_select
upload
wait_for_task
) +
adv_search_post +
exp_post +
x_post
},
:miq_request => {
# FIXME: Change stamp to POST only; We need to remove the redirect
:get => %w(
index
post_install_callback
pre_prov
prov_copy
prov_edit
show
show_list
stamp
),
:post => %w(
button
post_install_callback
pre_prov
prov_button
prov_change_options
prov_continue
prov_edit
prov_field_changed
prov_load_tab
prov_show_option
request_copy
request_edit
retrieve_email
show_list
sort_configured_system_grid
sort_ds_grid
sort_host_grid
sort_iso_img_grid
sort_pxe_img_grid
sort_template_grid
sort_vc_grid
sort_vm_grid
sort_windows_image_grid
stamp
stamp_field_changed
vm_pre_prov
upload
) +
dialog_runner_post
},
:miq_task => {
:get => %w(
change_tab
index
jobs
tasks_show_option
),
:post => %w(
button
jobs
tasks_button
tasks_change_options
)
},
:miq_template => {
:get => %w(
edit
show
ownership
),
:post => %w(
edit
edit_vm
form_field_changed
show
) +
ownership_post
},
:ontap_file_share => {
:get => %w(
cim_base_storage_extents
create_ds
download_data
index
protect
show
show_list
snia_local_file_systems
tagging_edit
) +
compare_get,
:post => %w(
button
create_ds
create_ds_field_changed
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:ontap_logical_disk => {
:get => %w(
cim_base_storage_extents
download_data
index
protect
show
show_list
snia_local_file_systems
tagging_edit
) +
compare_get,
:post => %w(
button
panel_control
perf_chart_chooser
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
wait_for_task
) +
adv_search_post +
compare_post +
exp_post
},
:ontap_storage_system => {
:get => %w(
cim_base_storage_extents
create_ld
download_data
index
protect
show
show_list
snia_local_file_systems
tagging_edit
) +
compare_get,
:post => %w(
button
create_ld
create_ld_field_changed
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:ontap_storage_volume => {
:get => %w(
cim_base_storage_extents
download_data
index
protect
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:ops => {
:get => %w(
explorer
fetch_audit_log
fetch_build
fetch_log
fetch_production_log
log_collection_form_fields
log_protocol_changed
pglogical_subscriptions_form_fields
schedule_form_fields
show_product_update
tenant_quotas_form_fields
tenant_form_fields
ldap_regions_list
),
:post => %w(
accordion_select
activate
apply_imports
ap_ce_delete
ap_ce_select
ap_edit
ap_form_field_changed
ap_set_active_tab
aps_list
category_delete
category_edit
category_field_changed
category_update
ce_accept
ce_delete
ce_new_cat
ce_select
change_tab
cu_collection_field_changed
cu_collection_update
cu_repair
cu_repair_field_changed
db_backup
db_backup_form_field_changed
db_gc_collection
db_list
diagnostics_server_list
diagnostics_tree_select
diagnostics_worker_selected
edit_rhn
explorer
fetch_build
forest_accept
forest_delete
forest_form_field_changed
forest_select
log_depot_edit
log_depot_field_changed
log_depot_validate
orphaned_records_delete
perf_chart_chooser
pglogical_save_subscriptions
pglogical_validate_subscription
product_updates_list
rbac_group_edit
rbac_group_field_changed
rbac_group_seq_edit
rbac_group_user_lookup
rbac_groups_list
rbac_role_edit
rbac_role_field_changed
rbac_roles_list
rbac_tags_edit
rbac_tenant_edit
rbac_tenants_list
rbac_tenant_manage_quotas
rbac_user_edit
rbac_user_field_changed
rbac_users_list
region_edit
region_form_field_changed
repo_default_name
restart_server
rhn_buttons
rhn_default_server
rhn_validate
schedule_edit
schedule_form_field_changed
schedule_form_filter_type_field_changed
schedules_list
schedule_update
settings_form_field_changed
settings_update
show
show_product_update
smartproxy_affinity_field_changed
tag_edit_form_field_changed
tl_chooser
tree_autoload_dynatree
tree_select
update
upload_csv
upload_form_field_changed
upload_login_logo
upload_logo
validate_replcation_worker
wait_for_task
x_button
x_show
zone_edit
zone_field_changed
ldap_region_add
ldap_region_edit
ldap_region_form_field_changed
ldap_domain_edit
ldap_domain_form_field_changed
ls_select
ldap_entry_changed
ls_delete
)
},
:orchestration_stack => {
:get => %w(
cloud_networks
download_data
retirement_info
index
outputs
parameters
resources
retire
show
show_list
stacks_ot_info
tagging_edit
protect
),
:post => %w(
button
cloud_networks
outputs
listnav_search_selected
panel_control
parameters
quick_search
resources
retire
sections_field_changed
show
show_list
stacks_ot_copy
protect
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
save_post
},
:provider_foreman => {
:get => %w(
download_data
explorer
provider_foreman_form_fields
show
show_list
tagging_edit
),
:post => %w(
accordion_select
authentication_validate
button
change_tab
delete
edit
explorer
exp_button
exp_changed
exp_token_pressed
form_field_changed
new
panel_control
provision
quick_search
refresh
reload
show
show_list
tagging
tagging_edit
tag_edit_form_field_changed
tree_autoload_dynatree
tree_select
configscript_service_dialog_submit
cs_form_field_changed
users
wait_for_task
) +
adv_search_post +
x_post
},
:pxe => {
:get => %w(
explorer
),
:post => %w(
accordion_select
explorer
iso_datastore_create
iso_datastore_form_field_changed
iso_datastore_list
iso_image_edit
iso_img_form_field_changed
log_depot_validate
pxe_image_edit
pxe_image_type_edit
pxe_image_type_form_field_changed
pxe_image_type_list
pxe_img_form_field_changed
pxe_server_create_update
pxe_server_form_field_changed
pxe_server_list
pxe_wimg_edit
pxe_wimg_form_field_changed
reload
template_create_update
template_form_field_changed
template_list
tree_autoload_dynatree
tree_select
x_button
x_history
)
},
:report => {
:get => %w(
db_widget_dd_done
download_report
explorer
export_widgets
miq_report_edit
miq_report_new
preview_chart
preview_timeline
render_chart
report_only
sample_chart
sample_timeline
send_report_data
tree_autoload_dynatree
tree_select
),
:post => %w(
accordion_select
change_tab
create
db_edit
db_form_field_changed
db_seq_edit
db_widget_dd_done
db_widget_remove
discard_changes
explorer
export_field_changed
filter_change
form_field_changed
get_report
import_widgets
menu_editor
menu_field_changed
menu_folder_message_display
menu_update
miq_report_edit
reload
rep_change_tab
saved_report_paging
schedule_edit
schedule_form_field_changed
show_preview
show_saved
tree_autoload_dynatree
tree_select
upload
upload_widget_import_file
wait_for_task
widget_edit
widget_form_field_changed
widget_shortcut_dd_done
widget_shortcut_remove
widget_shortcut_reset
x_button
x_history
x_show
) +
exp_post
},
:resource_pool => {
:get => %w(
download_data
index
protect
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
listnav_search_selected
panel_control
protect
sections_field_changed
show
show_list
tagging_edit
tag_edit_form_field_changed
tree_autoload_dynatree
quick_search
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:service => {
:get => %w(
download_data
explorer
retirement_info
reconfigure_form_fields
retire
service_form_fields
show
),
:post => %w(
button
explorer
ownership_field_changed
ownership_update
reload
retire
service_edit
service_tag
tag_edit_form_field_changed
tree_autoload_dynatree
tree_select
x_button
x_history
x_show
) +
dialog_runner_post
},
# TODO: revisit this controller/route, might be removed after other storage issues are sorted out
:snia_local_file_system => {
:get => %w(show)
},
:storage => {
:get => %w(
button
debris_files
dialog_load
disk_files
download_data
explorer
files
index
perf_chart_chooser
protect
show
show_list
snapshot_files
tagging_edit
tree_select
vm_ram_files
vm_misc_files
x_show
) +
compare_get,
:post => %w(
accordion_select
button
debris_files
explorer
files
listnav_search_selected
panel_control
disk_files
perf_chart_chooser
protect
quick_search
sections_field_changed
show
show_association
show_details
show_list
storage_list
storage_pod_list
snapshot_files
tag_edit_form_field_changed
tagging
tagging_edit
tree_autoload_dynatree
tree_select
vm_misc_files
vm_ram_files
wait_for_task
x_search_by_name
x_show
) +
adv_search_post +
compare_post +
dialog_runner_post +
exp_post +
save_post +
x_post
},
:storage_manager => {
:get => %w(
download_data
edit
index
new
show
show_list
),
:post => %w(
button
create
form_field_changed
panel_control
quick_search
show
show_list
update
) +
adv_search_post +
exp_post
},
:support => {
:get => %w(index)
},
:vm => {
:get => %w(
download_data
edit
retirement_info
ownership
policy_sim
reconfigure
reconfigure_form_fields
resize
evacuate
evacuate_form_fields
live_migrate
live_migrate_form_fields
retire
right_size
show
show_list
),
:post => %w(
edit_vm
form_field_changed
policy_sim
policy_sim_add
policy_sim_remove
provision
reconfigure
reconfigure_form_fields
reconfigure_update
resize_field_changed
resize_vm
evacuate_vm
live_migrate_vm
retire
right_size
set_checked_items
show_list
vmtree_selected
) +
ownership_post +
pre_prov_post
},
:vm_cloud => {
:get => %w(
download_data
drift_to_csv
drift_to_pdf
drift_to_txt
explorer
filesystem_download
retirement_info
reconfigure_form_fields
launch_html5_console
perf_chart_chooser
protect
retire
show
tagging_edit
resize
migrate
live_migrate_form_fields
attach
detach
evacuate
evacuate_form_fields
) +
compare_get,
:post => %w(
advanced_settings
accordion_select
button
edit_vm
resize_vm
resize_field_changed
event_logs
explorer
launch_html5_console
filesystems
filesystem_drivers
form_field_changed
guest_applications
groups
html5_console
kernel_drivers
linux_initprocesses
ownership_field_changed
ownership_update
panel_control
patches
perf_chart_chooser
policies
processes
protect
prov_edit
prov_field_changed
quick_search
registry_items
reload
retire
reconfigure_update
scan_histories
sections_field_changed
security_groups
floating_ips
network_routers
network_ports
cloud_subnets
cloud_networks
cloud_volumes
show
squash_toggle
tagging_edit
tag_edit_form_field_changed
tl_chooser
tree_autoload_dynatree
tree_select
users
vm_pre_prov
wait_for_task
win32_services
live_migrate_vm
attach_volume
detach_volume
evacuate_vm
) +
adv_search_post +
compare_post +
dialog_runner_post +
drift_post +
evm_relationship_post +
exp_post +
policy_post +
pre_prov_post +
x_post
},
:vm_infra => {
:get => %w(
download_data
drift_to_csv
drift_to_pdf
drift_to_txt
explorer
filesystem_download
retirement_info
reconfigure_form_fields
launch_vmware_console
launch_html5_console
perf_chart_chooser
policies
protect
retire
show
tagging_edit
) +
compare_get,
:post => %w(
accordion_select
advanced_settings
button
edit_vm
event_logs
explorer
filesystems
filesystem_drivers
form_field_changed
guest_applications
groups
kernel_drivers
linux_initprocesses
ontap_file_shares
ontap_logical_disks
ontap_storage_systems
ontap_storage_volume
ownership_field_changed
ownership_update
panel_control
patches
perf_chart_chooser
policies
protect
processes
prov_edit
prov_field_changed
quick_search
reconfigure_field_changed
reconfigure_update
registry_items
reload
retire
scan_histories
sections_field_changed
security_groups
show
sort_ds_grid
sort_host_grid
sort_iso_img_grid
sort_vc_grid
sort_template_grid
sort_vm_grid
squash_toggle
tagging_edit
tag_edit_form_field_changed
tl_chooser
tree_autoload_dynatree
tree_select
users
vmrc_console
vm_pre_prov
vm_vdi
html5_console
wait_for_task
win32_services
) +
adv_search_post +
compare_post +
dialog_runner_post +
drift_post +
evm_relationship_post +
exp_post +
policy_post +
pre_prov_post +
snap_post +
x_post
},
:vm_or_template => {
:get => %w(
download_data
drift_to_csv
drift_to_pdf
drift_to_txt
explorer
launch_html5_console
retirement_info
reconfigure_form_fields
launch_vmware_console
protect
retire
show
tagging_edit
util_report_download
utilization
vm_show
) +
compare_get,
:post => %w(
accordion_select
advanced_settings
button
console
drift_all
drift_differences
drift_history
drift_mode
drift_same
edit_vm
event_logs
explorer
filesystem_drivers
filesystems
form_field_changed
groups
guest_applications
kernel_drivers
linux_initprocesses
ontap_file_shares
ontap_logical_disks
ontap_storage_systems
ownership_field_changed
ownership_update
panel_control
patches
perf_chart_chooser
policies
processes
protect
prov_edit
prov_field_changed
quick_search
reconfigure_field_changed
reconfigure_update
registry_items
reload
retire
scan_histories
sections_field_changed
security_groups
floating_ips
network_routers
network_ports
cloud_subnets
cloud_networks
cloud_volumes
show
sort_ds_grid
sort_host_grid
sort_iso_img_grid
sort_vc_grid
squash_toggle
tagging_edit
tag_edit_form_field_changed
tl_chooser
tree_select
users
util_chart_chooser
vm_pre_prov
vmrc_console
html5_console
wait_for_task
win32_services
x_button
x_history
x_search_by_name
x_show
) +
adv_search_post +
compare_post +
dialog_runner_post +
evm_relationship_post +
exp_post +
policy_post +
pre_prov_post +
snap_post
},
}
root :to => 'dashboard#login'
get '/saml_login(/*path)' => 'dashboard#saml_login'
# Let's serve pictures directly from the DB
get '/pictures/:basename' => 'picture#show', :basename => /[\da-zA-Z]+\.[\da-zA-Z]+/
# Enablement for the REST API
# OPTIONS requests for REST API pre-flight checks
# Semantic Versioning Regex for API, i.e. vMajor.minor.patch[-pre]
API_VERSION_REGEX = /v[\d]+(\.[\da-zA-Z]+)*(\-[\da-zA-Z]+)?/
match '/api/*path' => 'api#handle_options_request', :via => [:options]
get '/api(/:version)' => 'api#show_entrypoint', :format => 'json', :version => API_VERSION_REGEX
API_ACTIONS = {
:get => "show",
:post => "update",
:put => "update",
:patch => "update",
:delete => "destroy"
}.freeze
def action_for(verb)
"api##{API_ACTIONS[verb]}"
end
Api::Settings.collections.each do |collection_name, collection|
collection.verbs.each do |verb|
if collection.options.include?(:primary)
public_send(
verb,
"/api(/:version)/#{collection_name}" => action_for(verb),
:format => "json",
:version => API_VERSION_REGEX
)
end
if collection.options.include?(:collection)
public_send(
verb,
"/api(/:version)/#{collection_name}(/:c_id)" => action_for(verb),
:format => "json",
:version => API_VERSION_REGEX
)
end
end
Array(collection.subcollections).each do |subcollection_name|
Api::Settings.collections[subcollection_name].verbs.each do |verb|
public_send(
verb,
"/api(/:version)/#{collection_name}/:c_id/#{subcollection_name}(/:s_id)" => action_for(verb),
:format => "json",
:version => API_VERSION_REGEX
)
end
end
end
controller_routes.each do |controller_name, controller_actions|
# Default route with no action to controller's index action
unless [:ems_cloud, :ems_infra, :ems_container].include?(controller_name)
match "#{controller_name}", :controller => controller_name, :action => :index, :via => :get
end
# One-by-one get/post routes for defined controllers
if controller_actions.kind_of?(Hash)
unless controller_actions[:get].nil?
controller_actions[:get].each do |action_name|
get "#{controller_name}/#{action_name}(/:id)",
:action => action_name,
:controller => controller_name
end
end
unless controller_actions[:post].nil?
controller_actions[:post].each do |action_name|
post "#{controller_name}/#{action_name}(/:id)",
:action => action_name,
:controller => controller_name
end
end
end
end
# pure-angular templates
get '/static/*id' => 'static#show', :format => false
# ping response for load balancing
get '/ping' => 'ping#index'
resources :ems_cloud, :as => :ems_clouds
resources :ems_infra, :as => :ems_infras
resources :ems_container, :as => :ems_containers
match "/auth/:provider/callback" => "sessions#create", :via => :get
if Rails.env.development? && defined?(Rails::Server)
mount WebsocketServer.new(:logger => Logger.new(STDOUT)) => '/ws'
end
# rubocop:enable MultilineOperationIndentation
# rubocop:enable AlignHash
end
Extract method `#create_api_route`
Vmdb::Application.routes.draw do
# rubocop:disable AlignHash
# rubocop:disable MultilineOperationIndentation
# grouped routes
adv_search_post = %w(
adv_search_button
adv_search_clear
adv_search_load_choice
adv_search_name_typed
adv_search_toggle
)
button_post = %w(
button_create
button_update
)
compare_get = %w(
compare_miq
compare_to_csv
compare_to_pdf
compare_to_txt
)
compare_post = %w(
compare_choose_base
compare_compress
compare_miq
compare_miq_all
compare_miq_differences
compare_miq_same
compare_mode
compare_remove
compare_set_state
)
dialog_runner_post = %w(
dialog_field_changed
dialog_form_button_pressed
dynamic_checkbox_refresh
dynamic_date_refresh
dynamic_radio_button_refresh
dynamic_text_box_refresh
)
discover_get_post = %w(
discover
discover_field_changed
)
drift_get = %w(
drift
drift_history
drift_to_csv
drift_to_pdf
drift_to_txt
)
drift_post = %w(
drift_all
drift_compress
drift_differences
drift_history
drift_mode
drift_same
)
exp_post = %w(
exp_button
exp_changed
exp_token_pressed
)
evm_relationship_post = %w(
evm_relationship_field_changed
evm_relationship_update
)
ownership_post = %w(
ownership
ownership_field_changed
ownership_update
)
perf_post = %w(
perf_chart_chooser
perf_top_chart
)
policy_post = %w(
policy_options
policy_show_options
policy_sim
policy_sim_add
policy_sim_remove
)
pre_prov_post = %w(
pre_prov
pre_prov_continue
)
save_post = %w(
save_default_search
)
snap_post = %w(
snap_pressed
snap_vm
)
x_post = %w(
x_button
x_history
x_search_by_name
x_show
)
controller_routes = {
:alert => {
:get => %w(
index
rss
show_list
),
:post => %w(
role_selected
start_rss
),
},
:auth_key_pair_cloud => {
:get => %w(
download_data
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed,
ems_form_choices
) + compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + compare_post + exp_post + save_post
},
:availability_zone => {
:get => %w(
download_data
index
perf_top_chart
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
panel_control
quick_search
sections_field_changed
show
show_list
tagging_edit
tag_edit_form_field_changed
tl_chooser
wait_for_task
) + adv_search_post + compare_post + exp_post + perf_post
},
:catalog => {
:get => %w(
download_data
explorer
ot_edit
ot_show
show
),
:post => %w(
ab_group_reorder
accordion_select
ae_tree_select
ae_tree_select_discard
ae_tree_select_toggle
atomic_form_field_changed
atomic_st_edit
automate_button_field_changed
explorer
get_ae_tree_edit_key
group_create
group_form_field_changed
group_reorder_field_changed
group_update
identify_catalog
orchestration_template_add
orchestration_template_copy
orchestration_template_edit
ot_add_form_field_changed
ot_add_submit
ot_copy_submit
ot_edit_submit
ot_form_field_changed
ot_tags_edit
process_sts
prov_field_changed
reload
resolve
resource_delete
service_dialog_from_ot_submit
servicetemplate_edit
sort_ds_grid
sort_host_grid
sort_iso_img_grid
sort_pxe_img_grid
sort_vc_grid
sort_vm_grid
st_catalog_edit
st_catalog_form_field_changed
st_delete
st_edit
st_form_field_changed
st_tags_edit
st_upload_image
svc_catalog_provision
tag_edit_form_field_changed
tree_autoload_dynatree
tree_select
x_button
x_history
x_show
) +
button_post +
dialog_runner_post
},
:chargeback => {
:get => %w(
explorer
index
render_csv
render_pdf
render_txt
report_only
),
:post => %w(
accordion_select
explorer
cb_assign_field_changed
cb_assign_update
cb_rate_edit
cb_rate_form_field_changed
cb_rate_show
cb_rates_delete
cb_rates_list
cb_tier_add
cb_tier_remove
saved_report_paging
tree_autoload_dynatree
tree_select
x_button
x_show
)
},
:consumption => {
:get => %w(
show
)
},
:cloud_object_store_container => {
:get => %w(
download_data
index
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_get,
:post => %w(
button
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_post + adv_search_post + exp_post + save_post
},
:cloud_tenant => {
:get => %w(
download_data
edit
index
protect
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
protect
sections_field_changed
show
show_list
tagging_edit
tag_edit_form_field_changed
update
panel_control
) +
compare_post
},
:cloud_object_store_object => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
update
) + compare_post + adv_search_post + exp_post + save_post
},
:cloud_volume => {
:get => %w(
download_data
attach
detach
edit
cloud_volume_form_fields
cloud_volume_tenants
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_get,
:post => %w(
attach_volume
detach_volume
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
update
) + compare_post + adv_search_post + exp_post + save_post
},
:cloud_volume_snapshot => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) + compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
show
show_list
tagging_edit
tag_edit_form_field_changed
update
) + compare_post + adv_search_post + exp_post + save_post
},
:configuration => {
# TODO: routes for new/edit/copy buttons need to be revisited
# TODO: so they can be changed to send up POST request instead of GET
:get => %w(
change_tab
index
show
timeprofile_copy
timeprofile_edit
timeprofile_new
),
:post => %w(
button
filters_field_changed
form_field_changed
theme_changed
timeprofile_create
timeprofile_delete
timeprofile_field_changed
timeprofile_update
tree_autoload_dynatree
update
view_selected
)
},
:container => {
:get => %w(
download_data
explorer
perf_top_chart
show
tl_chooser
wait_for_task
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
accordion_select
button
container_edit
container_form_field_changed
explorer
tl_chooser
wait_for_task
quick_search
reload
tree_autoload_dynatree
tree_select
container_tag
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post +
x_post
},
:container_group => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_node => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_replicator => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_image => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
guest_applications
openscap_rule_results
openscap_html
protect
squash_toggle
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
guest_applications
openscap_rule_results
protect
squash_toggle
) + adv_search_post + exp_post + save_post
},
:container_image_registry => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
},
:container_service => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_project => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
perf_post +
save_post
},
:container_route => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
},
:persistent_volume => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
},
:container_build => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
),
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
update
tagging_edit
tag_edit_form_field_changed
) + adv_search_post + exp_post + save_post
},
:container_topology => {
:get => %w(
show
data
)
},
:middleware_topology => {
:get => %w(
show
data
)
},
:network_topology => {
:get => %w(
show
data
)
},
:container_dashboard => {
:get => %w(
show
data
)
},
:dashboard => {
:get => %w(
auth_error
iframe
change_tab
index
login
logout
saml_login
maintab
render_csv
render_pdf
render_txt
render_chart
report_only
show
timeline
timeline_data
widget_to_pdf
),
:post => %w(
kerberos_authenticate
initiate_saml_login
authenticate
change_group
csp_report
timeline_data
login_retry
panel_control
reset_widgets
resize_layout
show_timeline
tl_generate
wait_for_task
widget_add
widget_close
widget_dd_done
widget_toggle_minmax
widget_zoom
window_sizes
)
},
:ems_cloud => {
:get => %w(
dialog_load
discover
download_data
ems_cloud_form_fields
protect
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
dynamic_list_refresh
dynamic_radio_button_refresh
dynamic_text_box_refresh
form_field_changed
listnav_search_selected
panel_control
protect
provider_type_field_changed
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
tl_chooser
update
wait_for_task
) +
adv_search_post +
compare_post +
dialog_runner_post +
discover_get_post +
exp_post +
save_post
},
:ems_cluster => {
:get => %w(
columns_json
dialog_load
download_data
index
perf_top_chart
protect
rows_json
show
show_list
tagging_edit
) +
compare_get +
drift_get,
:post => %w(
button
listnav_search_selected
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
tl_chooser
tree_autoload_dynatree
tree_autoload_quads
wait_for_task
) +
adv_search_post +
compare_post +
dialog_runner_post +
drift_post +
exp_post +
perf_post +
save_post
},
:ems_infra => {
:get => %w(
dialog_load
discover
download_data
ems_infra_form_fields
protect
show_list
tagging_edit
scaling
scaledown
) +
compare_get,
:post => %w(
button
create
form_field_changed
listnav_search_selected
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
tl_chooser
tree_autoload_dynatree
tree_autoload_quads
update
wait_for_task
scaling
scaledown
x_show
) +
adv_search_post +
compare_post +
dialog_runner_post +
discover_get_post +
exp_post +
save_post
},
:ems_container => {
:get => %w(
download_data
perf_top_chart
protect
show_list
tagging_edit
ems_container_form_fields
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
protect
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
perf_post +
save_post
},
:ems_middleware => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:middleware_server => {
:get => %w(
download_data
edit
index
new
perf_top_chart
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
perf_chart_chooser
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:middleware_deployment => {
:get => %w(
download_data
edit
index
new
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:middleware_datasource => {
:get => %w(
download_data
edit
index
new
perf_chart_chooser
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
form_field_changed
listnav_search_selected
panel_control
quick_search
sections_field_changed
perf_chart_chooser
show
show_list
tl_chooser
update
wait_for_task
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:ems_network => {
:get => %w(
dialog_load
download_data
edit
ems_network_form_fields
index
new
protect
show
show_list
tagging_edit
tag_edit_form_field_changed
) +
compare_get,
:post => %w(
button
create
dynamic_checkbox_refresh
dynamic_list_refresh
dynamic_radio_button_refresh
dynamic_text_box_refresh
form_field_changed
listnav_search_selected
panel_control
protect
provider_type_field_changed
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
tl_chooser
update
wait_for_task
) +
adv_search_post +
compare_post +
dialog_runner_post +
exp_post +
save_post
},
:security_group => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:floating_ip => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:cloud_subnet => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:cloud_network => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:network_port => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:network_router => {
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:flavor => {
# FIXME: Change tagging_edit to POST only; We need to remove the redirects
# in app/controllers/application_controller/tags.rb#tag that are used in
# a role of a method call.
# Then remove this route from all other controllers too.
:get => %w(
download_data
index
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
quick_search
panel_control
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:host => {
:get => %w(
advanced_settings
dialog_load
download_data
edit
filesystem_download
filesystems
firewall_rules
timeline_data
groups
guest_applications
host_form_fields
host_services
host_cloud_services
index
list
new
patches
perf_top_chart
protect
show
show_association
show_details
show_list
start
tagging_edit
users
) +
compare_get +
discover_get_post +
drift_get,
:post => %w(
advanced_settings
button
create
drift_all
drift_compress
drift_differences
drift_mode
drift_same
filesystems
firewall_rules
firewallrules
form_field_changed
groups
guest_applications
host_services
host_cloud_services
listnav_search_selected
quick_search
panel_control
patches
protect
sections_field_changed
show
show_list
squash_toggle
tag_edit_form_field_changed
tagging_edit
tl_chooser
tree_autoload_dynatree
update
users
wait_for_task
) +
adv_search_post +
compare_post +
dialog_runner_post +
discover_get_post +
exp_post +
perf_post +
save_post
},
:miq_ae_class => {
:get => %w(
explorer
),
:post => %w(
ae_tree_select
ae_tree_select_toggle
change_tab
copy_objects
create
create_instance
create_method
create_ns
domains_priority_edit
explorer
expand_toggle
field_accept
field_delete
field_method_accept
field_method_delete
field_method_select
field_select
fields_form_field_changed
fields_seq_edit
fields_seq_field_changed
form_copy_objects_field_changed
form_field_changed
form_instance_field_changed
form_method_field_changed
form_ns_field_changed
priority_form_field_changed
reload
tree_select
tree_autoload_dynatree
update
update_fields
update_instance
update_method
update_ns
validate_method_data
x_button
x_history
x_show
)
},
:miq_ae_customization => {
:get => %w(
dialog_accordion_json
explorer
export_service_dialogs
),
:post => %w(
ab_group_reorder
ae_tree_select
ae_tree_select_toggle
accordion_select
automate_button_field_changed
cancel_import
change_tab
dialog_edit
dialog_form_field_changed
dialog_list
dialog_res_remove
dialog_res_reorder
explorer
field_value_accept
field_value_delete
field_value_select
group_create
group_form_field_changed
group_reorder_field_changed
group_update
import_service_dialogs
old_dialogs_form_field_changed
old_dialogs_list
old_dialogs_update
reload
resolve
tree_autoload_dynatree
tree_select
upload_import_file
x_button
x_history
x_show
) +
button_post
},
:miq_ae_tools => {
:get => %w(
automate_json
export_datastore
fetch_log
import_export
log
resolve
review_import
),
:post => %w(
button
cancel_import
form_field_changed
import_automate_datastore
reset_datastore
resolve
upload
upload_import_file
wait_for_task
)
},
:miq_capacity => {
:get => %w(
bottlenecks
timeline_data
index
planning
planning_report_download
util_report_download
utilization
),
:post => %w(
bottleneck_tl_chooser
change_tab
optimize_tree_select
planning
planning_option_changed
reload
tree_autoload_dynatree
util_chart_chooser
wait_for_task
)
},
:miq_policy => {
:get => %w(
explorer
export
fetch_log
fetch_yaml
get_json
import
index
log
rsop
),
:post => %w(
accordion_select
action_edit
action_field_changed
action_get_all
action_tag_pressed
alert_delete
alert_edit
alert_field_changed
alert_get_all
alert_profile_assign
alert_profile_assign_changed
alert_profile_delete
alert_profile_edit
alert_profile_field_changed
button
condition_edit
condition_field_changed
event_edit
export
export_field_changed
import
panel_control
policy_edit
policy_get_all
policy_field_changed
profile_edit
profile_field_changed
quick_search
reload
rsop
rsop_option_changed
rsop_show_options
rsop_toggle
tree_autoload_dynatree
tree_select
upload
wait_for_task
) +
adv_search_post +
exp_post +
x_post
},
:miq_request => {
# FIXME: Change stamp to POST only; We need to remove the redirect
:get => %w(
index
post_install_callback
pre_prov
prov_copy
prov_edit
show
show_list
stamp
),
:post => %w(
button
post_install_callback
pre_prov
prov_button
prov_change_options
prov_continue
prov_edit
prov_field_changed
prov_load_tab
prov_show_option
request_copy
request_edit
retrieve_email
show_list
sort_configured_system_grid
sort_ds_grid
sort_host_grid
sort_iso_img_grid
sort_pxe_img_grid
sort_template_grid
sort_vc_grid
sort_vm_grid
sort_windows_image_grid
stamp
stamp_field_changed
vm_pre_prov
upload
) +
dialog_runner_post
},
:miq_task => {
:get => %w(
change_tab
index
jobs
tasks_show_option
),
:post => %w(
button
jobs
tasks_button
tasks_change_options
)
},
:miq_template => {
:get => %w(
edit
show
ownership
),
:post => %w(
edit
edit_vm
form_field_changed
show
) +
ownership_post
},
:ontap_file_share => {
:get => %w(
cim_base_storage_extents
create_ds
download_data
index
protect
show
show_list
snia_local_file_systems
tagging_edit
) +
compare_get,
:post => %w(
button
create_ds
create_ds_field_changed
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:ontap_logical_disk => {
:get => %w(
cim_base_storage_extents
download_data
index
protect
show
show_list
snia_local_file_systems
tagging_edit
) +
compare_get,
:post => %w(
button
panel_control
perf_chart_chooser
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
wait_for_task
) +
adv_search_post +
compare_post +
exp_post
},
:ontap_storage_system => {
:get => %w(
cim_base_storage_extents
create_ld
download_data
index
protect
show
show_list
snia_local_file_systems
tagging_edit
) +
compare_get,
:post => %w(
button
create_ld
create_ld_field_changed
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:ontap_storage_volume => {
:get => %w(
cim_base_storage_extents
download_data
index
protect
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
panel_control
protect
quick_search
sections_field_changed
show
show_list
tag_edit_form_field_changed
tagging_edit
) +
adv_search_post +
compare_post +
exp_post
},
:ops => {
:get => %w(
explorer
fetch_audit_log
fetch_build
fetch_log
fetch_production_log
log_collection_form_fields
log_protocol_changed
pglogical_subscriptions_form_fields
schedule_form_fields
show_product_update
tenant_quotas_form_fields
tenant_form_fields
ldap_regions_list
),
:post => %w(
accordion_select
activate
apply_imports
ap_ce_delete
ap_ce_select
ap_edit
ap_form_field_changed
ap_set_active_tab
aps_list
category_delete
category_edit
category_field_changed
category_update
ce_accept
ce_delete
ce_new_cat
ce_select
change_tab
cu_collection_field_changed
cu_collection_update
cu_repair
cu_repair_field_changed
db_backup
db_backup_form_field_changed
db_gc_collection
db_list
diagnostics_server_list
diagnostics_tree_select
diagnostics_worker_selected
edit_rhn
explorer
fetch_build
forest_accept
forest_delete
forest_form_field_changed
forest_select
log_depot_edit
log_depot_field_changed
log_depot_validate
orphaned_records_delete
perf_chart_chooser
pglogical_save_subscriptions
pglogical_validate_subscription
product_updates_list
rbac_group_edit
rbac_group_field_changed
rbac_group_seq_edit
rbac_group_user_lookup
rbac_groups_list
rbac_role_edit
rbac_role_field_changed
rbac_roles_list
rbac_tags_edit
rbac_tenant_edit
rbac_tenants_list
rbac_tenant_manage_quotas
rbac_user_edit
rbac_user_field_changed
rbac_users_list
region_edit
region_form_field_changed
repo_default_name
restart_server
rhn_buttons
rhn_default_server
rhn_validate
schedule_edit
schedule_form_field_changed
schedule_form_filter_type_field_changed
schedules_list
schedule_update
settings_form_field_changed
settings_update
show
show_product_update
smartproxy_affinity_field_changed
tag_edit_form_field_changed
tl_chooser
tree_autoload_dynatree
tree_select
update
upload_csv
upload_form_field_changed
upload_login_logo
upload_logo
validate_replcation_worker
wait_for_task
x_button
x_show
zone_edit
zone_field_changed
ldap_region_add
ldap_region_edit
ldap_region_form_field_changed
ldap_domain_edit
ldap_domain_form_field_changed
ls_select
ldap_entry_changed
ls_delete
)
},
:orchestration_stack => {
:get => %w(
cloud_networks
download_data
retirement_info
index
outputs
parameters
resources
retire
show
show_list
stacks_ot_info
tagging_edit
protect
),
:post => %w(
button
cloud_networks
outputs
listnav_search_selected
panel_control
parameters
quick_search
resources
retire
sections_field_changed
show
show_list
stacks_ot_copy
protect
tagging_edit
tag_edit_form_field_changed
) +
adv_search_post +
exp_post +
save_post
},
:provider_foreman => {
:get => %w(
download_data
explorer
provider_foreman_form_fields
show
show_list
tagging_edit
),
:post => %w(
accordion_select
authentication_validate
button
change_tab
delete
edit
explorer
exp_button
exp_changed
exp_token_pressed
form_field_changed
new
panel_control
provision
quick_search
refresh
reload
show
show_list
tagging
tagging_edit
tag_edit_form_field_changed
tree_autoload_dynatree
tree_select
configscript_service_dialog_submit
cs_form_field_changed
users
wait_for_task
) +
adv_search_post +
x_post
},
:pxe => {
:get => %w(
explorer
),
:post => %w(
accordion_select
explorer
iso_datastore_create
iso_datastore_form_field_changed
iso_datastore_list
iso_image_edit
iso_img_form_field_changed
log_depot_validate
pxe_image_edit
pxe_image_type_edit
pxe_image_type_form_field_changed
pxe_image_type_list
pxe_img_form_field_changed
pxe_server_create_update
pxe_server_form_field_changed
pxe_server_list
pxe_wimg_edit
pxe_wimg_form_field_changed
reload
template_create_update
template_form_field_changed
template_list
tree_autoload_dynatree
tree_select
x_button
x_history
)
},
:report => {
:get => %w(
db_widget_dd_done
download_report
explorer
export_widgets
miq_report_edit
miq_report_new
preview_chart
preview_timeline
render_chart
report_only
sample_chart
sample_timeline
send_report_data
tree_autoload_dynatree
tree_select
),
:post => %w(
accordion_select
change_tab
create
db_edit
db_form_field_changed
db_seq_edit
db_widget_dd_done
db_widget_remove
discard_changes
explorer
export_field_changed
filter_change
form_field_changed
get_report
import_widgets
menu_editor
menu_field_changed
menu_folder_message_display
menu_update
miq_report_edit
reload
rep_change_tab
saved_report_paging
schedule_edit
schedule_form_field_changed
show_preview
show_saved
tree_autoload_dynatree
tree_select
upload
upload_widget_import_file
wait_for_task
widget_edit
widget_form_field_changed
widget_shortcut_dd_done
widget_shortcut_remove
widget_shortcut_reset
x_button
x_history
x_show
) +
exp_post
},
:resource_pool => {
:get => %w(
download_data
index
protect
show
show_list
tagging_edit
) +
compare_get,
:post => %w(
button
listnav_search_selected
panel_control
protect
sections_field_changed
show
show_list
tagging_edit
tag_edit_form_field_changed
tree_autoload_dynatree
quick_search
) +
adv_search_post +
compare_post +
exp_post +
save_post
},
:service => {
:get => %w(
download_data
explorer
retirement_info
reconfigure_form_fields
retire
service_form_fields
show
),
:post => %w(
button
explorer
ownership_field_changed
ownership_update
reload
retire
service_edit
service_tag
tag_edit_form_field_changed
tree_autoload_dynatree
tree_select
x_button
x_history
x_show
) +
dialog_runner_post
},
# TODO: revisit this controller/route, might be removed after other storage issues are sorted out
:snia_local_file_system => {
:get => %w(show)
},
:storage => {
:get => %w(
button
debris_files
dialog_load
disk_files
download_data
explorer
files
index
perf_chart_chooser
protect
show
show_list
snapshot_files
tagging_edit
tree_select
vm_ram_files
vm_misc_files
x_show
) +
compare_get,
:post => %w(
accordion_select
button
debris_files
explorer
files
listnav_search_selected
panel_control
disk_files
perf_chart_chooser
protect
quick_search
sections_field_changed
show
show_association
show_details
show_list
storage_list
storage_pod_list
snapshot_files
tag_edit_form_field_changed
tagging
tagging_edit
tree_autoload_dynatree
tree_select
vm_misc_files
vm_ram_files
wait_for_task
x_search_by_name
x_show
) +
adv_search_post +
compare_post +
dialog_runner_post +
exp_post +
save_post +
x_post
},
:storage_manager => {
:get => %w(
download_data
edit
index
new
show
show_list
),
:post => %w(
button
create
form_field_changed
panel_control
quick_search
show
show_list
update
) +
adv_search_post +
exp_post
},
:support => {
:get => %w(index)
},
:vm => {
:get => %w(
download_data
edit
retirement_info
ownership
policy_sim
reconfigure
reconfigure_form_fields
resize
evacuate
evacuate_form_fields
live_migrate
live_migrate_form_fields
retire
right_size
show
show_list
),
:post => %w(
edit_vm
form_field_changed
policy_sim
policy_sim_add
policy_sim_remove
provision
reconfigure
reconfigure_form_fields
reconfigure_update
resize_field_changed
resize_vm
evacuate_vm
live_migrate_vm
retire
right_size
set_checked_items
show_list
vmtree_selected
) +
ownership_post +
pre_prov_post
},
:vm_cloud => {
:get => %w(
download_data
drift_to_csv
drift_to_pdf
drift_to_txt
explorer
filesystem_download
retirement_info
reconfigure_form_fields
launch_html5_console
perf_chart_chooser
protect
retire
show
tagging_edit
resize
migrate
live_migrate_form_fields
attach
detach
evacuate
evacuate_form_fields
) +
compare_get,
:post => %w(
advanced_settings
accordion_select
button
edit_vm
resize_vm
resize_field_changed
event_logs
explorer
launch_html5_console
filesystems
filesystem_drivers
form_field_changed
guest_applications
groups
html5_console
kernel_drivers
linux_initprocesses
ownership_field_changed
ownership_update
panel_control
patches
perf_chart_chooser
policies
processes
protect
prov_edit
prov_field_changed
quick_search
registry_items
reload
retire
reconfigure_update
scan_histories
sections_field_changed
security_groups
floating_ips
network_routers
network_ports
cloud_subnets
cloud_networks
cloud_volumes
show
squash_toggle
tagging_edit
tag_edit_form_field_changed
tl_chooser
tree_autoload_dynatree
tree_select
users
vm_pre_prov
wait_for_task
win32_services
live_migrate_vm
attach_volume
detach_volume
evacuate_vm
) +
adv_search_post +
compare_post +
dialog_runner_post +
drift_post +
evm_relationship_post +
exp_post +
policy_post +
pre_prov_post +
x_post
},
:vm_infra => {
:get => %w(
download_data
drift_to_csv
drift_to_pdf
drift_to_txt
explorer
filesystem_download
retirement_info
reconfigure_form_fields
launch_vmware_console
launch_html5_console
perf_chart_chooser
policies
protect
retire
show
tagging_edit
) +
compare_get,
:post => %w(
accordion_select
advanced_settings
button
edit_vm
event_logs
explorer
filesystems
filesystem_drivers
form_field_changed
guest_applications
groups
kernel_drivers
linux_initprocesses
ontap_file_shares
ontap_logical_disks
ontap_storage_systems
ontap_storage_volume
ownership_field_changed
ownership_update
panel_control
patches
perf_chart_chooser
policies
protect
processes
prov_edit
prov_field_changed
quick_search
reconfigure_field_changed
reconfigure_update
registry_items
reload
retire
scan_histories
sections_field_changed
security_groups
show
sort_ds_grid
sort_host_grid
sort_iso_img_grid
sort_vc_grid
sort_template_grid
sort_vm_grid
squash_toggle
tagging_edit
tag_edit_form_field_changed
tl_chooser
tree_autoload_dynatree
tree_select
users
vmrc_console
vm_pre_prov
vm_vdi
html5_console
wait_for_task
win32_services
) +
adv_search_post +
compare_post +
dialog_runner_post +
drift_post +
evm_relationship_post +
exp_post +
policy_post +
pre_prov_post +
snap_post +
x_post
},
:vm_or_template => {
:get => %w(
download_data
drift_to_csv
drift_to_pdf
drift_to_txt
explorer
launch_html5_console
retirement_info
reconfigure_form_fields
launch_vmware_console
protect
retire
show
tagging_edit
util_report_download
utilization
vm_show
) +
compare_get,
:post => %w(
accordion_select
advanced_settings
button
console
drift_all
drift_differences
drift_history
drift_mode
drift_same
edit_vm
event_logs
explorer
filesystem_drivers
filesystems
form_field_changed
groups
guest_applications
kernel_drivers
linux_initprocesses
ontap_file_shares
ontap_logical_disks
ontap_storage_systems
ownership_field_changed
ownership_update
panel_control
patches
perf_chart_chooser
policies
processes
protect
prov_edit
prov_field_changed
quick_search
reconfigure_field_changed
reconfigure_update
registry_items
reload
retire
scan_histories
sections_field_changed
security_groups
floating_ips
network_routers
network_ports
cloud_subnets
cloud_networks
cloud_volumes
show
sort_ds_grid
sort_host_grid
sort_iso_img_grid
sort_vc_grid
squash_toggle
tagging_edit
tag_edit_form_field_changed
tl_chooser
tree_select
users
util_chart_chooser
vm_pre_prov
vmrc_console
html5_console
wait_for_task
win32_services
x_button
x_history
x_search_by_name
x_show
) +
adv_search_post +
compare_post +
dialog_runner_post +
evm_relationship_post +
exp_post +
policy_post +
pre_prov_post +
snap_post
},
}
root :to => 'dashboard#login'
get '/saml_login(/*path)' => 'dashboard#saml_login'
# Let's serve pictures directly from the DB
get '/pictures/:basename' => 'picture#show', :basename => /[\da-zA-Z]+\.[\da-zA-Z]+/
# Enablement for the REST API
# OPTIONS requests for REST API pre-flight checks
# Semantic Versioning Regex for API, i.e. vMajor.minor.patch[-pre]
API_VERSION_REGEX = /v[\d]+(\.[\da-zA-Z]+)*(\-[\da-zA-Z]+)?/
match '/api/*path' => 'api#handle_options_request', :via => [:options]
get '/api(/:version)' => 'api#show_entrypoint', :format => 'json', :version => API_VERSION_REGEX
API_ACTIONS = {
:get => "show",
:post => "update",
:put => "update",
:patch => "update",
:delete => "destroy"
}.freeze
def action_for(verb)
"api##{API_ACTIONS[verb]}"
end
def create_api_route(verb, url, action)
public_send(verb, url, :to => action, :format => "json", :version => API_VERSION_REGEX)
end
Api::Settings.collections.each do |collection_name, collection|
collection.verbs.each do |verb|
if collection.options.include?(:primary)
create_api_route(verb, "/api(/:version)/#{collection_name}", action_for(verb))
end
if collection.options.include?(:collection)
create_api_route(verb, "/api(/:version)/#{collection_name}(/:c_id)", action_for(verb))
end
end
Array(collection.subcollections).each do |subcollection_name|
Api::Settings.collections[subcollection_name].verbs.each do |verb|
create_api_route(verb,
"/api(/:version)/#{collection_name}/:c_id/#{subcollection_name}(/:s_id)",
action_for(verb))
end
end
end
controller_routes.each do |controller_name, controller_actions|
# Default route with no action to controller's index action
unless [:ems_cloud, :ems_infra, :ems_container].include?(controller_name)
match "#{controller_name}", :controller => controller_name, :action => :index, :via => :get
end
# One-by-one get/post routes for defined controllers
if controller_actions.kind_of?(Hash)
unless controller_actions[:get].nil?
controller_actions[:get].each do |action_name|
get "#{controller_name}/#{action_name}(/:id)",
:action => action_name,
:controller => controller_name
end
end
unless controller_actions[:post].nil?
controller_actions[:post].each do |action_name|
post "#{controller_name}/#{action_name}(/:id)",
:action => action_name,
:controller => controller_name
end
end
end
end
# pure-angular templates
get '/static/*id' => 'static#show', :format => false
# ping response for load balancing
get '/ping' => 'ping#index'
resources :ems_cloud, :as => :ems_clouds
resources :ems_infra, :as => :ems_infras
resources :ems_container, :as => :ems_containers
match "/auth/:provider/callback" => "sessions#create", :via => :get
if Rails.env.development? && defined?(Rails::Server)
mount WebsocketServer.new(:logger => Logger.new(STDOUT)) => '/ws'
end
# rubocop:enable MultilineOperationIndentation
# rubocop:enable AlignHash
end
|
ActionController::Routing::Routes.draw do |map|
map.connect "", :controller => "static", :action => "index"
map.connect "post/show/:id/:tag_title", :controller => "post", :action => "show", :requirements => {:id => /\d+/}
map.connect "pool/zip/:id/:filename", :controller => "pool", :action => "zip", :requirements => {:id => /\d+/, :filename => /.*/}
map.connect ":controller/:action/:id.:format", :requirements => {:id => /[-\d]+/}
map.connect ":controller/:action/:id", :requirements => {:id => /[-\d]+/}
map.connect ":controller/:action.:format"
map.connect ":controller/:action"
end
route for browse-pool
--HG--
branch : moe
extra : convert_revision : svn%3A2d28d66d-8d94-df11-8c86-00306ef368cb/trunk/moe%40427
ActionController::Routing::Routes.draw do |map|
map.connect "", :controller => "static", :action => "index"
map.connect "post/show/:id/:tag_title", :controller => "post", :action => "show", :requirements => {:id => /\d+/}
map.connect "post/browse-pool/:id", :controller => "post", :action => "browse-pool", :requirements => {:id => /\d+/}
map.connect "pool/zip/:id/:filename", :controller => "pool", :action => "zip", :requirements => {:id => /\d+/, :filename => /.*/}
map.connect ":controller/:action/:id.:format", :requirements => {:id => /[-\d]+/}
map.connect ":controller/:action/:id", :requirements => {:id => /[-\d]+/}
map.connect ":controller/:action.:format"
map.connect ":controller/:action"
end
|
SEMAT::Application.routes.draw do
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
devise_for :users, :controllers => { :registrations => "registrations" }
root :to => "welcome#index"
resources :teams
get "teams/checklists"
post "teams/:team_id/mass_invite" => "teams#mass_invite", as: :mass_invite
get "alphas" => "alphas#index"
get "alphas/:team_id" => "alphas#index"
# resources :alphas
get "simple_alphas" => "alphas#simple_index"
get "users/:email/teams" => "users#my_teams", as: :my_teams, :email => /[A-Za-z0-9@\.]+?/
get 'static/about' => 'static#about', as: :about
# get 'static/:action' => 'static#:action'
namespace :api do
namespace :v1 do
# Directs /admin/products/* to Admin::ProductsController
# (app/controllers/admin/products_controller.rb)
resources :alphas
devise_scope :user do
post 'sessions' => 'sessions#create', :as => 'login'
delete 'sessions' => 'sessions#destroy', :as => 'logout'
end
get "simple_alphas" => "alphas#simple_index"
post "progress/:team_id/mark" => "progress#mark"
post "progress/:team_id/save_notes" => "progress#save_notes"
post "progress/:team_id/save_actions" => "progress#save_actions"
get "progress/:team_id" => "progress#show"
get "progress/:team_id/current_alpha_states" => "progress#current_alpha_states"
get "users/:email/teams" => "users#my_teams", as: :my_teams, :email => /[A-Za-z0-9@\.]+?/
post "users/find_or_register" => "users#find_or_register"
post "teams/:team_id/rename" => "teams#rename"
post "teams/:team_id/add_member" => "teams#add_member"
post "teams/:team_id/remove_member" => "teams#remove_member"
get "test/get" => "test#get"
post "test/post" => "test#post"
end
end
constraints(:host => /essence.sv.cmu.edu/) do
match "/(*path)" => redirect {|params, req| "http://semat.herokuapp.com/#{params[:path]}"}, via: [:get, :post]
end
constraints(:host => /essence.ece.cmu.edu/) do
match "/(*path)" => redirect {|params, req| "http://semat.herokuapp.com/#{params[:path]}"}, via: [:get, :post]
end
# get "alphas/show"
# get "alphas/show"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Moved url redirects to top
SEMAT::Application.routes.draw do
constraints(:host => /essence.sv.cmu.edu/) do
match "/(*path)" => redirect {|params, req| "http://semat.herokuapp.com/#{params[:path]}"}, via: [:get, :post]
end
constraints(:host => /essence.ece.cmu.edu/) do
match "/(*path)" => redirect {|params, req| "http://semat.herokuapp.com/#{params[:path]}"}, via: [:get, :post]
end
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
devise_for :users, :controllers => { :registrations => "registrations" }
root :to => "welcome#index"
resources :teams
get "teams/checklists"
post "teams/:team_id/mass_invite" => "teams#mass_invite", as: :mass_invite
get "alphas" => "alphas#index"
get "alphas/:team_id" => "alphas#index"
# resources :alphas
get "simple_alphas" => "alphas#simple_index"
get "users/:email/teams" => "users#my_teams", as: :my_teams, :email => /[A-Za-z0-9@\.]+?/
get 'static/about' => 'static#about', as: :about
# get 'static/:action' => 'static#:action'
namespace :api do
namespace :v1 do
# Directs /admin/products/* to Admin::ProductsController
# (app/controllers/admin/products_controller.rb)
resources :alphas
devise_scope :user do
post 'sessions' => 'sessions#create', :as => 'login'
delete 'sessions' => 'sessions#destroy', :as => 'logout'
end
get "simple_alphas" => "alphas#simple_index"
post "progress/:team_id/mark" => "progress#mark"
post "progress/:team_id/save_notes" => "progress#save_notes"
post "progress/:team_id/save_actions" => "progress#save_actions"
get "progress/:team_id" => "progress#show"
get "progress/:team_id/current_alpha_states" => "progress#current_alpha_states"
get "users/:email/teams" => "users#my_teams", as: :my_teams, :email => /[A-Za-z0-9@\.]+?/
post "users/find_or_register" => "users#find_or_register"
post "teams/:team_id/rename" => "teams#rename"
post "teams/:team_id/add_member" => "teams#add_member"
post "teams/:team_id/remove_member" => "teams#remove_member"
get "test/get" => "test#get"
post "test/post" => "test#post"
end
end
# get "alphas/show"
# get "alphas/show"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
require 'sidekiq/web'
# Sidekiq dashboard HTTP basic auth
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
username == Figaro.env.sidekiq_dashboard_username && password == Figaro.env.sidekiq_dashboard_password
end if Rails.env.production? || Rails.env.staging?
# host, protocol, port for full URLs
default_url_options = {
host: Figaro.env.transitland_datastore_host.match(/:\/\/([^:]+)/)[1],
protocol: Figaro.env.transitland_datastore_host.split('://')[0]
}
if (port_match = Figaro.env.transitland_datastore_host.match(/:(\d+)/))
default_url_options[:port] = port_match[1]
end
Rails.application.routes.default_url_options = default_url_options
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
get '/onestop_id/:onestop_id', to: 'onestop_id#show'
resources :changesets, only: [:index, :show, :create, :update] do
member do
post 'check'
post 'apply'
post 'revert'
end
end
resources :stops, only: [:index, :show]
resources :operators, only: [:index, :show]
resources :routes, only: [:index, :show]
resources :feeds, only: [:index, :show] do
resources :feed_imports, only: [:index]
end
post '/webhooks/feed_eater', to: 'webhooks#feed_eater'
end
match '*unmatched_route', :to => 'v1/base_api#raise_not_found!', via: :all
end
mount Sidekiq::Web => '/worker_dashboard'
end
another fix for Rails base URL
fixes commit aa83fd8bd0e481e3c69a544aac4cfacfa2793ff3
require 'sidekiq/web'
# Sidekiq dashboard HTTP basic auth
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
username == Figaro.env.sidekiq_dashboard_username && password == Figaro.env.sidekiq_dashboard_password
end if Rails.env.production? || Rails.env.staging?
# host, protocol, port for full URLs
if Figaro.env.transitland_datastore_host.present?
default_url_options = {
host: Figaro.env.transitland_datastore_host.match(/:\/\/([^:]+)/)[1],
protocol: Figaro.env.transitland_datastore_host.split('://')[0]
}
if (port_match = Figaro.env.transitland_datastore_host.match(/:(\d+)/))
default_url_options[:port] = port_match[1]
end
else
default_url_options = {
host: 'localhost',
protocol: 'http',
port: '3000'
}
end
Rails.application.routes.default_url_options = default_url_options
Rails.application.routes.draw do
namespace :api do
namespace :v1 do
get '/onestop_id/:onestop_id', to: 'onestop_id#show'
resources :changesets, only: [:index, :show, :create, :update] do
member do
post 'check'
post 'apply'
post 'revert'
end
end
resources :stops, only: [:index, :show]
resources :operators, only: [:index, :show]
resources :routes, only: [:index, :show]
resources :feeds, only: [:index, :show] do
resources :feed_imports, only: [:index]
end
post '/webhooks/feed_eater', to: 'webhooks#feed_eater'
end
match '*unmatched_route', :to => 'v1/base_api#raise_not_found!', via: :all
end
mount Sidekiq::Web => '/worker_dashboard'
end
|
Catarse::Application.routes.draw do
devise_for :users, :controllers => {:registrations => "registrations", :passwords => "passwords"} do
get "/login" => "devise/sessions#new"
end
# Non production routes
if Rails.env == "test"
match "/fake_login" => "sessions#fake_create", :as => :fake_login
elsif Rails.env == "development"
resources :emails, :only => [ :index ]
end
ActiveAdmin.routes(self)
mount CatarseDineromail::Engine => "/", :as => "catarse_dineromail"
filter :locale
root to: 'projects#index'
match "/reports/financial/:project_id/backers" => "reports#financial_by_project", :as => :backers_financial_report
match "/reports/location/:project_id/backers" => "reports#location_by_project", :as => :backers_location_report
match "/reports/users_most_backed" => "reports#users_most_backed", :as => :most_backed_report
match "/reports/all_confirmed_backers" => "reports#all_confirmed_backers", :as => :all_confirmed_backers_report
match "/reports/all_projects_owners" => "reports#all_projects_owner", :as => :all_projects_owner_report
match "/reports/all_emails" => "reports#all_emails_to_newsletter", :as => :all_emails_to_newsletter
# Static Pages
match '/sitemap' => "static#sitemap", :as => :sitemap
match "/guidelines" => "static#guidelines", :as => :guidelines
match "/faq" => "static#faq", :as => :faq
match "/terms" => "static#terms", :as => :terms
match "/privacy" => "static#privacy", :as => :privacy
match "/thank_you" => "payment_stream#thank_you", :as => :thank_you
match "/moip" => "payment_stream#moip", :as => :moip
match "/explore" => "explore#index", :as => :explore
match "/explore#:quick" => "explore#index", :as => :explore_quick
match "/credits" => "credits#index", :as => :credits
post "/auth" => "sessions#auth", :as => :auth
match "/auth/:provider/callback" => "sessions#create"
match "/auth/failure" => "sessions#failure"
match "/logout" => "sessions#destroy", :as => :logout
resources :posts, only: [:index, :create]
resources :projects, only: [:index, :new, :create, :show] do
resources :updates, :only => [:index, :create, :destroy]
resources :rewards
resources :backers, controller: 'projects/backers' do
collection do
post 'review'
end
member do
put 'checkout'
end
end
collection do
get 'start'
post 'send_mail'
get 'vimeo'
get 'cep'
get 'pending'
get 'pending_backers'
get 'thank_you'
post 'update_attribute_on_the_spot'
end
member do
put 'pay'
get 'embed'
get 'video_embed'
end
end
resources :users do
resources :backers, :only => [:index]
member do
get 'projects'
get 'credits'
end
post 'update_attribute_on_the_spot', :on => :collection
end
match "/users/:id/request_refund/:back_id" => 'users#request_refund'
resources :credits, only: [:index] do
collection do
get 'buy'
post 'refund'
end
end
resources :paypal, only: [] do
member do
get :pay
get :success
get :cancel
get :notifications
end
end
resources :curated_pages do
collection do
post 'update_attribute_on_the_spot'
end
end
match "/pages/:permalink" => "curated_pages#show", as: :curated_page
resources :tests
match "/:permalink" => "projects#show", as: :project_by_slug
end
disabled routes for paypal and payment_stream#moip
Catarse::Application.routes.draw do
devise_for :users, :controllers => {:registrations => "registrations", :passwords => "passwords"} do
get "/login" => "devise/sessions#new"
end
# Non production routes
if Rails.env == "test"
match "/fake_login" => "sessions#fake_create", :as => :fake_login
elsif Rails.env == "development"
resources :emails, :only => [ :index ]
end
ActiveAdmin.routes(self)
mount CatarseDineromail::Engine => "/", :as => "catarse_dineromail"
filter :locale
root to: 'projects#index'
match "/reports/financial/:project_id/backers" => "reports#financial_by_project", :as => :backers_financial_report
match "/reports/location/:project_id/backers" => "reports#location_by_project", :as => :backers_location_report
match "/reports/users_most_backed" => "reports#users_most_backed", :as => :most_backed_report
match "/reports/all_confirmed_backers" => "reports#all_confirmed_backers", :as => :all_confirmed_backers_report
match "/reports/all_projects_owners" => "reports#all_projects_owner", :as => :all_projects_owner_report
match "/reports/all_emails" => "reports#all_emails_to_newsletter", :as => :all_emails_to_newsletter
# Static Pages
match '/sitemap' => "static#sitemap", :as => :sitemap
match "/guidelines" => "static#guidelines", :as => :guidelines
match "/faq" => "static#faq", :as => :faq
match "/terms" => "static#terms", :as => :terms
match "/privacy" => "static#privacy", :as => :privacy
match "/thank_you" => "payment_stream#thank_you", :as => :thank_you
#match "/moip" => "payment_stream#moip", :as => :moip
match "/explore" => "explore#index", :as => :explore
match "/explore#:quick" => "explore#index", :as => :explore_quick
match "/credits" => "credits#index", :as => :credits
post "/auth" => "sessions#auth", :as => :auth
match "/auth/:provider/callback" => "sessions#create"
match "/auth/failure" => "sessions#failure"
match "/logout" => "sessions#destroy", :as => :logout
resources :posts, only: [:index, :create]
resources :projects, only: [:index, :new, :create, :show] do
resources :updates, :only => [:index, :create, :destroy]
resources :rewards
resources :backers, controller: 'projects/backers' do
collection do
post 'review'
end
member do
put 'checkout'
end
end
collection do
get 'start'
post 'send_mail'
get 'vimeo'
get 'cep'
get 'pending'
get 'pending_backers'
get 'thank_you'
post 'update_attribute_on_the_spot'
end
member do
put 'pay'
get 'embed'
get 'video_embed'
end
end
resources :users do
resources :backers, :only => [:index]
member do
get 'projects'
get 'credits'
end
post 'update_attribute_on_the_spot', :on => :collection
end
match "/users/:id/request_refund/:back_id" => 'users#request_refund'
resources :credits, only: [:index] do
collection do
get 'buy'
post 'refund'
end
end
#resources :paypal, only: [] do
#member do
#get :pay
#get :success
#get :cancel
#get :notifications
#end
#end
resources :curated_pages do
collection do
post 'update_attribute_on_the_spot'
end
end
match "/pages/:permalink" => "curated_pages#show", as: :curated_page
resources :tests
match "/:permalink" => "projects#show", as: :project_by_slug
end
|
# = test_resource_get.rb
#
# Unit Test of Resource get method
#
# == Project
#
# * ActiveRDF
# <http://m3pe.org/activerdf/>
#
# == Authors
#
# * Eyal Oren <first dot last at deri dot org>
# * Renaud Delbru <first dot last at deri dot org>
#
# == Copyright
#
# (c) 2005-2006 by Eyal Oren and Renaud Delbru - All Rights Reserved
#
# == To-do
#
# * To-do 1
#
require 'test/unit'
require 'active_rdf'
require 'node_factory'
class TestResourceGet < Test::Unit::TestCase
def setup
params = { :adapter => :redland }
NodeFactory.connection(params)
end
def test_1_empty_db
subject = NodeFactory.create_basic_identified_resource("http://m3pe.org/subject")
predicate = NodeFactory.create_basic_identified_resource("http://m3pe.org/predicate")
result = Resource.get(subject, predicate)
end
end
Removed because add a test unit for each adapter
|
Rails.application.routes.draw do
resources :publishers, only: %i(create update new show javascript_detected) do
collection do
get :sign_up
put :javascript_detected
get :create_done
post :resend_auth_email, action: :resend_auth_email
get :home
get :log_in, action: :new_auth_token, as: :new_auth_token
post :log_in, action: :create_auth_token, as: :create_auth_token
get :change_email
get :change_email_confirm
patch :update_email
get :expired_auth_token
get :log_out
get :email_verified
get :balance
get :uphold_verified
get :statement
get :statement_ready
get :statements
get :uphold_status
patch :verify
patch :update
patch :generate_statement
patch :complete_signup
patch :disconnect_uphold
get :choose_new_channel_type
resources :two_factor_authentications, only: %i(index)
resources :two_factor_registrations, only: %i(index) do
collection do
get :prompt
end
end
resources :u2f_registrations, only: %i(new create destroy)
resources :u2f_authentications, only: %i(create)
resources :totp_registrations, only: %i(new create destroy)
resources :totp_authentications, only: %i(create)
resources :promo_registrations, only: %i(index create)
end
end
devise_for :publishers, only: :omniauth_callbacks, controllers: { omniauth_callbacks: "publishers/omniauth_callbacks" }
resources :channels, only: %i(destroy) do
member do
get :verification_status
get :cancel_add
delete :destroy
end
end
resources :site_channels, only: %i(create update new show) do
member do
patch :update_unverified
patch :check_for_https
patch :verify
get :download_verification_file
get :verification_choose_method
get :verification_dns_record
get :verification_public_file
get :verification_github
get :verification_wordpress
get :verification_support_queue
end
end
resources :static, only: [] do
collection do
get :index
end
end
root "static#index"
namespace :api, defaults: { format: :json } do
resources :owners, only: %i(index create), constraints: { owner_id: %r{[^\/]+} } do
resources :channels, only: %i(create), constraints: { channel_id: %r{[^\/]+} } do
get "/", action: :show
post "notifications", action: :notify
end
end
resources :tokens, only: %i(index)
resources :channels, constraints: { channel_id: %r{[^\/]+} }
namespace :public, defaults: { format: :json } do
get "channels/identity", controller: 'channels/identity'
end
end
resources :errors, only: [], path: "/" do
collection do
get "400", action: :error_400
get "401", action: :error_401
get "403", action: :error_403
get "404", action: :error_404
get "422", action: :error_422
get "500", action: :error_500
end
end
require "sidekiq/web"
if Rails.env.production?
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
# Protect against timing attacks: (https://codahale.com/a-lesson-in-timing-attacks/)
# - Use & (do not use &&) so that it doesn't short circuit.
# - Use `secure_compare` to stop length information leaking
ActiveSupport::SecurityUtils.secure_compare(username, ENV["SIDEKIQ_USERNAME"]) &
ActiveSupport::SecurityUtils.secure_compare(password, ENV["SIDEKIQ_PASSWORD"])
end
end
mount Sidekiq::Web, at: "/magic"
end
Remove unnecessary route declaration
Rails.application.routes.draw do
resources :publishers, only: %i(create update new show) do
collection do
get :sign_up
put :javascript_detected
get :create_done
post :resend_auth_email, action: :resend_auth_email
get :home
get :log_in, action: :new_auth_token, as: :new_auth_token
post :log_in, action: :create_auth_token, as: :create_auth_token
get :change_email
get :change_email_confirm
patch :update_email
get :expired_auth_token
get :log_out
get :email_verified
get :balance
get :uphold_verified
get :statement
get :statement_ready
get :statements
get :uphold_status
patch :verify
patch :update
patch :generate_statement
patch :complete_signup
patch :disconnect_uphold
get :choose_new_channel_type
resources :two_factor_authentications, only: %i(index)
resources :two_factor_registrations, only: %i(index) do
collection do
get :prompt
end
end
resources :u2f_registrations, only: %i(new create destroy)
resources :u2f_authentications, only: %i(create)
resources :totp_registrations, only: %i(new create destroy)
resources :totp_authentications, only: %i(create)
resources :promo_registrations, only: %i(index create)
end
end
devise_for :publishers, only: :omniauth_callbacks, controllers: { omniauth_callbacks: "publishers/omniauth_callbacks" }
resources :channels, only: %i(destroy) do
member do
get :verification_status
get :cancel_add
delete :destroy
end
end
resources :site_channels, only: %i(create update new show) do
member do
patch :update_unverified
patch :check_for_https
patch :verify
get :download_verification_file
get :verification_choose_method
get :verification_dns_record
get :verification_public_file
get :verification_github
get :verification_wordpress
get :verification_support_queue
end
end
resources :static, only: [] do
collection do
get :index
end
end
root "static#index"
namespace :api, defaults: { format: :json } do
resources :owners, only: %i(index create), constraints: { owner_id: %r{[^\/]+} } do
resources :channels, only: %i(create), constraints: { channel_id: %r{[^\/]+} } do
get "/", action: :show
post "notifications", action: :notify
end
end
resources :tokens, only: %i(index)
resources :channels, constraints: { channel_id: %r{[^\/]+} }
namespace :public, defaults: { format: :json } do
get "channels/identity", controller: 'channels/identity'
end
end
resources :errors, only: [], path: "/" do
collection do
get "400", action: :error_400
get "401", action: :error_401
get "403", action: :error_403
get "404", action: :error_404
get "422", action: :error_422
get "500", action: :error_500
end
end
require "sidekiq/web"
if Rails.env.production?
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
# Protect against timing attacks: (https://codahale.com/a-lesson-in-timing-attacks/)
# - Use & (do not use &&) so that it doesn't short circuit.
# - Use `secure_compare` to stop length information leaking
ActiveSupport::SecurityUtils.secure_compare(username, ENV["SIDEKIQ_USERNAME"]) &
ActiveSupport::SecurityUtils.secure_compare(password, ENV["SIDEKIQ_PASSWORD"])
end
end
mount Sidekiq::Web, at: "/magic"
end
|
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'welcome#index'
resources :categories, only: [:index, :new, :create, :show] do
resources :varieties, only: [:new, :create]
end
resource :user_session, only: [:new, :create, :destroy]
resource :user, only: [:new, :create] do
resources :gardens, only: [:create, :edit, :update]
end
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
edit working
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'welcome#index'
resources :categories, only: [:index, :new, :create, :show] do
resources :varieties, only: [:new, :create]
end
resource :user_session, only: [:new, :create, :destroy]
resource :user, only: [:new, :create]
resources :gardens, only: [:create, :edit, :update]
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Gultalks::Application.routes.draw do
devise_for :admin
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
# devise_for :admin_users, ActiveAdmin::Devise.config
# Admin
match 'admin', to: 'admin#index', via: :get, path: '/admin'
# API
match 'api_docs', to: 'api#index', via: :get, path: '/api'
match 'api_conferences', to: 'api#conferences', via: :get, path: '/api/conferences'
match 'api_conference_events', to: 'api#conference_events', via: :get, path: '/api/conferences/:id/events'
match 'api_modify_conference', to: 'api#modify_conference', via: :post, path: '/api/conferences/:id/:task'
# Verifiers
match 'verify', to: 'verifier#verify', via: :get, path: '/verify/:token'
# Conferences
match 'conferences', to: 'conferences#index', via: :get, path: '/conferences'
match 'conference', to: 'conferences#show', via: :get, path: '/:id'
# Comments
resources :comments, path: '/:conference_id/:event_id/comments'
# Event creation
match 'new_conference_event', to: 'events#new', via: :get, path: '/:conference_id/new'
match 'basic_events', to: 'events#new_basic', via: :get, path: '/:conference_id/new/basic'
match 'create_basic_event', to: 'events#create_basic', via: :post, path: '/:conference_id/new/basic'
match 'detailed_events', to: 'events#new_detailed', via: :get, path: '/:conference_id/new/detailed'
match 'create_detailed_event', to: 'events#create_detailed', via: :post, path: '/:conference_id/new/detailed'
# Event edition
match 'edit_event', to: 'events#edit', via: :get, path: '/edit/:token'
match 'save_edited_event', to: 'events#save_edit', via: :patch, path: '/edit/:token'
# Events
match 'conference_events', to: 'events#index', via: :get, path: '/:conference_id/events'
match 'conference_event', to: 'events#show', via: :get, path: '/:conference_id/:id'
match 'propose_speaker_conference_event', to: 'events#propose_speaker', via: :get, path: '/:conference_id/:id/propose_speaker'
match 'send_speaker_conference_event', to: 'events#send_speaker', via: :post, path: '/:conference_id/:id/propose_speaker'
match 'vote_conference_event', to: 'events#vote', via: :get, path: '/:conference_id/:id/vote'
match 'send_vote_conference_event', to: 'events#send_vote', via: :post, path: '/:conference_id/:id/vote'
root 'home#index'
end
Get rid of unsued comment in routes
Gultalks::Application.routes.draw do
devise_for :admin
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
# Admin
match 'admin', to: 'admin#index', via: :get, path: '/admin'
# API
match 'api_docs', to: 'api#index', via: :get, path: '/api'
match 'api_conferences', to: 'api#conferences', via: :get, path: '/api/conferences'
match 'api_conference_events', to: 'api#conference_events', via: :get, path: '/api/conferences/:id/events'
match 'api_modify_conference', to: 'api#modify_conference', via: :post, path: '/api/conferences/:id/:task'
# Verifiers
match 'verify', to: 'verifier#verify', via: :get, path: '/verify/:token'
# Conferences
match 'conferences', to: 'conferences#index', via: :get, path: '/conferences'
match 'conference', to: 'conferences#show', via: :get, path: '/:id'
# Comments
resources :comments, path: '/:conference_id/:event_id/comments'
# Event creation
match 'new_conference_event', to: 'events#new', via: :get, path: '/:conference_id/new'
match 'basic_events', to: 'events#new_basic', via: :get, path: '/:conference_id/new/basic'
match 'create_basic_event', to: 'events#create_basic', via: :post, path: '/:conference_id/new/basic'
match 'detailed_events', to: 'events#new_detailed', via: :get, path: '/:conference_id/new/detailed'
match 'create_detailed_event', to: 'events#create_detailed', via: :post, path: '/:conference_id/new/detailed'
# Event edition
match 'edit_event', to: 'events#edit', via: :get, path: '/edit/:token'
match 'save_edited_event', to: 'events#save_edit', via: :patch, path: '/edit/:token'
# Events
match 'conference_events', to: 'events#index', via: :get, path: '/:conference_id/events'
match 'conference_event', to: 'events#show', via: :get, path: '/:conference_id/:id'
match 'propose_speaker_conference_event', to: 'events#propose_speaker', via: :get, path: '/:conference_id/:id/propose_speaker'
match 'send_speaker_conference_event', to: 'events#send_speaker', via: :post, path: '/:conference_id/:id/propose_speaker'
match 'vote_conference_event', to: 'events#vote', via: :get, path: '/:conference_id/:id/vote'
match 'send_vote_conference_event', to: 'events#send_vote', via: :post, path: '/:conference_id/:id/vote'
root 'home#index'
end
|
Spree::Core::Engine.add_routes do
# Add your extension routes here
resources :orders, :only => [] do
resource :checkout, :controller => 'checkout' do
member do
get :skrill_cancel
get :skrill_return
end
end
end
post '/skrill' => 'skrill_status#update'
end
Update config/routes to use better hash syntax.
Rockets are old news!
Spree::Core::Engine.add_routes do
resources :orders, only: [] do
resource :checkout, controller: 'checkout' do
member do
get :skrill_cancel
get :skrill_return
end
end
end
post '/skrill', to: 'skrill_status#update'
end
|
# s t a g e s
set :stages, %w(integration staging production)
require 'capistrano/ext/multistage'
set :stage, nil
set :default_stage, "integration"
# v e r s i o n c o n t r o l
set :scm, :git
# r e m o t e s e r v e r
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
set :git_enable_submodules, 1
set :use_sudo, false
set :keep_releases, 2
set (:document_root) {"#{deploy_to}/current/public"}
set (:server_cache_dir) {"#{current_release}/application/data/cache"}
set :ssh_keys, File.read("garp/application/configs/authorized_keys")
basepath = "garp/application/configs/deploy/"
load "#{basepath}disk.rb"
load "#{basepath}webroot.rb"
load "#{basepath}crontab.rb"
load "#{basepath}auth.rb"
load "#{basepath}garp.rb"
# d e p l o y
after "deploy:update_code", "deploy:cleanup"
namespace :deploy do
desc "Set up server instance"
task :setup do
transaction do
Auth.add_public_ssh_keys self, ssh_keys
Webroot.find_webroot self, deploy_to
Auth.mark_git_server_safe self
Disk.create_deploy_dirs self, deploy_to
Auth.set_shared_dirs_permissions self, deploy_to
create_webroot_reroute_htaccess
Crontab.install_crontab self, deploy_to, garp_env
prompt_to_set_newly_found_deploy_dir
end
end
desc "Deploy project"
task :update do
transaction do
update_code
Disk.create_system_cache_dirs self, server_cache_dir
Disk.create_static_cache_dir self, current_release
Disk.create_log_dir self, current_release
Disk.set_blackhole_path_symlink_fix self
Garp.spawn
Garp.update_version
Garp.env_setup
Auth.set_webroot_permissions self, releases_path, release_name
symlink
end
end
# Overwritten because cap looks for Rails directories (javascripts, stylesheets, images)
desc "Finalize update"
task :finalize_update do
transaction do
# zzzz
end
end
# ------- P R I V A T E M E T H O D S
desc "Create .htaccess file to reroute webroot"
task :create_webroot_reroute_htaccess do
run "printf '<IfModule mod_rewrite.c>\\n\\tRewriteEngine on\\n\\tRewriteRule ^(.*)$ current/public/$1 [L]\\n</IfModule>' > #{deploy_to}/.htaccess"
end
task :prompt_to_set_newly_found_deploy_dir do
if exists?(:unset_deploy_to)
puts("\033[1;31mDone. Now please set :deploy_to in deploy.rb to:\n#{unset_deploy_to}\033[0m")
end
end
desc "Point the webroot symlink to the current release"
task :symlink do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
end
end
desc "Throw a warning when deploying to production"
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to deploy to a live, public server.
Please confirm that your work is ready for that.
========================================================================
WARN
answer = Capistrano::CLI.ui.ask " Are you sure? (y) "
if answer == 'y' then true else false end
end
unless fetch(:confirmed)
puts "\nDeploy cancelled!"
exit
end
end
before 'production', :ask_production_confirmation
fix param
# s t a g e s
set :stages, %w(integration staging production)
require 'capistrano/ext/multistage'
set :stage, nil
set :default_stage, "integration"
# v e r s i o n c o n t r o l
set :scm, :git
# r e m o t e s e r v e r
set :deploy_via, :remote_cache
ssh_options[:forward_agent] = true
set :git_enable_submodules, 1
set :use_sudo, false
set :keep_releases, 2
set (:document_root) {"#{deploy_to}/current/public"}
set (:server_cache_dir) {"#{current_release}/application/data/cache"}
set :ssh_keys, File.read("garp/application/configs/authorized_keys")
basepath = "garp/application/configs/deploy/"
load "#{basepath}disk.rb"
load "#{basepath}webroot.rb"
load "#{basepath}crontab.rb"
load "#{basepath}auth.rb"
load "#{basepath}garp.rb"
# d e p l o y
after "deploy:update_code", "deploy:cleanup"
namespace :deploy do
desc "Set up server instance"
task :setup do
transaction do
Auth.add_public_ssh_keys self, ssh_keys
Webroot.find_webroot self, deploy_to
Auth.mark_git_server_safe self
Disk.create_deploy_dirs self, deploy_to
Auth.set_shared_dirs_permissions self, deploy_to
create_webroot_reroute_htaccess
Crontab.install_crontab self, deploy_to, garp_env
prompt_to_set_newly_found_deploy_dir
end
end
desc "Deploy project"
task :update do
transaction do
update_code
Disk.create_system_cache_dirs self, server_cache_dir
Disk.create_static_cache_dir self, current_release
Disk.create_log_dir self, current_release
Disk.set_blackhole_path_symlink_fix self, current_release
Garp.spawn
Garp.update_version
Garp.env_setup
Auth.set_webroot_permissions self, releases_path, release_name
symlink
end
end
# Overwritten because cap looks for Rails directories (javascripts, stylesheets, images)
desc "Finalize update"
task :finalize_update do
transaction do
# zzzz
end
end
# ------- P R I V A T E M E T H O D S
desc "Create .htaccess file to reroute webroot"
task :create_webroot_reroute_htaccess do
run "printf '<IfModule mod_rewrite.c>\\n\\tRewriteEngine on\\n\\tRewriteRule ^(.*)$ current/public/$1 [L]\\n</IfModule>' > #{deploy_to}/.htaccess"
end
task :prompt_to_set_newly_found_deploy_dir do
if exists?(:unset_deploy_to)
puts("\033[1;31mDone. Now please set :deploy_to in deploy.rb to:\n#{unset_deploy_to}\033[0m")
end
end
desc "Point the webroot symlink to the current release"
task :symlink do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
end
end
desc "Throw a warning when deploying to production"
task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to deploy to a live, public server.
Please confirm that your work is ready for that.
========================================================================
WARN
answer = Capistrano::CLI.ui.ask " Are you sure? (y) "
if answer == 'y' then true else false end
end
unless fetch(:confirmed)
puts "\nDeploy cancelled!"
exit
end
end
before 'production', :ask_production_confirmation
|
Spree::Core::Engine.routes.draw do
get '/payone_frontend/status', :to => 'payone_frontend#status'
get '/payone_frontend/success', :to => 'payone_frontend#success'
get '/payone_frontend/cancel', :to => 'payone_frontend#cancel'
end
Fix routes to match POST requests.
Spree::Core::Engine.routes.draw do
match '/payone_frontend/status', :to => 'payone_frontend#status'
match '/payone_frontend/success', :to => 'payone_frontend#success'
match '/payone_frontend/cancel', :to => 'payone_frontend#cancel'
end
|
Rails.application.routes.draw do
devise_for :users
get '/dashboard', to: 'users#dashboard'
get '/about', to: 'static_pages#about'
get '/coming_soon', to: 'static_pages#coming_soon'
get '/demo', to: 'users#demo_sign_in'
resources :events, only: [:show, :new, :create, :edit, :update, :destroy]
root 'static_pages#index'
end
updated routes
Rails.application.routes.draw do
devise_for :users
get '/dashboard', to: 'users#dashboard'
get '/about', to: 'static_pages#about'
get '/coming_soon', to: 'static_pages#coming_soon'
get '/demo', to: 'users#demo_sign_in'
resources :events, only: [:show, :new, :create, :edit, :update, :destroy] do
resources :event_times, only: [:new, :create]
end
root 'static_pages#index'
end
|
ActionController::Routing::Routes.draw do |map|
# home page
map.root :controller => 'problems', :action => 'new'
# resources
map.resources :stories, :controller => 'problems',
:except => [:update, :edit, :create],
:collection => {:choose_location => :get, :find => :post, :recent => :get}
map.resources :routes, :only => [:show],
:collection => {:random => :get},
:member => {:respond => :get}
map.resources :stops, :only => [:show],
:collection => {:random => :get},
:member => {:respond => :get}
map.resources :stop_areas, :only => [:show],
:collection => {:random => :get},
:member => {:respond => :get}
# static
map.about '/about', :controller => 'static', :action => 'about'
# admin
map.namespace :admin do |admin|
admin.root :controller => 'home'
admin.resources :location_searches, :only => [:index, :show]
admin.resources :routes, :only => [:index, :show, :update ]
end
end
Email confirmation route, condense resource routing
ActionController::Routing::Routes.draw do |map|
# home page
map.root :controller => 'problems', :action => 'new'
# resources
map.resources :stories, :controller => 'problems',
:except => [:update, :edit, :create],
:collection => {:choose_location => :get, :find => :post, :recent => :get}
map.confirm '/c/:email_token', :action => 'confirm', :controller => 'problems'
[:routes, :stops, :stop_areas].each do |location|
map.resources location, :only => [:show, :update],
:collection => {:random => :get},
:member => {:respond => :get}
end
# static
map.about '/about', :controller => 'static', :action => 'about'
# admin
map.namespace :admin do |admin|
admin.root :controller => 'home'
admin.resources :location_searches, :only => [:index, :show]
admin.resources :routes, :only => [:index, :show, :update ]
end
end
|
Rails.application.routes.draw do
namespace :jera_push do
namespace :admin do
resources :messages, only: [:index, :show, :new, :create] do
collection do
get :device_filter, format: :js
end
member do
get :message_devices_filter, format: :js
end
end
resources :devices, only: [:index]
end
namespace :v1 do
resources :devices, only: [:create] do
collection do
delete :destroy
end
end
end
end
end
Adicionando rota index para admin
Rails.application.routes.draw do
namespace :jera_push do
namespace :admin do
get '/', to: 'devices#index'
resources :messages, only: [:index, :show, :new, :create] do
collection do
get :device_filter, format: :js
end
member do
get :message_devices_filter, format: :js
end
end
resources :devices, only: [:index]
end
namespace :v1 do
resources :devices, only: [:create] do
collection do
delete :destroy
end
end
end
end
end
|
Rails.application.routes.draw do
get "locations", to: 'locations#show', defaults: {format: :json}
get "location" , to: 'locations#show', defaults: {format: :json}
root "locations#show", defaults: {format: :json}
end
add versioning to routes
Rails.application.routes.draw do
namespace :api, defaults: {format: :json} do
scope module: :v1 do
get "locations", to: 'locations#show'
get "location" , to: 'locations#show'
end
end
root "locations#show", defaults: {format: :json}
end
|
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Declare factoid resource.
Rails.application.routes.draw do
resources :factoids, only: [:index, :new, :create, :destroy]
end
|
Rails::Application.routes.draw do
match "/stylesheets/:stylesheet.css" => 'sass_on_heroku_with_rack/stylesheets#show', :as => 'stylesheet'
end
supress warning message
Rails.application.routes.draw do
match "/stylesheets/:stylesheet.css" => 'sass_on_heroku_with_rack/stylesheets#show', :as => 'stylesheet'
end |
Rails.application.routes.draw do
get 'pages/index', as: :home
get 'pages/interact_basic', as: :interact_basic
get 'pages/interact_advanced', as: :interact_advanced
get 'pages/references', as: :references
get 'pages/discussion', as: :discussion
get 'pages/occ_model', as: :occ_model
get 'pages/sw_vignette', as: :sw_vignette
get 'pages/sw_act_sub_verb_obj', as: :sw_act_sub_verb_obj
get 'pages/interact_advanced_report', as: :interact_advanced_report
get 'pages/interact_basic_report', as: :interact_basic_report
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
root path added
Rails.application.routes.draw do
get 'pages/index', as: :home
get 'pages/interact_basic', as: :interact_basic
get 'pages/interact_advanced', as: :interact_advanced
get 'pages/references', as: :references
get 'pages/discussion', as: :discussion
get 'pages/occ_model', as: :occ_model
get 'pages/sw_vignette', as: :sw_vignette
get 'pages/sw_act_sub_verb_obj', as: :sw_act_sub_verb_obj
get 'pages/interact_advanced_report', as: :interact_advanced_report
get 'pages/interact_basic_report', as: :interact_basic_report
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'pages#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
root 'questions#index'
resources :users
resources :questions
resources :tags, controller: 'hashtags', only: [:index, :show] do
member do
get 'questions'
end
end
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
added votes to routes
Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
root 'questions#index'
resources :users
resources :questions
resources :votes
resources :tags, controller: 'hashtags', only: [:index, :show] do
member do
get 'questions'
end
end
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Rails.application.routes.draw do
require 'sidekiq/web'
# authenticate :user, lambda { |u| u.admin } do
mount Sidekiq::Web => '/sidekiq'
# end
mount ForestLiana::Engine => '/forest'
root to: 'pages#home'
get 'entreprise', to: 'pages#enterprise', as: :enterprise
get 'daily', to: 'pages#daily'
get 'business', to: 'pages#business'
get 'legal', to: 'pages#legal'
get 'jeu', to: redirect('https://docs.google.com/forms/d/e/1FAIpQLSeBQZHSxbjdnSOklHUd2ryeVewsK4t_MlI3_hUqeo--gbnKsQ/viewform?usp=pp_url&entry.1522435496')
resources :business_requests, only: [ :create ]
resources :commute_requests, only: [ :create ]
resources :pro_requests, only: [ :create ]
end
udpate usp on quizz url
Rails.application.routes.draw do
require 'sidekiq/web'
# authenticate :user, lambda { |u| u.admin } do
mount Sidekiq::Web => '/sidekiq'
# end
mount ForestLiana::Engine => '/forest'
root to: 'pages#home'
get 'entreprise', to: 'pages#enterprise', as: :enterprise
get 'daily', to: 'pages#daily'
get 'business', to: 'pages#business'
get 'legal', to: 'pages#legal'
get 'jeu', to: redirect('https://docs.google.com/forms/d/e/1FAIpQLSeBQZHSxbjdnSOklHUd2ryeVewsK4t_MlI3_hUqeo--gbnKsQ/viewform?usp=kariol_co')
resources :business_requests, only: [ :create ]
resources :commute_requests, only: [ :create ]
resources :pro_requests, only: [ :create ]
end
|
Rails.application.routes.draw do
resources :errands
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Set root page
Signed-off-by: Shen Yichen <be3bb257ef8d73236feaba36cd3e5ee9095e6819@gmail.com>
Rails.application.routes.draw do
resources :errands
root 'errands#index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
scope 'v1.0' do
resources :authentications, only: [:create]
end
end
Specify API version via URL path.
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
scope 'v:version', constraints: { version: /\d+\.\d+/ } do
resources :authentications, only: [:create]
end
end
|
# frozen_string_literal: true
Rails.application.routes.draw do
resources :buckets, only: [:show, :index] do
resources :prefixes, only: [:show, :index]
end
end
Rename prefixes -> s3_objects
# frozen_string_literal: true
Rails.application.routes.draw do
resources :buckets, only: [:show, :index] do
resources :s3_objects, only: [:show, :index]
end
end
|
Rails.application.routes.draw do
resources :user_profiles, only: [:index, :show, :edit, :update]
resources :forum_threads
resources :news
resources :events
resources :replies, only: [:create, :update] do
post :create_multiple, on: :collection
end
devise_for :users, controllers: { registrations: "registrations" }
resources :users, only: [:index, :update]
resources :teams, only: [:index, :new, :create, :edit, :update]
resources :reports
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'pages#welcome'
get '/contact' => 'pages#contact'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
restrict report routes
Rails.application.routes.draw do
resources :user_profiles, only: [:index, :show, :edit, :update]
resources :forum_threads
resources :news
resources :events
resources :replies, only: [:create, :update] do
post :create_multiple, on: :collection
end
devise_for :users, controllers: { registrations: "registrations" }
resources :users, only: [:index, :update]
resources :teams, only: [:index, :new, :create, :edit, :update]
resources :reports, only: [:index, :new, :create, :edit, :update]
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
root 'pages#welcome'
get '/contact' => 'pages#contact'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Rails.application.routes.draw do
root to: redirect { |path_params, req| '/random' }
# reusable regex
operator = /(plus)|(minus)|(times)|(by)/
number = /[-]?\d+/
not_zero = /[-]?[1-9]+[\.\d+]?/
constraints op1: number do
constraints operator: operator do
constraints op2: number do
get '/:op1/plus/:op2',
to: proc { |env| [200, {}, ["#{params(env)[:op1].to_i + params(env)[:op2].to_i}"]] }
get '/:op1/minus/:op2',
to: proc { |env| [200, {}, ["#{params(env)[:op1].to_i - params(env)[:op2].to_i}"]] }
get '/:op1/times/:op2',
to: proc { |env| [200, {}, ["#{params(env)[:op1].to_i * params(env)[:op2].to_i}"]] }
get '/:op1/by/:op2',
constraints: { :op2 => not_zero },
to: proc { |env| [200, {}, ["#{params(env)[:op1].to_i / params(env)[:op2].to_i}"]] }
end
end
end
get '/:op1/:operator/:op2',
to: proc { |env| [400, {}, ["400 Bad Request"]] }
match '*path',
to: redirect { |path_params, req| "/#{(rand * 100).to_i}/#{%w[plus minus times by].sample}/#{(rand * 100).to_i}" },
via: :GET
end
private
def params(env)
env['action_dispatch.request.path_parameters']
end
Extract some functionality into methods to simplify routes.
Rails.application.routes.draw do
root to: redirect { |path_params, req| '/random' }
# reusable regex
operator = /(plus)|(minus)|(times)|(by)/
number = /[-]?\d+/
not_zero = /[-]?[1-9]+[\.\d+]?/
constraints op1: number do
constraints operator: operator do
constraints op2: number do
get '/:op1/plus/:op2',
to: proc { |env| [200, {}, ["#{params(env)[:op1].to_i + params(env)[:op2].to_i}"]] }
get '/:op1/minus/:op2',
to: proc { |env| [200, {}, ["#{params(env)[:op1].to_i - params(env)[:op2].to_i}"]] }
get '/:op1/times/:op2',
to: proc { |env| [200, {}, ["#{params(env)[:op1].to_i * params(env)[:op2].to_i}"]] }
get '/:op1/by/:op2',
constraints: { :op2 => not_zero },
to: proc { |env| [200, {}, ["#{params(env)[:op1].to_i / params(env)[:op2].to_i}"]] }
end
end
end
get '/:op1/:operator/:op2',
to: proc { |env| [400, {}, ["400 Bad Request"]] }
match '*path',
to: redirect { |path_params, req| "/#{rand_int}/#{random_operator}/#{rand_int}" },
via: :GET
end
private
def params(env)
env['action_dispatch.request.path_parameters']
end
def rand_int(value=100)
(rand * value).to_i
end
def rand_operator
%w[plus minus times by].sample
end
|
Galleror::Application.routes.draw do
resources :photos
resources :albums
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Fija albums#index como ruta por defecto
Galleror::Application.routes.draw do
resources :photos
resources :albums
root 'albums#index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Rails.application.routes.draw do
resources :categories do
member do
get :contract
get :expand
end
resources :children, :controller => 'categories' do
member do
get :contract
get :expand
end
end
end
#map.netbadge_sessions 'sessions/netbadge', :controller=>'sessions', :action=>'netbadge', :protocol=>(SSL_ENABLED ? 'https' : 'http')
resources :users do
member do
get :unban_user
get :ban_user
end
end
resources :blacklists, :relationships, :languages, :posts
resources :sessions, :except => [:index]
match '/testmail' => 'users#testmail', :as => :testmail
match '/signup' => 'users#new', :as => :signup
match '/signup_netbadge' => 'users#new_netbadge', :as => :signup_netbadge
match '/signup_openid' => 'users#new_openid', :as => :signup_openid
match '/openid_validate' => 'users#validate_openid', :as => :openid_validate, :via => :post
match '/signed_up' => 'users#pending', :as => :signed_up
match '/turned_down' => 'users#rejected', :as => :turned_down
match '/forgot' => 'users#forgot_password', :as => :forgot
match '/reset/:reset_code' => 'users#reset_password', :as => :reset
match '/login' => 'sessions#new', :as => :login
match '/logout' => 'sessions#destroy', :as => :logout
match '/login' => 'sessions#new', :as => :authenticated_system_login
match '/logout' => 'sessions#destroy', :as => :authenticated_system_logout
match '/login_page' => 'sessions#login_page', :as => :login_page
match '/sessions' => 'sessions#create', :as => :open_id_complete
match '/relate' => 'home#relate', :as => :relate, :defaults => { :format => 'xml'}
match '/link_netbadge' => 'users#link_netbadge', :as => :link_netbadge
match '/search' => 'search#index', :as => :search
match '/regenerate_index' => 'search#regenerate_index', :as => :regenerate_index
match '/add_item' => 'line_items#add_item', :as => :add_item
match '/home_page' => 'home#index', :as => :home_page
resources :organizations do
resources :posts
end
resources :people do
collection do
get :profile_tags
end
resources :line_items do
collection do
post :add_item
end
member do
get :remove_item
end
end
resources :links, :posts
end
resources :tools do
resources :posts, :people
resources :reviews do
collection do
get :add_author
end
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :sources do
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :translated_sources do
collection do
get :add_author
end
end
end
end
resources :usage_scenarios do
collection do
get :add_author
end
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :sources do
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :translated_sources do
collection do
get :add_author
end
end
end
end
resources :sources do
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :translated_sources do
collection do
get :add_author
end
end
end
end
resources :projects do
resources :posts, :people
end
resources :tag_projects, :controller => 'projects', :path_prefix => 'tags/:tag_string'
match '/me' => 'people#me', :as => :me
match 'relationbrowser' => 'home#relationbrowser', :as => :relationbrowser
match '/admin' => 'users#index', :as => :admin
match '/admin/update_users' => 'users#update', :as => :admin_update_users
root :to => 'home#index' # , :as => :home_page
match '/:controller(/:action(/:id))'
end
netbadge protocl route
Rails.application.routes.draw do
resources :categories do
member do
get :contract
get :expand
end
resources :children, :controller => 'categories' do
member do
get :contract
get :expand
end
end
end
#map.netbadge_sessions 'sessions/netbadge', :controller=>'sessions', :action=>'netbadge', :protocol=>(SSL_ENABLED ? 'https' : 'http')
resources :users do
member do
get :unban_user
get :ban_user
end
end
resources :blacklists, :relationships, :languages, :posts
resources :sessions, :except => [:index]
match '/netbadge_sessions' => 'sessions#netbadge', :constraints => { :protocol=>(SSL_ENABLED ? 'https' : 'http') }, :as => :netbadge_sessions
match '/testmail' => 'users#testmail', :as => :testmail
match '/signup' => 'users#new', :as => :signup
match '/signup_netbadge' => 'users#new_netbadge', :as => :signup_netbadge
match '/signup_openid' => 'users#new_openid', :as => :signup_openid
match '/openid_validate' => 'users#validate_openid', :as => :openid_validate, :via => :post
match '/signed_up' => 'users#pending', :as => :signed_up
match '/turned_down' => 'users#rejected', :as => :turned_down
match '/forgot' => 'users#forgot_password', :as => :forgot
match '/reset/:reset_code' => 'users#reset_password', :as => :reset
match '/login' => 'sessions#new', :as => :login
match '/logout' => 'sessions#destroy', :as => :logout
match '/login' => 'sessions#new', :as => :authenticated_system_login
match '/logout' => 'sessions#destroy', :as => :authenticated_system_logout
match '/login_page' => 'sessions#login_page', :as => :login_page
match '/sessions' => 'sessions#create', :as => :open_id_complete
match '/relate' => 'home#relate', :as => :relate, :defaults => { :format => 'xml'}
match '/link_netbadge' => 'users#link_netbadge', :as => :link_netbadge
match '/search' => 'search#index', :as => :search
match '/regenerate_index' => 'search#regenerate_index', :as => :regenerate_index
match '/add_item' => 'line_items#add_item', :as => :add_item
match '/home_page' => 'home#index', :as => :home_page
resources :organizations do
resources :posts
end
resources :people do
collection do
get :profile_tags
end
resources :line_items do
collection do
post :add_item
end
member do
get :remove_item
end
end
resources :links, :posts
end
resources :tools do
resources :posts, :people
resources :reviews do
collection do
get :add_author
end
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :sources do
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :translated_sources do
collection do
get :add_author
end
end
end
end
resources :usage_scenarios do
collection do
get :add_author
end
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :sources do
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :translated_sources do
collection do
get :add_author
end
end
end
end
resources :sources do
member do
get :contract
get :expand
get :expand_show
get :contract_show
end
resources :translated_sources do
collection do
get :add_author
end
end
end
end
resources :projects do
resources :posts, :people
end
resources :tag_projects, :controller => 'projects', :path_prefix => 'tags/:tag_string'
match '/me' => 'people#me', :as => :me
match 'relationbrowser' => 'home#relationbrowser', :as => :relationbrowser
match '/admin' => 'users#index', :as => :admin
match '/admin/update_users' => 'users#update', :as => :admin_update_users
root :to => 'home#index' # , :as => :home_page
match '/:controller(/:action(/:id))'
end |
Rails.application.routes.draw do
# devise_for :users, :controllers => { omniauth_callbacks: 'omniauth_callbacks' }
get '/rooms', to: 'rooms#generate'
get '/:room_session', to: 'rooms#show'
end
create routes for home index
Rails.application.routes.draw do
devise_for :users, :controllers => { omniauth_callbacks: 'omniauth_callbacks' }
root 'home#index'
get '/rooms', to: 'rooms#generate'
get '/:room_session', to: 'rooms#show'
end
|
Add simple ruby file
#! /usr/bin/env ruby
#
#def hello
# puts 'hello world'
# end
#
# hello()
|
Rails.application.routes.draw do
resources :locations
resources :people
root to: "application#show"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Added scaffold of Material
Rails.application.routes.draw do
resources :materials
resources :locations
resources :people
root to: "application#show"
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Rails.application.routes.draw do
root 'coming_soon#index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
#
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
add music route
Rails.application.routes.draw do
root 'coming_soon#index'
get 'music' => 'coming_soon#index'
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
#
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
module DTK
class ModuleRepoInfo < Hash
def initialize(repo,module_name,module_idh,branch_obj,version=nil)
super()
repo.update_object!(:repo_name,:id)
repo_name = repo[:repo_name]
hash = {
:repo_id => repo[:id],
:repo_name => repo_name,
:module_id => module_idh.get_id(),
:module_name => module_name,
:module_branch_idh => branch_obj.id_handle(),
:repo_url => RepoManager.repo_url(repo_name),
:workspace_branch => branch_obj.get_field?(:branch)
}
hash.merge!(:version => version) if version
replace(hash)
end
end
class CloneUpdateInfo < ModuleRepoInfo
def initialize(module_obj,version=nil)
aug_branch = module_obj.get_augmented_workspace_branch(Opts.new(:filter => {:version => version}))
super(aug_branch[:repo],aug_branch[:module_name],module_obj.id_handle(),aug_branch,version)
replace(Aux.hash_subset(self,[:repo_name,:repo_url,:module_name,:workspace_branch]))
self[:commit_sha] = aug_branch[:current_sha]
end
end
r8_nested_require('module_mixins','remote')
module ModuleMixin
include ModuleRemoteMixin
def get_module_branches()
get_objs_helper(:module_branches,:module_branch)
end
def get_module_branch_matching_version(version=nil)
get_module_branches().find{|mb|mb.matches_version?(version)}
end
def get_workspace_branch_info(version=nil)
aug_branch = get_augmented_workspace_branch(Opts.new(:filter => {:version => version}))
module_name = aug_branch[:module_name]
ModuleRepoInfo.new(aug_branch[:repo],module_name,id_handle(),aug_branch,version)
end
def ret_clone_update_info(version=nil)
CloneUpdateInfo.new(self,version)
end
def get_augmented_workspace_branch(opts=Opts.new)
version = (opts[:filter]||{})[:version]
version_field = ModuleBranch.version_field(version) #version can be nil
sp_hash = {
:cols => [:display_name,:workspace_info_full]
}
module_rows = get_objs(sp_hash).select{|r|r[:module_branch][:version] == version_field}
if module_rows.size == 0
unless opts[:donot_raise_error]
raise ErrorUsage.new("Module (#{pp_module_name(version)}) does not exist")
end
return nil
end
#aggregate by remote_namespace, filtering by remote_namespace if remote_namespace is given
unless module_obj = aggregate_by_remote_namespace(module_rows,opts)
raise ErrorUsage.new("There is no module (#{pp_module_name(version)}) taht meets filter conditions")
end
module_obj[:module_branch].merge(:repo => module_obj[:repo],:module_name => module_obj[:display_name])
end
#type is :library or :workspace
def find_branch(type,branches)
matches =
case type
when :library then branches.reject{|r|r[:is_workspace]}
when :workspace then branches.select{|r|r[:is_workspace]}
else raise Error.new("Unexpected type (#{type})")
end
if matches.size > 1
Error.new("Unexpected that there is more than one matching #{type} branches")
end
matches.first
end
def create_new_version(new_version)
unless aug_ws_branch = get_augmented_workspace_branch()
raise ErrorUsage.new("There is no module (#{pp_module_name()}) in the workspace")
end
#make sure there is a not an existing branch that matches the new one
if get_module_branch_matching_version(new_version)
raise ErrorUsage.new("Version exists already for module (#{pp_module_name(new_version)})")
end
#TODO: may check that version number is greater than existing versions, locally and possibly remotely
repo_for_new_version = aug_ws_branch.create_new_branch_from_this_branch?(get_project(),aug_ws_branch[:repo],new_version)
create_new_version__type_specific(repo_for_new_version,new_version)
end
def update_model_from_clone_changes?(commit_sha,diffs_summary,version=nil)
module_branch = get_workspace_module_branch(version)
pull_was_needed = module_branch.pull_repo_changes?(commit_sha)
parse_needed = !dsl_parsed?()
return unless pull_was_needed or parse_needed
update_model_from_clone__type_specific?(commit_sha,diffs_summary,module_branch,version)
end
def get_project()
#caching
return self[:project] if self[:project]
update_object!(:project_project_id,:display_name) #including :display_name is opportunistic
if project_id = self[:project_project_id]
self[:project] = id_handle(:model_name => :project, :id => project_id).create_object()
end
end
def get_repos()
get_objs_uniq(:repos)
end
def get_workspace_repo()
sp_hash = {
:cols => [:id,:display_name,:workspace_info,:project_project_id]
}
row = get_obj(sp_hash)
#opportunistically set display name and project_project_id on module
self[:display_name] ||= row[:display_name]
self[:project_project_id] ||= row[:project_project_id]
row[:repo]
end
#MOD_RESTRUCT: deprecate below for above
def get_library_repo()
sp_hash = {
:cols => [:id,:display_name,:library_repo,:library_library_id]
}
row = get_obj(sp_hash)
#opportunistically set display name and library_library_id on module
self[:display_name] ||= row[:display_name]
self[:library_library_id] ||= row[:library_library_id]
row[:repo]
end
def get_implementations()
get_objs_uniq(:implementations)
end
def get_library_implementations()
get_objs_uniq(:library_implementations)
end
def module_type()
self.class.module_type()
end
def get_workspace_module_branch(version=nil)
mb_mh = model_handle().create_childMH(:module_branch)
sp_hash = {
:cols => [:id,:group_id,:display_name,:branch,:version],
:filter => [:and,[:eq,mb_mh.parent_id_field_name(),id()],
[:eq,:is_workspace,true],
[:eq,:version,ModuleBranch.version_field(version)]]
}
Model.get_obj(mb_mh,sp_hash)
end
#MOD_RESTRUCT: may replace below with above
def get_module_branch(branch)
sp_hash = {
:cols => [:module_branches]
}
module_branches = get_objs(sp_hash).map{|r|r[:module_branch]}
module_branches.find{|mb|mb[:branch] == branch}
end
def module_name()
get_field?(:display_name)
end
def pp_module_name(version=nil)
self.class.pp_module_name(module_name(),version)
end
def pp_module_branch_name(module_branch)
module_branch.update_object!(:version)
version = (module_branch.has_default_version?() ? nil : module_branch[:version])
self.class.pp_module_name(module_name(),version)
end
def set_dsl_parsed!(boolean_val)
update(:dsl_parsed => boolean_val)
end
def dsl_parsed?()
get_field?(:dsl_parsed)
end
#assumed that all raw_module_rows agree on all except repo_remote
def aggregate_by_remote_namespace(raw_module_rows,opts=Opts.new)
ret = nil
#raw_module_rows should have morea than 1 row and should agree on all fields aside from :repo_remote
if raw_module_rows.empty?()
raise Error.new("Unexepected that raw_module_rows is empty")
end
namespace = (opts[:filter]||{})[:remote_namespace]
repo_remotes = raw_module_rows.map do |e|
repo_remote = e.delete(:repo_remote)
if namespace.nil? or namespace == repo_remote[:repo_namespace]
repo_remote
end
end.compact
#if filtering by namespace (tested by namespace is non-null) and nothing matched then return ret (which is nil)
if namespace and repo_remotes.empty?
return ret
end
ret = raw_module_rows.first.merge(:repo_remotes => repo_remotes)
repo = ret[:repo]
if default = RepoRemote.ret_default_remote_repo(ret[:repo_remotes])
repo.consume_remote_repo!(default)
end
ret
end
private
def get_library_module_branch(version=nil)
update_object!(:display_name,:library_library_id)
library_idh = id_handle(:model_name => :library, :id => self[:library_library_id])
module_name = self[:display_name]
self.class.get_library_module_branch(library_idh,module_name,version)
end
def library_branch_name(version=nil)
library_id = update_object!(:library_library_id)[:library_library_id]
library_idh = id_handle(:model_name => :library, :id => library_id)
ModuleBranch.library_branch_name(library_idh,version)
end
end
module ModuleClassMixin
include ModuleRemoteClassMixin
def component_type()
case module_type()
when :service_module
:service_module
when :component_module
:puppet #TODO: hard wired
end
end
def module_type()
model_name()
end
def check_valid_id(model_handle,id)
check_valid_id_default(model_handle,id)
end
def name_to_id(model_handle,name)
name_to_id_default(model_handle,name)
end
def info(target_mh, id, opts={})
remote_repo_cols = [:id, :display_name, :version, :remote_repos]
components_cols = [:id, :display_name, :version]
namespaces = []
sp_hash = {
:cols => remote_repo_cols,
:filter => [:eq,:id,id]
}
response = get_objs(target_mh, sp_hash.merge(opts))
# if there are no remotes just get component info
if response.empty?
sp_hash[:cols] = components_cols
response = get_objs(target_mh, sp_hash.merge(opts))
else
# we sort in ascending order, last remote is default one
response.sort { |a,b| b[:repo_remote][:created_at] <=> a[:repo_remote][:created_at]}
# we switch to ascending order
response.each_with_index do |e,i|
display_name = (e[:repo_remote]||{})[:display_name]
prefix = ( i == 0 ? "*" : " ")
namespaces << { :repo_name => "#{prefix} #{display_name}" }
end
end
ret = response.first || {}
ret.delete_if { |k,v| [:repo,:module_branch,:repo_remote].include?(k) }
# [Haris] Due to join condition with module.branch we can have situations where we have many versions
# of module with same remote branch, with 'uniq' we iron that out
ret.merge!(:remote_repos => namespaces.uniq ) if namespaces
ret
end
def list(opts=opts.new)
project_idh = opts.required(:project_idh)
include_remotes = opts.array(:detail_to_include).include?(:remotes)
include_versions = opts.array(:detail_to_include).include?(:versions)
include_any_detail = ((include_remotes or include_versions) ? true : nil)
sp_hash = {
:cols => [:id, :display_name, include_any_detail && :module_branches_with_repos].compact,
:filter => [:eq, :project_project_id, project_idh.get_id()]
}
mh = project_idh.createMH(model_type())
unsorted_ret = get_objs(mh,sp_hash)
unsorted_ret.each{|r|r.merge!(:type => r.component_type()) if r.respond_to?(:component_type)}
if include_any_detail
unsorted_ret = ListMethodHelper.aggregate_detail(unsorted_ret,mh,Opts.new(:include_remotes => include_remotes,:include_versions => include_versions))
end
unsorted_ret.sort{|a,b|a[:display_name] <=> b[:display_name]}
end
module ListMethodHelper
def self.aggregate_detail(branch_module_rows,module_mh,opts)
if opts[:include_remotes]
augment_with_remotes_info!(branch_module_rows,module_mh)
end
#there can be dupliactes for a module when multiple repos; in which case will agree on all fields
#except :repo, :module_branch, and :repo_remotes
#index by module
ndx_ret = Hash.new
#aggregate
branch_module_rows.each do |r|
module_branch = r[:module_branch]
ndx_repo_remotes = r[:ndx_repo_remotes]
ndx = r[:id]
repo_remotes_added = false
unless mdl = ndx_ret[ndx]
r.delete(:repo)
r.delete(:module_branch)
mdl = ndx_ret[ndx] = r
end
(mdl[:version_array] ||= Array.new) << module_branch.version_print_form(Opts.new(:default_version_string => DefaultVersionString))
if ndx_repo_remotes and not repo_remotes_added
ndx_repo_remotes.each do |remote_repo_id,remote_repo|
(mdl[:ndx_repo_remotes] ||= Hash.new)[remote_repo_id] ||= remote_repo
end
end
end
pp ndx_ret.values
#put in display name form
ndx_ret.values
end
DefaultVersionString = "CURRENT"
private
def self.augment_with_remotes_info!(branch_module_rows,module_mh)
#index by repo_id
ndx_branch_module_rows = branch_module_rows.inject(Hash.new){|h,r|h.merge(r[:repo][:id] => r)}
sp_hash = {
:cols => [:id,:group_id,:display_name,:repo_id,:created_at,:is_default],
:filter => [:oneof, :repo_id, ndx_branch_module_rows.keys]
}
Model.get_objs(module_mh.createMH(:repo_remote),sp_hash).each do |r|
ndx = r[:repo_id]
(ndx_branch_module_rows[ndx][:ndx_repo_remotes] ||= Hash.new).merge!(r[:id] => r)
end
branch_module_rows
end
end
=begin
branch_info = get_objs(project_idh.createMH(:module_branch),sp_hash)
#join in version info
branch_info.each do |br|
mod = ndx_module_info[br[branch_parent_field_name]]
version = ((br[:version].nil? or br[:version] == "master") ? "CURRENT" : br[:version])
mdl = ndx_module_info[br[branch_parent_field_name]]
(mdl[:version_array] ||= Array.new) << version
end
#put version info in print form
unsorted = ndx_module_info.values.map do |mdl|
repo_namespace = mdl[:repo_remote][:display_name] if mdl[:repo_remote]
(mdl[:linked_remotes] ||= Array.new) << repo_namespace
raw_va = mdl.delete(:version_array)
unless raw_va.nil? or raw_va == ["CURRENT"]
version_array = (raw_va.include?("CURRENT") ? ["CURRENT"] : []) + raw_va.reject{|v|v == "CURRENT"}.sort
mdl.merge!(:version => version_array.join(", ")) #TODO: change to ':versions' after sync with client
end
if mdl.respond_to?(:component_type)
mdl.merge!(:type => mdl.component_type())
end
mdl
end
unsorted.sort{|a,b|a[:display_name] <=> b[:display_name]}
end
{:repo_remotes=>
[{:group_id=>2147562164,
:repo_id=>2147579421,
:display_name=>"dtk/bootstrap",
:created_at=>Thu Jun 06 23:54:28 +0000 2013,
:id=>2147579422,
:is_default=>false}],
:repo=>
{:repo_name=>"sm-rich-bootstrap",
:local_dir=>"/home/dtk/r8server-repo/sm-rich-bootstrap",
:id=>2147579421},
:display_name=>"bootstrap",
:module_branch=>
{:version=>"master",
:service_id=>2147579427,
:repo_id=>2147579421,
:id=>2147579428},
:id=>2147579427}]
=end
=begin
ndx_branch_module_rows = branch_module_rows.inject(Hash.new()){|h,r|h.merge(r[:id] => r)}
if opts[:include_versions]
branch_mh = module_mh.create_childMH(:module_branch)
branch_parent_field_name = branch_mh.parent_id_field_name()
sp_hash = {
:cols => [branch_parent_field_name,:version],
:filter => [:and,[:oneof, branch_parent_field_name, ndx_branch_module_rows.keys], [:eq,:is_workspace,true]]
}
branch_info = Model.get_objs(branch_mh,sp_hash)
pp branch_module_rows.map{|r|r[:module_branch]}
pp [branch_info]
#join in version info
branch_info.each do |br|
mod = ndx_branch_module_rows[br[branch_parent_field_name]]
version = ((br[:version].nil? or br[:version] == "master") ? "CURRENT" : br[:version])
mdl = ndx_branch_module_rows[br[branch_parent_field_name]]
(mdl[:version_array] ||= Array.new) << version
end
end
#put version info in print form
branch_module_rows.each do |r|
raw_va = r.delete(:version_array)
unless raw_va.nil? or raw_va == ["CURRENT"]
version_array = (raw_va.include?("CURRENT") ? ["CURRENT"] : []) + raw_va.reject{|v|v == "CURRENT"}.sort
r.merge!(:version => version_array.join(", ")) #TODO: change to ':versions' after sync with client
end
end
branch_module_rows
end
end
=end
def aggregate_and_add_remotes_info(module_rows)
no_remote_proc = true
ndx_module_rows = Hash.new
module_rows.each do |r|
ndx = r[:id]
if repo_remote = r.delete(:repo_remote)
no_remote_proc = false
pntr = ndx_module_rows[ndx] ||= r.merge!(:repo_remotes => Array.new)
pntr[:repo_remotes] << repo_remote
else
ndx_module_rows[ndx] = r
end
end
#short-cut
return module_rows if no_remote_proc
ndx_module_rows.each do |ndx,module_row|
if repo_remotes = module_row.delete(:repo_remotes)
linked_remotes =
if repo_remotes.size == 1
repo_remotes.first.print_form()
else
default = RepoRemote.ret_default_remote_repo(repo_remotes)
repo_remotes.reject!{|r|r[:id] == default[:id]}
sorted_array = [default.print_form(Opts.new(:is_default_namespace => true))] + repo_remotes.map{|r|r.print_form()}
sorted_array.join(", ")
end
module_row.merge!(:linked_remotes => linked_remotes)
end
end
ndx_module_rows.values
end
private :aggregate_and_add_remotes_info
def get_and_join_in_version_info!(module_rows,mh)
ndx_module_rows = module_rows.inject(Hash.new()){|h,r|h.merge(r[:id] => r)}
branch_mh = mh.create_childMH(:module_branch)
branch_parent_field_name = branch_mh.parent_id_field_name()
sp_hash = {
:cols => [branch_parent_field_name,:version],
:filter => [:and,[:oneof, branch_parent_field_name, ndx_module_rows.keys], [:eq,:is_workspace,true]]
}
branch_info = get_objs(branch_mh,sp_hash)
#join in version info
branch_info.each do |br|
mod = ndx_module_rows[br[branch_parent_field_name]]
version = ((br[:version].nil? or br[:version] == "master") ? "CURRENT" : br[:version])
mdl = ndx_module_rows[br[branch_parent_field_name]]
(mdl[:version_array] ||= Array.new) << version
end
#put version info in print form
module_rows.each do |r|
raw_va = r.delete(:version_array)
unless raw_va.nil? or raw_va == ["CURRENT"]
version_array = (raw_va.include?("CURRENT") ? ["CURRENT"] : []) + raw_va.reject{|v|v == "CURRENT"}.sort
r.merge!(:version => version_array.join(", ")) #TODO: change to ':versions' after sync with client
end
end
module_rows
end
private :get_and_join_in_version_info!
=begin
def modify_to_include_version_info!(ret)
ndx_module_info = get_objs(mh,sp_hash).inject(Hash.new()){|h,r|h.merge(r[:id] => r)}
branch_mh = mh.create_childMH(:module_branch)
branch_parent_field_name = branch_mh.parent_id_field_name()
#get version info
sp_hash = {
:cols => [branch_parent_field_name,:version],
:filter => [:and,[:oneof, branch_parent_field_name, ndx_module_info.keys], [:eq,:is_workspace,true]]
}
branch_info = get_objs(project_idh.createMH(:module_branch),sp_hash)
#join in version info
branch_info.each do |br|
mod = ndx_module_info[br[branch_parent_field_name]]
version = ((br[:version].nil? or br[:version] == "master") ? "CURRENT" : br[:version])
mdl = ndx_module_info[br[branch_parent_field_name]]
(mdl[:version_array] ||= Array.new) << version
end
#put version info in print form
unsorted = ndx_module_info.values.map do |mdl|
repo_namespace = mdl[:repo_remote][:display_name] if mdl[:repo_remote]
(mdl[:linked_remotes] ||= Array.new) << repo_namespace
raw_va = mdl.delete(:version_array)
unless raw_va.nil? or raw_va == ["CURRENT"]
version_array = (raw_va.include?("CURRENT") ? ["CURRENT"] : []) + raw_va.reject{|v|v == "CURRENT"}.sort
mdl.merge!(:version => version_array.join(", ")) #TODO: change to ':versions' after sync with client
end
if mdl.respond_to?(:component_type)
mdl.merge!(:type => mdl.component_type())
end
mdl
end
unsorted.sort{|a,b|a[:display_name] <=> b[:display_name]}
end
=end
def list_old(opts=opts.new)
project_idh = opts.required(:project_idh)
sp_hash = {
:cols => [:id, :display_name, :remote_repos_simple],
:filter => [:eq, :project_project_id, project_idh.get_id()]
}
mh = project_idh.createMH(model_type())
branch_mh = mh.create_childMH(:module_branch)
branch_parent_field_name = branch_mh.parent_id_field_name()
ndx_module_info = get_objs(mh,sp_hash).inject(Hash.new()){|h,r|h.merge(r[:id] => r)}
#get version info
sp_hash = {
:cols => [branch_parent_field_name,:version],
:filter => [:and,[:oneof, branch_parent_field_name, ndx_module_info.keys], [:eq,:is_workspace,true]]
}
branch_info = get_objs(project_idh.createMH(:module_branch),sp_hash)
#join in version info
branch_info.each do |br|
mod = ndx_module_info[br[branch_parent_field_name]]
version = ((br[:version].nil? or br[:version] == "master") ? "CURRENT" : br[:version])
mdl = ndx_module_info[br[branch_parent_field_name]]
(mdl[:version_array] ||= Array.new) << version
end
#put version info in print form
unsorted = ndx_module_info.values.map do |mdl|
repo_namespace = mdl[:repo_remote][:display_name] if mdl[:repo_remote]
(mdl[:linked_remotes] ||= Array.new) << repo_namespace
raw_va = mdl.delete(:version_array)
unless raw_va.nil? or raw_va == ["CURRENT"]
version_array = (raw_va.include?("CURRENT") ? ["CURRENT"] : []) + raw_va.reject{|v|v == "CURRENT"}.sort
mdl.merge!(:version => version_array.join(", ")) #TODO: change to ':versions' after sync with client
end
if mdl.respond_to?(:component_type)
mdl.merge!(:type => mdl.component_type())
end
mdl
end
unsorted.sort{|a,b|a[:display_name] <=> b[:display_name]}
end
def add_user_direct_access(model_handle,rsa_pub_key)
repo_user = RepoUser.add_repo_user?(:client,model_handle.createMH(:repo_user),{:public => rsa_pub_key})
model_name = model_handle[:model_name]
raise ErrorUsage.new("Provided rsa public key exists already") if repo_user.has_direct_access?(model_name,:donot_update => true)
repo_user.update_direct_access(model_name,true)
repos = get_all_repos(model_handle)
unless repos.empty?
repo_names = repos.map{|r|r[:repo_name]}
RepoManager.set_user_rights_in_repos(repo_user[:username],repo_names,DefaultAccessRights)
repos.map{|repo|RepoUserAcl.update_model(repo,repo_user,DefaultAccessRights)}
end
end
DefaultAccessRights = "RW+"
def remove_user_direct_access(model_handle,rsa_pub_key)
repo_user = RepoUser.get_matching_repo_user(model_handle.createMH(:repo_user),:ssh_rsa_pub_key => rsa_pub_key)
return unless repo_user
model_name = model_handle[:model_name]
return unless repo_user.has_direct_access?(model_name)
username = repo_user[:username]
RepoManager.delete_user(username)
repos = get_all_repos(model_handle)
unless repos.empty?
repo_names = repos.map{|r|r[:repo_name]}
RepoManager.remove_user_rights_in_repos(username,repo_names)
#repo user acls deleted by foriegn key cascade
end
if repo_user.any_direct_access_except?(model_name)
repo_user.update_direct_access(model_name,false)
else
delete_instance(repo_user.id_handle())
end
end
#returns hash with keys :module_idh :module_branch_idh
def initialize_module(project,module_name,config_agent_type,version=nil)
project_idh = project.id_handle()
if module_exists?(project_idh,module_name)
raise ErrorUsage.new("Module (#{module_name}) cannot be created since it exists already")
end
ws_branch = ModuleBranch.workspace_branch_name(project,version)
create_opts = {
:create_branch => ws_branch,
:push_created_branch => true,
:donot_create_master_branch => true,
:delete_if_exists => true
}
repo = create_empty_workspace_repo(project_idh,module_name,module_specific_type(config_agent_type),create_opts)
module_and_branch_info = create_ws_module_and_branch_obj?(project,repo.id_handle(),module_name,version)
module_and_branch_info.merge(:module_repo_info => module_repo_info(repo,module_and_branch_info,version))
end
def module_repo_info(repo,module_and_branch_info,version)
info = module_and_branch_info #for succinctness
branch_obj = info[:module_branch_idh].create_object()
ModuleRepoInfo.new(repo,info[:module_name],info[:module_idh],branch_obj,version)
end
#can be overwritten
def module_specific_type(config_agent_type)
module_type()
end
private :module_specific_type
def create_empty_workspace_repo(project_idh,module_name,module_specific_type,opts={})
auth_repo_users = RepoUser.authorized_users(project_idh.createMH(:repo_user))
repo_user_acls = auth_repo_users.map do |repo_username|
{
:repo_username => repo_username,
:access_rights => "RW+"
}
end
Repo.create_empty_workspace_repo(project_idh,module_name,module_specific_type,repo_user_acls,opts)
end
def get_workspace_module_branch(project,module_name,version=nil)
project_idh = project.id_handle()
filter = [:and, [:eq, :display_name, module_name], [:eq, :project_project_id, project_idh.get_id()]]
branch = ModuleBranch.workspace_branch_name(project,version)
post_filter = proc{|mb|mb[:branch] == branch}
matches = get_matching_module_branches(project_idh,filter,post_filter)
if matches.size == 1
matches.first
elsif matches.size > 2
raise Error.new("Matched rows has unexpected size (#{matches.size}) since its is >1")
end
end
#MOD_RESTRUCT: TODO: may deprecate below for above
def get_library_module_branch(library_idh,module_name,version=nil)
filter = [:and, [:eq, :display_name, module_name], [:eq, :library_library_id, library_idh.get_id()]]
branch = ModuleBranch.library_branch_name(library_idh,version)
post_filter = proc{|mb|mb[:branch] == branch}
matches = get_matching_module_branches(library_idh,filter,post_filter)
if matches.size == 1
matches.first
elsif matches.size > 2
raise Error.new("Matched rows has unexpected size (#{matches.size}) since its is >1")
end
end
def get_matching_module_branches(mh_or_idh,filter,post_filter=nil)
sp_hash = {
:cols => [:id,:display_name,:group_id,:module_branches],
:filter => filter
}
rows = get_objs(mh_or_idh.create_childMH(module_type()),sp_hash).map do |r|
r[:module_branch].merge(:module_id => r[:id])
end
if rows.empty?
raise ErrorUsage.new("Module does not exist")
end
post_filter ? rows.select{|r|post_filter.call(r)} : rows
end
def pp_module_name(module_name,version=nil)
version ? "#{module_name} (#{version})" : module_name
end
def create_ws_module_and_branch_obj?(project,repo_idh,module_name,input_version)
project_idh = project.id_handle()
ref = module_name
module_type = model_name.to_s
mb_create_hash = ModuleBranch.ret_workspace_create_hash(project,module_type,repo_idh,input_version)
version = mb_create_hash.values.first[:version]
fields = {
:display_name => module_name,
:module_branch => mb_create_hash
}
create_hash = {
model_name.to_s => {
ref => fields
}
}
input_hash_content_into_model(project_idh,create_hash)
module_branch = get_workspace_module_branch(project,module_name,version)
module_idh = project_idh.createIDH(:model_name => model_name(),:id => module_branch[:module_id])
{:version => version, :module_name => module_name, :module_idh => module_idh,:module_branch_idh => module_branch.id_handle()}
end
#MOD_RESTRUCT: TODO: deprecate below for above
def create_lib_module_and_branch_obj?(library_idh,repo_idh,module_name,input_version)
ref = module_name
mb_create_hash = ModuleBranch.ret_lib_create_hash(model_name,library_idh,repo_idh,input_version)
version = mb_create_hash.values.first[:version]
create_hash = {
model_name.to_s => {
ref => {
:display_name => module_name,
:module_branch => mb_create_hash
}
}
}
input_hash_content_into_model(library_idh,create_hash)
module_branch = get_library_module_branch(library_idh,module_name,version)
module_idh = library_idh.createIDH(:model_name => model_name(),:id => module_branch[:module_id])
{:version => version, :module_idh => module_idh,:module_branch_idh => module_branch.id_handle()}
end
private
def get_all_repos(mh)
get_objs(mh,{:cols => [:repos]}).inject(Hash.new) do |h,r|
repo = r[:repo]
h[repo[:id]] ||= repo
h
end.values
end
def module_exists?(project_idh,module_name)
unless project_idh[:model_name] == :project
raise Error.new("MOD_RESTRUCT: module_exists? should take a project, not a (#{project_idh[:model_name]})")
end
sp_hash = {
:cols => [:id,:display_name],
:filter => [:and, [:eq, :project_project_id, project_idh.get_id()],
[:eq, :display_name, module_name]]
}
module_branches = get_obj(project_idh.createMH(model_name()),sp_hash)
end
end
end
updating module list, no_build
module DTK
class ModuleRepoInfo < Hash
def initialize(repo,module_name,module_idh,branch_obj,version=nil)
super()
repo.update_object!(:repo_name,:id)
repo_name = repo[:repo_name]
hash = {
:repo_id => repo[:id],
:repo_name => repo_name,
:module_id => module_idh.get_id(),
:module_name => module_name,
:module_branch_idh => branch_obj.id_handle(),
:repo_url => RepoManager.repo_url(repo_name),
:workspace_branch => branch_obj.get_field?(:branch)
}
hash.merge!(:version => version) if version
replace(hash)
end
end
class CloneUpdateInfo < ModuleRepoInfo
def initialize(module_obj,version=nil)
aug_branch = module_obj.get_augmented_workspace_branch(Opts.new(:filter => {:version => version}))
super(aug_branch[:repo],aug_branch[:module_name],module_obj.id_handle(),aug_branch,version)
replace(Aux.hash_subset(self,[:repo_name,:repo_url,:module_name,:workspace_branch]))
self[:commit_sha] = aug_branch[:current_sha]
end
end
r8_nested_require('module_mixins','remote')
module ModuleMixin
include ModuleRemoteMixin
def get_module_branches()
get_objs_helper(:module_branches,:module_branch)
end
def get_module_branch_matching_version(version=nil)
get_module_branches().find{|mb|mb.matches_version?(version)}
end
def get_workspace_branch_info(version=nil)
aug_branch = get_augmented_workspace_branch(Opts.new(:filter => {:version => version}))
module_name = aug_branch[:module_name]
ModuleRepoInfo.new(aug_branch[:repo],module_name,id_handle(),aug_branch,version)
end
def ret_clone_update_info(version=nil)
CloneUpdateInfo.new(self,version)
end
def get_augmented_workspace_branch(opts=Opts.new)
version = (opts[:filter]||{})[:version]
version_field = ModuleBranch.version_field(version) #version can be nil
sp_hash = {
:cols => [:display_name,:workspace_info_full]
}
module_rows = get_objs(sp_hash).select{|r|r[:module_branch][:version] == version_field}
if module_rows.size == 0
unless opts[:donot_raise_error]
raise ErrorUsage.new("Module (#{pp_module_name(version)}) does not exist")
end
return nil
end
#aggregate by remote_namespace, filtering by remote_namespace if remote_namespace is given
unless module_obj = aggregate_by_remote_namespace(module_rows,opts)
raise ErrorUsage.new("There is no module (#{pp_module_name(version)}) taht meets filter conditions")
end
module_obj[:module_branch].merge(:repo => module_obj[:repo],:module_name => module_obj[:display_name])
end
#type is :library or :workspace
def find_branch(type,branches)
matches =
case type
when :library then branches.reject{|r|r[:is_workspace]}
when :workspace then branches.select{|r|r[:is_workspace]}
else raise Error.new("Unexpected type (#{type})")
end
if matches.size > 1
Error.new("Unexpected that there is more than one matching #{type} branches")
end
matches.first
end
def create_new_version(new_version)
unless aug_ws_branch = get_augmented_workspace_branch()
raise ErrorUsage.new("There is no module (#{pp_module_name()}) in the workspace")
end
#make sure there is a not an existing branch that matches the new one
if get_module_branch_matching_version(new_version)
raise ErrorUsage.new("Version exists already for module (#{pp_module_name(new_version)})")
end
#TODO: may check that version number is greater than existing versions, locally and possibly remotely
repo_for_new_version = aug_ws_branch.create_new_branch_from_this_branch?(get_project(),aug_ws_branch[:repo],new_version)
create_new_version__type_specific(repo_for_new_version,new_version)
end
def update_model_from_clone_changes?(commit_sha,diffs_summary,version=nil)
module_branch = get_workspace_module_branch(version)
pull_was_needed = module_branch.pull_repo_changes?(commit_sha)
parse_needed = !dsl_parsed?()
return unless pull_was_needed or parse_needed
update_model_from_clone__type_specific?(commit_sha,diffs_summary,module_branch,version)
end
def get_project()
#caching
return self[:project] if self[:project]
update_object!(:project_project_id,:display_name) #including :display_name is opportunistic
if project_id = self[:project_project_id]
self[:project] = id_handle(:model_name => :project, :id => project_id).create_object()
end
end
def get_repos()
get_objs_uniq(:repos)
end
def get_workspace_repo()
sp_hash = {
:cols => [:id,:display_name,:workspace_info,:project_project_id]
}
row = get_obj(sp_hash)
#opportunistically set display name and project_project_id on module
self[:display_name] ||= row[:display_name]
self[:project_project_id] ||= row[:project_project_id]
row[:repo]
end
#MOD_RESTRUCT: deprecate below for above
def get_library_repo()
sp_hash = {
:cols => [:id,:display_name,:library_repo,:library_library_id]
}
row = get_obj(sp_hash)
#opportunistically set display name and library_library_id on module
self[:display_name] ||= row[:display_name]
self[:library_library_id] ||= row[:library_library_id]
row[:repo]
end
def get_implementations()
get_objs_uniq(:implementations)
end
def get_library_implementations()
get_objs_uniq(:library_implementations)
end
def module_type()
self.class.module_type()
end
def get_workspace_module_branch(version=nil)
mb_mh = model_handle().create_childMH(:module_branch)
sp_hash = {
:cols => [:id,:group_id,:display_name,:branch,:version],
:filter => [:and,[:eq,mb_mh.parent_id_field_name(),id()],
[:eq,:is_workspace,true],
[:eq,:version,ModuleBranch.version_field(version)]]
}
Model.get_obj(mb_mh,sp_hash)
end
#MOD_RESTRUCT: may replace below with above
def get_module_branch(branch)
sp_hash = {
:cols => [:module_branches]
}
module_branches = get_objs(sp_hash).map{|r|r[:module_branch]}
module_branches.find{|mb|mb[:branch] == branch}
end
def module_name()
get_field?(:display_name)
end
def pp_module_name(version=nil)
self.class.pp_module_name(module_name(),version)
end
def pp_module_branch_name(module_branch)
module_branch.update_object!(:version)
version = (module_branch.has_default_version?() ? nil : module_branch[:version])
self.class.pp_module_name(module_name(),version)
end
def set_dsl_parsed!(boolean_val)
update(:dsl_parsed => boolean_val)
end
def dsl_parsed?()
get_field?(:dsl_parsed)
end
#assumed that all raw_module_rows agree on all except repo_remote
def aggregate_by_remote_namespace(raw_module_rows,opts=Opts.new)
ret = nil
#raw_module_rows should have morea than 1 row and should agree on all fields aside from :repo_remote
if raw_module_rows.empty?()
raise Error.new("Unexepected that raw_module_rows is empty")
end
namespace = (opts[:filter]||{})[:remote_namespace]
repo_remotes = raw_module_rows.map do |e|
repo_remote = e.delete(:repo_remote)
if namespace.nil? or namespace == repo_remote[:repo_namespace]
repo_remote
end
end.compact
#if filtering by namespace (tested by namespace is non-null) and nothing matched then return ret (which is nil)
if namespace and repo_remotes.empty?
return ret
end
ret = raw_module_rows.first.merge(:repo_remotes => repo_remotes)
repo = ret[:repo]
if default = RepoRemote.ret_default_remote_repo(ret[:repo_remotes])
repo.consume_remote_repo!(default)
end
ret
end
private
def get_library_module_branch(version=nil)
update_object!(:display_name,:library_library_id)
library_idh = id_handle(:model_name => :library, :id => self[:library_library_id])
module_name = self[:display_name]
self.class.get_library_module_branch(library_idh,module_name,version)
end
def library_branch_name(version=nil)
library_id = update_object!(:library_library_id)[:library_library_id]
library_idh = id_handle(:model_name => :library, :id => library_id)
ModuleBranch.library_branch_name(library_idh,version)
end
end
module ModuleClassMixin
include ModuleRemoteClassMixin
def component_type()
case module_type()
when :service_module
:service_module
when :component_module
:puppet #TODO: hard wired
end
end
def module_type()
model_name()
end
def check_valid_id(model_handle,id)
check_valid_id_default(model_handle,id)
end
def name_to_id(model_handle,name)
name_to_id_default(model_handle,name)
end
def info(target_mh, id, opts={})
remote_repo_cols = [:id, :display_name, :version, :remote_repos]
components_cols = [:id, :display_name, :version]
namespaces = []
sp_hash = {
:cols => remote_repo_cols,
:filter => [:eq,:id,id]
}
response = get_objs(target_mh, sp_hash.merge(opts))
# if there are no remotes just get component info
if response.empty?
sp_hash[:cols] = components_cols
response = get_objs(target_mh, sp_hash.merge(opts))
else
# we sort in ascending order, last remote is default one
response.sort { |a,b| b[:repo_remote][:created_at] <=> a[:repo_remote][:created_at]}
# we switch to ascending order
response.each_with_index do |e,i|
display_name = (e[:repo_remote]||{})[:display_name]
prefix = ( i == 0 ? "*" : " ")
namespaces << { :repo_name => "#{prefix} #{display_name}" }
end
end
ret = response.first || {}
ret.delete_if { |k,v| [:repo,:module_branch,:repo_remote].include?(k) }
# [Haris] Due to join condition with module.branch we can have situations where we have many versions
# of module with same remote branch, with 'uniq' we iron that out
ret.merge!(:remote_repos => namespaces.uniq ) if namespaces
ret
end
def list(opts=opts.new)
project_idh = opts.required(:project_idh)
include_remotes = opts.array(:detail_to_include).include?(:remotes)
include_versions = opts.array(:detail_to_include).include?(:versions)
include_any_detail = ((include_remotes or include_versions) ? true : nil)
sp_hash = {
:cols => [:id, :display_name, include_any_detail && :module_branches_with_repos].compact,
:filter => [:eq, :project_project_id, project_idh.get_id()]
}
mh = project_idh.createMH(model_type())
unsorted_ret = get_objs(mh,sp_hash)
unsorted_ret.each{|r|r.merge!(:type => r.component_type()) if r.respond_to?(:component_type)}
if include_any_detail
unsorted_ret = ListMethodHelper.aggregate_detail(unsorted_ret,mh,Opts.new(:include_remotes => include_remotes,:include_versions => include_versions))
end
unsorted_ret.sort{|a,b|a[:display_name] <=> b[:display_name]}
end
module ListMethodHelper
def self.aggregate_detail(branch_module_rows,module_mh,opts)
if opts[:include_remotes]
augment_with_remotes_info!(branch_module_rows,module_mh)
end
#there can be dupliactes for a module when multiple repos; in which case will agree on all fields
#except :repo, :module_branch, and :repo_remotes
#index by module
ndx_ret = Hash.new
#aggregate
branch_module_rows.each do |r|
module_branch = r[:module_branch]
ndx_repo_remotes = r[:ndx_repo_remotes]
ndx = r[:id]
repo_remotes_added = false
unless mdl = ndx_ret[ndx]
r.delete(:repo)
r.delete(:module_branch)
mdl = ndx_ret[ndx] = r
end
if opts[:include_versions]
(mdl[:version_array] ||= Array.new) << module_branch.version_print_form(Opts.new(:default_version_string => DefaultVersionString))
end
if ndx_repo_remotes and not repo_remotes_added
ndx_repo_remotes.each do |remote_repo_id,remote_repo|
(mdl[:ndx_repo_remotes] ||= Hash.new)[remote_repo_id] ||= remote_repo
end
end
end
#put in display name form
ndx_ret.each_value do |mdl|
if raw_va = mdl.delete(:version_array)
unless raw_va.size == 1 and raw_va.first == DefaultVersionString
version_array = (raw_va.include?(DefaultVersionString) ? [DefaultVersionString] : []) + raw_va.reject{|v|v == DefaultVersionString}.sort
mdl.merge!(:version => version_array.join(", ")) #TODO: change to ':versions' after sync with client
end
end
if ndx_repo_remotes = mdl.delete(:ndx_repo_remotes)
mdl.merge!(:linked_remotes => ret_linked_remotes_print_form(ndx_repo_remotes.values))
end
end
ndx_ret.values
end
DefaultVersionString = "CURRENT"
private
def self.augment_with_remotes_info!(branch_module_rows,module_mh)
#index by repo_id
ndx_branch_module_rows = branch_module_rows.inject(Hash.new){|h,r|h.merge(r[:repo][:id] => r)}
sp_hash = {
:cols => [:id,:group_id,:display_name,:repo_id,:created_at,:is_default],
:filter => [:oneof, :repo_id, ndx_branch_module_rows.keys]
}
Model.get_objs(module_mh.createMH(:repo_remote),sp_hash).each do |r|
ndx = r[:repo_id]
(ndx_branch_module_rows[ndx][:ndx_repo_remotes] ||= Hash.new).merge!(r[:id] => r)
end
branch_module_rows
end
def self.ret_linked_remotes_print_form(repo_remotes)
if repo_remotes.size == 1
repo_remotes.first.print_form()
else
default = RepoRemote.ret_default_remote_repo(repo_remotes)
repo_remotes.reject!{|r|r[:id] == default[:id]}
sorted_array = [default.print_form(Opts.new(:is_default_namespace => true))] + repo_remotes.map{|r|r.print_form()}
sorted_array.join(", ")
end
end
end
def add_user_direct_access(model_handle,rsa_pub_key)
repo_user = RepoUser.add_repo_user?(:client,model_handle.createMH(:repo_user),{:public => rsa_pub_key})
model_name = model_handle[:model_name]
raise ErrorUsage.new("Provided rsa public key exists already") if repo_user.has_direct_access?(model_name,:donot_update => true)
repo_user.update_direct_access(model_name,true)
repos = get_all_repos(model_handle)
unless repos.empty?
repo_names = repos.map{|r|r[:repo_name]}
RepoManager.set_user_rights_in_repos(repo_user[:username],repo_names,DefaultAccessRights)
repos.map{|repo|RepoUserAcl.update_model(repo,repo_user,DefaultAccessRights)}
end
end
DefaultAccessRights = "RW+"
def remove_user_direct_access(model_handle,rsa_pub_key)
repo_user = RepoUser.get_matching_repo_user(model_handle.createMH(:repo_user),:ssh_rsa_pub_key => rsa_pub_key)
return unless repo_user
model_name = model_handle[:model_name]
return unless repo_user.has_direct_access?(model_name)
username = repo_user[:username]
RepoManager.delete_user(username)
repos = get_all_repos(model_handle)
unless repos.empty?
repo_names = repos.map{|r|r[:repo_name]}
RepoManager.remove_user_rights_in_repos(username,repo_names)
#repo user acls deleted by foriegn key cascade
end
if repo_user.any_direct_access_except?(model_name)
repo_user.update_direct_access(model_name,false)
else
delete_instance(repo_user.id_handle())
end
end
#returns hash with keys :module_idh :module_branch_idh
def initialize_module(project,module_name,config_agent_type,version=nil)
project_idh = project.id_handle()
if module_exists?(project_idh,module_name)
raise ErrorUsage.new("Module (#{module_name}) cannot be created since it exists already")
end
ws_branch = ModuleBranch.workspace_branch_name(project,version)
create_opts = {
:create_branch => ws_branch,
:push_created_branch => true,
:donot_create_master_branch => true,
:delete_if_exists => true
}
repo = create_empty_workspace_repo(project_idh,module_name,module_specific_type(config_agent_type),create_opts)
module_and_branch_info = create_ws_module_and_branch_obj?(project,repo.id_handle(),module_name,version)
module_and_branch_info.merge(:module_repo_info => module_repo_info(repo,module_and_branch_info,version))
end
def module_repo_info(repo,module_and_branch_info,version)
info = module_and_branch_info #for succinctness
branch_obj = info[:module_branch_idh].create_object()
ModuleRepoInfo.new(repo,info[:module_name],info[:module_idh],branch_obj,version)
end
#can be overwritten
def module_specific_type(config_agent_type)
module_type()
end
private :module_specific_type
def create_empty_workspace_repo(project_idh,module_name,module_specific_type,opts={})
auth_repo_users = RepoUser.authorized_users(project_idh.createMH(:repo_user))
repo_user_acls = auth_repo_users.map do |repo_username|
{
:repo_username => repo_username,
:access_rights => "RW+"
}
end
Repo.create_empty_workspace_repo(project_idh,module_name,module_specific_type,repo_user_acls,opts)
end
def get_workspace_module_branch(project,module_name,version=nil)
project_idh = project.id_handle()
filter = [:and, [:eq, :display_name, module_name], [:eq, :project_project_id, project_idh.get_id()]]
branch = ModuleBranch.workspace_branch_name(project,version)
post_filter = proc{|mb|mb[:branch] == branch}
matches = get_matching_module_branches(project_idh,filter,post_filter)
if matches.size == 1
matches.first
elsif matches.size > 2
raise Error.new("Matched rows has unexpected size (#{matches.size}) since its is >1")
end
end
#MOD_RESTRUCT: TODO: may deprecate below for above
def get_library_module_branch(library_idh,module_name,version=nil)
filter = [:and, [:eq, :display_name, module_name], [:eq, :library_library_id, library_idh.get_id()]]
branch = ModuleBranch.library_branch_name(library_idh,version)
post_filter = proc{|mb|mb[:branch] == branch}
matches = get_matching_module_branches(library_idh,filter,post_filter)
if matches.size == 1
matches.first
elsif matches.size > 2
raise Error.new("Matched rows has unexpected size (#{matches.size}) since its is >1")
end
end
def get_matching_module_branches(mh_or_idh,filter,post_filter=nil)
sp_hash = {
:cols => [:id,:display_name,:group_id,:module_branches],
:filter => filter
}
rows = get_objs(mh_or_idh.create_childMH(module_type()),sp_hash).map do |r|
r[:module_branch].merge(:module_id => r[:id])
end
if rows.empty?
raise ErrorUsage.new("Module does not exist")
end
post_filter ? rows.select{|r|post_filter.call(r)} : rows
end
def pp_module_name(module_name,version=nil)
version ? "#{module_name} (#{version})" : module_name
end
def create_ws_module_and_branch_obj?(project,repo_idh,module_name,input_version)
project_idh = project.id_handle()
ref = module_name
module_type = model_name.to_s
mb_create_hash = ModuleBranch.ret_workspace_create_hash(project,module_type,repo_idh,input_version)
version = mb_create_hash.values.first[:version]
fields = {
:display_name => module_name,
:module_branch => mb_create_hash
}
create_hash = {
model_name.to_s => {
ref => fields
}
}
input_hash_content_into_model(project_idh,create_hash)
module_branch = get_workspace_module_branch(project,module_name,version)
module_idh = project_idh.createIDH(:model_name => model_name(),:id => module_branch[:module_id])
{:version => version, :module_name => module_name, :module_idh => module_idh,:module_branch_idh => module_branch.id_handle()}
end
#MOD_RESTRUCT: TODO: deprecate below for above
def create_lib_module_and_branch_obj?(library_idh,repo_idh,module_name,input_version)
ref = module_name
mb_create_hash = ModuleBranch.ret_lib_create_hash(model_name,library_idh,repo_idh,input_version)
version = mb_create_hash.values.first[:version]
create_hash = {
model_name.to_s => {
ref => {
:display_name => module_name,
:module_branch => mb_create_hash
}
}
}
input_hash_content_into_model(library_idh,create_hash)
module_branch = get_library_module_branch(library_idh,module_name,version)
module_idh = library_idh.createIDH(:model_name => model_name(),:id => module_branch[:module_id])
{:version => version, :module_idh => module_idh,:module_branch_idh => module_branch.id_handle()}
end
private
def get_all_repos(mh)
get_objs(mh,{:cols => [:repos]}).inject(Hash.new) do |h,r|
repo = r[:repo]
h[repo[:id]] ||= repo
h
end.values
end
def module_exists?(project_idh,module_name)
unless project_idh[:model_name] == :project
raise Error.new("MOD_RESTRUCT: module_exists? should take a project, not a (#{project_idh[:model_name]})")
end
sp_hash = {
:cols => [:id,:display_name],
:filter => [:and, [:eq, :project_project_id, project_idh.get_id()],
[:eq, :display_name, module_name]]
}
module_branches = get_obj(project_idh.createMH(model_name()),sp_hash)
end
end
end
|
Morph::Application.routes.draw do
# Owner.table_exists? is workaround to allow migration to add STI Owner/User table to run
if Owner.table_exists?
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
end
devise_scope :user do
get 'sign_out', :to => 'devise/sessions#destroy', :as => :destroy_user_session
get 'sign_in', :to => 'devise/sessions#new', :as => :new_user_session
end
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# TODO: Put this in a path where it won't conflict
require 'sidekiq/web'
authenticate :user, lambda { |u| u.admin? } do
mount Sidekiq::Web => '/admin/jobs'
end
root 'static#index'
get "/api", to: "static#api"
get "/documentation", to: 'static#documentation'
# Hmm not totally sure about this url.
post "/run", to: "api#run_remote"
get '/settings', to: "users#settings", as: :user_settings
post '/settings/reset_key', to: "users#reset_key", as: :user_reset_key
# TODO: Don't allow a user to be called "new". Chances are GitHub enforces this anyway.
resources :scrapers, path: '/', only: [:new, :create]
resources :owners, path: "/", only: :show
post '/:id/watch', to: "owners#watch", as: :owner_watch
# This url begins with /users so that we don't stop users have scrapers called watching
get '/users/:id/watching', to: "users#watching", as: :user_watching
resources :users, path: "/", only: :show
resources :organizations, path: "/", only: :show
# TODO Not very happy with this URL but this will do for the time being
resources "scraperwiki_forks", only: [:new, :create]
get '/*id/data', to: "scrapers#data", as: :scraper_data
post '/*id/watch', to: "scrapers#watch", as: :scraper_watch
get '/*id/settings', to: "scrapers#settings", as: :scraper_settings
get "/*id", to: "scrapers#show", as: :scraper
delete "/*id", to: "scrapers#destroy"
patch "/*id", to: "scrapers#update"
post "/*id/run", to: "scrapers#run", as: :run_scraper
post "/*id/clear", to: "scrapers#clear", as: :clear_scraper
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Change url of scrapers#new and create
Morph::Application.routes.draw do
# Owner.table_exists? is workaround to allow migration to add STI Owner/User table to run
if Owner.table_exists?
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
end
devise_scope :user do
get 'sign_out', :to => 'devise/sessions#destroy', :as => :destroy_user_session
get 'sign_in', :to => 'devise/sessions#new', :as => :new_user_session
end
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# TODO: Put this in a path where it won't conflict
require 'sidekiq/web'
authenticate :user, lambda { |u| u.admin? } do
mount Sidekiq::Web => '/admin/jobs'
end
root 'static#index'
get "/api", to: "static#api"
get "/documentation", to: 'static#documentation'
# Hmm not totally sure about this url.
post "/run", to: "api#run_remote"
get '/settings', to: "users#settings", as: :user_settings
post '/settings/reset_key', to: "users#reset_key", as: :user_reset_key
# TODO: Don't allow a user to be called "scrapers"
resources :scrapers, path: '/scrapers', only: [:new, :create]
resources :owners, path: "/", only: :show
post '/:id/watch', to: "owners#watch", as: :owner_watch
# This url begins with /users so that we don't stop users have scrapers called watching
get '/users/:id/watching', to: "users#watching", as: :user_watching
resources :users, path: "/", only: :show
resources :organizations, path: "/", only: :show
# TODO Not very happy with this URL but this will do for the time being
resources "scraperwiki_forks", only: [:new, :create]
get '/*id/data', to: "scrapers#data", as: :scraper_data
post '/*id/watch', to: "scrapers#watch", as: :scraper_watch
get '/*id/settings', to: "scrapers#settings", as: :scraper_settings
get "/*id", to: "scrapers#show", as: :scraper
delete "/*id", to: "scrapers#destroy"
patch "/*id", to: "scrapers#update"
post "/*id/run", to: "scrapers#run", as: :run_scraper
post "/*id/clear", to: "scrapers#clear", as: :clear_scraper
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Spree::Core::Engine.routes.prepend do
get '/unified_payments', :to => "unified_payments#index", :as => :unified_payments
get '/unified_payments/new', :to => "unified_payments#new", :as => :new_unified_transaction
post '/unified_payments/create', :to => "unified_payments#create", :as => :create_unified_transaction
post '/unified_payments/canceled', :to => "unified_payments#canceled", :as => :canceled_unified_payments
post '/unified_payments/declined', :to => "unified_payments#declined", :as => :declined_unified_payments
post '/unified_payments/approved', :to => "unified_payments#approved", :as => :approved_unified_payments
get '/unified_payments/declined', :to => redirect{ |p, request| '/' }
namespace :admin do
get '/unified_payments', :to => "unified_payments#index"
get '/unified_payments/receipt/:transaction_id', :to => "unified_payments#receipt", :as => :unified_payments_receipt
post '/unified_payments/query_gateway', :to => "unified_payments#query_gateway", :as => :unified_payments_query_gateway
end
end
update routes.rb for routes updated format to use draw instead of prepend
Spree::Core::Engine.routes.draw do
get '/unified_payments' => "unified_payments#index", as: :unified_payments
get '/unified_payments/new' => "unified_payments#new", as: :new_unified_transaction
post '/unified_payments/create' => "unified_payments#create", as: :create_unified_transaction
post '/unified_payments/canceled' => "unified_payments#canceled", as: :canceled_unified_payments
get '/unified_payments/declined' => "unified_payments#declined", as: :declined_unified_payments
post '/unified_payments/approved' => "unified_payments#approved", as: :approved_unified_payments
get 'admin/unified_payments' => "admin/unified_payments#index"
get 'admin/unified_payments/receipt/:transaction_id' => "admin/unified_payments#receipt", as: :unified_payments_receipt
post 'admin/unified_payments/query_gateway' => "admin/unified_payments#query_gateway", as: :unified_payments_query_gateway
#for test
#[TODO]:uncomment this later
# get '/unified_payments/declined', :to => redirect{ |p, request| '/' }
#[TODO]:remove this later
# get '/unified_payments/approved', :to => "unified_payments#approved"
# get '/unified_payments/canceled', :to => "unified_payments#canceled"
end |
require 'caffeine/constraints/page_constraint'
module Caffeine
Engine.routes.draw do
root 'main_page#index'
namespace :admin do
root 'dashboard#index'
resources :pages
end
# Define route for page tags
get '*page_id/tags/:id', controller: 'pages/tags', action: :show
# Define route for pages
get '*page_id', to: 'pages#show', constraints: PageConstraint
end
end
Name routes
require 'caffeine/constraints/page_constraint'
module Caffeine
Engine.routes.draw do
root 'main_page#index'
namespace :admin do
root 'dashboard#index'
resources :pages
end
# Define route for page tags
get '*page_id/tags/:id', controller: 'pages/tags', action: :show, as: :page_tag
# Define route for pages
get '*page_id', to: 'pages#show', constraints: PageConstraint, as: :page
end
end
|
Rails.application.routes.draw do
root to: "companies#new"
devise_for :company_users, controllers: { registrations: 'company_users/registrations' }
devise_scope :company_user do
get 'sucesso', to: 'company_users/registrations#success', as: :success_sign_up
end
namespace :dashboard do
root to: 'dashboard#index'
resources :roles, except: :show, path: 'cargos'
resources :periods, except: :show, path: 'periodos'
end
resources :companies, only: [:new, :create]
end
Rotas da frequencia
Rails.application.routes.draw do
root to: "companies#new"
devise_for :company_users, controllers: { registrations: 'company_users/registrations' }
devise_scope :company_user do
get 'sucesso', to: 'company_users/registrations#success', as: :success_sign_up
end
namespace :dashboard do
root to: 'dashboard#index'
resources :roles, except: :show, path: 'cargos'
resources :periods, except: :show, path: 'periodos'
resources :frequencies, except: :show, path: 'frequencias'
end
resources :companies, only: [:new, :create]
end
|
Serpscan::Dashboard::Engine.routes.draw do
##mount Serpscan::Dashboard::Engine => "/serpscan"
#namespace :serpscan do
get '/' => 'websites#index', as: :websites
get '/:id' => 'websites#show', as: :website
post '/:id/keyword' => 'keywords#create'
get '/keywords/delete' => 'keywords#delete'
#end
end
Cleaned up routes
Serpscan::Dashboard::Engine.routes.draw do
get '/' => 'websites#index', as: :websites
get '/:id' => 'websites#show', as: :website
post '/:id/keyword' => 'keywords#create'
get '/keywords/delete' => 'keywords#delete'
end
|
Genes::Application.routes.draw do |map|
resources :reviews
resources :genes
resources :subjects
root :to => "reviews#index"
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get :short
# post :toggle
# end
#
# collection do
# get :sold
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get :recent, :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end
add source code url to route
Genes::Application.routes.draw do |map|
resources :reviews
resources :genes
resources :subjects
root :to => "reviews#index"
match '/code', :to => redirect("http://github.com/medvane/genes")
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get :short
# post :toggle
# end
#
# collection do
# get :sold
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get :recent, :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
end
|
# frozen_string_literal: true
# Nested hash of permissible controllers and actions. Each entry as follows,
# with missing element meaning use default
# controller: { # hash of controller ctions
# action_name: { # hash of attributes for this action
# methods: (array), # allowed HTML methods, as symbols
# # methods key omitted => default: [:get, :post]
# segments: (string), # expected segments, with leading slash(es)
# # segments key omitted => default: "/:id"
# # blank string means no segments allowed
# id_constraint: (string|regexp) # any constraint on id, default: /d+/
# }
# }
ACTIONS = {
account: {
activate_api_key: {},
add_user_to_group: {},
api_keys: {},
create_alert: {},
create_api_key: {},
destroy_user: {},
edit_api_key: {},
email_new_password: {},
login: {},
logout_user: {},
manager: {},
no_comment_email: { methods: [:get] },
no_comment_response_email: {},
no_commercial_email: {},
no_consensus_change_email: {},
no_email_comments_all: {},
no_email_comments_owner: {},
no_email_comments_response: {},
no_email_general_commercial: {},
no_email_general_feature: {},
no_email_general_question: {},
no_email_locations_admin: {},
no_email_locations_all: {},
no_email_locations_author: {},
no_email_locations_editor: {},
no_email_names_admin: {},
no_email_names_all: {},
no_email_names_author: {},
no_email_names_editor: {},
no_email_names_reviewer: {},
no_email_observations_all: {},
no_email_observations_consensus: {},
no_email_observations_naming: {},
no_feature_email: {},
no_name_change_email: {},
no_name_proposal_email: {},
no_question_email: {},
prefs: {},
profile: {},
remove_api_keys: {},
remove_image: {},
reverify: {},
send_verify: {},
signup: {},
test_autologin: {},
test_flash: {},
turn_admin_off: {},
turn_admin_on: {},
verify: {},
welcome: {}
},
ajax: {
api_key: {},
auto_complete: {},
create_image_object: {},
exif: {},
export: {},
external_link: {},
geocode: {},
image: {},
multi_image_template: {},
old_translation: {},
pivotal: {},
test: {},
vote: {}
},
api: {
api_keys: {},
collection_numbers: {},
comments: {},
external_links: {},
external_sites: {},
herbaria: {},
herbarium_records: {},
images: {},
locations: {},
names: {},
observations: {},
projects: {},
sequences: {},
species_lists: {},
users: {}
},
article: {
create_article: {},
destroy_article: {},
edit_article: {},
index_article: {},
list_articles: {},
show_article: {}
},
collection_number: {
collection_number_search: {},
create_collection_number: {},
destroy_collection_number: {},
edit_collection_number: {},
index_collection_number: {},
list_collection_numbers: {},
next_collection_number: {},
observation_index: {},
prev_collection_number: {},
remove_observation: {},
show_collection_number: {}
},
comment: {
add_comment: {},
comment_search: {},
destroy_comment: {},
edit_comment: {},
index_comment: {},
list_comments: {},
next_comment: {},
prev_comment: {},
show_comment: {},
show_comments_by_user: {},
show_comments_for_target: {},
show_comments_for_user: {}
},
glossary: {
create_glossary_term: {},
edit_glossary_term: {},
index: {},
show_glossary_term: {},
show_past_glossary_term: {}
},
herbarium: {
create_herbarium: {},
delete_curator: {},
destroy_herbarium: {},
edit_herbarium: {},
herbarium_search: {},
index: {},
index_herbarium: {},
list_herbaria: {},
merge_herbaria: {},
next_herbarium: {},
prev_herbarium: {},
request_to_be_curator: {},
show_herbarium: {}
},
herbarium_record: {
create_herbarium_record: {},
destroy_herbarium_record: {},
edit_herbarium_record: {},
herbarium_index: {},
herbarium_record_search: {},
index_herbarium_record: {},
list_herbarium_records: {},
next_herbarium_record: {},
observation_index: {},
prev_herbarium_record: {},
remove_observation: {},
show_herbarium_record: {}
},
image: {
add_image: {},
advanced_search: {},
bulk_filename_purge: {},
bulk_vote_anonymity_updater: {},
cast_vote: {},
destroy_image: {},
edit_image: {},
image_search: {},
images_by_user: {},
images_for_mushroom_app: {},
images_for_project: {},
index_image: {},
license_updater: {},
list_images: {},
next_image: {},
prev_image: {},
remove_images: {},
remove_images_for_glossary_term: {},
reuse_image: {},
reuse_image_for_glossary_term: {},
show_image: {},
show_original: {},
transform_image: {}
},
interest: {
destroy_notification: {},
list_interests: {},
set_interest: {}
},
location: {
add_to_location: {},
adjust_permissions: {},
advanced_search: {},
create_location: {},
create_location_description: {},
destroy_location_description: {},
edit_location: {},
edit_location_description: {},
help: {},
index_location: {},
index_location_description: {},
list_by_country: {},
list_countries: {},
list_dubious_locations: {},
list_location_descriptions: {},
list_locations: {},
list_merge_options: {},
location_descriptions_by_author: {},
location_descriptions_by_editor: {},
location_search: {},
locations_by_editor: {},
locations_by_user: {},
make_description_default: {},
map_locations: {},
merge_descriptions: {},
next_location: {},
next_location_description: {},
prev_location: {},
prev_location_description: {},
publish_description: {},
reverse_name_order: {},
show_location: {},
show_location_description: {},
show_past_location: {},
show_past_location_description: {}
},
name: {
adjust_permissions: {},
advanced_search: {},
approve_name: {},
authored_names: {},
bulk_name_edit: {},
change_synonyms: {},
create_name: {},
create_name_description: {},
deprecate_name: {},
destroy_name_description: {},
edit_classification: {},
edit_lifeform: {},
edit_name: {},
edit_name_description: {},
email_tracking: {},
eol: {},
eol_expanded_review: {},
eol_preview: {},
index_name: {},
index_name_description: {},
inherit_classification: {},
list_name_descriptions: {},
list_names: {},
make_description_default: {},
map: {},
merge_descriptions: {},
name_descriptions_by_author: {},
name_descriptions_by_editor: {},
name_search: {},
names_by_author: {},
names_by_editor: {},
names_by_user: {},
names_for_mushroom_app: {},
needed_descriptions: {},
next_name: {},
next_name_description: {},
observation_index: {},
prev_name: {},
prev_name_description: {},
propagate_classification: {},
propagate_lifeform: {},
publish_description: {},
refresh_classification: {},
set_review_status: {},
show_name: {},
show_name_description: {},
show_past_name: {},
show_past_name_description: {},
test_index: {}
},
naming: {
create: {},
destroy: {},
edit: {}
},
observer: {
advanced_search: {},
advanced_search_form: {},
ask_observation_question: {},
ask_user_question: {},
ask_webmaster_question: {},
author_request: {},
change_banner: {},
change_user_bonuses: {},
checklist: {},
commercial_inquiry: {},
create_observation: {},
destroy_observation: {},
download_observations: {},
edit_observation: {},
email_features: {},
email_merge_request: {},
hide_thumbnail_map: {},
how_to_help: {},
how_to_use: {},
ilist_users: {},
index: {},
index_observation: {},
index_rss_log: {},
index_user: {},
intro: {},
letter_to_community: {},
list_observations: {},
list_rss_logs: {},
list_users: {},
lookup_accepted_name: {},
lookup_comment: {},
lookup_image: {},
lookup_location: {},
lookup_name: {},
lookup_observation: {},
lookup_project: {},
lookup_species_list: {},
lookup_user: {},
map_observation: {},
map_observations: {},
news: {},
next_observation: {},
next_rss_log: {},
next_user: {},
observation_search: {},
observations_at_location: {},
observations_at_where: {},
observations_by_name: {},
observations_by_user: {},
observations_for_project: {},
observations_of_name: {},
pattern_search: {},
prev_observation: {},
prev_rss_log: {},
prev_user: {},
print_labels: {},
recalc: {},
review_authors: {},
risd_terminology: {},
rss: {},
set_export_status: {},
show_location_observations: {},
show_notifications: {},
show_obs: {},
show_observation: {},
show_rss_log: {},
show_site_stats: {},
show_user: {},
test_flash_redirection: {},
textile: {},
textile_sandbox: {},
translators_note: {},
turn_javascript_nil: {},
turn_javascript_off: {},
turn_javascript_on: {},
update_whitelisted_observation_attributes: {},
user_search: {},
users_by_contribution: {},
users_by_name: {},
w3c_tests: {},
wrapup_2011: {}
},
pivotal: {
index: {}
},
project: {
add_members: {},
add_project: {},
admin_request: {},
change_member_status: {},
destroy_project: {},
edit_project: {},
index_project: {},
list_projects: {},
next_project: {},
prev_project: {},
project_search: {},
show_project: {}
},
publications: {
create: {},
destroy: {},
edit: {},
index: {},
new: {},
show: {},
update: {}
},
sequence: {
create_sequence: {},
destroy_sequence: {},
edit_sequence: {},
index_sequence: {},
list_sequences: {},
next_sequence: {},
observation_index: {},
prev_sequence: {},
sequence_search: {},
show_sequence: {}
},
species_list: {
add_observation_to_species_list: {},
add_remove_observations: {},
bulk_editor: {},
create_species_list: {},
destroy_species_list: {},
edit_species_list: {},
index_species_list: {},
list_species_lists: {},
make_report: {},
manage_projects: {},
manage_species_lists: {},
name_lister: {},
next_species_list: {},
post_add_remove_observations: {},
prev_species_list: {},
print_labels: {},
remove_observation_from_species_list: {},
show_species_list: {},
species_list_search: {},
species_lists_by_title: {},
species_lists_by_user: {},
species_lists_for_project: {},
upload_species_list: {}
},
support: {
confirm: {},
create_donation: {},
donate: {},
donors: {},
governance: {},
letter: {},
review_donations: {},
thanks: {},
wrapup_2011: {},
wrapup_2012: {}
},
theme: {
color_themes: {}
},
translation: {
edit_translations: {},
edit_translations_ajax_get: {},
edit_translations_ajax_post: {}
},
vote: {
cast_vote: {},
cast_votes: {},
refresh_vote_cache: {},
show_votes: {}
}
}.freeze
AJAX_ACTIONS = %w[
api_key
auto_complete
exif
export
external_link
geocode
old_translation
pivotal
multi_image_template
create_image_object
vote
].freeze
LOOKUP_XXX_ID_ACTIONS = %w[
lookup_accepted_name
lookup_comment
lookup_image
lookup_location
lookup_name
lookup_observation
lookup_project
lookup_species_list
lookup_user
].freeze
MushroomObserver::Application.routes.draw do
# Priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically)
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
get "publications/:id/destroy" => "publications#destroy"
resources :publications
# Default page is /observer/list_rss_logs.
root "observer#list_rss_logs"
# Route /123 to /observer/show_observation/123.
get ":id" => "observer#show_observation", id: /\d+/
# Short-hand notation for AJAX methods.
# get "ajax/:action/:type/:id" => "ajax", constraints: { id: /\S.*/ }
AJAX_ACTIONS.each do |action|
get("ajax/#{action}/:type/:id",
controller: "ajax", action: action, id: /\S.*/)
end
# Accept non-numeric ids for the /observer/lookup_xxx/id actions.
LOOKUP_XXX_ID_ACTIONS.each do |action|
get("observer/#{action}/:id",
controller: "observer", action: action, id: /.*/)
end
ACTIONS.each do |controller, actions|
# Default action for any controller is "index".
get controller.to_s => "#{controller}#index"
# Standard routes
actions.each do |action, attributes|
get "#{controller}/#{action}", controller: controller, action: action
match "#{controller}(/#{action}(/:id))",
controller: controller,
action: action,
via: [:get, :post],
id: /\d+/
end
end
# routes for actions that Rails automatically creates from view templates
MO.themes.each { |scheme| get "theme/#{scheme}" }
end
Fix CodeClimate complaint about each_key instead of each
# frozen_string_literal: true
# Nested hash of permissible controllers and actions. Each entry as follows,
# with missing element meaning use default
# controller: { # hash of controller ctions
# action_name: { # hash of attributes for this action
# methods: (array), # allowed HTML methods, as symbols
# # methods key omitted => default: [:get, :post]
# segments: (string), # expected segments, with leading slash(es)
# # segments key omitted => default: "/:id"
# # blank string means no segments allowed
# id_constraint: (string|regexp) # any constraint on id, default: /d+/
# }
# }
ACTIONS = {
account: {
activate_api_key: {},
add_user_to_group: {},
api_keys: {},
create_alert: {},
create_api_key: {},
destroy_user: {},
edit_api_key: {},
email_new_password: {},
login: {},
logout_user: {},
manager: {},
no_comment_email: { methods: [:get] },
no_comment_response_email: {},
no_commercial_email: {},
no_consensus_change_email: {},
no_email_comments_all: {},
no_email_comments_owner: {},
no_email_comments_response: {},
no_email_general_commercial: {},
no_email_general_feature: {},
no_email_general_question: {},
no_email_locations_admin: {},
no_email_locations_all: {},
no_email_locations_author: {},
no_email_locations_editor: {},
no_email_names_admin: {},
no_email_names_all: {},
no_email_names_author: {},
no_email_names_editor: {},
no_email_names_reviewer: {},
no_email_observations_all: {},
no_email_observations_consensus: {},
no_email_observations_naming: {},
no_feature_email: {},
no_name_change_email: {},
no_name_proposal_email: {},
no_question_email: {},
prefs: {},
profile: {},
remove_api_keys: {},
remove_image: {},
reverify: {},
send_verify: {},
signup: {},
test_autologin: {},
test_flash: {},
turn_admin_off: {},
turn_admin_on: {},
verify: {},
welcome: {}
},
ajax: {
api_key: {},
auto_complete: {},
create_image_object: {},
exif: {},
export: {},
external_link: {},
geocode: {},
image: {},
multi_image_template: {},
old_translation: {},
pivotal: {},
test: {},
vote: {}
},
api: {
api_keys: {},
collection_numbers: {},
comments: {},
external_links: {},
external_sites: {},
herbaria: {},
herbarium_records: {},
images: {},
locations: {},
names: {},
observations: {},
projects: {},
sequences: {},
species_lists: {},
users: {}
},
article: {
create_article: {},
destroy_article: {},
edit_article: {},
index_article: {},
list_articles: {},
show_article: {}
},
collection_number: {
collection_number_search: {},
create_collection_number: {},
destroy_collection_number: {},
edit_collection_number: {},
index_collection_number: {},
list_collection_numbers: {},
next_collection_number: {},
observation_index: {},
prev_collection_number: {},
remove_observation: {},
show_collection_number: {}
},
comment: {
add_comment: {},
comment_search: {},
destroy_comment: {},
edit_comment: {},
index_comment: {},
list_comments: {},
next_comment: {},
prev_comment: {},
show_comment: {},
show_comments_by_user: {},
show_comments_for_target: {},
show_comments_for_user: {}
},
glossary: {
create_glossary_term: {},
edit_glossary_term: {},
index: {},
show_glossary_term: {},
show_past_glossary_term: {}
},
herbarium: {
create_herbarium: {},
delete_curator: {},
destroy_herbarium: {},
edit_herbarium: {},
herbarium_search: {},
index: {},
index_herbarium: {},
list_herbaria: {},
merge_herbaria: {},
next_herbarium: {},
prev_herbarium: {},
request_to_be_curator: {},
show_herbarium: {}
},
herbarium_record: {
create_herbarium_record: {},
destroy_herbarium_record: {},
edit_herbarium_record: {},
herbarium_index: {},
herbarium_record_search: {},
index_herbarium_record: {},
list_herbarium_records: {},
next_herbarium_record: {},
observation_index: {},
prev_herbarium_record: {},
remove_observation: {},
show_herbarium_record: {}
},
image: {
add_image: {},
advanced_search: {},
bulk_filename_purge: {},
bulk_vote_anonymity_updater: {},
cast_vote: {},
destroy_image: {},
edit_image: {},
image_search: {},
images_by_user: {},
images_for_mushroom_app: {},
images_for_project: {},
index_image: {},
license_updater: {},
list_images: {},
next_image: {},
prev_image: {},
remove_images: {},
remove_images_for_glossary_term: {},
reuse_image: {},
reuse_image_for_glossary_term: {},
show_image: {},
show_original: {},
transform_image: {}
},
interest: {
destroy_notification: {},
list_interests: {},
set_interest: {}
},
location: {
add_to_location: {},
adjust_permissions: {},
advanced_search: {},
create_location: {},
create_location_description: {},
destroy_location_description: {},
edit_location: {},
edit_location_description: {},
help: {},
index_location: {},
index_location_description: {},
list_by_country: {},
list_countries: {},
list_dubious_locations: {},
list_location_descriptions: {},
list_locations: {},
list_merge_options: {},
location_descriptions_by_author: {},
location_descriptions_by_editor: {},
location_search: {},
locations_by_editor: {},
locations_by_user: {},
make_description_default: {},
map_locations: {},
merge_descriptions: {},
next_location: {},
next_location_description: {},
prev_location: {},
prev_location_description: {},
publish_description: {},
reverse_name_order: {},
show_location: {},
show_location_description: {},
show_past_location: {},
show_past_location_description: {}
},
name: {
adjust_permissions: {},
advanced_search: {},
approve_name: {},
authored_names: {},
bulk_name_edit: {},
change_synonyms: {},
create_name: {},
create_name_description: {},
deprecate_name: {},
destroy_name_description: {},
edit_classification: {},
edit_lifeform: {},
edit_name: {},
edit_name_description: {},
email_tracking: {},
eol: {},
eol_expanded_review: {},
eol_preview: {},
index_name: {},
index_name_description: {},
inherit_classification: {},
list_name_descriptions: {},
list_names: {},
make_description_default: {},
map: {},
merge_descriptions: {},
name_descriptions_by_author: {},
name_descriptions_by_editor: {},
name_search: {},
names_by_author: {},
names_by_editor: {},
names_by_user: {},
names_for_mushroom_app: {},
needed_descriptions: {},
next_name: {},
next_name_description: {},
observation_index: {},
prev_name: {},
prev_name_description: {},
propagate_classification: {},
propagate_lifeform: {},
publish_description: {},
refresh_classification: {},
set_review_status: {},
show_name: {},
show_name_description: {},
show_past_name: {},
show_past_name_description: {},
test_index: {}
},
naming: {
create: {},
destroy: {},
edit: {}
},
observer: {
advanced_search: {},
advanced_search_form: {},
ask_observation_question: {},
ask_user_question: {},
ask_webmaster_question: {},
author_request: {},
change_banner: {},
change_user_bonuses: {},
checklist: {},
commercial_inquiry: {},
create_observation: {},
destroy_observation: {},
download_observations: {},
edit_observation: {},
email_features: {},
email_merge_request: {},
hide_thumbnail_map: {},
how_to_help: {},
how_to_use: {},
ilist_users: {},
index: {},
index_observation: {},
index_rss_log: {},
index_user: {},
intro: {},
letter_to_community: {},
list_observations: {},
list_rss_logs: {},
list_users: {},
lookup_accepted_name: {},
lookup_comment: {},
lookup_image: {},
lookup_location: {},
lookup_name: {},
lookup_observation: {},
lookup_project: {},
lookup_species_list: {},
lookup_user: {},
map_observation: {},
map_observations: {},
news: {},
next_observation: {},
next_rss_log: {},
next_user: {},
observation_search: {},
observations_at_location: {},
observations_at_where: {},
observations_by_name: {},
observations_by_user: {},
observations_for_project: {},
observations_of_name: {},
pattern_search: {},
prev_observation: {},
prev_rss_log: {},
prev_user: {},
print_labels: {},
recalc: {},
review_authors: {},
risd_terminology: {},
rss: {},
set_export_status: {},
show_location_observations: {},
show_notifications: {},
show_obs: {},
show_observation: {},
show_rss_log: {},
show_site_stats: {},
show_user: {},
test_flash_redirection: {},
textile: {},
textile_sandbox: {},
translators_note: {},
turn_javascript_nil: {},
turn_javascript_off: {},
turn_javascript_on: {},
update_whitelisted_observation_attributes: {},
user_search: {},
users_by_contribution: {},
users_by_name: {},
w3c_tests: {},
wrapup_2011: {}
},
pivotal: {
index: {}
},
project: {
add_members: {},
add_project: {},
admin_request: {},
change_member_status: {},
destroy_project: {},
edit_project: {},
index_project: {},
list_projects: {},
next_project: {},
prev_project: {},
project_search: {},
show_project: {}
},
publications: {
create: {},
destroy: {},
edit: {},
index: {},
new: {},
show: {},
update: {}
},
sequence: {
create_sequence: {},
destroy_sequence: {},
edit_sequence: {},
index_sequence: {},
list_sequences: {},
next_sequence: {},
observation_index: {},
prev_sequence: {},
sequence_search: {},
show_sequence: {}
},
species_list: {
add_observation_to_species_list: {},
add_remove_observations: {},
bulk_editor: {},
create_species_list: {},
destroy_species_list: {},
edit_species_list: {},
index_species_list: {},
list_species_lists: {},
make_report: {},
manage_projects: {},
manage_species_lists: {},
name_lister: {},
next_species_list: {},
post_add_remove_observations: {},
prev_species_list: {},
print_labels: {},
remove_observation_from_species_list: {},
show_species_list: {},
species_list_search: {},
species_lists_by_title: {},
species_lists_by_user: {},
species_lists_for_project: {},
upload_species_list: {}
},
support: {
confirm: {},
create_donation: {},
donate: {},
donors: {},
governance: {},
letter: {},
review_donations: {},
thanks: {},
wrapup_2011: {},
wrapup_2012: {}
},
theme: {
color_themes: {}
},
translation: {
edit_translations: {},
edit_translations_ajax_get: {},
edit_translations_ajax_post: {}
},
vote: {
cast_vote: {},
cast_votes: {},
refresh_vote_cache: {},
show_votes: {}
}
}.freeze
AJAX_ACTIONS = %w[
api_key
auto_complete
exif
export
external_link
geocode
old_translation
pivotal
multi_image_template
create_image_object
vote
].freeze
LOOKUP_XXX_ID_ACTIONS = %w[
lookup_accepted_name
lookup_comment
lookup_image
lookup_location
lookup_name
lookup_observation
lookup_project
lookup_species_list
lookup_user
].freeze
MushroomObserver::Application.routes.draw do
# Priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically)
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
get "publications/:id/destroy" => "publications#destroy"
resources :publications
# Default page is /observer/list_rss_logs.
root "observer#list_rss_logs"
# Route /123 to /observer/show_observation/123.
get ":id" => "observer#show_observation", id: /\d+/
# Short-hand notation for AJAX methods.
# get "ajax/:action/:type/:id" => "ajax", constraints: { id: /\S.*/ }
AJAX_ACTIONS.each do |action|
get("ajax/#{action}/:type/:id",
controller: "ajax", action: action, id: /\S.*/)
end
# Accept non-numeric ids for the /observer/lookup_xxx/id actions.
LOOKUP_XXX_ID_ACTIONS.each do |action|
get("observer/#{action}/:id",
controller: "observer", action: action, id: /.*/)
end
ACTIONS.each do |controller, actions|
# Default action for any controller is "index".
get controller.to_s => "#{controller}#index"
# Standard routes
actions.each_key do |action|
get "#{controller}/#{action}", controller: controller, action: action
match "#{controller}(/#{action}(/:id))",
controller: controller,
action: action,
via: [:get, :post],
id: /\d+/
end
end
# routes for actions that Rails automatically creates from view templates
MO.themes.each { |scheme| get "theme/#{scheme}" }
end
|
Rails.application.routes.draw do
resources :user, only: [:show, :edit, :update]
get 'auth/:provider/callback', to: 'sessions#create'
get 'auth/failure', to: redirect('/')
get 'signout', to: 'sessions#destroy', as: 'signout'
get 'login', to: 'home#login'
resources :sessions, only: [:create, :destroy]
resource :home, only: [:show]
root to: 'home#show'
end
switch sign-out route to delete
Rails.application.routes.draw do
resources :user, only: [:show, :edit, :update]
get 'auth/:provider/callback', to: 'sessions#create'
get 'auth/failure', to: redirect('/')
delete 'signout', to: 'sessions#destroy', as: 'signout'
get 'login', to: 'home#login'
resources :sessions, only: [:create, :destroy]
resource :home, only: [:show]
root to: 'home#show'
end
|
Rails.application.routes.draw do
mount Ckeditor::Engine => '/ckeditor'
mount RailsAdmin::Engine => '/internal/admin', as: 'rails_admin'
devise_for :users, class_name: 'User', controllers: {
registrations: 'users/registrations',
sessions: 'users/sessions',
confirmations: 'users/confirmations'
}, only: [:confirmations, :passwords]
devise_scope :user do
post '/v1/users' => 'users/registrations#create', as: 'user_registration'
get '/v1/users' => 'users/registrations#new', as: 'new_user_registration'
get '/v1/users/sign_in', to: 'users/sessions#new', as: 'new_user_session'
post '/v1/users/sign_in', to: 'users/sessions#create', as: 'user_session'
end
namespace :v1, defaults: { format: :json } do
resource :sign_in, only: [:create], controller: :sessions
resources :news, only: [:index, :show]
resources :talks, only: [:index]
resources :alumni, only: [:index]
resources :contestants, only: [:index, :show, :create] do
collection do
post :additional
end
end
post 'contestants/update_registration_step_number', to: 'contestants#update_registration_step_number'
resources :projects, only: [:index, :show, :create] do
member do
post :finish
post :screenshots
post :collaborators
end
end
get "current" => "current#index"
end
get "/404", :to => "errors#error_404"
get "/422", :to => "errors#error_404"
get "/500", :to => "errors#error_500"
root :to => redirect("http://dev.infoeducatie.ro/")
match '*unmatched_route', :to => 'errors#error_404', via: [:get, :put, :patch, :post,
:delete, :copy, :head, :options, :link, :unlink, :purge, :lock, :unlock, :propfind]
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
Logout route. Fixes #87
Rails.application.routes.draw do
mount Ckeditor::Engine => '/ckeditor'
mount RailsAdmin::Engine => '/internal/admin', as: 'rails_admin'
devise_for :users, class_name: 'User', controllers: {
registrations: 'users/registrations',
sessions: 'users/sessions',
confirmations: 'users/confirmations'
}, only: [:confirmations, :passwords]
devise_scope :user do
post '/v1/users' => 'users/registrations#create', as: 'user_registration'
get '/v1/users' => 'users/registrations#new', as: 'new_user_registration'
get '/v1/users/sign_in', to: 'users/sessions#new', as: 'new_user_session'
post '/v1/users/sign_in', to: 'users/sessions#create', as: 'user_session'
get '/v1/users/sign_out', to: 'users/sessions#destroy', as: 'destroy_user_session'
end
namespace :v1, defaults: { format: :json } do
resource :sign_in, only: [:create], controller: :sessions
resources :news, only: [:index, :show]
resources :talks, only: [:index]
resources :alumni, only: [:index]
resources :contestants, only: [:index, :show, :create] do
collection do
post :additional
end
end
post 'contestants/update_registration_step_number', to: 'contestants#update_registration_step_number'
resources :projects, only: [:index, :show, :create] do
member do
post :finish
post :screenshots
post :collaborators
end
end
get "current" => "current#index"
end
get "/404", :to => "errors#error_404"
get "/422", :to => "errors#error_404"
get "/500", :to => "errors#error_500"
root :to => redirect("http://dev.infoeducatie.ro/")
match '*unmatched_route', :to => 'errors#error_404', via: [:get, :put, :patch, :post,
:delete, :copy, :head, :options, :link, :unlink, :purge, :lock, :unlock, :propfind]
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
# Example of named route that can be invoked with purchase_url(id: product.id)
# get 'products/:id/purchase' => 'catalog#purchase', as: :purchase
# Example resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Example resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Example resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Example resource route with more complex sub-resources:
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', on: :collection
# end
# end
# Example resource route with concerns:
# concern :toggleable do
# post 'toggle'
# end
# resources :posts, concerns: :toggleable
# resources :photos, concerns: :toggleable
# Example resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.