From: Mohammed Morsi <mmorsi(a)redhat.com>
Note that this patch should be ammended with more vetted
routes.rb updates (and fix the commented ones).
(edited by Jason Guiditta <jguiditt(a)redhat.com>)
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
---
src/Rakefile | 6 +-
src/config.ru | 9 +-
src/config/application.rb | 49 ++++++++
src/config/boot.rb | 123 ++-------------------
src/config/environment.rb | 94 +---------------
src/config/environments/development.rb | 52 +++------
src/config/environments/production.rb | 58 ++++++++---
src/config/environments/test.rb | 79 ++++++--------
src/config/initializers/new_rails_defaults.rb | 19 ---
src/config/initializers/secret_token.rb | 7 +
src/config/initializers/session_store.rb | 4 +-
src/config/routes.rb | 146 +++++++++++++++----------
12 files changed, 267 insertions(+), 379 deletions(-)
create mode 100644 src/config/application.rb
delete mode 100644 src/config/initializers/new_rails_defaults.rb
create mode 100644 src/config/initializers/secret_token.rb
diff --git a/src/Rakefile b/src/Rakefile
index 37c683b..d654057 100644
--- a/src/Rakefile
+++ b/src/Rakefile
@@ -1,11 +1,9 @@
-# -*- ruby -*-
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to
Rake.
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
-
+require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
-require 'tasks/rails'
+Conductor::Application.load_tasks
diff --git a/src/config.ru b/src/config.ru
index acbfe4e..51a0775 100644
--- a/src/config.ru
+++ b/src/config.ru
@@ -1,7 +1,4 @@
-# Rack Dispatcher
+# This file is used by Rack-based servers to start the application.
-# Require your environment file to bootstrap Rails
-require File.dirname(__FILE__) + '/config/environment'
-
-# Dispatch the request
-run ActionController::Dispatcher.new
+require ::File.expand_path('../config/environment', __FILE__)
+run Conductor::Application
diff --git a/src/config/application.rb b/src/config/application.rb
new file mode 100644
index 0000000..042dc8a
--- /dev/null
+++ b/src/config/application.rb
@@ -0,0 +1,49 @@
+require File.expand_path('../boot', __FILE__)
+
+require 'rails/all'
+
+# If you have a Gemfile, require the gems listed there, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(:default, Rails.env) if defined?(Bundler)
+
+$: << File.join(File.dirname(__FILE__), "../app")
+
+module Aggregator
+ class Application < Rails::Application
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+
+ # Custom directories with classes and modules you want to be autoloadable.
+ # config.autoload_paths += %W(#{config.root}/extras)
+
+ # Only load the plugins named here, in the order given (default is alphabetical).
+ # :all can be used as a placeholder for all plugins not explicitly named.
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Activate observers that should always be running.
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
+ config.active_record.observers = :instance_observer, :task_observer
+
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to
this zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names.
Default is UTC.
+ # config.time_zone = 'Central Time (US & Canada)'
+
+ # The default locale is :en and all translations from config/locales/*.rb,yml are
auto loaded.
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales',
'*.{rb,yml}').to_s]
+ # config.i18n.default_locale = :de
+
+ # JavaScript files you want as :defaults (application.js is always included).
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
+
+ # Configure the default encoding used in templates for Ruby 1.9.
+ config.encoding = "utf-8"
+
+ # Configure sensitive parameters which will be filtered from the log file.
+ config.filter_parameters += [:password, :password_confirmation]
+
+ config.after_initialize do
+ Haml::Template.options[:format] = :html5
+ end
+ end
+end
diff --git a/src/config/boot.rb b/src/config/boot.rb
index 9759b93..ab6cb37 100644
--- a/src/config/boot.rb
+++ b/src/config/boot.rb
@@ -1,110 +1,13 @@
-# Don't change this file!
-# Configure your app in config/environment.rb and config/environments/*.rb
-
-RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
-
-module Rails
- class << self
- def boot!
- unless booted?
- preinitialize
- pick_boot.run
- end
- end
-
- def booted?
- defined? Rails::Initializer
- end
-
- def pick_boot
- (vendor_rails? ? VendorBoot : GemBoot).new
- end
-
- def vendor_rails?
- File.exist?("#{RAILS_ROOT}/vendor/rails")
- end
-
- def preinitialize
- load(preinitializer_path) if File.exist?(preinitializer_path)
- end
-
- def preinitializer_path
- "#{RAILS_ROOT}/config/preinitializer.rb"
- end
- end
-
- class Boot
- def run
- load_initializer
- Rails::Initializer.run(:set_load_path)
- end
- end
-
- class VendorBoot < Boot
- def load_initializer
- require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
- Rails::Initializer.run(:install_gem_spec_stubs)
- Rails::GemDependency.add_frozen_gem_path
- end
- end
-
- class GemBoot < Boot
- def load_initializer
- self.class.load_rubygems
- load_rails_gem
- require 'initializer'
- end
-
- def load_rails_gem
- if version = self.class.gem_version
- gem 'rails', version
- else
- gem 'rails'
- end
- rescue Gem::LoadError => load_error
- $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version}
rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails
version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version
installed.)
- exit 1
- end
-
- class << self
- def rubygems_version
- Gem::RubyGemsVersion rescue nil
- end
-
- def gem_version
- if defined? RAILS_GEM_VERSION
- RAILS_GEM_VERSION
- elsif ENV.include?('RAILS_GEM_VERSION')
- ENV['RAILS_GEM_VERSION']
- else
- parse_gem_version(read_environment_rb)
- end
- end
-
- def load_rubygems
- min_version = '1.3.1'
- require 'rubygems'
- unless rubygems_version >= min_version
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have
#{rubygems_version}). Please `gem update --system` and try again.)
- exit 1
- end
-
- rescue LoadError
- $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install
RubyGems and try again:
http://rubygems.rubyforge.org)
- exit 1
- end
-
- def parse_gem_version(text)
- $1 if text =~
/^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
- end
-
- private
- def read_environment_rb
- File.read("#{RAILS_ROOT}/config/environment.rb")
- end
- end
- end
-end
-
-# All that for this:
-Rails.boot!
+require 'rubygems'
+
+# Set up gems listed in the Gemfile.
+gemfile = File.expand_path('../../Gemfile', __FILE__)
+begin
+ ENV['BUNDLE_GEMFILE'] = gemfile
+ require 'bundler'
+ Bundler.setup
+rescue Bundler::GemNotFound => e
+ STDERR.puts e.message
+ STDERR.puts "Try running `bundle install`."
+ exit!
+end if File.exist?(gemfile)
diff --git a/src/config/environment.rb b/src/config/environment.rb
index 5966b0d..d9e2695 100644
--- a/src/config/environment.rb
+++ b/src/config/environment.rb
@@ -1,91 +1,5 @@
-#
-# Copyright (C) 2009 Red Hat, Inc.
-# Written by Scott Seago <sseago(a)redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA. A copy of the GNU General Public License is
-# also available at
http://www.gnu.org/copyleft/gpl.html.
+# Load the rails application
+require File.expand_path('../application', __FILE__)
-# Be sure to restart your web server when you modify this file.
-
-# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '>= 2.3.2' unless defined? RAILS_GEM_VERSION
-
-# Bootstrap the Rails environment, frameworks, and default configuration
-require File.join(File.dirname(__FILE__), 'boot')
-require 'util/condormatic'
-
-
-Rails::Initializer.run do |config|
- # Settings in config/environments/* take precedence over those specified here
- # Application configuration should go into files in config/initializers
- # -- all .rb files in that directory are automatically loaded.
- # See Rails::Configuration for more options.
-
- # Skip frameworks you're not going to use. To use Rails without a database
- # you must remove the Active Record framework.
- # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
-
- # Specify gems that this application depends on.
- # They can then be installed with "rake gems:install" on new installations.
- config.gem "authlogic"
- config.gem "deltacloud-client", :lib => "deltacloud", :version
=> ">= 0.0.9.8"
- config.gem "haml"
- config.gem "will_paginate"
- config.gem "nokogiri", :version => ">= 1.4.0"
- config.gem "compass", :version => ">= 0.10.2"
- config.gem "compass-960-plugin", :lib => "ninesixty"
- config.gem "simple-navigation"
- config.gem "typhoeus"
- config.gem 'rest-client', :version => '>= 1.6.1'
- config.gem 'rack-restful_submit', :version => '1.1.2'
- config.gem 'net-scp', :lib => 'net/scp'
- config.gem 'uuidtools'
-
- config.middleware.swap Rack::MethodOverride, 'Rack::RestfulSubmit'
-
- config.active_record.observers = :instance_observer, :task_observer
- # Only load the plugins named here, in the order given. By default, all plugins
- # in vendor/plugins are loaded in alphabetical order.
- # :all can be used as a placeholder for all plugins not explicitly named
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
- # Add additional load paths for your own custom dirs
- # config.load_paths += %W( #{RAILS_ROOT}/extras )
-
- # Force all environments to use the same logger level
- # (by default production uses :info, the others :debug)
- # config.log_level = :debug
-
- # Make Time.zone default to the specified zone, and make Active Record store time
values
- # in the database in UTC, and return them converted to the specified local zone.
- # Run "rake -D time" for a list of tasks for finding time zone names.
Uncomment to use default local time.
- config.time_zone = 'UTC'
-
- # Use SQL instead of Active Record's schema dumper when creating the test
database.
- # This is necessary if your schema can't be completely dumped by the schema
dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
-
- # Activate observers that should always be running
- # config.active_record.observers = :cacher, :garbage_collector
-
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto
loaded.
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales',
'*.{rb,yml}')]
- # config.i18n.default_locale = :de
-
- config.after_initialize do
- Haml::Template.options[:format] = :html5
- end
-end
+# Initialize the rails application
+Conductor::Application.initialize!
diff --git a/src/config/environments/development.rb
b/src/config/environments/development.rb
index 9bd4fa6..d4d3942 100644
--- a/src/config/environments/development.rb
+++ b/src/config/environments/development.rb
@@ -1,39 +1,25 @@
-#
-# Copyright (C) 2008 Red Hat, Inc.
-# Written by Scott Seago <sseago(a)redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA. A copy of the GNU General Public License is
-# also available at
http://www.gnu.org/copyleft/gpl.html.
+Conductor::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
-# Settings specified here will take precedence over those in config/environment.rb
+ # In the development environment your application's code is reloaded on
+ # every request. This slows down response time but is perfect for development
+ # since you don't have to restart the webserver when you make code changes.
+ config.cache_classes = false
-# In the development environment your application's code is reloaded on
-# every request. This slows down response time but is perfect for development
-# since you don't have to restart the webserver when you make code changes.
-config.cache_classes = false
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_view.debug_rjs = true
+ config.action_controller.perform_caching = false
-# Enable the breakpoint server that script/breakpointer connects to
-#config.breakpoint_server = true
+ # Don't care if the mailer can't send
+ config.action_mailer.raise_delivery_errors = false
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching = false
-config.action_view.debug_rjs = true
+ # Print deprecation notices to the Rails logger
+ config.active_support.deprecation = :log
-# Don't care if the mailer can't send
-config.action_mailer.raise_delivery_errors = false
+ # Only use best-standards-support built into browsers
+ config.action_dispatch.best_standards_support = :builtin
+end
diff --git a/src/config/environments/production.rb
b/src/config/environments/production.rb
index 9ad4568..ecc0196 100644
--- a/src/config/environments/production.rb
+++ b/src/config/environments/production.rb
@@ -17,22 +17,52 @@
# MA 02110-1301, USA. A copy of the GNU General Public License is
# also available at
http://www.gnu.org/copyleft/gpl.html.
-# Settings specified here will take precedence over those in config/environment.rb
+Conductor::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
-# The production environment is meant for finished, "live" apps.
-# Code is not reloaded between requests
-config.cache_classes = true
+ # The production environment is meant for finished, "live" apps.
+ # Code is not reloaded between requests
+ config.cache_classes = true
-# Use a different logger for distributed setups
-# config.logger = SyslogLogger.new
+ # Full error reports are disabled and caching is turned on
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
-# Full error reports are disabled and caching is turned on
-config.action_controller.consider_all_requests_local = false
-config.action_controller.perform_caching = true
+ # Specifies the header that your server uses for sending files
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
-# Enable serving of images, stylesheets, and javascripts from an asset server
-# config.action_controller.asset_host =
"http://assets.example.com"
+ # For nginx:
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
-# Disable delivery errors, bad email addresses will be ignored
-# config.action_mailer.raise_delivery_errors = false
-config.log_path = "/var/log/aeolus-conductor/rails.log"
+ # If you have no front-end server that supports something like X-Sendfile,
+ # just comment this out and Rails will serve the files
+
+ # See everything in the log (default is :info)
+ # config.log_level = :debug
+
+ # Use a different logger for distributed setups
+ # config.logger = SyslogLogger.new
+
+ # Use a different cache store in production
+ # config.cache_store = :mem_cache_store
+
+ # Disable Rails's static asset server
+ # In production, Apache or nginx will already do this
+ config.serve_static_assets = false
+
+ # Enable serving of images, stylesheets, and javascripts from an asset server
+ # config.action_controller.asset_host = "http://assets.example.com"
+
+ # Disable delivery errors, bad email addresses will be ignored
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable threaded mode
+ # config.threadsafe!
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation can not be found)
+ config.i18n.fallbacks = true
+
+ # Send deprecation notices to registered listeners
+ config.active_support.deprecation = :notify
+end
diff --git a/src/config/environments/test.rb b/src/config/environments/test.rb
index 42ed90f..ba633db 100644
--- a/src/config/environments/test.rb
+++ b/src/config/environments/test.rb
@@ -1,44 +1,35 @@
-#
-# Copyright (C) 2008 Red Hat, Inc.
-# Written by Scott Seago <sseago(a)redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA. A copy of the GNU General Public License is
-# also available at
http://www.gnu.org/copyleft/gpl.html.
-
-# Settings specified here will take precedence over those in config/environment.rb
-
-# The test environment is used exclusively to run your application's
-# test suite. You never need to work with it otherwise. Remember that
-# your test database is "scratch space" for the test suite and is wiped
-# and recreated between test runs. Don't rely on the data there!
-config.cache_classes = true
-
-# Log error messages when you accidentally call methods on nil.
-config.whiny_nils = true
-
-# Show full error reports and disable caching
-config.action_controller.consider_all_requests_local = true
-config.action_controller.perform_caching = false
-
-# Tell ActionMailer not to deliver emails to the real world.
-# The :test delivery method accumulates sent emails in the
-# ActionMailer::Base.deliveries array.
-config.action_mailer.delivery_method = :test
-
-config.gem 'rspec-rails', :version => '>= 1.3.2', :lib => false
unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
-config.gem "factory_girl", :lib => "factory_girl", :version =>
">=1.3.1"
-config.gem 'timecop', :lib => 'timecop', :version => '>=
0.3.5'
-config.gem 'vcr', :lib => 'vcr', :version => '>=
1.10.0'
-config.gem 'webmock', :lib => 'webmock', :version => '>=
1.6.4'
+Aggregator::Application.configure do
+ # Settings specified here will take precedence over those in config/environment.rb
+
+ # The test environment is used exclusively to run your application's
+ # test suite. You never need to work with it otherwise. Remember that
+ # your test database is "scratch space" for the test suite and is wiped
+ # and recreated between test runs. Don't rely on the data there!
+ config.cache_classes = true
+
+ # Log error messages when you accidentally call methods on nil.
+ config.whiny_nils = true
+
+ # Show full error reports and disable caching
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+
+ # Raise exceptions instead of rendering exception templates
+ config.action_dispatch.show_exceptions = false
+
+ # Disable request forgery protection in test environment
+ config.action_controller.allow_forgery_protection = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Use SQL instead of Active Record's schema dumper when creating the test
database.
+ # This is necessary if your schema can't be completely dumped by the schema
dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Print deprecation notices to the stderr
+ config.active_support.deprecation = :stderr
+end
diff --git a/src/config/initializers/new_rails_defaults.rb
b/src/config/initializers/new_rails_defaults.rb
deleted file mode 100644
index 8ec3186..0000000
--- a/src/config/initializers/new_rails_defaults.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# These settings change the behavior of Rails 2 apps and will be defaults
-# for Rails 3. You can remove this initializer when Rails 3 is released.
-
-if defined?(ActiveRecord)
- # Include Active Record class name as root for JSON serialized output.
- ActiveRecord::Base.include_root_in_json = true
-
- # Store the full class name (including module namespace) in STI type column.
- ActiveRecord::Base.store_full_sti_class = true
-end
-
-# Use ISO 8601 format for JSON serialized times and dates.
-ActiveSupport.use_standard_json_time_format = true
-
-# Don't escape HTML entities in JSON, leave that for the #json_escape helper.
-# if you're including raw json in an HTML page.
-ActiveSupport.escape_html_entities_in_json = false
\ No newline at end of file
diff --git a/src/config/initializers/secret_token.rb
b/src/config/initializers/secret_token.rb
new file mode 100644
index 0000000..7c6aba6
--- /dev/null
+++ b/src/config/initializers/secret_token.rb
@@ -0,0 +1,7 @@
+# Be sure to restart your server when you modify this file.
+
+# Your secret key for verifying the integrity of signed cookies.
+# If you change this key, all old signed cookies will become invalid!
+# Make sure the secret is at least 30 characters and all random,
+# no regular words or you'll be exposed to dictionary attacks.
+Conductor::Application.config.secret_token =
'538786e891b468964662eb7385b3b781062b907175875c6b7fc344ffb9eb7de5abd7bca07e7901bf0bfdda57e52a10f2688fae7e86e30e6194d22dc489bd9b54'
diff --git a/src/config/initializers/session_store.rb
b/src/config/initializers/session_store.rb
index 64dbf51..55d2275 100644
--- a/src/config/initializers/session_store.rb
+++ b/src/config/initializers/session_store.rb
@@ -4,7 +4,7 @@
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
-ActionController::Base.session = {
+Conductor::Application.config.session = {
:key => '_rails23-app_session',
:secret =>
'41713a6b4a92b5b7af55314d2ef6fc499a177269ea91b9fdaa7d15c42e1234b70b32f52278ae26b774b38dbdfeb7d078585d10f643e81b6615d32410f192f1de'
}
@@ -12,4 +12,4 @@ ActionController::Base.session = {
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rake db:sessions:create")
-ActionController::Base.session_store = :active_record_store
+Conductor::Application.config.session_store = :active_record_store
diff --git a/src/config/routes.rb b/src/config/routes.rb
index 7f83338..2589742 100644
--- a/src/config/routes.rb
+++ b/src/config/routes.rb
@@ -1,75 +1,107 @@
-#
-# Copyright (C) 2009 Red Hat, Inc.
-# Written by Scott Seago <sseago(a)redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA. A copy of the GNU General Public License is
-# also available at
http://www.gnu.org/copyleft/gpl.html.
-
-ActionController::Routing::Routes.draw do |map|
-
- # The priority is based upon order of creation: first created -> highest priority.
+Conductor::Application.routes.draw do
+ # The priority is based upon order of creation:
+ # first created -> highest priority.
# Sample of regular route:
- # map.connect 'products/:id', :controller => 'catalog', :action
=> 'view'
+ # match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
- # map.purchase 'products/:id/purchase', :controller => 'catalog',
:action => 'purchase'
+ # 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
- # You can have the root of your site routed by hooking up ''
- # -- just remember to delete public/index.html.
+ # Sample resource route with options:
+ # resources :products do
+ # member do
+ # get 'short'
+ # post 'toggle'
+ # end
+ #
+ # collection do
+ # get 'sold'
+ # end
+ # end
- map.resources :pools, :collection => { :multi_destroy => :delete }
- map.resources :deployments, :collection => { :multi_stop => :get, :launch_new
=> :get, :check_name => :get }
- map.resources :instances, :collection => {:start => :get, :multi_stop => :get,
:remove_failed => :get, :can_start => :get, :can_create => :get }, :member =>
{:key => :get}
+ # Sample resource route with sub-resources:
+ # resources :products do
+ # resources :comments, :sales
+ # resource :seller
+ # end
- map.can_start_instance
'/instances/:instance_id/can_start/:provider_account_id', :controller =>
'instances', :action => 'can_start', :conditions => { :method =>
:get }
- map.can_create_instance
'/instances/:instance_id/can_create/:provider_account_id', :controller =>
'instances', :action => 'can_create', :conditions => { :method =>
:get }
+ # Sample resource route with more complex sub-resources
+ # resources :products do
+ # resources :comments
+ # resources :sales do
+ # get 'recent', :on => :collection
+ # end
+ # end
- map.resources :image_imports
+ # Sample resource route within a namespace:
+ # namespace :admin do
+ # # Directs /admin/products/* to Admin::ProductsController
+ # # (app/controllers/admin/products_controller.rb)
+ # resources :products
+ # end
- map.resources :hardware_profiles, :collection => { :multi_destroy => :delete }
- map.resources :providers, :collection => { :multi_destroy => :delete }
- map.resources :provider_types, :only => :index
- map.resources :users, :collection => { :multi_destroy => :delete }
- map.resources :provider_accounts, :collection => { :multi_destroy => :delete,
:set_selected_provider => :get}
- map.resources :roles, :collection => { :multi_destroy => :delete }
- map.resources :settings, :collection => { :self_service => :get,
:general_settings => :get }
- map.resources :pool_families, :collection => { :multi_destroy => :delete,
:add_provider_account => :post, :multi_destroy_provider_accounts => :delete }
- map.resources :realms, :collection => { :multi_destroy => :delete }
- map.resources :realm_mappings, :collection => { :multi_destroy => :delete }
- map.resources :suggested_deployables, :collection => { :multi_destroy => :delete
}
+ # You can have the root of your site routed with "root"
+ # just remember to delete public/index.html.
+ # root :to => "welcome#index"
- map.matching_profiles
'/hardware_profiles/matching_profiles/:hardware_profile_id/provider/:provider_id',
:controller => 'hardware_profiles', :action => 'matching_profiles',
:conditions => { :method => :get }
+ # See how all your routes lay out with "rake routes"
- map.login 'login', :controller => "user_sessions", :action =>
"new"
- map.logout 'logout', :controller => "user_sessions", :action =>
"destroy"
- map.resource :user_session
- map.register 'register', :controller => 'users', :action =>
'new'
- map.resource :account, :controller => "users"
- map.resources :permissions, :collection => { :list => :get }
+ # 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)))'
- map.root :controller => 'pools'
+ #Do we still need this one? => resource :user_session
+ match 'login', :to => 'user_sessions#new', :as =>
'login'
+ match 'logout', :to => 'user_sessions#destroy', :as =>
'logout'
+ match 'register', :to => 'users#new', :as =>
'register'
+ resource 'account', :to => 'users'
+ resources :users, :instances, :templates, :builds
+ resources :permissions, :collection => { :list => :get}
+ resources :settings do
+ collection do
+ get :self_service
+ get :general_settings
+ end
+ end
+ resources :pools do
+ get :hardware_profiles
+ get :realms
+ end
- # Allow downloading Web Service WSDL as a file with an extension
- # instead of a file named 'wsdl'
- map.connect ':controller/service.wsdl', :action => 'wsdl'
+ resources :pools, :collection => { :multi_destroy => :delete }
+ resources :deployments, :collection => { :multi_stop => :get, :launch_new =>
:get, :check_name => :get }
+ resources :instances, :collection => {:start => :get, :multi_stop => :get,
:remove_failed => :get, :can_start => :get, :can_create => :get }, :member =>
{:key => :get}
- # Install the default route as the lowest priority.
- map.connect ':controller/:action/:id.:format'
- map.connect ':controller/:action/:id'
+ #map.can_start_instance
'/instances/:instance_id/can_start/:provider_account_id', :controller =>
'instances', :action => 'can_start', :conditions => { :method =>
:get }
+ #map.can_create_instance
'/instances/:instance_id/can_create/:provider_account_id', :controller =>
'instances', :action => 'can_create', :conditions => { :method =>
:get }
+
+ resources :image_imports
+
+ resources :hardware_profiles, :collection => { :multi_destroy => :delete }
+ resources :providers, :collection => { :multi_destroy => :delete }
+ #This may be the correct way to do the above now....
+ #resources :providers do
+ # resources :accounts, :to => :cloud_accounts
+ #end
+ resources :provider_types, :only => :index
+ resources :users, :collection => { :multi_destroy => :delete }
+ resources :provider_accounts, :collection => { :multi_destroy => :delete,
:set_selected_provider => :get}
+ resources :roles, :collection => { :multi_destroy => :delete }
+ resources :settings, :collection => { :self_service => :get, :general_settings
=> :get }
+ resources :pool_families, :collection => { :multi_destroy => :delete,
:add_provider_account => :post, :multi_destroy_provider_accounts => :delete }
+ resources :realms, :collection => { :multi_destroy => :delete }
+ resources :realm_mappings, :collection => { :multi_destroy => :delete }
+ resources :suggested_deployables, :collection => { :multi_destroy => :delete }
+
+ #match 'matching_profiles', :to =>
'/hardware_profiles/matching_profiles/:hardware_profile_id/provider/:provider_id',
:controller => 'hardware_profiles', :action => 'matching_profiles',
:conditions => { :method => :get }, :as =>'matching_profiles'
+ match 'dashboard', :to => 'dashboard', :as =>
'dashboard'
+ root :to => "pools#index"
+
+ match '/:controller(/:action(/:id))'
end
--
1.7.4.4