--- src/Rakefile | 8 +- src/config.ru | 9 +- src/config/application.rb | 58 ++++++++++ src/config/boot.rb | 123 +++------------------- src/config/environment.rb | 103 +----------------- src/config/environments/development.rb | 52 ++++------ src/config/environments/production.rb | 87 +++++++++------- src/config/environments/test.rb | 77 ++++++------- 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 | 144 ++++++++++++------------- 12 files changed, 262 insertions(+), 429 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..03d16cb 100644 --- a/src/Rakefile +++ b/src/Rakefile @@ -1,11 +1,7 @@ -# -*- 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' +Aggregator::Application.load_tasks diff --git a/src/config.ru b/src/config.ru index acbfe4e..42fc9ce 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 Aggregator::Application diff --git a/src/config/application.rb b/src/config/application.rb new file mode 100644 index 0000000..0ca0f53 --- /dev/null +++ b/src/config/application.rb @@ -0,0 +1,58 @@ +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") +require 'util/condormatic' + +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 + begin + # This pulls all the possible classad matches from the database and puts + # them on condor on startup. Note that this can fail because this is run on startup + # even for rake db:migrate etc. which won't work since the database doesn't exist + # yet. + kick_condor + rescue Exception => ex + end + 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 07c0ea0..0c6e8c3 100644 --- a/src/config/environment.rb +++ b/src/config/environment.rb @@ -1,100 +1,5 @@ -# -# Copyright (C) 2009 Red Hat, Inc. -# Written by Scott Seago sseago@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 "bj" - # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" - # config.gem "aws-s3", :lib => "aws/s3" - 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 "rb-inotify" - config.gem 'rack-restful_submit' - - config.middleware.insert_after 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 - begin - # This pulls all the possible classad matches from the database and puts - # them on condor on startup. Note that this can fail because this is run on startup - # even for rake db:migrate etc. which won't work since the database doesn't exist - # yet. - kick_condor - rescue Exception => ex - end - end -end +# Initialize the rails application +Aggregator::Application.initialize! diff --git a/src/config/environments/development.rb b/src/config/environments/development.rb index 9bd4fa6..e7970f7 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@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. +Aggregator::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 dc093bf..19c8e5c 100644 --- a/src/config/environments/production.rb +++ b/src/config/environments/production.rb @@ -1,38 +1,49 @@ -# -# Copyright (C) 2008 Red Hat, Inc. -# Written by Scott Seago sseago@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 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.action_controller.consider_all_requests_local = false -config.action_controller.perform_caching = true - -# 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 -config.log_path = "/var/log/deltacloud-aggregator/rails.log" +Aggregator::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 + + # Full error reports are disabled and caching is turned on + config.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" + + # For nginx: + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' + + # 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 f7981c4..ba633db 100644 --- a/src/config/environments/test.rb +++ b/src/config/environments/test.rb @@ -1,42 +1,35 @@ -# -# Copyright (C) 2008 Red Hat, Inc. -# Written by Scott Seago sseago@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' +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..544cb22 --- /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. +Aggregator::Application.config.secret_token = '538786e891b468964662eb7385b3b781062b907175875c6b7fc344ffb9eb7de5abd7bca07e7901bf0bfdda57e52a10f2688fae7e86e30e6194d22dc489bd9b54' diff --git a/src/config/initializers/session_store.rb b/src/config/initializers/session_store.rb index 64dbf51..541a4a6 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 = { +Aggregator::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 +Aggregator::Application.config.session_store = :active_record_store diff --git a/src/config/routes.rb b/src/config/routes.rb index f4e4bb8..6b689bd 100644 --- a/src/config/routes.rb +++ b/src/config/routes.rb @@ -1,86 +1,82 @@ -# -# Copyright (C) 2009 Red Hat, Inc. -# Written by Scott Seago sseago@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. +Aggregator::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) - - # You can have the root of your site routed by hooking up '' - # -- just remember to delete public/index.html. - - map.namespace 'resources' do |r| - r.resources :pools, :instances, :deployments + # 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)))' + + 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 :settings do + collection do + get :self_service + get :general_settings + end end - - map.namespace 'image_factory' do |r| - r.resources :assemblies, :deployables, :templates + resources :pools do + get :hardware_profiles + get :realms end - - map.namespace 'admin' do |r| - r.resources :hardware_profiles, :pool_families, :providers, :provider_accounts, :realms, :roles, :settings, :users + resources :providers do + resources :accounts, :to => :cloud_accounts end
- map.resources :pools - - map.connect '', :controller => 'dashboard' - - 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 :users - - map.dashboard '/dashboard', :controller => 'dashboard' - map.instance '/instances', :controller => 'instances' - # map.templates '/templates', :controller => 'templates' - map.settings '/settings', :controller => 'settings' - map.root :dashboard - - # Temporarily disable this route, provider stuff is not restful yet. - # Will be re-enabled in upcoming patch - map.resources :providers do |provider| - provider.resources :accounts, :controller => 'cloud_accounts' - end - map.destroy_providers_account '/providers/:provider_id/accounts/:id/destroy', :controller => 'cloud_accounts', :action => 'destroy', :conditions => { :method => :get } - - map.resources :templates, :collection => { :destroy_multiple => :get }, - :member => { - :assembly => :get, - :deployment_definition => :get, - :action => :get, - } - map.resources :builds - - # Allow downloading Web Service WSDL as a file with an extension - # instead of a file named 'wsdl' - map.connect ':controller/service.wsdl', :action => 'wsdl' + match 'dashboard', :to => 'dashboard', :as => 'dashboard' + root :to => "dashboard#index"
- # Install the default route as the lowest priority. - map.connect ':controller/:action/:id.:format' - map.connect ':controller/:action/:id' + match '/:controller(/:action(/:id))' end