json_voorhees 1.5.0 → 1.5.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0a3783e034387e3b3fe1ffa96110dc1dc046899
|
4
|
+
data.tar.gz: d5ffcdf7ba7141709a132bd81888c0137fe086bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0cb1d59e6ea52d8e292f2a545a7c1d1c6d9d1e916edf9e9b158e02fa607b197b45f530a0f85c68c296487dcded0e329bdd64be2f350343ea2814f58fe90dcf3
|
7
|
+
data.tar.gz: d3c3cac26a0cea3e6db719b52d7ee2e9a1af425177f18ea033b3078edf0f5b1459d1c418525661831a3612217667b6a5cc779fcd50caf3e2950fa3e5e8fbd5d0
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
# JsonVoorhees 1.
|
1
|
+
# JsonVoorhees 1.5.0
|
2
2
|
|
3
3
|
## Introduction
|
4
4
|
|
5
5
|
JsonVoorhees is an api builder that encapsulates all of it's generated code
|
6
6
|
inside of engines. It's essentially an opinionated framework built with rails
|
7
7
|
generators. It comes with common gems, a user model and other common functionality
|
8
|
-
such as token authentication.
|
8
|
+
such as token authentication. It builds in a scalable solution for authorizations. All controller actions are before filtered into a method that takes as arguments the current user, the parameters and current object. As a bonus, when the object is ready to be serialized, every attribute and association implements active model serializers include? method. Both controller and serializer consult the corresponding method in the created authorizations gem. This leaves the controller and serializer slim and all of the authorizations in one spot. You can be as granular as you want to be. Since tests are already set up for you, it makes implementing your features a breeze. Enjoy!
|
9
9
|
|
10
10
|
## Scaffold Use
|
11
11
|
|
@@ -54,8 +54,31 @@ rails g json_voorhees:massive_scaffold chat message 1 user_id:integer message:te
|
|
54
54
|
|
55
55
|
I usually set the app up, and then design the database. I make a list of all the models I need, then separate them into engines. Then I run 20 or so massive scaffolds using "&&". The result is a modular functioning backend that only needs the model relationships wired together. The default tests get you pretty far. It's a pretty good idea to create a script file that contains all of the scaffolds. It's essentially a schema for how to recreate your backend.
|
56
56
|
|
57
|
+
### Test it out
|
58
|
+
|
59
|
+
After creating your rails app and including the json_voorhees gem,
|
60
|
+
cd into your directory and run this command. Explore the files to see
|
61
|
+
what it does for you.
|
62
|
+
|
63
|
+
```bash
|
64
|
+
rails g json_voorhees:setup_app --fbonly &&
|
65
|
+
rails g json_voorhees:create_engine ocean &&
|
66
|
+
rails g json_voorhees:massive_scaffold ocean atlantic 1 cold:boolean hot:boolean &&
|
67
|
+
rails g json_voorhees:massive_scaffold ocean pacific 1 fun:boolean description:string &&
|
68
|
+
rake railties:install:migrations &&
|
69
|
+
rake db:migrate RAILS_ENV=development &&
|
70
|
+
rake db:migrate RAILS_ENV=test &&
|
71
|
+
rake db:migrate RAILS_ENV=production &&
|
72
|
+
rspec
|
73
|
+
```
|
74
|
+
|
57
75
|
## Gotchas and Reminders
|
58
76
|
|
77
|
+
JsonVoorhees is only tested on rails apps from 4 - 4.1.6 but
|
78
|
+
it should work on anything below 4.2. 4.2 finally includes some
|
79
|
+
commonly used gems so it throws an error when JsonVoorhees tries
|
80
|
+
to include it again. I'll write up a list of these offenders later.
|
81
|
+
|
59
82
|
After authenticating the user, routes will by default require the users token
|
60
83
|
to be sent with every request. This can be disabled by skipping the filter in
|
61
84
|
the controller. If you want to set the user optionally, call set_hash. It wont
|
@@ -82,12 +105,15 @@ the defaults.
|
|
82
105
|
|
83
106
|
Does not work with Rails 4.2 yet. Byebug is added by default and this generator tries to add it twice so it fails.
|
84
107
|
|
108
|
+
##Bugs
|
109
|
+
|
110
|
+
Serializer doesn't call the correct method for attributes
|
111
|
+
|
85
112
|
##Future
|
86
113
|
|
87
114
|
1. Sidekiq
|
88
115
|
2. Paperclip
|
89
116
|
3. Websockets
|
90
|
-
4. App tokens
|
91
117
|
|
92
118
|
Emails are sent synchronously for now. I'm waiting for ActiveJob in Rails 4.2 so I can
|
93
119
|
implement that interface and use the sidekiq adapter.
|
@@ -19,7 +19,7 @@ module <%= module_camel %>
|
|
19
19
|
|
20
20
|
<% attributes.each do |pair| %>
|
21
21
|
def include_<%= pair.split(/:/)[0] %>?
|
22
|
-
return ::Authorization::<%= module_camel %>::V<%= api_version %>::<%= resource_camel %>.
|
22
|
+
return ::Authorization::<%= module_camel %>::V<%= api_version %>::<%= resource_camel %>.include_<%= pair.split(/:/)[0] %>?(current_user,object,@options)
|
23
23
|
end
|
24
24
|
<% end %>
|
25
25
|
def include_created_at?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_voorhees
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cleophus Robinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|