From cece28eaf8d9489d56d1455a560dbf50a9b20b37 Mon Sep 17 00:00:00 2001 From: Dan Buch Date: Sun, 13 Sep 2015 23:02:37 -0400 Subject: [PATCH] Redirect to S3 file --- Gemfile | 4 ++-- Gemfile.lock | 9 +-------- app.rb | 21 --------------------- config.ru | 4 +--- 4 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 app.rb diff --git a/Gemfile b/Gemfile index 0847425..40a7839 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,6 @@ source 'https://rubygems.org' ruby '2.2.2' if ENV.key?('DYNO') gem 'aws-sdk', '~> 2' -gem 'puma' gem 'pry', group: [:development, :test] -gem 'sinatra' +gem 'puma' +gem 'rack' diff --git a/Gemfile.lock b/Gemfile.lock index 4129877..318ce29 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -18,14 +18,7 @@ GEM slop (~> 3.4) puma (2.13.4) rack (1.6.4) - rack-protection (1.5.3) - rack - sinatra (1.4.6) - rack (~> 1.4) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) slop (3.6.0) - tilt (2.0.1) PLATFORMS ruby @@ -34,7 +27,7 @@ DEPENDENCIES aws-sdk (~> 2) pry puma - sinatra + rack BUNDLED WITH 1.10.6 diff --git a/app.rb b/app.rb deleted file mode 100644 index 15612d0..0000000 --- a/app.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'sinatra/base' -require_relative 'cpi_fetcher' - -class App < Sinatra::Base - get '/' do - current_cpi = fetcher.cpi - halt 502 unless current_cpi - - expires 300, :public, :must_revalidate - content_type :text - "#{current_cpi}\n" - end - - run! if app_file == $PROGRAM_FILE - - private - - def fetcher - @fetcher ||= CPIFetcher.new - end -end diff --git a/config.ru b/config.ru index eae1e13..c191bf4 100644 --- a/config.ru +++ b/config.ru @@ -1,3 +1 @@ -require './app' - -run App +run lambda { |env| [301, { 'Location' => ENV['CPI_FEED_URL'] }, []] }