Skip to content

Commit

Permalink
Remove version from API
Browse files Browse the repository at this point in the history
  • Loading branch information
epistrephein committed Jun 10, 2023
1 parent 86dee76 commit 02a7be4
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 42 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,6 @@ $ curl -s https://rubies.io/api/last_update | jq
}
```

[`/version`](https://rubies.io/api/version) - returns the version of the API. It's the same value of the latest tag of the GitHub repo.

```bash
$ curl -s https://rubies.io/api/version | jq
{
"version": "2.2.1"
}
```

### Errors

Invalid requests return a `404` status with no body.
Expand Down
4 changes: 0 additions & 4 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ class Rubies < Sinatra::Base
set :root, File.dirname(settings.app_file)
set :public_folder, File.join(settings.root, 'public')

before do
@version = REDIS.get('__version')
end

get '/' do
@normal = REDIS.lrange('__normal', 0, -1)
@security = REDIS.lrange('__security', 0, -1)
Expand Down
6 changes: 0 additions & 6 deletions lib/version.rb

This file was deleted.

12 changes: 0 additions & 12 deletions spec/app_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,6 @@
end
end

describe 'version endpoint' do
let(:endpoint) { '/api/version' }

it 'returns the API version' do
get endpoint

expect(json).to eq({
'version' => '2.2.1'
})
end
end

describe 'last update endpoint' do
let(:endpoint) { '/api/last_update' }

Expand Down
3 changes: 0 additions & 3 deletions spec/fixtures/redis.json
Original file line number Diff line number Diff line change
Expand Up @@ -1343,9 +1343,6 @@
"latest": false,
"prerelease": false
},
"version": {
"version": "2.2.1"
},
"last_update": {
"last_update": "2020-10-24 07:30:00 +0000"
}
Expand Down
1 change: 0 additions & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
require_relative '../lib/remote'
require_relative '../lib/branch'
require_relative '../lib/release'
require_relative '../lib/version'
require_relative '../app'

ENV['RACK_ENV'] = 'test'
Expand Down
5 changes: 1 addition & 4 deletions tasks/redis.rake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ require 'redis'
require_relative '../lib/remote'
require_relative '../lib/branch'
require_relative '../lib/release'
require_relative '../lib/version'

REDIS ||= Redis.new(url: ENV['REDIS_URL'])

Expand All @@ -32,16 +31,14 @@ namespace :redis do
REDIS.set('__branches_sha', Branch.sha)
REDIS.set('__releases_sha', Release.sha)

REDIS.set('__version', VERSION_FULL)
REDIS.set('__last_update', last_update)

# API endpoints
Branch.hashmap_statuses.each { |key, attr| REDIS.set(key, attr.to_json) }
Branch.hashmap_branches.each { |key, attr| REDIS.set(key, attr.to_json) }
Release.hashmap_releases.each { |key, attr| REDIS.set(key, attr.to_json) }

REDIS.set('version', { version: VERSION_FULL }.to_json)
REDIS.set('last_update', { last_update: last_update }.to_json)
REDIS.set('last_update', { last_update: last_update }.to_json)

puts "#{last_update}: Redis OK (#{REDIS.dbsize})"
end
Expand Down
4 changes: 1 addition & 3 deletions views/layout.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@
<footer class="footer mt-auto py-3 text-center">
<div class="container">
<span class="small text-muted">
rubies.io &middot;
v<%= @version %> &middot;
<a href="https://github.com/epistrephein/rubies" title="GitHub">github</a> &middot;
<a href="https://status.rubies.io" title="Status">status</a><br>
<p class="small mt-2 mb-1">We do not use cookies or collect any personal data.</p>
<p class="small mt-1 mb-1">We do not use cookies or collect any personal data.</p>
</span>
</div>
</footer>
Expand Down

0 comments on commit 02a7be4

Please sign in to comment.