deflectable 0.1.0 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/lib/deflectable/version.rb +5 -1
  3. data/lib/deflectable/watcher.rb +61 -64
  4. data/test/dummy/config/deflect.yml +3 -3
  5. data/test/dummy/config/routes.rb +2 -2
  6. data/test/dummy/config.ru +4 -0
  7. data/test/dummy/db/development.sqlite3 +0 -0
  8. data/test/dummy/db/schema.rb +16 -0
  9. data/test/dummy/db/test.sqlite3 +0 -0
  10. data/test/dummy/log/development.log +250 -44
  11. data/test/dummy/log/test.log +16 -35
  12. data/test/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  13. data/test/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  14. data/test/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  15. data/test/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  16. data/test/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  17. data/test/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  18. data/test/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  19. data/test/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  20. data/test/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  21. data/test/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  22. data/test/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  23. data/test/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  24. metadata +51 -9
  25. data/test/acceptable_test.rb +0 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7f7634fbfb7036178b5e4da6ce6b3072403b0d6
4
- data.tar.gz: 5b1794dc341d97da15bd232c11046e04a52eda39
3
+ metadata.gz: 3bd528df2e6f5e896503ba33641cae09e9b68c02
4
+ data.tar.gz: 924d024b46dc02b5fede00e21ecb929d55c4a1bd
5
5
  SHA512:
6
- metadata.gz: 82a16effdbde0592d9de5d3ffb49684babdaebe4c7be9245d4d647ea7575b7cf0a66cfd603f37991d6bfbd25a4aa67f37b27296d1eac1a6c0e9591a0618d161d
7
- data.tar.gz: 42579f8d9d78a1b7125621af6db6fcddbc73d2809f0fc6b9124c88647f86269975af0cc9172767b5d49576bf099b7eb72775e73e07f7ce6b0aaefabe92e37172
6
+ metadata.gz: 11ea528553e799a83b4e6f0c302c198b068cab1c3c9e3703d76a93657713dca34ed6b842ee3c984e07d4f56c9d7e8045a708b74ad59cf754ef4d6b1a766a714d
7
+ data.tar.gz: 717c2eff3fee2382ed0353c7bcdee223dbced0595a5e0d8ca926e0c2fd92653d3d61e7d10e428739832042d58dea5d91291c5a29b227c153b76cc04144771170
@@ -1,3 +1,7 @@
1
1
  module Deflectable
2
- VERSION = "0.1.0"
2
+ major = 0
3
+ minore = 2
4
+ patch = 4
5
+
6
+ VERSION = [major, minore, patch].join('.')
3
7
  end
@@ -1,101 +1,98 @@
1
- require 'thread'
2
-
1
+ require 'logger'
3
2
  module Deflectable
4
3
  class Watcher
5
4
  attr_accessor :options
6
5
 
7
- def initialize(app, options = {})
8
- @mutex = Mutex.new
6
+ def initialize(app, build_options = {})
9
7
  @app = app
10
- conf = YAML.load_file(Rails.root.join('config/deflect.yml')) rescue {}
8
+ @filtering = nil
11
9
  @options = {
12
- :log => true,
10
+ :log => false,
11
+ :logger => nil,
13
12
  :log_format => 'deflect(%s): %s',
14
13
  :log_date_format => '%m/%d/%Y',
15
- :request_threshold => 100,
16
- :interval => 5,
17
- :block_duration => 900,
18
14
  :whitelist => [],
19
15
  :blacklist => [],
20
- }.merge(conf)
16
+ }.merge(build_options)
17
+ configure_check!
21
18
  end
22
19
 
23
20
  def call(env)
24
- return reject! if detect?(env)
21
+ return reject!(env) if detect?(env)
25
22
  status, headers, body = @app.call(env)
26
23
  [status, headers, body]
27
24
  end
28
25
 
29
- def reject!
30
- res = Rack::Response.new do |r|
31
- r.status = 403
32
- r['Content-Type'] = 'text/html;charset=utf-8'
33
- r.write File.read(Rails.root.join('public/403.html'))
34
- end
35
- res.finish
36
- end
37
26
 
38
- def detect?(env)
39
- @remote_addr = env['REMOTE_ADDR']
40
- return false if options[:whitelist].include? @remote_addr
41
- return true if options[:blacklist].include? @remote_addr
42
- @mutex.synchronize { watch }
43
- end
44
-
45
- def watch
46
- increment_requests
47
- clear! if watch_expired? and not blocked?
48
- clear! if blocked? and block_expired?
49
- block! if watching? and exceeded_request_threshold?
50
- blocked?
51
- end
52
-
53
- def map
54
- @remote_addr_map[@remote_addr] ||= {
55
- :expires => Time.now + options[:interval],
56
- :requests => 0
57
- }
58
- end
27
+ private
59
28
 
60
- def block!
61
- return if blocked?
62
- log "blocked #{@remote_addr}"
63
- map[:block_expires] = Time.now + options[:block_duration]
64
- end
65
-
66
- def blocked?
67
- map.has_key? :block_expires
29
+ def configure_check!
30
+ set_rails_configure!
31
+ if (not options[:whitelist].empty?) and (not options[:blacklist].empty?)
32
+ raise <<-EOS
33
+ There was both a :blanklist and :whitelist.
34
+ `Please select the :blacklist or :whitelist.'
35
+ EOS
36
+ end
37
+ @filtering = :whitelist unless options[:whitelist].empty?
38
+ @filtering = :blacklist unless options[:blacklist].empty?
39
+ unless options[:logger]
40
+ self.options[:logger] = Logger.new('deflecter.log')
41
+ end
68
42
  end
69
43
 
70
- def block_expired?
71
- map[:block_expires] < Time.now rescue false
44
+ def set_rails_configure!
45
+ return unless defined?(Rails)
46
+ conf = YAML.load_file(Rails.root.join('config/deflect.yml'))
47
+ self.options = options.merge(conf).merge(:logger => Rails.logger)
48
+ rescue => e
49
+ log e.message
72
50
  end
73
51
 
74
- def watching?
75
- @remote_addr_map.has_key? @remote_addr
52
+ def reject!(env)
53
+ res = Rack::Response.new do |r|
54
+ r.status = 403
55
+ r['Content-Type'] = 'text/html;charset=utf-8'
56
+ r.write error_content
57
+ end
58
+ log "Rejected(#{@filtering}): #{env['REMOTE_ADDR']}"
59
+ res.finish
76
60
  end
77
61
 
78
- def clear!
79
- return unless watching?
80
- log "released #{@remote_addr}" if blocked?
81
- @remote_addr_map.delete @remote_addr
62
+ def error_content
63
+ File.read(Rails.root.join('public/403.html'))
64
+ rescue
65
+ '<p>failed</p>'
82
66
  end
83
67
 
84
- def increment_requests
85
- map[:requests] += 1
68
+ def detect?(env)
69
+ case @filtering
70
+ when :whitelist
71
+ allowed?(env) ? false : true
72
+ when :blacklist
73
+ denied?(env)
74
+ else
75
+ false
76
+ end
86
77
  end
87
78
 
88
- def exceeded_request_threshold?
89
- map[:requests] > options[:request_threshold]
79
+ def allowed?(env)
80
+ return true if options[:whitelist].empty?
81
+ options[:whitelist].include?(env['REMOTE_ADDR']) ? true : false
90
82
  end
91
83
 
92
- def watch_expired?
93
- map[:expires] <= Time.now
84
+ def denied?(env)
85
+ return false if options[:blacklist].empty?
86
+ options[:blacklist].include?(env['REMOTE_ADDR']) ? true : false
94
87
  end
95
88
 
96
- def log message
89
+ def log(message, level = :info)
97
90
  return unless options[:log]
98
- options[:log].puts(options[:log_format] % [Time.now.strftime(options[:log_date_format]), message])
91
+ if logger = options[:logger]
92
+ logger.send(level, message)
93
+ else
94
+ STDOUT.puts(options[:log_format] % [Time.now.strftime(options[:log_date_format]), message])
95
+ end
99
96
  end
100
97
  end
101
98
  end
@@ -1,4 +1,4 @@
1
- # :whitelist:
2
- # - '127.0.0.1'
3
- :blacklist:
1
+ :whitelist:
4
2
  - '127.0.0.1'
3
+ # :blacklist:
4
+ # - '127.0.0.1'
@@ -3,7 +3,7 @@ Dummy::Application.routes.draw do
3
3
  # See how all your routes lay out with "rake routes".
4
4
 
5
5
  # You can have the root of your site routed with "root"
6
- # root 'welcome#index'
6
+ root 'welcome#index'
7
7
 
8
8
  # Example of regular route:
9
9
  # get 'products/:id' => 'catalog#view'
@@ -39,7 +39,7 @@ Dummy::Application.routes.draw do
39
39
  # get 'recent', on: :collection
40
40
  # end
41
41
  # end
42
-
42
+
43
43
  # Example resource route with concerns:
44
44
  # concern :toggleable do
45
45
  # post 'toggle'
data/test/dummy/config.ru CHANGED
@@ -1,4 +1,8 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
3
  require ::File.expand_path('../config/environment', __FILE__)
4
+ require 'deflectable'
5
+
6
+ use Deflectable::Watcher
7
+
4
8
  run Rails.application
Binary file
@@ -0,0 +1,16 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 0) do
15
+
16
+ end
Binary file
@@ -1,108 +1,314 @@
1
1
 
2
2
 
3
- Started GET "/" for 127.0.0.1 at 2013-09-24 23:00:33 +0900
3
+ Started GET "/" for 127.0.0.1 at 2013-09-25 18:30:06 +0900
4
+
5
+ SQLite3::CantOpenException (unable to open database file):
6
+ activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `initialize'
7
+ activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `new'
8
+ activerecord (4.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:24:in `sqlite3_connection'
9
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:440:in `new_connection'
10
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:450:in `checkout_new_connection'
11
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:421:in `acquire_connection'
12
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:356:in `block in checkout'
13
+ /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
14
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:355:in `checkout'
15
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `block in connection'
16
+ /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
17
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `connection'
18
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:546:in `retrieve_connection'
19
+ activerecord (4.0.0) lib/active_record/connection_handling.rb:79:in `retrieve_connection'
20
+ activerecord (4.0.0) lib/active_record/connection_handling.rb:53:in `connection'
21
+ activerecord (4.0.0) lib/active_record/query_cache.rb:51:in `restore_query_cache_settings'
22
+ activerecord (4.0.0) lib/active_record/query_cache.rb:43:in `rescue in call'
23
+ activerecord (4.0.0) lib/active_record/query_cache.rb:32:in `call'
24
+ activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
25
+ activerecord (4.0.0) lib/active_record/migration.rb:369:in `call'
26
+ actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
27
+ activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__1688254131637688522__call__callbacks'
28
+ activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
29
+ actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
30
+ actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
31
+ actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
32
+ actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
33
+ actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
34
+ railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
35
+ railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
36
+ activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
37
+ activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
38
+ activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
39
+ railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
40
+ actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
41
+ rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
42
+ rack (1.5.2) lib/rack/runtime.rb:17:in `call'
43
+ activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
44
+ rack (1.5.2) lib/rack/lock.rb:17:in `call'
45
+ actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
46
+ railties (4.0.0) lib/rails/engine.rb:511:in `call'
47
+ railties (4.0.0) lib/rails/application.rb:97:in `call'
48
+ /Users/sakuma/apps/libs/deflectable/lib/deflectable/watcher.rb:25:in `call'
49
+ rack (1.5.2) lib/rack/lock.rb:17:in `call'
50
+ rack (1.5.2) lib/rack/content_length.rb:14:in `call'
51
+ rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
52
+ /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
53
+ /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
54
+ /Users/sakuma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
55
+
56
+
57
+ Rendered /Users/sakuma/.rvm/gems/ruby-2.0.0-p247@deflectable/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_source.erb (0.4ms)
58
+ Rendered /Users/sakuma/.rvm/gems/ruby-2.0.0-p247@deflectable/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.8ms)
59
+ Rendered /Users/sakuma/.rvm/gems/ruby-2.0.0-p247@deflectable/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.7ms)
60
+ Rendered /Users/sakuma/.rvm/gems/ruby-2.0.0-p247@deflectable/gems/actionpack-4.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (11.6ms)
61
+  (2.4ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
62
+  (0.8ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
63
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
64
+
65
+
66
+ Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:04 +0900
4
67
  Processing by WelcomeController#index as HTML
5
68
  Rendered welcome/index.html.erb within layouts/application (0.8ms)
6
- Completed 200 OK in 27ms (Views: 26.3ms | ActiveRecord: 0.0ms)
69
+ Completed 200 OK in 54ms (Views: 54.0ms | ActiveRecord: 0.0ms)
7
70
 
8
71
 
9
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-24 23:00:34 +0900
72
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:05 +0900
10
73
 
11
74
 
12
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-24 23:00:34 +0900
75
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:05 +0900
13
76
 
14
77
 
15
- Started GET "/" for 127.0.0.1 at 2013-09-24 23:51:20 +0900
78
+ Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
16
79
  Processing by WelcomeController#index as HTML
17
- Rendered welcome/index.html.erb within layouts/application (17.0ms)
18
- Completed 200 OK in 41ms (Views: 40.6ms | ActiveRecord: 0.0ms)
80
+ Rendered welcome/index.html.erb within layouts/application (0.0ms)
81
+ Completed 200 OK in 3ms (Views: 3.0ms | ActiveRecord: 0.0ms)
19
82
 
20
83
 
21
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-24 23:51:20 +0900
84
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
22
85
 
23
86
 
24
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-24 23:51:20 +0900
87
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
25
88
 
26
89
 
27
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:26:37 +0900
90
+ Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
28
91
  Processing by WelcomeController#index as HTML
29
- Rendered welcome/index.html.erb within layouts/application (1.1ms)
30
- Completed 200 OK in 45ms (Views: 44.5ms | ActiveRecord: 0.0ms)
92
+ Rendered welcome/index.html.erb within layouts/application (0.0ms)
93
+ Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
94
+
95
+
96
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
97
+
98
+
99
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:13 +0900
31
100
 
32
101
 
33
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:30:07 +0900
102
+ Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
34
103
  Processing by WelcomeController#index as HTML
35
- Rendered welcome/index.html.erb within layouts/application (0.7ms)
36
- Completed 200 OK in 24ms (Views: 23.4ms | ActiveRecord: 0.0ms)
104
+ Rendered welcome/index.html.erb within layouts/application (0.0ms)
105
+ Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
106
+
107
+
108
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
109
+
110
+
111
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
37
112
 
38
113
 
39
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:32:49 +0900
114
+ Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
115
+ Processing by WelcomeController#index as HTML
116
+ Rendered welcome/index.html.erb within layouts/application (0.1ms)
117
+ Completed 200 OK in 3ms (Views: 2.7ms | ActiveRecord: 0.0ms)
118
+
119
+
120
+ Started GET "/" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
121
+ Processing by WelcomeController#index as HTML
122
+ Rendered welcome/index.html.erb within layouts/application (0.0ms)
123
+ Completed 200 OK in 2ms (Views: 1.9ms | ActiveRecord: 0.0ms)
124
+
125
+
126
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
127
+
128
+
129
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 22:57:14 +0900
130
+
131
+
132
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:35:51 +0900
40
133
  Processing by WelcomeController#index as HTML
41
134
  Rendered welcome/index.html.erb within layouts/application (0.8ms)
42
- Completed 200 OK in 24ms (Views: 23.7ms | ActiveRecord: 0.0ms)
135
+ Completed 200 OK in 25ms (Views: 24.6ms | ActiveRecord: 0.0ms)
136
+
137
+
138
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:35:51 +0900
43
139
 
44
140
 
45
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:39:33 +0900
141
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:35:51 +0900
142
+
143
+
144
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:36:39 +0900
46
145
  Processing by WelcomeController#index as HTML
47
- Rendered welcome/index.html.erb within layouts/application (0.7ms)
48
- Completed 200 OK in 23ms (Views: 23.0ms | ActiveRecord: 0.0ms)
146
+ Rendered welcome/index.html.erb within layouts/application (0.8ms)
147
+ Completed 200 OK in 25ms (Views: 24.3ms | ActiveRecord: 0.0ms)
148
+
149
+
150
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:36:39 +0900
151
+
49
152
 
153
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:36:39 +0900
50
154
 
51
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:46:32 +0900
155
+
156
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:36:43 +0900
52
157
  Processing by WelcomeController#index as HTML
53
- Rendered welcome/index.html.erb within layouts/application (0.7ms)
54
- Completed 200 OK in 24ms (Views: 23.5ms | ActiveRecord: 0.0ms)
158
+ Rendered welcome/index.html.erb within layouts/application (0.0ms)
159
+ Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
160
+
161
+
162
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:36:44 +0900
55
163
 
56
164
 
57
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:47:37 +0900
165
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:36:44 +0900
166
+
167
+
168
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:42:54 +0900
58
169
  Processing by WelcomeController#index as HTML
59
170
  Rendered welcome/index.html.erb within layouts/application (0.8ms)
60
- Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
171
+ Completed 200 OK in 25ms (Views: 24.2ms | ActiveRecord: 0.0ms)
172
+
173
+
174
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:42:54 +0900
61
175
 
62
176
 
63
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:48:19 +0900
177
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:42:54 +0900
178
+
179
+
180
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:45:45 +0900
64
181
  Processing by WelcomeController#index as HTML
65
182
  Rendered welcome/index.html.erb within layouts/application (0.7ms)
66
- Completed 200 OK in 24ms (Views: 23.8ms | ActiveRecord: 0.0ms)
183
+ Completed 200 OK in 25ms (Views: 24.3ms | ActiveRecord: 0.0ms)
184
+
67
185
 
186
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:45:45 +0900
68
187
 
69
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:49:49 +0900
188
+
189
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:45:45 +0900
190
+
191
+
192
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:47:41 +0900
70
193
  Processing by WelcomeController#index as HTML
71
- Rendered welcome/index.html.erb within layouts/application (0.7ms)
72
- Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
194
+ Rendered welcome/index.html.erb within layouts/application (0.9ms)
195
+ Completed 200 OK in 29ms (Views: 28.9ms | ActiveRecord: 0.0ms)
196
+
197
+
198
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:47:41 +0900
73
199
 
74
200
 
75
- Started GET "/" for 127.0.0.1 at 2013-09-25 09:50:53 +0900
201
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:47:41 +0900
202
+
203
+
204
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:48:09 +0900
76
205
  Processing by WelcomeController#index as HTML
77
- Rendered welcome/index.html.erb within layouts/application (0.7ms)
78
- Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
206
+ Rendered welcome/index.html.erb within layouts/application (0.8ms)
207
+ Completed 200 OK in 24ms (Views: 24.0ms | ActiveRecord: 0.0ms)
208
+
209
+
210
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:48:09 +0900
211
+
79
212
 
213
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:48:09 +0900
80
214
 
81
- Started GET "/" for 127.0.0.1 at 2013-09-25 10:26:22 +0900
215
+
216
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:49:31 +0900
217
+ Processing by WelcomeController#index as HTML
218
+ Rendered welcome/index.html.erb within layouts/application (0.8ms)
219
+ Completed 200 OK in 25ms (Views: 24.7ms | ActiveRecord: 0.0ms)
220
+
221
+
222
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:49:31 +0900
223
+
224
+
225
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:49:31 +0900
226
+
227
+
228
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:49:35 +0900
82
229
  Processing by WelcomeController#index as HTML
83
230
  Rendered welcome/index.html.erb within layouts/application (0.0ms)
84
- Completed 200 OK in 2ms (Views: 2.2ms | ActiveRecord: 0.0ms)
231
+ Completed 200 OK in 3ms (Views: 2.4ms | ActiveRecord: 0.0ms)
232
+
233
+
234
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:49:36 +0900
235
+
236
+
237
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:49:36 +0900
85
238
 
86
239
 
87
- Started GET "/" for 127.0.0.1 at 2013-09-25 10:32:29 +0900
240
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:55:23 +0900
88
241
  Processing by WelcomeController#index as HTML
89
- Rendered welcome/index.html.erb within layouts/application (0.7ms)
90
- Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
242
+ Rendered welcome/index.html.erb within layouts/application (1.5ms)
243
+ Completed 200 OK in 29ms (Views: 28.6ms | ActiveRecord: 0.0ms)
91
244
 
92
245
 
93
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 10:32:30 +0900
246
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:55:30 +0900
94
247
 
95
248
 
96
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 10:32:30 +0900
249
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:55:33 +0900
97
250
 
98
251
 
99
- Started GET "/" for 127.0.0.1 at 2013-09-25 10:33:11 +0900
252
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:55:52 +0900
100
253
  Processing by WelcomeController#index as HTML
101
254
  Rendered welcome/index.html.erb within layouts/application (0.8ms)
102
- Completed 200 OK in 24ms (Views: 23.6ms | ActiveRecord: 0.0ms)
255
+ Completed 200 OK in 25ms (Views: 24.5ms | ActiveRecord: 0.0ms)
256
+
257
+
258
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:55:53 +0900
259
+
260
+
261
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:55:53 +0900
262
+
263
+
264
+ Started GET "/" for 127.0.0.1 at 2013-09-26 00:56:17 +0900
265
+ Processing by WelcomeController#index as HTML
266
+ Rendered welcome/index.html.erb within layouts/application (0.8ms)
267
+ Completed 200 OK in 25ms (Views: 24.4ms | ActiveRecord: 0.0ms)
268
+
269
+
270
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 00:56:17 +0900
271
+
272
+
273
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 00:56:17 +0900
274
+
275
+
276
+ Started GET "/" for 127.0.0.1 at 2013-09-26 01:03:40 +0900
277
+ Processing by WelcomeController#index as HTML
278
+ Rendered welcome/index.html.erb within layouts/application (0.8ms)
279
+ Completed 200 OK in 24ms (Views: 24.0ms | ActiveRecord: 0.0ms)
280
+
281
+
282
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 01:03:40 +0900
283
+
284
+
285
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 01:03:40 +0900
286
+ Rejected(blacklist): 127.0.0.1
287
+ Rejected(blacklist): 127.0.0.1
288
+ Rejected(blacklist): 127.0.0.1
289
+ Rejected(blacklist): 127.0.0.1
290
+
291
+
292
+ Started GET "/" for 127.0.0.1 at 2013-09-26 01:17:52 +0900
293
+ Processing by WelcomeController#index as HTML
294
+ Rendered welcome/index.html.erb within layouts/application (0.8ms)
295
+ Completed 200 OK in 25ms (Views: 24.5ms | ActiveRecord: 0.0ms)
296
+
297
+
298
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 01:17:52 +0900
299
+
300
+
301
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 01:17:52 +0900
302
+ Rejected(whitelist): 127.0.0.1
303
+
304
+
305
+ Started GET "/" for 127.0.0.1 at 2013-09-26 01:20:16 +0900
306
+ Processing by WelcomeController#index as HTML
307
+ Rendered welcome/index.html.erb within layouts/application (1.0ms)
308
+ Completed 200 OK in 25ms (Views: 24.5ms | ActiveRecord: 0.0ms)
103
309
 
104
310
 
105
- Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-25 10:33:11 +0900
311
+ Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2013-09-26 01:20:17 +0900
106
312
 
107
313
 
108
- Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-25 10:33:11 +0900
314
+ Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2013-09-26 01:20:17 +0900
@@ -1,49 +1,30 @@
1
+  (2.7ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL) 
2
+  (1.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
+  (0.1ms) SELECT version FROM "schema_migrations"
4
+  (0.7ms) INSERT INTO "schema_migrations" (version) VALUES ('0')
5
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
1
6
   (0.2ms) begin transaction
2
- -------------------------------------
3
- AcceptableTest: test_should_get_index
4
- -------------------------------------
5
-  (0.0ms) rollback transaction
6
-  (0.0ms) begin transaction
7
- ---------------------------
8
- DeflectableTest: test_truth
9
- ---------------------------
10
-  (0.0ms) rollback transaction
11
-  (0.0ms) begin transaction
12
- --------------------------------------------
13
- WelcomeControllerTest: test_should_get_index
14
- --------------------------------------------
7
+ ----------------------------------------------------------
8
+ AcceptableTest: test_should_get_index_when_not_ip_controll
9
+ ----------------------------------------------------------
10
+ Started GET "/" for 127.0.0.1 at 2013-09-25 18:31:54 +0900
15
11
  Processing by WelcomeController#index as HTML
16
12
  Rendered welcome/index.html.erb within layouts/application (0.7ms)
17
- Completed 200 OK in 12ms (Views: 12.1ms | ActiveRecord: 0.0ms)
13
+ Completed 200 OK in 14ms (Views: 13.8ms | ActiveRecord: 0.0ms)
18
14
   (0.1ms) rollback transaction
19
-  (0.2ms) begin transaction
20
- -------------------------------------
21
- AcceptableTest: test_should_get_index
22
- -------------------------------------
23
-  (0.0ms) rollback transaction
24
15
   (0.0ms) begin transaction
25
16
  ---------------------------
26
17
  DeflectableTest: test_truth
27
18
  ---------------------------
28
19
   (0.0ms) rollback transaction
29
20
   (0.2ms) begin transaction
30
- -------------------------------------
31
- AcceptableTest: test_should_get_index
32
- -------------------------------------
33
-  (0.0ms) rollback transaction
34
-  (0.0ms) begin transaction
35
- ---------------------------
36
- DeflectableTest: test_truth
37
- ---------------------------
38
-  (0.0ms) rollback transaction
39
-  (0.2ms) begin transaction
40
- -------------------------------------
41
- AcceptableTest: test_should_get_index
42
- -------------------------------------
43
- Started GET "/" for 127.0.0.1 at 2013-09-24 23:17:55 +0900
21
+ ----------------------------------------------------------
22
+ AcceptableTest: test_should_get_index_when_not_ip_controll
23
+ ----------------------------------------------------------
24
+ Started GET "/" for 127.0.0.1 at 2013-09-25 19:13:16 +0900
44
25
  Processing by WelcomeController#index as HTML
45
- Rendered welcome/index.html.erb within layouts/application (0.9ms)
46
- Completed 200 OK in 26ms (Views: 25.5ms | ActiveRecord: 0.0ms)
26
+ Rendered welcome/index.html.erb within layouts/application (0.7ms)
27
+ Completed 200 OK in 12ms (Views: 12.0ms | ActiveRecord: 0.0ms)
47
28
   (0.1ms) rollback transaction
48
29
   (0.0ms) begin transaction
49
30
  ---------------------------
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deflectable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naohiro Sakuma
@@ -11,21 +11,21 @@ cert_chain: []
11
11
  date: 2013-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: rack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 0.9.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: 0.9.1
27
27
  - !ruby/object:Gem::Dependency
28
- name: sqlite3
28
+ name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '>='
@@ -38,6 +38,48 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>'
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>'
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '2'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rack-test
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>'
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>'
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
41
83
  description: Access controll by IP Address.
42
84
  email:
43
85
  - nao.bear@gmail.com
@@ -52,7 +94,6 @@ files:
52
94
  - MIT-LICENSE
53
95
  - Rakefile
54
96
  - README.md
55
- - test/acceptable_test.rb
56
97
  - test/deflectable_test.rb
57
98
  - test/dummy/app/assets/javascripts/application.js
58
99
  - test/dummy/app/assets/stylesheets/application.css
@@ -84,6 +125,7 @@ files:
84
125
  - test/dummy/config/routes.rb
85
126
  - test/dummy/config.ru
86
127
  - test/dummy/db/development.sqlite3
128
+ - test/dummy/db/schema.rb
87
129
  - test/dummy/db/test.sqlite3
88
130
  - test/dummy/log/development.log
89
131
  - test/dummy/log/test.log
@@ -131,7 +173,6 @@ signing_key:
131
173
  specification_version: 4
132
174
  summary: Access controll by IP Address.
133
175
  test_files:
134
- - test/acceptable_test.rb
135
176
  - test/deflectable_test.rb
136
177
  - test/dummy/app/assets/javascripts/application.js
137
178
  - test/dummy/app/assets/stylesheets/application.css
@@ -163,6 +204,7 @@ test_files:
163
204
  - test/dummy/config/routes.rb
164
205
  - test/dummy/config.ru
165
206
  - test/dummy/db/development.sqlite3
207
+ - test/dummy/db/schema.rb
166
208
  - test/dummy/db/test.sqlite3
167
209
  - test/dummy/log/development.log
168
210
  - test/dummy/log/test.log
@@ -1,8 +0,0 @@
1
- require 'test_helper'
2
-
3
- class AcceptableTest < ActionDispatch::IntegrationTest
4
- test "should get index when not ip controll" do
5
- get root_path
6
- assert_response :success
7
- end
8
- end