Yank content from server

This commit is contained in:
Hakan Ensari 2019-04-25 16:56:13 +01:00
parent d50a96ede8
commit 6c48bcadbe
12 changed files with 4 additions and 279 deletions

View File

@ -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

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 KiB

View File

@ -1,3 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100" viewBox="0 0 100 100"><g><g transform="translate(50 50) scale(0.69 0.69) rotate(0) translate(-50 -50)" style="fill:#000000;"><svg fill="#000000" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 99.6 99.6" style="enable-background:new 0 0 99.6 99.6;" xml:space="preserve"><style type="text/css">
.st0{display:none;}
</style><g><path d="M72.8,8.2c-0.5,0.4-1,0.8-1.5,1.3L10.8,72.3c-0.5,0.5-1,1.1-1.4,1.7c-1.3-1.6-1.9-3.5-1.9-5.4c0-2.2,0.8-4.3,2.4-6 L61.4,9.1C64.5,6,69.3,5.6,72.8,8.2z"></path><path d="M91.2,36.3L38.1,91.5c-2.9,3-7.6,3.1-10.6,0.2l-1.7-1.6l0-0.1c0.6-0.4,1.3-0.9,1.8-1.5l60.5-62.8c0.5-0.5,0.9-1,1.2-1.5 l1.7,1.6C94,28.6,94.1,33.4,91.2,36.3z"></path><path d="M85.7,11.3c-1.7-1.6-3.8-2.4-6-2.4c-1.7,0-3.4,0.5-4.8,1.5c-0.5,0.3-1,0.7-1.4,1.2L12.9,74.4c-0.5,0.5-0.9,1.1-1.2,1.7 c-0.8,1.4-1.2,2.9-1.2,4.5c0,2.3,1,4.5,2.6,6.1c3,2.9,7.6,3.2,10.9,0.9c0.5-0.3,0.9-0.7,1.4-1.1L86,23.6c0.3-0.3,0.6-0.7,0.8-1 C89.2,19.1,88.8,14.3,85.7,11.3z M80.8,25.5c-0.6,0.6-1.5,0.6-2.1,0c-1.9-1.8-4.2-2.8-6.6-2.9c-1.8-0.1-3.4,0.4-4.8,1.3 c5.5,6,3.9,11.3,3.8,11.5c-0.2,0.5-0.6,0.9-1.1,1c-0.5,0.1-1,0-1.4-0.4c-1.9-1.8-4.2-2.8-6.6-2.9c-1.8-0.1-3.5,0.4-4.8,1.3 c4.8,5.5,3.6,11.4,3.5,11.7c-0.1,0.5-0.5,1-1,1.1c-0.5,0.2-1.1,0-1.5-0.3c-3.4-3.2-8.2-3.8-11.5-1.5c4.4,5.4,4,10.8,4,11.1 c-0.1,0.6-0.4,1.1-1,1.3c-0.5,0.2-1.1,0.1-1.6-0.3c-3.4-3.2-8.2-3.8-11.4-1.6c4.4,5.1,4.4,10.2,4.4,10.5c0,0.6-0.4,1.1-0.9,1.4 c-0.2,0.1-0.4,0.1-0.6,0.1c-0.4,0-0.8-0.1-1-0.4c-1.9-1.8-4.2-2.8-6.6-2.9c-2.3-0.1-4.4,0.7-5.9,2.3c-0.6,0.6-1.5,0.6-2.1,0 c-0.6-0.6-0.6-1.5,0-2.1c2.1-2.2,5-3.3,8.2-3.2c1.8,0.1,3.6,0.6,5.3,1.4c-0.6-1.8-1.8-4-3.9-6.1c-0.6-0.6-0.6-1.5,0-2.1 c3.5-3.7,9.2-4.1,13.9-1.6c-0.5-1.9-1.5-4.4-3.9-6.8c-0.6-0.6-0.6-1.5,0-2.1c3.6-3.8,9.5-4.2,14.3-1.3c-0.2-2-1.1-4.8-3.8-7.4 c-0.6-0.6-0.6-1.5,0-2.1c2.1-2.2,5-3.3,8.2-3.2c2.1,0.1,4.3,0.7,6.1,1.9C68,30.3,67,27.8,64.1,25c-0.6-0.6-0.6-1.5-0.1-2.1 c2.1-2.2,5-3.3,8.2-3.2c3.1,0.1,6.2,1.5,8.5,3.7C81.4,24,81.4,24.9,80.8,25.5z"></path></g></svg></g></g></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

View File

@ -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(/&gt;/g, '>');
element.onclick = () => new Function(code)();
});

View File

@ -1,4 +1,2 @@
User-agent: *
Disallow:
Sitemap: https://frankfurter.app/sitemap.xml.gz
Disallow: /

Binary file not shown.

View File

@ -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;
}

View File

@ -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

View File

@ -1,100 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Frankfurter is a free and open source API for currency conversion and historical exchange rates.">
<title>Foreign exchange rates and currency conversion API | Frankfurter</title>
<link rel="canonical" href="https://frankfurter.app/">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/solarized-dark.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.3.1/css/all.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Open+Sans">
<link rel="stylesheet" href="/stylesheets/application.css">
<link rel="shortcut icon" href="/images/frankfurter.png">
<% if ENV['GA_TRACKING_ID'] %>
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-36475354-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<%= ENV['GA_TRACKING_ID'] %>');
</script>
<% end %>
</head>
<body>
<nav class="navbar navbar-expand">
<div class="container">
<ul class="navbar-nav mx-auto">
<li class="nav-item">
<a class="nav-link" href="https://github.com/hakanensari/frankfurter" target="_blank">
<i class="fab fa-github fa-fw fa-lg"></i><span class="d-none d-sm-inline">Source</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://hub.docker.com/r/hakanensari/frankfurter/" target="_blank">
<i class="fab fa-docker fa-fw fa-lg"></i><span class="d-none d-sm-inline">Image</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://www.ecb.europa.eu/stats/exchange/eurofxref/html/index.en.html" target="_blank">
<i class="fas fa-file-alt fa-fw fa-lg"></i><span class="d-none d-sm-inline">Data sets</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://status.frankfurter.app/" target="_blank">
<i class="fas fa-signature fa-fw fa-lg"></i><span class="d-none d-sm-inline">Status</span>
</a>
</li>
</ul>
</div>
</nav>
<header class="header container">
<div class="logo">
<image src="/images/frankfurter.png" alt="">
</div>
<h1>Frankfurter</h1>
<h2>Foreign exchange (forex) rates and currency conversion API</h2>
<a href="https://heroku.com/deploy?template=https://github.com/hakanensari/frankfurter" target="_blank">
<button type="button" class="btn btn-ssm"><i class="fas fa-arrow-circle-up fa-fw"></i> <strong>Deploy</strong> to Heroku</span></button>
</a>
</header>
<div class="content container">
<%= content %>
</div>
<footer class="footer container">
<p class="small">
<i class="far fa-heart"></i> Frankfurter 2012-<%= Date.today.year %>
</p>
</footer>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
<script type="text/javascript" src="/javascripts/application.js"></script>
<% if ENV['GA_TRACKING_ID'] %>
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
"palette": {
"popup": {
"background": "#d94f33"
},
"button": {
"background": "#8f1911"
}
},
"content": {
"message": "This site uses cookies for analytics. By continuing to browse this site, you agree to this use."
}
})});
</script>
<% end %>
</body>
</html>

View File

@ -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