abstracted 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.envrc +1 -0
- data/.gitignore +8 -0
- data/.rspec +3 -0
- data/.ruby-version +1 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +218 -0
- data/Guardfile +77 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +15 -0
- data/abstracted.gemspec +51 -0
- data/app/assets/images/abstracted/.keep +0 -0
- data/app/assets/javascripts/abstract_resources.js +39 -0
- data/app/assets/javascripts/abstracted/.keep +0 -0
- data/app/assets/javascripts/crud.js.coffee +49 -0
- data/app/assets/javascripts/initializers.js.coffee +111 -0
- data/app/assets/stylesheets/abstract_resources.css +5 -0
- data/app/assets/stylesheets/abstracted/.keep +0 -0
- data/app/assets/stylesheets/scaffold.css +56 -0
- data/app/controllers/.keep +0 -0
- data/app/controllers/abstract_resources_controller.rb +290 -0
- data/app/controllers/application_controller.rb +22 -0
- data/app/helpers/.keep +0 -0
- data/app/helpers/abstract_resources_helper.rb +26 -0
- data/app/mailers/.keep +0 -0
- data/app/models/.keep +0 -0
- data/app/models/abstract_resource.rb +122 -0
- data/app/models/concerns/roleable.rb +61 -0
- data/app/policies/abstract_resource_policy.rb +58 -0
- data/app/views/.keep +0 -0
- data/app/views/abstract_resources/_default.html.erb +11 -0
- data/app/views/abstract_resources/destroy.js.haml +1 -0
- data/app/views/abstract_resources/edit.html.haml +11 -0
- data/app/views/abstract_resources/index.html.erb +1 -0
- data/app/views/abstract_resources/new.html.haml +12 -0
- data/app/views/abstract_resources/show.html.haml +13 -0
- data/bin/rails +12 -0
- data/config/locales/abstracted.en.yml +20 -0
- data/config/routes.rb +4 -0
- data/lib/abstracted.rb +8 -0
- data/lib/abstracted/engine.rb +19 -0
- data/lib/abstracted/version.rb +3 -0
- data/lib/abstracted_responder.rb +7 -0
- data/lib/tasks/abstracted_tasks.rake +4 -0
- data/spec/controllers/abstract_resources_controller_spec.rb +241 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/user.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +26 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +21 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/test.log +6229 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/abstract_resources.rb +6 -0
- data/spec/factories/users.rb +5 -0
- data/spec/features/posts/manage_posts_spec.rb +24 -0
- data/spec/models/abstract_resource_spec.rb +14 -0
- data/spec/rails_helper.rb +114 -0
- data/spec/spec_helper.rb +97 -0
- data/test/integration/abstract_resource_test.rb +7 -0
- metadata +424 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8ff874ea5c2ff8ac5fea75f25e2203f30e765a76
|
4
|
+
data.tar.gz: 138c581a66628523013c51becbcf27500410e167
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ff2bd633bfb9371e29c0caf49542d96d5f7a6f89e7c224f7972d00c96e8e1bc174e44d250589d717b58b25e2c09ced0827516953b4d416604178cfc269b2d5a0
|
7
|
+
data.tar.gz: e473f114cd973ef8b8887a738ba5a454afd5e119dc0ed97f63325beb02a23d7775646c2650e8b448b12607dd1c96b8306e719b9896d12b4cbb22948e54fc8d8b
|
data/.envrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export PATH=$PWD/bin:$PATH
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.2.0
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Declare your gem's dependencies in abstracted.gemspec.
|
4
|
+
# Bundler will treat runtime dependencies like base dependencies, and
|
5
|
+
# development dependencies will be added by default to the :development group.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
# Declare any dependencies that are still in development here instead of in
|
9
|
+
# your gemspec. These might include edge Rails or gems from your path or
|
10
|
+
# Git. Remember to move these dependencies to your gemspec before releasing
|
11
|
+
# your gem to rubygems.org.
|
12
|
+
|
13
|
+
# To use a debugger
|
14
|
+
gem 'byebug', group: [:development, :test]
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
abstracted (0.0.4)
|
5
|
+
pundit
|
6
|
+
rails (~> 4.1)
|
7
|
+
responders
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
actionmailer (4.2.0)
|
13
|
+
actionpack (= 4.2.0)
|
14
|
+
actionview (= 4.2.0)
|
15
|
+
activejob (= 4.2.0)
|
16
|
+
mail (~> 2.5, >= 2.5.4)
|
17
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
18
|
+
actionpack (4.2.0)
|
19
|
+
actionview (= 4.2.0)
|
20
|
+
activesupport (= 4.2.0)
|
21
|
+
rack (~> 1.6.0)
|
22
|
+
rack-test (~> 0.6.2)
|
23
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
24
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
25
|
+
actionview (4.2.0)
|
26
|
+
activesupport (= 4.2.0)
|
27
|
+
builder (~> 3.1)
|
28
|
+
erubis (~> 2.7.0)
|
29
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
30
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.1)
|
31
|
+
activejob (4.2.0)
|
32
|
+
activesupport (= 4.2.0)
|
33
|
+
globalid (>= 0.3.0)
|
34
|
+
activemodel (4.2.0)
|
35
|
+
activesupport (= 4.2.0)
|
36
|
+
builder (~> 3.1)
|
37
|
+
activerecord (4.2.0)
|
38
|
+
activemodel (= 4.2.0)
|
39
|
+
activesupport (= 4.2.0)
|
40
|
+
arel (~> 6.0)
|
41
|
+
activesupport (4.2.0)
|
42
|
+
i18n (~> 0.7)
|
43
|
+
json (~> 1.7, >= 1.7.7)
|
44
|
+
minitest (~> 5.1)
|
45
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
46
|
+
tzinfo (~> 1.1)
|
47
|
+
arel (6.0.0)
|
48
|
+
builder (3.2.2)
|
49
|
+
byebug (5.0.0)
|
50
|
+
columnize (= 0.9.0)
|
51
|
+
capybara (2.4.4)
|
52
|
+
mime-types (>= 1.16)
|
53
|
+
nokogiri (>= 1.3.3)
|
54
|
+
rack (>= 1.0.0)
|
55
|
+
rack-test (>= 0.5.4)
|
56
|
+
xpath (~> 2.0)
|
57
|
+
celluloid (0.16.0)
|
58
|
+
timers (~> 4.0.0)
|
59
|
+
coderay (1.1.0)
|
60
|
+
columnize (0.9.0)
|
61
|
+
combustion (0.5.3)
|
62
|
+
activesupport (>= 3.0.0)
|
63
|
+
railties (>= 3.0.0)
|
64
|
+
thor (>= 0.14.6)
|
65
|
+
database_cleaner (1.4.1)
|
66
|
+
diff-lcs (1.2.5)
|
67
|
+
erubis (2.7.0)
|
68
|
+
factory_girl (4.5.0)
|
69
|
+
activesupport (>= 3.0.0)
|
70
|
+
factory_girl_rails (4.5.0)
|
71
|
+
factory_girl (~> 4.5.0)
|
72
|
+
railties (>= 3.0.0)
|
73
|
+
ffi (1.9.6)
|
74
|
+
formatador (0.2.5)
|
75
|
+
globalid (0.3.5)
|
76
|
+
activesupport (>= 4.1.0)
|
77
|
+
guard (2.12.4)
|
78
|
+
formatador (>= 0.2.4)
|
79
|
+
listen (~> 2.7)
|
80
|
+
lumberjack (~> 1.0)
|
81
|
+
nenv (~> 0.1)
|
82
|
+
notiffany (~> 0.0)
|
83
|
+
pry (>= 0.9.12)
|
84
|
+
shellany (~> 0.0)
|
85
|
+
thor (>= 0.18.1)
|
86
|
+
guard-compat (1.2.1)
|
87
|
+
guard-rspec (4.5.0)
|
88
|
+
guard (~> 2.1)
|
89
|
+
guard-compat (~> 1.1)
|
90
|
+
rspec (>= 2.99.0, < 4.0)
|
91
|
+
hitimes (1.2.2)
|
92
|
+
i18n (0.7.0)
|
93
|
+
json (1.8.2)
|
94
|
+
listen (2.8.5)
|
95
|
+
celluloid (>= 0.15.2)
|
96
|
+
rb-fsevent (>= 0.9.3)
|
97
|
+
rb-inotify (>= 0.9)
|
98
|
+
loofah (2.0.1)
|
99
|
+
nokogiri (>= 1.5.9)
|
100
|
+
lumberjack (1.0.9)
|
101
|
+
mail (2.6.3)
|
102
|
+
mime-types (>= 1.16, < 3)
|
103
|
+
method_source (0.8.2)
|
104
|
+
mime-types (2.4.3)
|
105
|
+
mini_portile (0.6.2)
|
106
|
+
minitest (5.5.1)
|
107
|
+
nenv (0.2.0)
|
108
|
+
nokogiri (1.6.6.2)
|
109
|
+
mini_portile (~> 0.6.0)
|
110
|
+
notiffany (0.0.6)
|
111
|
+
nenv (~> 0.1)
|
112
|
+
shellany (~> 0.0)
|
113
|
+
pry (0.10.1)
|
114
|
+
coderay (~> 1.1.0)
|
115
|
+
method_source (~> 0.8.1)
|
116
|
+
slop (~> 3.4)
|
117
|
+
pry-nav (0.2.4)
|
118
|
+
pry (>= 0.9.10, < 0.11.0)
|
119
|
+
pry-remote (0.1.8)
|
120
|
+
pry (~> 0.9)
|
121
|
+
slop (~> 3.0)
|
122
|
+
pundit (1.0.1)
|
123
|
+
activesupport (>= 3.0.0)
|
124
|
+
rack (1.6.0)
|
125
|
+
rack-test (0.6.3)
|
126
|
+
rack (>= 1.0)
|
127
|
+
rails (4.2.0)
|
128
|
+
actionmailer (= 4.2.0)
|
129
|
+
actionpack (= 4.2.0)
|
130
|
+
actionview (= 4.2.0)
|
131
|
+
activejob (= 4.2.0)
|
132
|
+
activemodel (= 4.2.0)
|
133
|
+
activerecord (= 4.2.0)
|
134
|
+
activesupport (= 4.2.0)
|
135
|
+
bundler (>= 1.3.0, < 2.0)
|
136
|
+
railties (= 4.2.0)
|
137
|
+
sprockets-rails
|
138
|
+
rails-deprecated_sanitizer (1.0.3)
|
139
|
+
activesupport (>= 4.2.0.alpha)
|
140
|
+
rails-dom-testing (1.0.5)
|
141
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
142
|
+
nokogiri (~> 1.6.0)
|
143
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
144
|
+
rails-html-sanitizer (1.0.1)
|
145
|
+
loofah (~> 2.0)
|
146
|
+
railties (4.2.0)
|
147
|
+
actionpack (= 4.2.0)
|
148
|
+
activesupport (= 4.2.0)
|
149
|
+
rake (>= 0.8.7)
|
150
|
+
thor (>= 0.18.1, < 2.0)
|
151
|
+
rake (10.4.2)
|
152
|
+
rb-fsevent (0.9.4)
|
153
|
+
rb-inotify (0.9.5)
|
154
|
+
ffi (>= 0.5.0)
|
155
|
+
responders (2.1.0)
|
156
|
+
railties (>= 4.2.0, < 5)
|
157
|
+
rspec (3.2.0)
|
158
|
+
rspec-core (~> 3.2.0)
|
159
|
+
rspec-expectations (~> 3.2.0)
|
160
|
+
rspec-mocks (~> 3.2.0)
|
161
|
+
rspec-core (3.2.1)
|
162
|
+
rspec-support (~> 3.2.0)
|
163
|
+
rspec-expectations (3.2.0)
|
164
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
165
|
+
rspec-support (~> 3.2.0)
|
166
|
+
rspec-mocks (3.2.1)
|
167
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
168
|
+
rspec-support (~> 3.2.0)
|
169
|
+
rspec-nc (0.2.0)
|
170
|
+
rspec (>= 2.9)
|
171
|
+
terminal-notifier (>= 1.4)
|
172
|
+
rspec-rails (3.2.1)
|
173
|
+
actionpack (>= 3.0, < 4.3)
|
174
|
+
activesupport (>= 3.0, < 4.3)
|
175
|
+
railties (>= 3.0, < 4.3)
|
176
|
+
rspec-core (~> 3.2.0)
|
177
|
+
rspec-expectations (~> 3.2.0)
|
178
|
+
rspec-mocks (~> 3.2.0)
|
179
|
+
rspec-support (~> 3.2.0)
|
180
|
+
rspec-support (3.2.2)
|
181
|
+
shellany (0.0.1)
|
182
|
+
slop (3.6.0)
|
183
|
+
sprockets (3.2.0)
|
184
|
+
rack (~> 1.0)
|
185
|
+
sprockets-rails (2.3.1)
|
186
|
+
actionpack (>= 3.0)
|
187
|
+
activesupport (>= 3.0)
|
188
|
+
sprockets (>= 2.8, < 4.0)
|
189
|
+
sqlite3 (1.3.10)
|
190
|
+
terminal-notifier (1.6.2)
|
191
|
+
thor (0.19.1)
|
192
|
+
thread_safe (0.3.4)
|
193
|
+
timers (4.0.1)
|
194
|
+
hitimes
|
195
|
+
tzinfo (1.2.2)
|
196
|
+
thread_safe (~> 0.1)
|
197
|
+
xpath (2.0.0)
|
198
|
+
nokogiri (~> 1.3)
|
199
|
+
|
200
|
+
PLATFORMS
|
201
|
+
ruby
|
202
|
+
|
203
|
+
DEPENDENCIES
|
204
|
+
abstracted!
|
205
|
+
byebug
|
206
|
+
capybara
|
207
|
+
combustion (~> 0.5.3)
|
208
|
+
database_cleaner
|
209
|
+
factory_girl_rails
|
210
|
+
guard
|
211
|
+
guard-rspec
|
212
|
+
pry
|
213
|
+
pry-nav
|
214
|
+
pry-remote
|
215
|
+
rspec
|
216
|
+
rspec-nc
|
217
|
+
rspec-rails
|
218
|
+
sqlite3
|
data/Guardfile
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features)
|
6
|
+
|
7
|
+
## Uncomment to clear the screen before every task
|
8
|
+
# clearing :on
|
9
|
+
|
10
|
+
## Guard internally checks for changes in the Guardfile and exits.
|
11
|
+
## If you want Guard to automatically start up again, run guard in a
|
12
|
+
## shell loop, e.g.:
|
13
|
+
##
|
14
|
+
## $ while bundle exec guard; do echo "Restarting Guard..."; done
|
15
|
+
##
|
16
|
+
## Note: if you are using the `directories` clause above and you are not
|
17
|
+
## watching the project directory ('.'), then you will want to move
|
18
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
19
|
+
#
|
20
|
+
# $ mkdir config
|
21
|
+
# $ mv Guardfile config/
|
22
|
+
# $ ln -s config/Guardfile .
|
23
|
+
#
|
24
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
25
|
+
|
26
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
27
|
+
# rspec may be run, below are examples of the most common uses.
|
28
|
+
# * bundler: 'bundle exec rspec'
|
29
|
+
# * bundler binstubs: 'bin/rspec'
|
30
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
31
|
+
# installed the spring binstubs per the docs)
|
32
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
33
|
+
# * 'just' rspec: 'rspec'
|
34
|
+
|
35
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
36
|
+
require "guard/rspec/dsl"
|
37
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
38
|
+
|
39
|
+
# Feel free to open issues for suggestions and improvements
|
40
|
+
|
41
|
+
# RSpec files
|
42
|
+
rspec = dsl.rspec
|
43
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
44
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
45
|
+
watch(rspec.spec_files)
|
46
|
+
|
47
|
+
# Ruby files
|
48
|
+
ruby = dsl.ruby
|
49
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
50
|
+
|
51
|
+
# Rails files
|
52
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
53
|
+
dsl.watch_spec_files_for(rails.app_files)
|
54
|
+
dsl.watch_spec_files_for(rails.views)
|
55
|
+
|
56
|
+
watch(rails.controllers) do |m|
|
57
|
+
[
|
58
|
+
rspec.spec.("routing/#{m[1]}_routing"),
|
59
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
60
|
+
rspec.spec.("acceptance/#{m[1]}")
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
# Rails config changes
|
65
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
66
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
67
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
68
|
+
|
69
|
+
# Capybara features specs
|
70
|
+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
71
|
+
|
72
|
+
# Turnip features and steps
|
73
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
74
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
75
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
76
|
+
end
|
77
|
+
end
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2015 Walther H Diechmann
|
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.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
8
|
+
load 'rails/tasks/engine.rake'
|
9
|
+
# Bundler::GemHelper.install_tasks
|
10
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
|
11
|
+
require 'rspec/core'
|
12
|
+
require 'rspec/core/rake_task'
|
13
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
14
|
+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
15
|
+
task :default => :spec
|
data/abstracted.gemspec
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
# Maintain your gem's version:
|
4
|
+
require "abstracted/version"
|
5
|
+
|
6
|
+
# Describe your gem and declare its dependencies:
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "abstracted"
|
9
|
+
s.version = Abstracted::VERSION
|
10
|
+
s.authors = ["Walther H Diechmann"]
|
11
|
+
s.email = ["walther@diechmann.net"]
|
12
|
+
s.homepage = "http://github.com/wdiechmann/abstracted"
|
13
|
+
s.summary = "Abstracted DRY's up your controllers totally"
|
14
|
+
s.description = "Abstracted has a lot of inspiration from gems like resources_controller by Ian White!"
|
15
|
+
s.license = "MIT"
|
16
|
+
|
17
|
+
# s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
|
18
|
+
s.files = `git ls-files -z`.split("\x0")
|
19
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
# s.test_files = Dir["test/**/*"]
|
21
|
+
# s.test_files = `git ls-files -- test/*`.split("\n")
|
22
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
23
|
+
# s.require_paths = ["lib"]
|
24
|
+
s.required_ruby_version = '>= 2.2.0'
|
25
|
+
#s.rubyforge_project = "devise"
|
26
|
+
|
27
|
+
s.add_dependency "rails", "~> 4.1"
|
28
|
+
s.add_dependency "pundit" #, "~> 0.3.0"
|
29
|
+
# s.add_dependency "sweetalert-rails"
|
30
|
+
|
31
|
+
s.add_dependency("responders")
|
32
|
+
|
33
|
+
s.add_development_dependency 'combustion', '~> 0.5.3'
|
34
|
+
s.add_development_dependency "sqlite3"
|
35
|
+
# s.add_development_dependency "railties", ">= 3.2.6", "< 5"
|
36
|
+
# s.add_development_dependency "activerecord", ">= 3.2.6"
|
37
|
+
# s.add_development_dependency "bundler", "~> 1.7"
|
38
|
+
# s.add_development_dependency "rake", "~> 10.0"
|
39
|
+
s.add_development_dependency 'factory_girl_rails'
|
40
|
+
s.add_development_dependency 'database_cleaner'
|
41
|
+
s.add_development_dependency 'capybara'
|
42
|
+
#
|
43
|
+
s.add_development_dependency "rspec"
|
44
|
+
s.add_development_dependency 'rspec-rails'
|
45
|
+
s.add_development_dependency "rspec-nc"
|
46
|
+
s.add_development_dependency "guard"
|
47
|
+
s.add_development_dependency "guard-rspec"
|
48
|
+
s.add_development_dependency "pry"
|
49
|
+
s.add_development_dependency "pry-remote"
|
50
|
+
s.add_development_dependency "pry-nav"
|
51
|
+
end
|
File without changes
|
@@ -0,0 +1,39 @@
|
|
1
|
+
// Place all the behaviors and hooks related to the matching controller here.
|
2
|
+
// All this logic will automatically be available in application.js.
|
3
|
+
//= require_tree .
|
4
|
+
|
5
|
+
|
6
|
+
// <!DOCTYPE html>
|
7
|
+
// <form method="post" action="?" disablemultiplesubmits>
|
8
|
+
// <button type="submit">click me</button>
|
9
|
+
// </form>
|
10
|
+
// // at the end of the page
|
11
|
+
// disableMultipleSubmits();
|
12
|
+
//
|
13
|
+
// // or within a defer or a non async script
|
14
|
+
// document.addEventListener('DOMContentLoaded', disableMultipleSubmits, false);
|
15
|
+
$(document).ready(function(){
|
16
|
+
function disableMultipleSubmits() { // by Andrea Giammarchi - WTFPL
|
17
|
+
Array.prototype.forEach.call(
|
18
|
+
document.querySelectorAll('form[disablemultiplesubmits]'),
|
19
|
+
function (form) {
|
20
|
+
form.addEventListener('submit', this, true);
|
21
|
+
},
|
22
|
+
{
|
23
|
+
// button to disable
|
24
|
+
query: 'input[type=submit],button[type=submit]',
|
25
|
+
// delay before re-enabling
|
26
|
+
delay: 500,
|
27
|
+
// handler
|
28
|
+
handleEvent: function (e) {
|
29
|
+
var button = e.currentTarget.querySelector(this.query);
|
30
|
+
button.disabled = true;
|
31
|
+
setTimeout(function () {
|
32
|
+
console.log('submit re-enabled');
|
33
|
+
button.disabled = false;
|
34
|
+
}, this.delay);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
);
|
38
|
+
}
|
39
|
+
});
|