deelay 0.2.9 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1 @@
1
+ language: ruby
data/Gemfile CHANGED
@@ -3,6 +3,12 @@ source "http://rubygems.org"
3
3
  # Specify your gem's dependencies in deelay.gemspec
4
4
  gemspec
5
5
  gem 'sinatra', "~>1.3.3"
6
+ gem 'thin'
7
+ gem 'async_sinatra'
8
+
9
+ group :development do
10
+ gem 'shotgun'
11
+ end
6
12
 
7
13
  group :test do
8
14
  gem "rack-test"
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/biesiad/deelay.png)](https://travis-ci.org/biesiad/deelay)
2
+
1
3
  # [Deelay.me](http://deelay.me)
2
4
 
3
5
  **Inline delay proxy for http resources**
data/Rakefile CHANGED
@@ -1 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run specs"
5
+ RSpec::Core::RakeTask.new
6
+
7
+ task :default => :spec
@@ -0,0 +1,3 @@
1
+ require File.expand_path('lib/deelay.rb')
2
+
3
+ Deelay::App.run!
@@ -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
@@ -1,4 +1,4 @@
1
1
  require "deelay/version"
2
2
  require "deelay/homepage"
3
- require "deelay/delay"
3
+ require "deelay/parse"
4
4
  require "deelay/app"
@@ -1,12 +1,13 @@
1
- require_relative "delay.rb"
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
- get '/:delay' do
8
- redirect Deelay.delay(params[:delay], request.query_string)
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.delay(delay, url)
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
@@ -1,3 +1,3 @@
1
1
  module Deelay
2
- VERSION = "0.2.9"
2
+ VERSION = "0.3.0"
3
3
  end
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.9
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-02-28 00:00:00.000000000 Z
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: -3864599460253073164
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: -3864599460253073164
75
+ hash: 3755310507841361791
74
76
  requirements: []
75
77
  rubyforge_project: deelay
76
- rubygems_version: 1.8.24
78
+ rubygems_version: 1.8.25
77
79
  signing_key:
78
80
  specification_version: 3
79
81
  summary: Delay proxy