deelay 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/Gemfile +6 -0
- data/README.md +2 -0
- data/Rakefile +6 -0
- data/config.ru +3 -0
- data/deelay.gemspec +0 -1
- data/lib/deelay.rb +1 -1
- data/lib/deelay/app.rb +6 -5
- data/lib/deelay/{delay.rb → parse.rb} +1 -4
- data/lib/deelay/version.rb +1 -1
- metadata +8 -6
data/.travis.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
language: ruby
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
data/config.ru
ADDED
data/deelay.gemspec
CHANGED
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
# specify any dependencies here; for example:
|
23
22
|
s.add_development_dependency "rake"
|
24
23
|
# s.add_runtime_dependency "rest-client"
|
25
24
|
end
|
data/lib/deelay.rb
CHANGED
data/lib/deelay/app.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
-
|
2
|
-
require "sinatra"
|
1
|
+
require "sinatra/async"
|
3
2
|
|
4
3
|
module Deelay
|
5
4
|
class App < Sinatra::Base
|
5
|
+
register Sinatra::Async
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
aget '/:delay' do |delay|
|
8
|
+
EM.add_timer(delay.to_i/1000) do
|
9
|
+
async_schedule { redirect Deelay.parse(request.query_string) }
|
10
|
+
end
|
9
11
|
end
|
10
|
-
|
11
12
|
end
|
12
13
|
end
|
@@ -1,13 +1,10 @@
|
|
1
1
|
require "uri"
|
2
2
|
|
3
3
|
module Deelay
|
4
|
-
def self.
|
5
|
-
sleep_time = delay.to_i
|
4
|
+
def self.parse(url)
|
6
5
|
resource_url = URI.unescape(url)
|
7
|
-
|
8
6
|
raise "Invalid URL" if (URI::regexp =~ resource_url).nil?
|
9
7
|
|
10
|
-
sleep(sleep_time / 1000)
|
11
8
|
return resource_url
|
12
9
|
end
|
13
10
|
end
|
data/lib/deelay/version.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.
|
4
|
+
version: 0.3.0
|
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: 2013-
|
12
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -36,15 +36,17 @@ extensions: []
|
|
36
36
|
extra_rdoc_files: []
|
37
37
|
files:
|
38
38
|
- .gitignore
|
39
|
+
- .travis.yml
|
39
40
|
- Gemfile
|
40
41
|
- README.md
|
41
42
|
- Rakefile
|
42
43
|
- bin/deelay
|
44
|
+
- config.ru
|
43
45
|
- deelay.gemspec
|
44
46
|
- lib/deelay.rb
|
45
47
|
- lib/deelay/app.rb
|
46
|
-
- lib/deelay/delay.rb
|
47
48
|
- lib/deelay/homepage.rb
|
49
|
+
- lib/deelay/parse.rb
|
48
50
|
- lib/deelay/version.rb
|
49
51
|
- spec/deelay_app_spec.rb
|
50
52
|
homepage: http://deelay.me
|
@@ -61,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
61
63
|
version: '0'
|
62
64
|
segments:
|
63
65
|
- 0
|
64
|
-
hash:
|
66
|
+
hash: 3755310507841361791
|
65
67
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
68
|
none: false
|
67
69
|
requirements:
|
@@ -70,10 +72,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
72
|
version: '0'
|
71
73
|
segments:
|
72
74
|
- 0
|
73
|
-
hash:
|
75
|
+
hash: 3755310507841361791
|
74
76
|
requirements: []
|
75
77
|
rubyforge_project: deelay
|
76
|
-
rubygems_version: 1.8.
|
78
|
+
rubygems_version: 1.8.25
|
77
79
|
signing_key:
|
78
80
|
specification_version: 3
|
79
81
|
summary: Delay proxy
|