forked from e621ng/e621ng
[Cleanup] Remove mock services
This commit is contained in:
parent
5c215ea154
commit
326bf9594f
4
Gemfile
4
Gemfile
@ -51,10 +51,6 @@ group :production do
|
||||
gem 'newrelic_rpm'
|
||||
end
|
||||
|
||||
group :development do
|
||||
gem 'sinatra'
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
gem 'awesome_print'
|
||||
gem 'pry-byebug'
|
||||
|
11
Gemfile.lock
11
Gemfile.lock
@ -208,8 +208,6 @@ GEM
|
||||
multi_json (1.15.0)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.1.1)
|
||||
mustermann (1.1.1)
|
||||
ruby2_keywords (~> 0.0.1)
|
||||
netrc (0.11.0)
|
||||
newrelic_rpm (8.2.0)
|
||||
nio4r (2.5.8)
|
||||
@ -229,8 +227,6 @@ GEM
|
||||
public_suffix (4.0.6)
|
||||
racc (1.6.0)
|
||||
rack (2.2.3)
|
||||
rack-protection (2.2.0)
|
||||
rack
|
||||
rack-proxy (0.7.0)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
@ -316,11 +312,6 @@ GEM
|
||||
simplecov_json_formatter (~> 0.1)
|
||||
simplecov-html (0.12.3)
|
||||
simplecov_json_formatter (0.1.3)
|
||||
sinatra (2.2.0)
|
||||
mustermann (~> 1.0)
|
||||
rack (~> 2.2)
|
||||
rack-protection (= 2.2.0)
|
||||
tilt (~> 2.0)
|
||||
sprockets (4.0.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
@ -331,7 +322,6 @@ GEM
|
||||
streamio-ffmpeg (3.0.2)
|
||||
multi_json (~> 1.8)
|
||||
thor (1.2.1)
|
||||
tilt (2.0.10)
|
||||
timecop (0.9.4)
|
||||
tzinfo (2.0.4)
|
||||
concurrent-ruby (~> 1.0)
|
||||
@ -409,7 +399,6 @@ DEPENDENCIES
|
||||
sidekiq-unique-jobs
|
||||
simple_form
|
||||
simplecov
|
||||
sinatra
|
||||
streamio-ffmpeg
|
||||
timecop
|
||||
unicorn
|
||||
|
@ -1,4 +0,0 @@
|
||||
These are mocked services to be used for development purposes.
|
||||
|
||||
- danbooru: port 3000
|
||||
- iqdbs: port 3002
|
@ -1,14 +0,0 @@
|
||||
require 'sinatra'
|
||||
require 'json'
|
||||
require_relative './mock_service_helper'
|
||||
|
||||
set :port, 3002
|
||||
|
||||
configure do
|
||||
POST_IDS = MockServiceHelper.fetch_post_ids()
|
||||
end
|
||||
|
||||
get '/similar' do
|
||||
content_type :json
|
||||
POST_IDS[0..10].map {|x| {post_id: x}}.to_json
|
||||
end
|
@ -1,22 +0,0 @@
|
||||
require 'socket'
|
||||
require 'timeout'
|
||||
require 'httparty'
|
||||
|
||||
module MockServiceHelper
|
||||
extend self
|
||||
|
||||
DANBOORU_PORT = 3000
|
||||
|
||||
def fetch_post_ids()
|
||||
begin
|
||||
s = TCPSocket.new("localhost", DANBOORU_PORT)
|
||||
s.close
|
||||
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
|
||||
sleep 1
|
||||
retry
|
||||
end
|
||||
|
||||
json = HTTParty.get("http://localhost:#{DANBOORU_PORT}/posts.json?random=true&limit=10").body
|
||||
return JSON.parse(json).map {|x| x["id"]}
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user