Permalink
Browse files

Merge branch 'master' of github.com:alphagov/fco

  • Loading branch information...
2 parents 7d5d9cf + 2f9200e commit 47408f40621bc80d83d6bdf984015fc3dabef598 James Weiner committed Dec 1, 2011
Showing with 12 additions and 27 deletions.
  1. +1 −1 Gemfile
  2. +2 −2 Gemfile.lock
  3. +9 −24 lib/tasks/router.rake
View
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
source 'https://gems.gemfury.com/vo6ZrmjBQu5szyywDszE/'
group :router do
- gem 'router-client', '1.0.0', :require => 'router/client'
+ gem 'router-client', '2.0.3', :require => 'router/client'
end
group :passenger_compatibility do
View
@@ -105,7 +105,7 @@ GEM
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
- router-client (1.0.0)
+ router-client (2.0.3)
builder
null_logger
simplecov (0.4.2)
@@ -156,7 +156,7 @@ DEPENDENCIES
rails (= 3.1.1)
rake (= 0.9.2)
rest-client
- router-client (= 1.0.0)
+ router-client (= 2.0.3)
rummageable!
simplecov (= 0.4.2)
simplecov-rcov
View
@@ -6,39 +6,24 @@ namespace :router do
@logger = Logger.new STDOUT
@logger.level = Logger::DEBUG
- http = Router::HttpClient.new "http://cache.cluster:8080/router", @logger
-
- @router = Router::Client.new http
+ @router = Router::Client.new :logger => @logger
end
task :register_application => :router_environment do
platform = ENV['FACTER_govuk_platform']
url = "fco.#{platform}.alphagov.co.uk/"
- begin
- @logger.info "Registering application..."
- @router.applications.create application_id: "fco", backend_url: url
- rescue Router::Conflict
- application = @router.applications.find "fco"
- puts "Application already registered: #{application.inspect}"
- end
+ @logger.info "Registering application..."
+ @router.applications.update application_id: "fco", backend_url: url
end
task :register_routes => [ :router_environment, :environment ] do
- begin
- @logger.info "Registering prefix /travel-advice"
- @router.routes.create application_id: "fco", route_type: :prefix,
- incoming_path: "/travel-advice"
- rescue => e
- puts [ e.message, e.backtrace ].join("\n")
- end
+ @logger.info "Registering prefix /travel-advice"
+ @router.routes.update application_id: "fco", route_type: :prefix,
+ incoming_path: "/travel-advice"
- begin
- @logger.info "Registering asset path /fco-assets"
- @router.routes.create application_id: "fco", route_type: :prefix,
- incoming_path: "/fco-assets"
- rescue => e
- puts [ e.message, e.backtrace ].join("\n")
- end
+ @logger.info "Registering asset path /fco-assets"
+ @router.routes.update application_id: "fco", route_type: :prefix,
+ incoming_path: "/fco-assets"
end
desc "Register fco application and routes with the router (run this task on server in cluster)"

0 comments on commit 47408f4

Please sign in to comment.