witch_doctor 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -2
  3. data/Rakefile +1 -0
  4. data/app/controllers/witch_doctor/virus_scans_controller.rb +13 -2
  5. data/app/models/virus_scan.rb +0 -3
  6. data/app/permiterters/virus_scan_permitter.rb +7 -0
  7. data/lib/witch_doctor/antivirus +0 -0
  8. data/lib/witch_doctor/antivirus_concern.rb +3 -1
  9. data/lib/witch_doctor/version.rb +1 -1
  10. data/spec/controllers/virus_scans_controller_spec.rb +4 -4
  11. data/spec/dummy/README.rdoc +15 -248
  12. data/spec/dummy/Rakefile +1 -2
  13. data/spec/dummy/app/assets/javascripts/application.js +3 -5
  14. data/spec/dummy/app/assets/stylesheets/application.css +5 -3
  15. data/spec/dummy/app/controllers/application_controller.rb +3 -1
  16. data/spec/dummy/app/views/layouts/application.html.erb +2 -2
  17. data/spec/dummy/bin/bundle +3 -0
  18. data/spec/dummy/bin/rails +4 -0
  19. data/spec/dummy/bin/rake +4 -0
  20. data/spec/dummy/config/application.rb +7 -37
  21. data/spec/dummy/config/boot.rb +4 -9
  22. data/spec/dummy/config/database.yml +8 -8
  23. data/spec/dummy/config/environment.rb +3 -3
  24. data/spec/dummy/config/environments/development.rb +18 -18
  25. data/spec/dummy/config/environments/production.rb +40 -29
  26. data/spec/dummy/config/environments/test.rb +16 -14
  27. data/spec/dummy/config/initializers/assets.rb +8 -0
  28. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  29. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  30. data/spec/dummy/config/initializers/inflections.rb +6 -5
  31. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  32. data/spec/dummy/config/initializers/session_store.rb +1 -6
  33. data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
  34. data/spec/dummy/config/locales/en.yml +20 -2
  35. data/spec/dummy/config/routes.rb +1 -0
  36. data/spec/dummy/config/secrets.yml +22 -0
  37. data/spec/dummy/config.ru +1 -1
  38. data/spec/dummy/db/development.sqlite3 +0 -0
  39. data/spec/dummy/db/schema.rb +8 -8
  40. data/spec/dummy/db/test.sqlite3 +0 -0
  41. data/spec/dummy/log/development.log +277 -0
  42. data/spec/dummy/log/test.log +1438 -0
  43. data/spec/dummy/public/404.html +54 -13
  44. data/spec/dummy/public/422.html +54 -13
  45. data/spec/dummy/public/500.html +53 -12
  46. data/spec/models/virus_scan_spec.rb +1 -1
  47. data/spec/permitters/virus_scan_permitter_spec.rb +34 -0
  48. metadata +37 -27
  49. data/spec/dummy/script/rails +0 -6
@@ -2,25 +2,66 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/404.html -->
21
59
  <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
24
65
  </div>
25
66
  </body>
26
67
  </html>
@@ -2,25 +2,66 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/422.html -->
21
59
  <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
24
65
  </div>
25
66
  </body>
26
67
  </html>
@@ -2,24 +2,65 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ body {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
16
54
  </style>
17
55
  </head>
18
56
 
19
57
  <body>
20
58
  <!-- This file lives in public/500.html -->
21
59
  <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
23
64
  </div>
24
65
  </body>
25
66
  </html>
@@ -5,7 +5,7 @@ describe VirusScan do
5
5
  let!(:virus_scan) { create :virus_scan }
6
6
 
7
7
  context 'after updating record with scan results' do
8
- before { virus_scan.update_attributes({scan_result: 'Clean'}, as: :scan_update ) }
8
+ before { virus_scan.update_attributes({scan_result: 'Clean'}) }
9
9
 
10
10
  it 'should be generate' do
11
11
  expect(virus_scan.scanned_at).not_to be nil
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe VirusScanPermitter do
4
+ describe '#attributes' do
5
+ subject { described_class.new.attributes params }
6
+
7
+ let(:params) do
8
+ ActionController::Parameters.new({
9
+ virus_scan: {
10
+ resource_type: 'logo',
11
+ resource_id: '123',
12
+ scan_result: 'Clean',
13
+ mount_point: 'file',
14
+ scanned_at: Time.now
15
+ }
16
+ })
17
+ end
18
+
19
+ it 'should filter out unnecessary params' do
20
+ expect(subject.keys).not_to include(
21
+ 'resource_type',
22
+ 'resource_id',
23
+ 'mount_point',
24
+ 'scanned_at'
25
+ )
26
+ end
27
+
28
+ it 'should permit necessary params' do
29
+ expect(subject.keys).to include(
30
+ 'scan_result'
31
+ )
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: witch_doctor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Valent
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-12 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.2'
20
- type: :runtime
19
+ version: 4.0.0
20
+ type: :development
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: '3.2'
26
+ version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.7'
89
+ version: 1.1.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.7'
96
+ version: 1.1.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: codeclimate-test-reporter
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: test-unit
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '3.0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '3.0'
125
111
  description: Rails engine that provides simple API so that external antivirus script
126
112
  can pull down files that need to be scanned and update their results.
127
113
  email:
@@ -137,10 +123,12 @@ files:
137
123
  - app/controllers/witch_doctor/virus_scans_controller.rb
138
124
  - app/helpers/witch_doctor/application_helper.rb
139
125
  - app/models/virus_scan.rb
126
+ - app/permiterters/virus_scan_permitter.rb
140
127
  - config/routes.rb
141
128
  - db/migrate/20150209121818_create_witch_doctor_virus_scans.rb
142
129
  - lib/tasks/witch_doctor_tasks.rake
143
130
  - lib/witch_doctor.rb
131
+ - lib/witch_doctor/antivirus
144
132
  - lib/witch_doctor/antivirus.rb
145
133
  - lib/witch_doctor/antivirus_concern.rb
146
134
  - lib/witch_doctor/engine.rb
@@ -154,6 +142,9 @@ files:
154
142
  - spec/dummy/app/helpers/application_helper.rb
155
143
  - spec/dummy/app/models/document.rb
156
144
  - spec/dummy/app/views/layouts/application.html.erb
145
+ - spec/dummy/bin/bundle
146
+ - spec/dummy/bin/rails
147
+ - spec/dummy/bin/rake
157
148
  - spec/dummy/config.ru
158
149
  - spec/dummy/config/application.rb
159
150
  - spec/dummy/config/boot.rb
@@ -162,7 +153,10 @@ files:
162
153
  - spec/dummy/config/environments/development.rb
163
154
  - spec/dummy/config/environments/production.rb
164
155
  - spec/dummy/config/environments/test.rb
156
+ - spec/dummy/config/initializers/assets.rb
165
157
  - spec/dummy/config/initializers/backtrace_silencers.rb
158
+ - spec/dummy/config/initializers/cookies_serializer.rb
159
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
166
160
  - spec/dummy/config/initializers/inflections.rb
167
161
  - spec/dummy/config/initializers/mime_types.rb
168
162
  - spec/dummy/config/initializers/secret_token.rb
@@ -171,18 +165,23 @@ files:
171
165
  - spec/dummy/config/initializers/wrap_parameters.rb
172
166
  - spec/dummy/config/locales/en.yml
173
167
  - spec/dummy/config/routes.rb
168
+ - spec/dummy/config/secrets.yml
169
+ - spec/dummy/db/development.sqlite3
174
170
  - spec/dummy/db/migrate/20150209121125_create_document.rb
175
171
  - spec/dummy/db/schema.rb
172
+ - spec/dummy/db/test.sqlite3
173
+ - spec/dummy/log/development.log
174
+ - spec/dummy/log/test.log
176
175
  - spec/dummy/public/404.html
177
176
  - spec/dummy/public/422.html
178
177
  - spec/dummy/public/500.html
179
178
  - spec/dummy/public/favicon.ico
180
- - spec/dummy/script/rails
181
179
  - spec/factories/witch_doctor_documents.rb
182
180
  - spec/factories/witch_doctor_virus_scans.rb
183
181
  - spec/helpers/application_helper_spec.rb
184
182
  - spec/lib/antivirus_spec.rb
185
183
  - spec/models/virus_scan_spec.rb
184
+ - spec/permitters/virus_scan_permitter_spec.rb
186
185
  - spec/spec_helper.rb
187
186
  homepage: https://github.com/equivalent/witch_doctor
188
187
  licenses: []
@@ -208,6 +207,7 @@ signing_key:
208
207
  specification_version: 4
209
208
  summary: Rails engine for virus scaning
210
209
  test_files:
210
+ - spec/permitters/virus_scan_permitter_spec.rb
211
211
  - spec/controllers/virus_scans_controller_spec.rb
212
212
  - spec/spec_helper.rb
213
213
  - spec/dummy/app/controllers/application_controller.rb
@@ -224,24 +224,34 @@ test_files:
224
224
  - spec/dummy/config/environments/development.rb
225
225
  - spec/dummy/config/environments/test.rb
226
226
  - spec/dummy/config/environments/production.rb
227
+ - spec/dummy/config/secrets.yml
227
228
  - spec/dummy/config/routes.rb
228
229
  - spec/dummy/config/environment.rb
229
230
  - spec/dummy/config/boot.rb
231
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
230
232
  - spec/dummy/config/initializers/inflections.rb
231
233
  - spec/dummy/config/initializers/secret_token.rb
232
234
  - spec/dummy/config/initializers/witch_doctor.rb
235
+ - spec/dummy/config/initializers/cookies_serializer.rb
233
236
  - spec/dummy/config/initializers/mime_types.rb
234
237
  - spec/dummy/config/initializers/session_store.rb
238
+ - spec/dummy/config/initializers/assets.rb
235
239
  - spec/dummy/config/initializers/wrap_parameters.rb
236
240
  - spec/dummy/config/initializers/backtrace_silencers.rb
237
241
  - spec/dummy/config.ru
242
+ - spec/dummy/db/test.sqlite3
238
243
  - spec/dummy/db/schema.rb
239
244
  - spec/dummy/db/migrate/20150209121125_create_document.rb
240
- - spec/dummy/script/rails
245
+ - spec/dummy/db/development.sqlite3
241
246
  - spec/dummy/public/500.html
242
247
  - spec/dummy/public/422.html
243
248
  - spec/dummy/public/favicon.ico
244
249
  - spec/dummy/public/404.html
250
+ - spec/dummy/bin/rake
251
+ - spec/dummy/bin/rails
252
+ - spec/dummy/bin/bundle
253
+ - spec/dummy/log/test.log
254
+ - spec/dummy/log/development.log
245
255
  - spec/models/virus_scan_spec.rb
246
256
  - spec/factories/witch_doctor_virus_scans.rb
247
257
  - spec/factories/witch_doctor_documents.rb
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'