deflectable 0.2.4 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bd528df2e6f5e896503ba33641cae09e9b68c02
4
- data.tar.gz: 924d024b46dc02b5fede00e21ecb929d55c4a1bd
3
+ metadata.gz: 31fc88c369571805b7f60abcf04e748a3ae02d55
4
+ data.tar.gz: 460b80af74858b9b19d7c6e286231b7df1de9e85
5
5
  SHA512:
6
- metadata.gz: 11ea528553e799a83b4e6f0c302c198b068cab1c3c9e3703d76a93657713dca34ed6b842ee3c984e07d4f56c9d7e8045a708b74ad59cf754ef4d6b1a766a714d
7
- data.tar.gz: 717c2eff3fee2382ed0353c7bcdee223dbced0595a5e0d8ca926e0c2fd92653d3d61e7d10e428739832042d58dea5d91291c5a29b227c153b76cc04144771170
6
+ metadata.gz: 174d85bef6a21be23f48aab6361a01e39507ab913ccb2685ce6fadc99553e4712dc886e747569069fefb102170ed9e9eee58c4c46fc73deb435ab2a1aac163de
7
+ data.tar.gz: 44c2a299a3ad2613f05f3234b60e0b83c46fe515038e2313b62e4dd2d8e6cf77f8c4b51d239e539dda43cbe85da9f266f89515758ece99f34476558dd9407f1f
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # deflectable
2
2
 
3
- RailsアプリにIP制限 (ブランクリスト、ホワイトリスト)を適用
3
+ RailsアプリにIP制限 (ブラックリスト、ホワイトリスト)を適用
4
4
 
5
5
  ## Installation
6
6
 
@@ -22,21 +22,18 @@ Or install it yourself as:
22
22
  ### Configure
23
23
 
24
24
  ```bash
25
- # TODO:
26
- # Not Yet implement
27
25
  $ rails generate deflectable:install
28
26
  ```
29
27
 
30
- ### Prepare 403.html
31
-
32
- In public/403.html
28
+ * generated 'config/deflectable.yml'
29
+ * generated 'public/403.html'
33
30
 
34
31
  ### Modified config.ru
35
32
 
36
33
  ```ruby
37
34
  # config.ru
38
35
 
39
- usaue Deflectable::Watcher
36
+ use Deflectable::Watcher
40
37
  ```
41
38
 
42
39
 
@@ -1,7 +1,7 @@
1
1
  module Deflectable
2
2
  major = 0
3
- minore = 2
4
- patch = 4
3
+ minore = 3
4
+ patch = 1
5
5
 
6
6
  VERSION = [major, minore, patch].join('.')
7
7
  end
@@ -43,7 +43,7 @@ There was both a :blanklist and :whitelist.
43
43
 
44
44
  def set_rails_configure!
45
45
  return unless defined?(Rails)
46
- conf = YAML.load_file(Rails.root.join('config/deflect.yml'))
46
+ conf = YAML.load_file(Rails.root.join('config/deflectable.yml'))
47
47
  self.options = options.merge(conf).merge(:logger => Rails.logger)
48
48
  rescue => e
49
49
  log e.message
@@ -0,0 +1,13 @@
1
+ module Deflectable::Generators
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def copy_config_yaml
6
+ template "deflectable.yml", "config/deflectable.yml"
7
+ end
8
+
9
+ def copy_forbidden_page
10
+ template "403.html", "public/403.html"
11
+ end
12
+ end
13
+ end if defined?(Rails)
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Access forbidden</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/403.html -->
52
+ <div class="dialog">
53
+ <h1>Sorry...</h1>
54
+ <p>You did not have access to this site.</p>
55
+ </div>
56
+ </body>
57
+ </html>
@@ -0,0 +1,7 @@
1
+ # :log: true # default: false
2
+ # :whitelist:
3
+ # - '127.0.0.1'
4
+ # - '10.20.30.40'
5
+ # :blacklist:
6
+ # - '12.12.12.12'
7
+ # - '90.80.70.60'
@@ -0,0 +1,7 @@
1
+ # :log: true # default: false
2
+ # :whitelist:
3
+ # - '127.0.0.1'
4
+ # - '10.20.30.40'
5
+ # :blacklist:
6
+ # - '12.12.12.12'
7
+ # - '90.80.70.60'
@@ -1,7 +1,7 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>403</title>
4
+ <title>Access forbidden</title>
5
5
  <style>
6
6
  body {
7
7
  background-color: #EFEFEF;
@@ -48,11 +48,10 @@
48
48
  </head>
49
49
 
50
50
  <body>
51
- <!-- This file lives in public/404.html -->
51
+ <!-- This file lives in public/403.html -->
52
52
  <div class="dialog">
53
- <h1>403</h1>
54
- <p>You may have mistyped the address or the page may have moved.</p>
53
+ <h1>Sorry...</h1>
54
+ <p>You did not have access to this site.</p>
55
55
  </div>
56
- <p>If you are the application owner check the logs for more information.</p>
57
56
  </body>
58
57
  </html>
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.2.4
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Naohiro Sakuma
@@ -90,6 +90,9 @@ files:
90
90
  - lib/deflectable/version.rb
91
91
  - lib/deflectable/watcher.rb
92
92
  - lib/deflectable.rb
93
+ - lib/generators/deflectable/install_generator.rb
94
+ - lib/generators/deflectable/templates/403.html
95
+ - lib/generators/deflectable/templates/deflectable.yml
93
96
  - lib/tasks/deflectable_tasks.rake
94
97
  - MIT-LICENSE
95
98
  - Rakefile
@@ -110,6 +113,7 @@ files:
110
113
  - test/dummy/config/boot.rb
111
114
  - test/dummy/config/database.yml
112
115
  - test/dummy/config/deflect.yml
116
+ - test/dummy/config/deflectable.yml
113
117
  - test/dummy/config/environment.rb
114
118
  - test/dummy/config/environments/development.rb
115
119
  - test/dummy/config/environments/production.rb
@@ -189,6 +193,7 @@ test_files:
189
193
  - test/dummy/config/boot.rb
190
194
  - test/dummy/config/database.yml
191
195
  - test/dummy/config/deflect.yml
196
+ - test/dummy/config/deflectable.yml
192
197
  - test/dummy/config/environment.rb
193
198
  - test/dummy/config/environments/development.rb
194
199
  - test/dummy/config/environments/production.rb