diff --git a/Gemfile b/Gemfile index 0c43a73..7b25b44 100644 --- a/Gemfile +++ b/Gemfile @@ -9,16 +9,13 @@ gem 'oj' gem 'ox' gem 'rack-cors' gem 'rake' -gem 'redcarpet' gem 'rufus-scheduler' -gem 'sass' gem 'sequel_pg' gem 'sinatra' gem 'unicorn' group :development do gem 'shotgun' - gem 'sitemap_generator' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 92302e1..8cef151 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,14 +4,12 @@ GEM addressable (2.6.0) public_suffix (>= 2.0.2, < 4.0) ast (2.4.0) - builder (3.2.3) coderay (1.1.2) concurrent-ruby (1.1.5) crack (0.4.3) safe_yaml (~> 1.0.0) et-orbi (1.2.0) tzinfo - ffi (1.10.0) fugit (1.2.0) et-orbi (~> 1.1, >= 1.1.8) raabro (~> 1.1) @@ -48,10 +46,6 @@ GEM rainbow (3.0.0) raindrops (0.19.0) rake (12.3.2) - rb-fsevent (0.10.3) - rb-inotify (0.10.0) - ffi (~> 1.0) - redcarpet (3.4.0) rubocop (0.67.2) jaro_winkler (~> 1.5.1) parallel (~> 1.10) @@ -66,11 +60,6 @@ GEM rufus-scheduler (3.6.0) fugit (~> 1.1, >= 1.1.6) safe_yaml (1.0.5) - sass (3.7.4) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) sequel (5.19.0) sequel_pg (1.12.0) pg (>= 0.18.0) @@ -82,8 +71,6 @@ GEM rack (~> 2.0) rack-protection (= 2.0.5) tilt (~> 2.0) - sitemap_generator (6.0.2) - builder (~> 3.0) tilt (2.0.9) tzinfo (2.0.0) concurrent-ruby (~> 1.0) @@ -110,14 +97,11 @@ DEPENDENCIES rack-cors rack-test rake - redcarpet rubocop-sequel rufus-scheduler - sass sequel_pg shotgun sinatra - sitemap_generator unicorn vcr webmock diff --git a/assets/noun_Hot Dog_228408.png b/assets/noun_Hot Dog_228408.png deleted file mode 100644 index 8f5c578..0000000 Binary files a/assets/noun_Hot Dog_228408.png and /dev/null differ diff --git a/assets/noun_Hot Dog_228408.svg b/assets/noun_Hot Dog_228408.svg deleted file mode 100644 index 8443640..0000000 --- a/assets/noun_Hot Dog_228408.svg +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/lib/web/public/images/frankfurter.png b/lib/web/public/images/frankfurter.png deleted file mode 100644 index 6ba5a4a..0000000 Binary files a/lib/web/public/images/frankfurter.png and /dev/null differ diff --git a/lib/web/public/javascripts/application.js b/lib/web/public/javascripts/application.js deleted file mode 100644 index 03d64cf..0000000 --- a/lib/web/public/javascripts/application.js +++ /dev/null @@ -1,29 +0,0 @@ -hljs.initHighlightingOnLoad(); - -// Make URLs clickable -document.querySelectorAll('.http').forEach((element) => { - element.onclick = () => { - if (element.innerHTML.indexOf('json') > -1) { - const output = element.innerHTML.match(/^(.*)\n/)[1]; - element.innerHTML = output; - } else { - const url = element.innerHTML.match(/>(\/[^<]*)/)[1]; - fetch(url) - .then((resp) => { - const host = resp.url.match(/\/\/([^:/]+)/)[1]; - element.insertAdjacentHTML('beforeend', `\nHost: ${host}\nContent-Type: ${resp.headers.get('Content-Type')}\nContent-Length: ${resp.headers.get('Content-Length')}\n\n`); - return resp.json(); - }) - .then((data) => { - element.insertAdjacentHTML('beforeend', `${JSON.stringify(data, undefined, 4)}`); - hljs.highlightBlock(element); - }); - } - }; -}); - -// Make the JavaScript examples clickable -document.querySelectorAll('.js').forEach((element) => { - const code = element.innerHTML.replace(/>/g, '>'); - element.onclick = () => new Function(code)(); -}); diff --git a/lib/web/public/robots.txt b/lib/web/public/robots.txt index 704e94c..1f53798 100644 --- a/lib/web/public/robots.txt +++ b/lib/web/public/robots.txt @@ -1,4 +1,2 @@ User-agent: * -Disallow: - -Sitemap: https://frankfurter.app/sitemap.xml.gz +Disallow: / diff --git a/lib/web/public/sitemap.xml.gz b/lib/web/public/sitemap.xml.gz deleted file mode 100644 index 6bf66fb..0000000 Binary files a/lib/web/public/sitemap.xml.gz and /dev/null differ diff --git a/lib/web/public/stylesheets/sass/application.scss b/lib/web/public/stylesheets/sass/application.scss deleted file mode 100644 index 5cea301..0000000 --- a/lib/web/public/stylesheets/sass/application.scss +++ /dev/null @@ -1,109 +0,0 @@ -body { - background-color: #F08D5C; - font-family: 'Open Sans', sans-serif; -} - -.navbar { - .navbar-nav { - .nav-link { - color: #fff; - font-size: 14px; - margin-bottom: 2em; - - &:hover { - text-decoration: underline; - } - - .fa-fw { - margin-right: 5px; - } - } - } -} - -.container { - max-width: 720px; -} - -.header { - margin-bottom: 4em; - text-align: center; - - .logo { - img { - margin-bottom: 1em; - width: 150px; - } - } - - .logo, - h1, - h2 { - color: #FFF; - } - - h1 { - font-size: 56px; - } - - h2 { - font-size: 20px; - margin-bottom: 1.5em; - } - - .btn { - background-color: #002B36; - color: #2AA198; - - &:hover { - background-color: #001A25; - } - - strong { - font-weight: normal; - } - - .fas, - strong { - color: #6EE5DB; - } - } -} - -.content { - h1 { - &, - &+p { - display: none; - } - } - - h2 { - font-size: 20px; - font-weight: bold; - } -} - -.hljs { - border-radius: 4px; - font-size: 13px; - padding: 9px 12px; - - &.http { - color: #2D4A53; - } - - i { - color: #2D4A53; - } - - &:hover { - cursor: pointer; - } -} - -.footer { - color: #FFF; - margin: 2em auto; - text-align: center; -} diff --git a/lib/web/server.rb b/lib/web/server.rb index fd27306..6848717 100644 --- a/lib/web/server.rb +++ b/lib/web/server.rb @@ -2,8 +2,6 @@ require 'oj' require 'rack/cors' -require 'redcarpet' -require 'sass/plugin/rack' require 'sinatra' require 'currency_names' @@ -17,11 +15,6 @@ use Rack::Cors do end end -css_location = File.join(Sinatra::Application.public_folder, 'stylesheets') -Sass::Plugin.options.update css_location: css_location, - style: :compressed -use Sass::Plugin::Rack - configure :development do set :show_exceptions, :after_handler end @@ -76,13 +69,7 @@ helpers do end get '/' do - # FIXME: We should cache this in production. - parser = Redcarpet::Markdown.new(Redcarpet::Render::HTML, - disable_indented_code_blocks: true, - fenced_code_blocks: true) - content = parser.render(File.read('README.md')) - - erb :index, locals: { content: content } + redirect 'https://www.frankfurter.app', 301 end get '/(?:latest|current)', mustermann_opts: { type: :regexp } do diff --git a/lib/web/views/index.erb b/lib/web/views/index.erb deleted file mode 100644 index 2caf6a0..0000000 --- a/lib/web/views/index.erb +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - Foreign exchange rates and currency conversion API | Frankfurter - - - - - - - - <% if ENV['GA_TRACKING_ID'] %> - - - - <% end %> - - - - - -
- -

Frankfurter

-

Foreign exchange (forex) rates and currency conversion API

- - - -
- -
- <%= content %> -
- - - - - - <% if ENV['GA_TRACKING_ID'] %> - - - <% end %> - - - diff --git a/spec/web/server_spec.rb b/spec/web/server_spec.rb index 46105b7..b2ba6db 100644 --- a/spec/web/server_spec.rb +++ b/spec/web/server_spec.rb @@ -11,9 +11,9 @@ describe 'the server' do let(:json) { Oj.load(last_response.body) } let(:headers) { last_response.headers } - it 'has a homepage' do + it 'redirects to www' do get '/' - last_response.must_be :ok? + last_response.must_be :redirect? end it 'returns latest quotes' do