deelay 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/deelay.rb +2 -1
- data/lib/deelay/app.rb +14 -0
- data/lib/deelay/delay.rb +13 -0
- data/lib/deelay/homepage.rb +0 -0
- data/lib/deelay/version.rb +1 -1
- data/spec/deelay_app_spec.rb +2 -2
- metadata +10 -3
- data/lib/deelay/deelay_app.rb +0 -22
data/lib/deelay.rb
CHANGED
data/lib/deelay/app.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require_relative "delay.rb"
|
2
|
+
require "sinatra"
|
3
|
+
|
4
|
+
module Deelay
|
5
|
+
class App < Sinatra::Base
|
6
|
+
get '/:delay' do
|
7
|
+
redirect Deelay.delay(params[:delay], request.query_string)
|
8
|
+
end
|
9
|
+
|
10
|
+
error do
|
11
|
+
redirect "#{Deelay::HOMEPAGE}/error"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/deelay/delay.rb
ADDED
data/lib/deelay/homepage.rb
CHANGED
File without changes
|
data/lib/deelay/version.rb
CHANGED
data/spec/deelay_app_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deelay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -42,7 +42,8 @@ files:
|
|
42
42
|
- bin/deelay
|
43
43
|
- deelay.gemspec
|
44
44
|
- lib/deelay.rb
|
45
|
-
- lib/deelay/
|
45
|
+
- lib/deelay/app.rb
|
46
|
+
- lib/deelay/delay.rb
|
46
47
|
- lib/deelay/homepage.rb
|
47
48
|
- lib/deelay/version.rb
|
48
49
|
- spec/deelay_app_spec.rb
|
@@ -58,12 +59,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
59
|
- - ! '>='
|
59
60
|
- !ruby/object:Gem::Version
|
60
61
|
version: '0'
|
62
|
+
segments:
|
63
|
+
- 0
|
64
|
+
hash: -1122285937117374849
|
61
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
66
|
none: false
|
63
67
|
requirements:
|
64
68
|
- - ! '>='
|
65
69
|
- !ruby/object:Gem::Version
|
66
70
|
version: '0'
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
hash: -1122285937117374849
|
67
74
|
requirements: []
|
68
75
|
rubyforge_project: deelay
|
69
76
|
rubygems_version: 1.8.24
|
data/lib/deelay/deelay_app.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require "sinatra"
|
2
|
-
require "uri"
|
3
|
-
|
4
|
-
module Deelay
|
5
|
-
class DeelayApp < Sinatra::Base
|
6
|
-
|
7
|
-
get '/:delay' do
|
8
|
-
delay = params[:delay].to_i
|
9
|
-
url = URI.unescape(request.query_string)
|
10
|
-
|
11
|
-
raise "Invalid URL" if (URI::regexp =~ url).nil?
|
12
|
-
|
13
|
-
sleep(delay / 1000)
|
14
|
-
redirect url
|
15
|
-
end
|
16
|
-
|
17
|
-
error do
|
18
|
-
redirect "#{Deelay::HOMEPAGE}/error"
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|