safety_cone 0.1.0 → 1.0.0
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 +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +12 -68
- data/Rakefile +30 -4
- data/app/assets/config/safety_cone_manifest.js +2 -0
- data/app/assets/images/safety_cone/logo.png +0 -0
- data/app/assets/stylesheets/safety_cone/application.css +15 -0
- data/app/assets/stylesheets/safety_cone/material.css +298 -0
- data/app/controllers/safety_cone/application_controller.rb +5 -0
- data/app/controllers/safety_cone/cones_controller.rb +28 -0
- data/app/helpers/safety_cone/application_helper.rb +4 -0
- data/app/helpers/safety_cone/cones_helper.rb +9 -0
- data/app/models/safety_cone/application_record.rb +5 -0
- data/app/models/safety_cone/cone.rb +37 -0
- data/app/views/layouts/safety_cone/application.html.erb +20 -0
- data/app/views/safety_cone/cones/edit.html.erb +33 -0
- data/app/views/safety_cone/cones/index.html.erb +24 -0
- data/config/environment.rb +0 -0
- data/config/routes.rb +4 -0
- data/lib/safety_cone.rb +1 -2
- data/lib/safety_cone/configuration.rb +8 -30
- data/lib/safety_cone/engine.rb +16 -0
- data/lib/safety_cone/filter.rb +18 -8
- data/lib/safety_cone/version.rb +1 -1
- data/lib/tasks/safety_cone_tasks.rake +4 -0
- metadata +154 -26
- data/.gitignore +0 -9
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -49
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -21
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/safety_cone.gemspec +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50edbf10878fc56a14539cd41c4b70e879735b77
|
4
|
+
data.tar.gz: a57be06d86eb4e58aff4887ff32070e1f8541545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d106b281c7e3b23fd901b065aa11e7872b54e37908e72619a43d4912706bb016ea7760539982014482cf2d9297661918264941bca45ca90ecc4314438c9fb76f
|
7
|
+
data.tar.gz: 7398e5766be675c6bd19b9622731ae61cebc00211e478aaa6d9ec39156836a5a118b6b191f1e9308abc237cf0946928ce2594337bac0962607d5b4aa45fbafcc
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2017 Edwin Rozario
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# SafetyConeMountable
|
2
|
+
Short description and motivation.
|
2
3
|
|
3
|
-
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
4
6
|
|
5
7
|
## Installation
|
6
|
-
|
7
8
|
Add this line to your application's Gemfile:
|
8
9
|
|
9
10
|
```ruby
|
@@ -11,74 +12,17 @@ gem 'safety_cone'
|
|
11
12
|
```
|
12
13
|
|
13
14
|
And then execute:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
Or install it yourself as:
|
18
|
-
|
19
|
-
$ gem install safety_cone
|
20
|
-
|
21
|
-
## Usage
|
22
|
-
|
23
|
-
Create a safety_con.rb file in config/initializer/
|
24
|
-
|
15
|
+
```bash
|
16
|
+
$ bundle
|
25
17
|
```
|
26
|
-
SafetyCone.configure do |config|
|
27
|
-
# disables safety_cone. By default this value is true
|
28
|
-
config.enable = false
|
29
|
-
|
30
|
-
# This config will block all POST requests and display this message.
|
31
|
-
config.add(
|
32
|
-
method: :POST,
|
33
|
-
message: 'We are unable to write any data to database now.',
|
34
|
-
measure: :block
|
35
|
-
)
|
36
|
-
|
37
|
-
# This is a controller action specific warning. But with no measures to prevent this action
|
38
|
-
config.add(
|
39
|
-
controller: :users,
|
40
|
-
action: :new,
|
41
|
-
message: 'We are unable to register any user now. Please try after sometime.'
|
42
|
-
measure: :notice
|
43
|
-
)
|
44
18
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
controller: 'users',
|
49
|
-
action: 'create',
|
50
|
-
message: 'We are unable to register any user now. Please try after sometime.',
|
51
|
-
measure: :block
|
52
|
-
)
|
53
|
-
|
54
|
-
# This is a controller action specific block with a redirect configured.
|
55
|
-
config.add(
|
56
|
-
controller: 'users',
|
57
|
-
action: 'create',
|
58
|
-
message: 'We are unable to register any user now. Please try after sometime.',
|
59
|
-
measure: :block,
|
60
|
-
redirect: '/page/more_info'
|
61
|
-
)
|
62
|
-
|
63
|
-
# For :block flash message is an alert
|
64
|
-
# For :notice flash message is a notice
|
65
|
-
end
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install safety_cone
|
66
22
|
```
|
67
23
|
|
68
|
-
|
69
|
-
|
70
|
-
<Development>
|
71
|
-
|
72
|
-
<After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.>
|
73
|
-
|
74
|
-
<To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).>
|
75
|
-
|
76
|
-
<Contributing>
|
77
|
-
|
78
|
-
<Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/safety_cone. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.>
|
79
|
-
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
80
26
|
|
81
27
|
## License
|
82
|
-
|
83
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT)
|
84
|
-
|
28
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,6 +1,32 @@
|
|
1
|
-
|
2
|
-
require
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
3
6
|
|
4
|
-
|
7
|
+
require 'rdoc/task'
|
5
8
|
|
6
|
-
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'SafetyConeMountable'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
20
|
+
load 'rails/tasks/engine.rake'
|
21
|
+
|
22
|
+
load 'rails/tasks/statistics.rake'
|
23
|
+
|
24
|
+
Bundler::GemHelper.install_tasks
|
25
|
+
|
26
|
+
require 'rspec/core'
|
27
|
+
require 'rspec/core/rake_task'
|
28
|
+
|
29
|
+
desc 'Run all specs in spec directory (excluding plugin specs)'
|
30
|
+
RSpec::Core::RakeTask.new(spec: 'app:db:test:prepare')
|
31
|
+
|
32
|
+
task default: :spec
|
Binary file
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,298 @@
|
|
1
|
+
/*
|
2
|
+
Place all the styles related to the matching controller here.
|
3
|
+
They will automatically be included in application.css.
|
4
|
+
*/
|
5
|
+
|
6
|
+
body {
|
7
|
+
margin-top: 2rem;
|
8
|
+
background-color: #e0e0e0;
|
9
|
+
}
|
10
|
+
|
11
|
+
.card {
|
12
|
+
padding: 2rem;
|
13
|
+
display: block;
|
14
|
+
position: relative;
|
15
|
+
margin: 0.5rem 0 1rem 0;
|
16
|
+
background-color: #fff;
|
17
|
+
transition: box-shadow .25s;
|
18
|
+
border-radius: 2px;
|
19
|
+
max-height: 100%;
|
20
|
+
overflow: hidden;
|
21
|
+
}
|
22
|
+
|
23
|
+
.card, .btn {
|
24
|
+
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
25
|
+
}
|
26
|
+
.card:hover{
|
27
|
+
box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2);
|
28
|
+
}
|
29
|
+
|
30
|
+
.chip {
|
31
|
+
width: 5rem;
|
32
|
+
text-align: center;
|
33
|
+
}
|
34
|
+
|
35
|
+
.status-notice {
|
36
|
+
background-color: #FFB74D !important;
|
37
|
+
}
|
38
|
+
|
39
|
+
.status-block {
|
40
|
+
background-color: #FF8A65 !important;
|
41
|
+
}
|
42
|
+
|
43
|
+
html {
|
44
|
+
font-family: sans-serif;
|
45
|
+
}
|
46
|
+
|
47
|
+
hr {
|
48
|
+
box-sizing: content-box;
|
49
|
+
height: 0;
|
50
|
+
}
|
51
|
+
|
52
|
+
.container {
|
53
|
+
margin: 0 auto;
|
54
|
+
max-width: 1280px;
|
55
|
+
width: 90%;
|
56
|
+
}
|
57
|
+
.row .col {
|
58
|
+
float: left;
|
59
|
+
box-sizing: border-box;
|
60
|
+
padding: 0 0.75rem;
|
61
|
+
min-height: 1px;
|
62
|
+
}
|
63
|
+
h4 {
|
64
|
+
font-size: 2.28rem;
|
65
|
+
line-height: 110%;
|
66
|
+
margin: 1.14rem 0 0.912rem 0;
|
67
|
+
text-align: center;
|
68
|
+
}
|
69
|
+
|
70
|
+
h5 {
|
71
|
+
font-size: 1.64rem;
|
72
|
+
line-height: 110%;
|
73
|
+
margin: 0.82rem 0 0.656rem 0;
|
74
|
+
text-align: center;
|
75
|
+
}
|
76
|
+
|
77
|
+
h6 {
|
78
|
+
font-size: 1rem;
|
79
|
+
line-height: 110%;
|
80
|
+
margin: 0.5rem 0 0.4rem 0;
|
81
|
+
text-align: center;
|
82
|
+
}
|
83
|
+
|
84
|
+
.chip {
|
85
|
+
display: inline-block;
|
86
|
+
height: 32px;
|
87
|
+
font-size: 13px;
|
88
|
+
font-weight: 500;
|
89
|
+
color: rgba(0, 0, 0, 0.6);
|
90
|
+
line-height: 32px;
|
91
|
+
padding: 0 12px;
|
92
|
+
border-radius: 16px;
|
93
|
+
background-color: #e4e4e4;
|
94
|
+
margin-bottom: 5px;
|
95
|
+
margin-right: 5px;
|
96
|
+
}
|
97
|
+
|
98
|
+
.btn {
|
99
|
+
font-size: 1rem;
|
100
|
+
border: none;
|
101
|
+
border-radius: 2px;
|
102
|
+
display: inline-block;
|
103
|
+
height: 36px;
|
104
|
+
line-height: 36px;
|
105
|
+
padding: 0 2rem;
|
106
|
+
text-transform: uppercase;
|
107
|
+
vertical-align: middle;
|
108
|
+
-webkit-tap-highlight-color: transparent;
|
109
|
+
text-decoration: none;
|
110
|
+
color: #fff;
|
111
|
+
background-color: #26a69a;
|
112
|
+
text-align: center;
|
113
|
+
letter-spacing: .5px;
|
114
|
+
transition: .2s ease-out;
|
115
|
+
cursor: pointer;
|
116
|
+
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
117
|
+
}
|
118
|
+
|
119
|
+
.btn:hover {
|
120
|
+
background-color: #2bbbad;
|
121
|
+
box-shadow: 0 3px 3px 0 rgba(0, 0, 0, 0.14), 0 1px 7px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -1px rgba(0, 0, 0, 0.2);
|
122
|
+
}
|
123
|
+
|
124
|
+
.row .col.s3 {
|
125
|
+
width: 25%;
|
126
|
+
margin-left: auto;
|
127
|
+
left: auto;
|
128
|
+
right: auto;
|
129
|
+
}
|
130
|
+
|
131
|
+
.row .col.s6 {
|
132
|
+
width: 50%;
|
133
|
+
margin-left: auto;
|
134
|
+
left: auto;
|
135
|
+
right: auto;
|
136
|
+
}
|
137
|
+
|
138
|
+
.row .col.s12 {
|
139
|
+
width: 100%;
|
140
|
+
margin-left: auto;
|
141
|
+
left: auto;
|
142
|
+
right: auto;
|
143
|
+
}
|
144
|
+
|
145
|
+
.row .col.offset-s3 {
|
146
|
+
margin-left: 25%;
|
147
|
+
}
|
148
|
+
.row .col.offset-s4 {
|
149
|
+
margin-left: 33.33333333%;
|
150
|
+
}
|
151
|
+
.row .col.offset-s4 {
|
152
|
+
left: 33.3333333333%;
|
153
|
+
}
|
154
|
+
|
155
|
+
|
156
|
+
.grey {
|
157
|
+
background: #DCDCDC;
|
158
|
+
}
|
159
|
+
.grey:hover {
|
160
|
+
background: #BABABA;
|
161
|
+
}
|
162
|
+
|
163
|
+
input[type=text] {
|
164
|
+
background-color: transparent;
|
165
|
+
border: none;
|
166
|
+
border-bottom: 1px solid #9e9e9e;
|
167
|
+
border-radius: 0;
|
168
|
+
outline: none;
|
169
|
+
height: 3rem;
|
170
|
+
width: 100%;
|
171
|
+
font-size: 1rem;
|
172
|
+
margin: 0 0 20px 0;
|
173
|
+
padding: 0;
|
174
|
+
box-shadow: none;
|
175
|
+
box-sizing: content-box;
|
176
|
+
transition: all 0.3s;
|
177
|
+
color: white;
|
178
|
+
}
|
179
|
+
.input-field .input-label{
|
180
|
+
color: #9e9e9e;
|
181
|
+
position: absolute;
|
182
|
+
top: 0.8rem;
|
183
|
+
left: 0;
|
184
|
+
font-size: 1rem;
|
185
|
+
cursor: text;
|
186
|
+
transition: .2s ease-out;
|
187
|
+
font-weight:normal;
|
188
|
+
position:absolute;
|
189
|
+
pointer-events:none;
|
190
|
+
margin-left: 0.75rem;
|
191
|
+
}
|
192
|
+
|
193
|
+
input[type=text]:focus {
|
194
|
+
color: #888888!important;
|
195
|
+
border-bottom: 2px solid #26a69a!important;
|
196
|
+
transition: .2s ease-out;
|
197
|
+
}
|
198
|
+
input[type=text]:focus + label {
|
199
|
+
margin-top: -20px!important;
|
200
|
+
color: #26a69a!important;
|
201
|
+
display: block;
|
202
|
+
position: absolute;
|
203
|
+
top: 0.8rem;
|
204
|
+
left: 0;
|
205
|
+
margin-left: 0.7rem;
|
206
|
+
font-size: 1rem;
|
207
|
+
cursor: text;
|
208
|
+
transition: .2s ease-out;
|
209
|
+
}
|
210
|
+
|
211
|
+
.input-field {
|
212
|
+
position: relative;
|
213
|
+
margin-top: 1rem;
|
214
|
+
}
|
215
|
+
|
216
|
+
input[type="radio"]:not(:checked),
|
217
|
+
[type="radio"]:checked {
|
218
|
+
position: absolute;
|
219
|
+
left: -9999px;
|
220
|
+
opacity: 0;
|
221
|
+
}
|
222
|
+
|
223
|
+
[type="radio"]:not(:checked) + label,
|
224
|
+
[type="radio"]:checked + label {
|
225
|
+
position: relative;
|
226
|
+
padding-left: 35px;
|
227
|
+
cursor: pointer;
|
228
|
+
display: inline-block;
|
229
|
+
height: 25px;
|
230
|
+
line-height: 30px;
|
231
|
+
font-size: 1rem;
|
232
|
+
transition: .28s ease;
|
233
|
+
/* webkit (konqueror) browsers */
|
234
|
+
-webkit-user-select: none;
|
235
|
+
-moz-user-select: none;
|
236
|
+
-ms-user-select: none;
|
237
|
+
user-select: none;
|
238
|
+
}
|
239
|
+
|
240
|
+
[type="radio"] + label:before,
|
241
|
+
[type="radio"] + label:after {
|
242
|
+
content: '';
|
243
|
+
position: absolute;
|
244
|
+
left: 0;
|
245
|
+
top: 0;
|
246
|
+
margin: 4px;
|
247
|
+
width: 16px;
|
248
|
+
height: 16px;
|
249
|
+
z-index: 0;
|
250
|
+
transition: .28s ease;
|
251
|
+
}
|
252
|
+
|
253
|
+
/* Unchecked styles */
|
254
|
+
[type="radio"]:not(:checked) + label:before,
|
255
|
+
[type="radio"]:not(:checked) + label:after,
|
256
|
+
[type="radio"]:checked + label:before,
|
257
|
+
[type="radio"]:checked + label:after,
|
258
|
+
[type="radio"].with-gap:checked + label:before,
|
259
|
+
[type="radio"].with-gap:checked + label:after {
|
260
|
+
border-radius: 50%;
|
261
|
+
}
|
262
|
+
|
263
|
+
[type="radio"]:not(:checked) + label:before,
|
264
|
+
[type="radio"]:not(:checked) + label:after {
|
265
|
+
border: 2px solid #5a5a5a;
|
266
|
+
}
|
267
|
+
|
268
|
+
[type="radio"]:not(:checked) + label:after {
|
269
|
+
-webkit-transform: scale(0);
|
270
|
+
transform: scale(0);
|
271
|
+
}
|
272
|
+
|
273
|
+
/* Checked styles */
|
274
|
+
[type="radio"]:checked + label:before {
|
275
|
+
border: 2px solid transparent;
|
276
|
+
}
|
277
|
+
|
278
|
+
[type="radio"]:checked + label:after,
|
279
|
+
[type="radio"].with-gap:checked + label:before,
|
280
|
+
[type="radio"].with-gap:checked + label:after {
|
281
|
+
border: 2px solid #26a69a;
|
282
|
+
}
|
283
|
+
|
284
|
+
[type="radio"]:checked + label:after,
|
285
|
+
[type="radio"].with-gap:checked + label:after {
|
286
|
+
background-color: #26a69a;
|
287
|
+
}
|
288
|
+
|
289
|
+
[type="radio"]:checked + label:after {
|
290
|
+
-webkit-transform: scale(1.02);
|
291
|
+
transform: scale(1.02);
|
292
|
+
}
|
293
|
+
|
294
|
+
/* Focused styles */
|
295
|
+
[type="radio"].tabbed:focus + label:before {
|
296
|
+
box-shadow: 0 0 0 10px rgba(0, 0, 0, 0.1);
|
297
|
+
color: red!Important;
|
298
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_dependency "safety_cone/application_controller"
|
2
|
+
|
3
|
+
module SafetyCone
|
4
|
+
class ConesController < ApplicationController
|
5
|
+
unless Rails.env.test?
|
6
|
+
http_basic_authenticate_with name: SafetyCone.auth[:username],
|
7
|
+
password: SafetyCone.auth[:password] if (SafetyCone.auth[:username] && SafetyCone.auth[:password])
|
8
|
+
end
|
9
|
+
|
10
|
+
def index
|
11
|
+
@cones = SafetyCone.cones
|
12
|
+
end
|
13
|
+
|
14
|
+
def edit
|
15
|
+
cone = SafetyCone.cones[params[:id].to_sym]
|
16
|
+
@cone = Cone.new(params[:id], cone)
|
17
|
+
@cone.fetch
|
18
|
+
end
|
19
|
+
|
20
|
+
def update
|
21
|
+
cone = SafetyCone.cones[params[:id].to_sym]
|
22
|
+
mereged_params = cone.merge(params[:cone].symbolize_keys)
|
23
|
+
Cone.new(params[:id], mereged_params).save
|
24
|
+
|
25
|
+
redirect_to cones_path
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module SafetyCone
|
2
|
+
class Cone
|
3
|
+
attr_accessor :name, :controller, :action,
|
4
|
+
:method, :message, :measure,
|
5
|
+
:key, :redis
|
6
|
+
|
7
|
+
def initialize(key, params)
|
8
|
+
@key = key
|
9
|
+
@name = params[:name]
|
10
|
+
@controller = params[:controller]
|
11
|
+
@method = params[:action]
|
12
|
+
@method = params[:method]
|
13
|
+
@message = params[:message]
|
14
|
+
@measure = params[:measure] || 'disabled'
|
15
|
+
@redis = SafetyCone.redis
|
16
|
+
end
|
17
|
+
|
18
|
+
def save
|
19
|
+
data = { message: @message, measure: @measure }.to_json
|
20
|
+
@redis.set(redis_key, data)
|
21
|
+
end
|
22
|
+
|
23
|
+
def fetch
|
24
|
+
stored_data = @redis.get(redis_key)
|
25
|
+
|
26
|
+
if stored_data
|
27
|
+
data = JSON.parse(stored_data)
|
28
|
+
@message = data['message']
|
29
|
+
@measure = data['measure']
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def redis_key
|
34
|
+
"safety::cone::#{@key}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Safety Cone</title>
|
5
|
+
<%= stylesheet_link_tag "safety_cone/application", media: 'all' %>
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<div class="container">
|
9
|
+
<div class="row">
|
10
|
+
<div class="col s1 offset-s4">
|
11
|
+
<%= image_tag('safety_cone/logo.png', size: "80x80") %>
|
12
|
+
</div>
|
13
|
+
<div class="col s4 center">
|
14
|
+
<h4>Safety Cone</h4>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<%= yield %>
|
18
|
+
</div>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col s6 offset-s3">
|
3
|
+
<h6 class="center"><%= @cone.name %></h6>
|
4
|
+
|
5
|
+
<div class="card">
|
6
|
+
<%= form_for :cone, url: cone_path(@cone.key), method: :PUT do |form| %>
|
7
|
+
<div class="row ">
|
8
|
+
<div class="input-field group col s12">
|
9
|
+
<%= form.text_field :message %>
|
10
|
+
<%= form.label :message, 'Message', class: 'input-label'%>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<div class="input-field col s12">
|
14
|
+
<%= form.radio_button :measure, 'notice' %>
|
15
|
+
<%= form.label :measure_notice, 'Notice' %>
|
16
|
+
|
17
|
+
<%= form.radio_button :measure, 'block' %>
|
18
|
+
<%= form.label :measure_block, 'Block' %>
|
19
|
+
|
20
|
+
<%= form.radio_button :measure, 'disabled' %>
|
21
|
+
<%= form.label :measure_disabled, 'Disable this Cone' %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="input-field col s12">
|
25
|
+
<%= form.submit 'save', class: 'waves-effect waves-light btn' %>
|
26
|
+
<%= link_to 'cancel', cones_path, class: 'waves-effect waves-light btn grey lighten-1' %>
|
27
|
+
</div>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
</div>
|
33
|
+
</div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="col s6 offset-s3">
|
3
|
+
<hr />
|
4
|
+
<% @cones.each do |cone, options| %>
|
5
|
+
|
6
|
+
<div class="row">
|
7
|
+
<div class="col s6">
|
8
|
+
<%= options[:name] %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="col s3">
|
12
|
+
<div class="chip status-<%= status(cone) %>">
|
13
|
+
<%= status(cone) %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div class="col s3">
|
18
|
+
<%= link_to 'edit', edit_cone_path(cone), class: 'waves-effect waves-light btn' %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
</div>
|
24
|
+
</div>
|
File without changes
|
data/config/routes.rb
ADDED
data/lib/safety_cone.rb
CHANGED
@@ -1,23 +1,19 @@
|
|
1
1
|
module SafetyCone
|
2
2
|
# Module for configuring safety measures
|
3
3
|
module Configuration
|
4
|
-
VALID_MEASURES = [
|
5
|
-
:block, :warn,
|
6
|
-
:notice, :alert
|
7
|
-
].freeze
|
8
|
-
|
9
4
|
VALID_OPTION_KEYS = [
|
10
5
|
:method, :controller,
|
11
|
-
:action, :
|
12
|
-
:measure, :redirect
|
6
|
+
:action, :name
|
13
7
|
].freeze
|
14
8
|
|
15
|
-
attr_accessor :
|
9
|
+
attr_accessor :cones, :options, :redis, :auth
|
16
10
|
|
17
|
-
# Method add a safety
|
11
|
+
# Method add a route or method to be managed by safety cone
|
18
12
|
def add(options = {})
|
19
13
|
self.options = options
|
20
|
-
|
14
|
+
|
15
|
+
raise(ArgumentError, 'Mandatory param :name missing') unless options[:name]
|
16
|
+
|
21
17
|
cones[make_key] = options
|
22
18
|
end
|
23
19
|
|
@@ -33,29 +29,11 @@ module SafetyCone
|
|
33
29
|
end
|
34
30
|
end
|
35
31
|
|
36
|
-
# Checks the validity of configuration params
|
37
|
-
def valid?
|
38
|
-
invalid_options = (options.keys - VALID_OPTION_KEYS)
|
39
|
-
unless invalid_options.empty?
|
40
|
-
raise ArgumentError, "Options #{invalid_options} are not valid."
|
41
|
-
end
|
42
|
-
|
43
|
-
unless options.key? :message
|
44
|
-
raise ArgumentError, 'Option :message is mandatory.'
|
45
|
-
end
|
46
|
-
|
47
|
-
if options[:measure]
|
48
|
-
unless VALID_MEASURES.include? options[:measure]
|
49
|
-
raise(ArgumentError,
|
50
|
-
"Option #{options[:measure]} is not a valid :measure")
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
32
|
# Configuration method for Rails initializer
|
56
33
|
def configure
|
57
|
-
self.enabled = true
|
58
34
|
self.cones = {}
|
35
|
+
self.auth = { username: nil, password: nil}
|
36
|
+
|
59
37
|
yield self
|
60
38
|
end
|
61
39
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module SafetyCone
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace SafetyCone
|
4
|
+
|
5
|
+
initializer "refinery.assets.precompile" do |app|
|
6
|
+
app.config.assets.precompile += %w(safety_cone/logo.png)
|
7
|
+
end
|
8
|
+
|
9
|
+
config.generators do |g|
|
10
|
+
g.test_framework :rspec, :fixture => false
|
11
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
12
|
+
g.assets false
|
13
|
+
g.helper false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/safety_cone/filter.rb
CHANGED
@@ -11,29 +11,39 @@ module SafetyCone
|
|
11
11
|
# Filter method that does the SafetyCone action
|
12
12
|
# based on the configuration.
|
13
13
|
def safety_cone_filter
|
14
|
-
return unless SafetyCone.enabled
|
15
|
-
|
16
14
|
if cone = fetch_cone
|
17
15
|
flash.clear
|
18
|
-
flash[notice_type(cone
|
19
|
-
redirect_to safety_redirect
|
16
|
+
flash[notice_type(cone.measure)] = cone.message
|
17
|
+
redirect_to safety_redirect if cone.measure == 'block'
|
20
18
|
end
|
21
19
|
end
|
22
20
|
|
23
21
|
# Fetches a configuration based on current request
|
24
22
|
def fetch_cone
|
25
23
|
cones = SafetyCone.cones
|
26
|
-
|
24
|
+
|
25
|
+
if cone = cones[request_action]
|
26
|
+
key = request_action
|
27
|
+
elsif cone = cones[request_method]
|
28
|
+
key = request_method
|
29
|
+
else
|
30
|
+
return false
|
31
|
+
end
|
32
|
+
|
33
|
+
cone = Cone.new(key, cone)
|
34
|
+
cone.fetch
|
35
|
+
|
36
|
+
%w(notice block).include?(cone.measure) ? cone : false
|
27
37
|
end
|
28
38
|
|
29
39
|
# Method to redirect a request
|
30
|
-
def safety_redirect
|
31
|
-
|
40
|
+
def safety_redirect
|
41
|
+
request.env['HTTP_REFERER']
|
32
42
|
end
|
33
43
|
|
34
44
|
# Returns type of notice
|
35
45
|
def notice_type(measure)
|
36
|
-
measure ==
|
46
|
+
measure == 'notice' ? 'notice' : 'alert'
|
37
47
|
end
|
38
48
|
|
39
49
|
# Returns the current request action as a symbol
|
data/lib/safety_cone/version.rb
CHANGED
metadata
CHANGED
@@ -1,81 +1,209 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safety_cone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edwin Rozario
|
8
|
+
- Yar Htut
|
8
9
|
autorequire:
|
9
|
-
bindir:
|
10
|
+
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2017-05-19 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "<="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 5.0.2
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "<="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 5.0.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: redis
|
15
30
|
requirement: !ruby/object:Gem::Requirement
|
16
31
|
requirements:
|
17
32
|
- - "~>"
|
18
33
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
|
34
|
+
version: '3.3'
|
35
|
+
- - ">="
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.3.3
|
38
|
+
type: :runtime
|
21
39
|
prerelease: false
|
22
40
|
version_requirements: !ruby/object:Gem::Requirement
|
23
41
|
requirements:
|
24
42
|
- - "~>"
|
25
43
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
44
|
+
version: '3.3'
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.3.3
|
27
48
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
49
|
+
name: sqlite3
|
29
50
|
requirement: !ruby/object:Gem::Requirement
|
30
51
|
requirements:
|
31
|
-
- -
|
52
|
+
- - '='
|
32
53
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
54
|
+
version: 1.3.13
|
34
55
|
type: :development
|
35
56
|
prerelease: false
|
36
57
|
version_requirements: !ruby/object:Gem::Requirement
|
37
58
|
requirements:
|
38
|
-
- -
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.3.13
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: capybara
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.14.0
|
69
|
+
type: :development
|
70
|
+
prerelease: false
|
71
|
+
version_requirements: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.14.0
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: factory_girl_rails
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 4.8.0
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 4.8.0
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: database_cleaner
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.6.1
|
97
|
+
type: :development
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.6.1
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: pry
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.10.4
|
111
|
+
type: :development
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.10.4
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: rspec-rails
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 3.5.2
|
125
|
+
type: :development
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - '='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 3.5.2
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: rails-controller-testing
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - '='
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.0.2
|
139
|
+
type: :development
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
39
144
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
145
|
+
version: 1.0.2
|
41
146
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
147
|
+
name: mock_redis
|
43
148
|
requirement: !ruby/object:Gem::Requirement
|
44
149
|
requirements:
|
45
150
|
- - "~>"
|
46
151
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
152
|
+
version: 0.17.3
|
48
153
|
type: :development
|
49
154
|
prerelease: false
|
50
155
|
version_requirements: !ruby/object:Gem::Requirement
|
51
156
|
requirements:
|
52
157
|
- - "~>"
|
53
158
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
159
|
+
version: 0.17.3
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
name: launchy
|
162
|
+
requirement: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - '='
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 2.4.3
|
167
|
+
type: :development
|
168
|
+
prerelease: false
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - '='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 2.4.3
|
55
174
|
description: |-
|
56
175
|
At times we would want to block certain requests.
|
57
|
-
|
176
|
+
SafetyCone allows this to be controller from an interface.
|
58
177
|
email:
|
59
178
|
- edwin@boost.co.nz
|
60
179
|
executables: []
|
61
180
|
extensions: []
|
62
181
|
extra_rdoc_files: []
|
63
182
|
files:
|
64
|
-
-
|
65
|
-
- ".rspec"
|
66
|
-
- ".travis.yml"
|
67
|
-
- CODE_OF_CONDUCT.md
|
68
|
-
- Gemfile
|
69
|
-
- LICENSE.txt
|
183
|
+
- MIT-LICENSE
|
70
184
|
- README.md
|
71
185
|
- Rakefile
|
72
|
-
-
|
73
|
-
-
|
186
|
+
- app/assets/config/safety_cone_manifest.js
|
187
|
+
- app/assets/images/safety_cone/logo.png
|
188
|
+
- app/assets/stylesheets/safety_cone/application.css
|
189
|
+
- app/assets/stylesheets/safety_cone/material.css
|
190
|
+
- app/controllers/safety_cone/application_controller.rb
|
191
|
+
- app/controllers/safety_cone/cones_controller.rb
|
192
|
+
- app/helpers/safety_cone/application_helper.rb
|
193
|
+
- app/helpers/safety_cone/cones_helper.rb
|
194
|
+
- app/models/safety_cone/application_record.rb
|
195
|
+
- app/models/safety_cone/cone.rb
|
196
|
+
- app/views/layouts/safety_cone/application.html.erb
|
197
|
+
- app/views/safety_cone/cones/edit.html.erb
|
198
|
+
- app/views/safety_cone/cones/index.html.erb
|
199
|
+
- config/environment.rb
|
200
|
+
- config/routes.rb
|
74
201
|
- lib/safety_cone.rb
|
75
202
|
- lib/safety_cone/configuration.rb
|
203
|
+
- lib/safety_cone/engine.rb
|
76
204
|
- lib/safety_cone/filter.rb
|
77
205
|
- lib/safety_cone/version.rb
|
78
|
-
-
|
206
|
+
- lib/tasks/safety_cone_tasks.rake
|
79
207
|
homepage: https://github.com/boost/safety_cone
|
80
208
|
licenses:
|
81
209
|
- MIT
|
@@ -99,5 +227,5 @@ rubyforge_project:
|
|
99
227
|
rubygems_version: 2.5.1
|
100
228
|
signing_key:
|
101
229
|
specification_version: 4
|
102
|
-
summary: Blocks or warns requests as
|
230
|
+
summary: Blocks or warns requests as cofigured by the admin
|
103
231
|
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.travis.yml
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
# Contributor Code of Conduct
|
2
|
-
|
3
|
-
As contributors and maintainers of this project, and in the interest of
|
4
|
-
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
-
contribute through reporting issues, posting feature requests, updating
|
6
|
-
documentation, submitting pull requests or patches, and other activities.
|
7
|
-
|
8
|
-
We are committed to making participation in this project a harassment-free
|
9
|
-
experience for everyone, regardless of level of experience, gender, gender
|
10
|
-
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
-
body size, race, ethnicity, age, religion, or nationality.
|
12
|
-
|
13
|
-
Examples of unacceptable behavior by participants include:
|
14
|
-
|
15
|
-
* The use of sexualized language or imagery
|
16
|
-
* Personal attacks
|
17
|
-
* Trolling or insulting/derogatory comments
|
18
|
-
* Public or private harassment
|
19
|
-
* Publishing other's private information, such as physical or electronic
|
20
|
-
addresses, without explicit permission
|
21
|
-
* Other unethical or unprofessional conduct
|
22
|
-
|
23
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
-
threatening, offensive, or harmful.
|
28
|
-
|
29
|
-
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
-
fairly and consistently applying these principles to every aspect of managing
|
31
|
-
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
-
Conduct may be permanently removed from the project team.
|
33
|
-
|
34
|
-
This code of conduct applies both within project spaces and in public spaces
|
35
|
-
when an individual is representing the project or its community.
|
36
|
-
|
37
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
-
reported by contacting a project maintainer at edwin@boost.co.nz. All
|
39
|
-
complaints will be reviewed and investigated and will result in a response that
|
40
|
-
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
-
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
-
incident.
|
43
|
-
|
44
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
-
version 1.3.0, available at
|
46
|
-
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
-
|
48
|
-
[homepage]: http://contributor-covenant.org
|
49
|
-
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
DELETED
data/LICENSE.txt
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Edwin Rozario
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "safety_cone"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
data/bin/setup
DELETED
data/safety_cone.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'safety_cone/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'safety_cone'
|
8
|
-
spec.version = SafetyCone::VERSION
|
9
|
-
spec.authors = ['Edwin Rozario']
|
10
|
-
spec.email = ['edwin@boost.co.nz']
|
11
|
-
|
12
|
-
spec.summary = 'Blocks or warns requests as per configuration'
|
13
|
-
spec.description = 'At times we would want to block certain requests.
|
14
|
-
SafetyCone allows this to be configued.'
|
15
|
-
spec.homepage = 'https://github.com/boost/safety_cone'
|
16
|
-
spec.license = 'MIT'
|
17
|
-
|
18
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
-
spec.bindir = 'exe'
|
20
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
-
spec.require_paths = ['lib']
|
22
|
-
|
23
|
-
spec.add_development_dependency 'bundler', '~> 1.12'
|
24
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
-
end
|