apes 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 +7 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +82 -0
- data/.travis-gemfile +15 -0
- data/.travis.yml +15 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +22 -0
- data/README.md +177 -0
- data/Rakefile +44 -0
- data/apes.gemspec +34 -0
- data/doc/Apes.html +130 -0
- data/doc/Apes/Concerns.html +127 -0
- data/doc/Apes/Concerns/Errors.html +1089 -0
- data/doc/Apes/Concerns/Pagination.html +636 -0
- data/doc/Apes/Concerns/Request.html +766 -0
- data/doc/Apes/Concerns/Response.html +940 -0
- data/doc/Apes/Controller.html +1100 -0
- data/doc/Apes/Errors.html +125 -0
- data/doc/Apes/Errors/AuthenticationError.html +133 -0
- data/doc/Apes/Errors/BadRequestError.html +157 -0
- data/doc/Apes/Errors/BaseError.html +320 -0
- data/doc/Apes/Errors/InvalidDataError.html +157 -0
- data/doc/Apes/Errors/MissingDataError.html +157 -0
- data/doc/Apes/Model.html +378 -0
- data/doc/Apes/PaginationCursor.html +2138 -0
- data/doc/Apes/RuntimeConfiguration.html +909 -0
- data/doc/Apes/Serializers.html +125 -0
- data/doc/Apes/Serializers/JSON.html +389 -0
- data/doc/Apes/Serializers/JWT.html +452 -0
- data/doc/Apes/Serializers/List.html +347 -0
- data/doc/Apes/UrlsParser.html +1432 -0
- data/doc/Apes/Validators.html +125 -0
- data/doc/Apes/Validators/BaseValidator.html +278 -0
- data/doc/Apes/Validators/BooleanValidator.html +494 -0
- data/doc/Apes/Validators/EmailValidator.html +350 -0
- data/doc/Apes/Validators/PhoneValidator.html +375 -0
- data/doc/Apes/Validators/ReferenceValidator.html +372 -0
- data/doc/Apes/Validators/TimestampValidator.html +640 -0
- data/doc/Apes/Validators/UuidValidator.html +372 -0
- data/doc/Apes/Validators/ZipCodeValidator.html +372 -0
- data/doc/Apes/Version.html +189 -0
- data/doc/ApplicationController.html +547 -0
- data/doc/Concerns.html +128 -0
- data/doc/Concerns/ErrorHandling.html +826 -0
- data/doc/Concerns/PaginationHandling.html +463 -0
- data/doc/Concerns/RequestHandling.html +512 -0
- data/doc/Concerns/ResponseHandling.html +579 -0
- data/doc/Errors.html +126 -0
- data/doc/Errors/AuthenticationError.html +123 -0
- data/doc/Errors/BadRequestError.html +147 -0
- data/doc/Errors/BaseError.html +289 -0
- data/doc/Errors/InvalidDataError.html +147 -0
- data/doc/Errors/MissingDataError.html +147 -0
- data/doc/Model.html +315 -0
- data/doc/PaginationCursor.html +764 -0
- data/doc/Serializers.html +126 -0
- data/doc/Serializers/JSON.html +253 -0
- data/doc/Serializers/JWT.html +253 -0
- data/doc/Serializers/List.html +245 -0
- data/doc/Validators.html +126 -0
- data/doc/Validators/BaseValidator.html +209 -0
- data/doc/Validators/BooleanValidator.html +391 -0
- data/doc/Validators/EmailValidator.html +298 -0
- data/doc/Validators/PhoneValidator.html +313 -0
- data/doc/Validators/ReferenceValidator.html +284 -0
- data/doc/Validators/TimestampValidator.html +476 -0
- data/doc/Validators/UuidValidator.html +310 -0
- data/doc/Validators/ZipCodeValidator.html +310 -0
- data/doc/_index.html +435 -0
- data/doc/class_list.html +58 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +252 -0
- data/doc/file_list.html +60 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +252 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +181 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +615 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/apes.rb +40 -0
- data/lib/apes/concerns/errors.rb +111 -0
- data/lib/apes/concerns/pagination.rb +81 -0
- data/lib/apes/concerns/request.rb +237 -0
- data/lib/apes/concerns/response.rb +74 -0
- data/lib/apes/controller.rb +77 -0
- data/lib/apes/errors.rb +38 -0
- data/lib/apes/model.rb +94 -0
- data/lib/apes/pagination_cursor.rb +152 -0
- data/lib/apes/runtime_configuration.rb +80 -0
- data/lib/apes/serializers.rb +88 -0
- data/lib/apes/urls_parser.rb +233 -0
- data/lib/apes/validators.rb +234 -0
- data/lib/apes/version.rb +24 -0
- data/spec/apes/concerns/errors_spec.rb +141 -0
- data/spec/apes/concerns/pagination_spec.rb +114 -0
- data/spec/apes/concerns/request_spec.rb +244 -0
- data/spec/apes/concerns/response_spec.rb +79 -0
- data/spec/apes/controller_spec.rb +54 -0
- data/spec/apes/errors_spec.rb +14 -0
- data/spec/apes/models_spec.rb +148 -0
- data/spec/apes/pagination_cursor_spec.rb +113 -0
- data/spec/apes/runtime_configuration_spec.rb +100 -0
- data/spec/apes/serializers_spec.rb +70 -0
- data/spec/apes/urls_parser_spec.rb +150 -0
- data/spec/apes/validators_spec.rb +237 -0
- data/spec/spec_helper.rb +30 -0
- data/views/_included.json.jbuilder +9 -0
- data/views/_pagination.json.jbuilder +9 -0
- data/views/collection.json.jbuilder +4 -0
- data/views/errors/400.json.jbuilder +9 -0
- data/views/errors/403.json.jbuilder +7 -0
- data/views/errors/404.json.jbuilder +6 -0
- data/views/errors/422.json.jbuilder +19 -0
- data/views/errors/500.json.jbuilder +12 -0
- data/views/errors/501.json.jbuilder +7 -0
- data/views/layouts/general.json.jbuilder +36 -0
- data/views/object.json.jbuilder +4 -0
- metadata +262 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: b17680f70819d6bf72c0169dc4b3239d2ce027a1
|
|
4
|
+
data.tar.gz: 433a38eb075debb0ce24c0175e4b3dfa7cd3448c
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 0acdbf772972650d5c1378590943f4fa93e887075431fbe2ad0170bbf2252674efa7809f50a98c77cbfa09fe9beb8be3e1b93a2c3ee50a6c137b4a4ad378ba5a
|
|
7
|
+
data.tar.gz: 08bfc68f9d5327ea22ba316bd319ea423004658eafa6ea060bc883dbe083b1b9eb749602a2bad91e6d21f967387566d08f12c4f481fce79e0a4a6ac762e62798
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of the apes gem. Copyright (C) 2016 and above Shogun <shogun@cowtech.it>.
|
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
AllCops:
|
|
7
|
+
TargetRubyVersion: 2.3
|
|
8
|
+
Include:
|
|
9
|
+
- "*/**/.rb"
|
|
10
|
+
- "config.ru"
|
|
11
|
+
- "Rakefile"
|
|
12
|
+
- "Gemfile"
|
|
13
|
+
Exclude:
|
|
14
|
+
- "config/**/*"
|
|
15
|
+
- "db/**/*"
|
|
16
|
+
- "spec/**/*"
|
|
17
|
+
|
|
18
|
+
Alias:
|
|
19
|
+
Enabled: false
|
|
20
|
+
|
|
21
|
+
AsciiComments:
|
|
22
|
+
Enabled: false
|
|
23
|
+
|
|
24
|
+
BracesAroundHashParameters:
|
|
25
|
+
Enabled: false
|
|
26
|
+
|
|
27
|
+
CyclomaticComplexity:
|
|
28
|
+
Max: 15
|
|
29
|
+
|
|
30
|
+
ClassLength:
|
|
31
|
+
Max: 150
|
|
32
|
+
|
|
33
|
+
Documentation:
|
|
34
|
+
Enabled: false
|
|
35
|
+
|
|
36
|
+
EachWithObject:
|
|
37
|
+
Enabled: false
|
|
38
|
+
|
|
39
|
+
FormatString:
|
|
40
|
+
Enabled: false
|
|
41
|
+
|
|
42
|
+
FrozenStringLiteralComment:
|
|
43
|
+
Enabled: false
|
|
44
|
+
|
|
45
|
+
IndentationConsistency:
|
|
46
|
+
Enabled: false
|
|
47
|
+
|
|
48
|
+
LineLength:
|
|
49
|
+
Max: 160
|
|
50
|
+
|
|
51
|
+
MethodLength:
|
|
52
|
+
Max: 15
|
|
53
|
+
|
|
54
|
+
ModuleLength:
|
|
55
|
+
Max: 200
|
|
56
|
+
|
|
57
|
+
MultilineMethodCallIndentation:
|
|
58
|
+
Enabled: false
|
|
59
|
+
|
|
60
|
+
ParameterLists:
|
|
61
|
+
Max: 8
|
|
62
|
+
|
|
63
|
+
RegexpLiteral:
|
|
64
|
+
Enabled: false
|
|
65
|
+
|
|
66
|
+
SignalException:
|
|
67
|
+
Enabled: false
|
|
68
|
+
|
|
69
|
+
SpaceInsideHashLiteralBraces:
|
|
70
|
+
Enabled: false
|
|
71
|
+
|
|
72
|
+
StringLiterals:
|
|
73
|
+
Enabled: false
|
|
74
|
+
|
|
75
|
+
StringLiteralsInInterpolation:
|
|
76
|
+
Enabled: false
|
|
77
|
+
|
|
78
|
+
StringReplacement:
|
|
79
|
+
Enabled: false
|
|
80
|
+
|
|
81
|
+
WordArray:
|
|
82
|
+
Enabled: false
|
data/.travis-gemfile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of the apes gem. Copyright (C) 2016 and above Shogun <shogun@cowtech.it>.
|
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
source "http://rubygems.org"
|
|
7
|
+
|
|
8
|
+
gemspec
|
|
9
|
+
|
|
10
|
+
# Testing
|
|
11
|
+
gem "sqlite3", "~> 1.3"
|
|
12
|
+
gem "rspec", "~> 3.4"
|
|
13
|
+
gem "rake", "~> 11.0"
|
|
14
|
+
gem "simplecov", "~> 0.11"
|
|
15
|
+
gem "coveralls", "~> 0.8", require: false
|
data/.travis.yml
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of the apes gem. Copyright (C) 2016 and above Shogun <shogun@cowtech.it>.
|
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
language: ruby
|
|
7
|
+
rvm:
|
|
8
|
+
- 2.3.0
|
|
9
|
+
script: bundle exec rake spec:ci
|
|
10
|
+
gemfile: .travis-gemfile
|
|
11
|
+
notifications:
|
|
12
|
+
email: false
|
|
13
|
+
addons:
|
|
14
|
+
code_climate:
|
|
15
|
+
repo_token:
|
data/.yardopts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-m markdown
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of the apes gem. Copyright (C) 2016 and above Shogun <shogun@cowtech.it>.
|
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
source "http://rubygems.org"
|
|
7
|
+
|
|
8
|
+
gemspec
|
|
9
|
+
|
|
10
|
+
# Testing
|
|
11
|
+
gem "sqlite3", "~> 1.3"
|
|
12
|
+
gem "rspec", "~> 3.4"
|
|
13
|
+
gem "rake", "~> 11.0"
|
|
14
|
+
|
|
15
|
+
# Documentation
|
|
16
|
+
gem "simplecov", "~> 0.11"
|
|
17
|
+
gem "coveralls", "~> 0.8", require: false
|
|
18
|
+
gem "pry", "~> 0.10"
|
|
19
|
+
gem "yard", "~> 0.8"
|
|
20
|
+
gem "kramdown", "~> 1.10"
|
|
21
|
+
gem "github-markup", "~> 1.4"
|
|
22
|
+
gem "rubocop", "~> 0.39"
|
data/README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# apes
|
|
2
|
+
|
|
3
|
+
[](http://badge.fury.io/rb/apes)
|
|
4
|
+
[](https://gemnasium.com/ShogunPanda/apes)
|
|
5
|
+
[](http://travis-ci.org/ShogunPanda/apes)
|
|
6
|
+
[](https://coveralls.io/r/ShogunPanda/apes)
|
|
7
|
+
|
|
8
|
+
A tiny JSON API framework for Ruby on Rails.
|
|
9
|
+
|
|
10
|
+
https://sw.cowtech.it/apes
|
|
11
|
+
|
|
12
|
+
https://github.com/ShogunPanda/apes
|
|
13
|
+
|
|
14
|
+
# Introduction
|
|
15
|
+
|
|
16
|
+
Apes makes it easy to deal with [JSON API](http://jsonapi.org/) by abstracting all the oddities of the specification.
|
|
17
|
+
|
|
18
|
+
## Routes
|
|
19
|
+
|
|
20
|
+
There's no requirement at all here, but a good start point for your routes might be the following:
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
Rails.application.routes.draw do
|
|
24
|
+
# This is to enable AJAX cross domain
|
|
25
|
+
match '*path', to: 'application#handle_cors', via: :options
|
|
26
|
+
|
|
27
|
+
# Insert your routes here
|
|
28
|
+
|
|
29
|
+
# Catch alls
|
|
30
|
+
match("/*unused", via: :all, to: "application#error_handle_not_found")
|
|
31
|
+
root(to: "application#error_handle_not_found")
|
|
32
|
+
end
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Controller
|
|
36
|
+
|
|
37
|
+
Once your controller inherits from `Apes::Controller`, you can implement a CRUD in virtually no time:
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
class UsersController < Apes::Controller
|
|
41
|
+
before_action :find_user, except: [:index, :create]
|
|
42
|
+
|
|
43
|
+
def index
|
|
44
|
+
@objects = paginate(User.all)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def show
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def create
|
|
51
|
+
@object = User.new
|
|
52
|
+
attributes = request_extract_model(@object)
|
|
53
|
+
@object.update_attributes!(request_cast_attributes(@object, attributes))
|
|
54
|
+
|
|
55
|
+
response.header["Location"] = user_url(@object)
|
|
56
|
+
response.status = :created
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def update
|
|
60
|
+
attributes = request_extract_model(@object)
|
|
61
|
+
@object.update_attributes!(request_cast_attributes(@object, attributes))
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def destroy
|
|
65
|
+
@object.destroy!
|
|
66
|
+
render(nothing: true, status: :no_content)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
private
|
|
70
|
+
|
|
71
|
+
def find_user
|
|
72
|
+
@object = User.find(params[:id])
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
By definining the `ATTRIBUTES` and `RELATIONSHIPS` in your model, you can ensure no invalid attributes are provided.
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
class Appointment < ApplicationRecord
|
|
81
|
+
ATTRIBUTES = [:user, :assignee, :date, :reason].freeze
|
|
82
|
+
RELATIONSHIPS = {user: nil, assignee: User}.freeze
|
|
83
|
+
end
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Model
|
|
87
|
+
|
|
88
|
+
If your model imports `Apes::Model`, it will earn two extra nice things: additional validations and enhanced search.
|
|
89
|
+
|
|
90
|
+
Additional validations use the same infrastructure of `ActiveModel::Validations` but it's not bound to any attribute and it's not reset when performing validations.
|
|
91
|
+
|
|
92
|
+
For instance, you can do:
|
|
93
|
+
|
|
94
|
+
```ruby
|
|
95
|
+
class User < ApplicationRecord
|
|
96
|
+
include Apes::Model
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
u = User.new
|
|
100
|
+
u.additional_errors.add("whatever", "I don't like my name!")
|
|
101
|
+
u.validate!
|
|
102
|
+
p u.errors
|
|
103
|
+
p u.all_validation_errors
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Enhanced searching, instead allow to perform single or multiple rows searching using `find_with_any` (including `find_with_any!` variant) or `search`.
|
|
107
|
+
|
|
108
|
+
The latter will perform full text search on one or more fields returning all matching rows:
|
|
109
|
+
|
|
110
|
+
```ruby
|
|
111
|
+
ZipCode.search(params: params, query: collection, fields: ["zip", "name", "county", "state"])
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
The former instead, with perform a exact search basing on the model definition and returning the first matching row:
|
|
115
|
+
|
|
116
|
+
```ruby
|
|
117
|
+
ZipCode.find_with_any!(params[:id])
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
You can customize which fields is searching on by defining the constants `SECONDARY_KEY` or `SECONDARY_QUERY` in your model.
|
|
121
|
+
|
|
122
|
+
Note that UUID are always matched against the `id` column.
|
|
123
|
+
|
|
124
|
+
## View
|
|
125
|
+
|
|
126
|
+
There's nothing much to say here. `Apes::Controller` handles views and error rendering.
|
|
127
|
+
|
|
128
|
+
All you need to do is to define a partial view in `app/views/models` using JBuilder.
|
|
129
|
+
If your action defines `@objects` or `@object` variables, Apes will render a collection or a single object automagically.
|
|
130
|
+
|
|
131
|
+
Example (`app/views/models/_appointment.json.jbuilder`):
|
|
132
|
+
|
|
133
|
+
```ruby
|
|
134
|
+
json.type "appointment"
|
|
135
|
+
json.id object.to_param
|
|
136
|
+
|
|
137
|
+
json.attributes do
|
|
138
|
+
json.extract! object, :date, :reason
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
json.relationships do
|
|
142
|
+
included = local_assigns.fetch(:included, false)
|
|
143
|
+
|
|
144
|
+
json.assignee do
|
|
145
|
+
json.data({type: "user", id: object.assignee.to_param})
|
|
146
|
+
json.links({related: user_url(object.assignee)})
|
|
147
|
+
response_included(object.assignee) unless included
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
json.user do
|
|
151
|
+
json.data({type: "user", id: object.user.to_param})
|
|
152
|
+
json.links({related: user_url(object.user)})
|
|
153
|
+
response_included(object.user) unless included
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
json.links do
|
|
158
|
+
json.self appointment_url(object)
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
json.meta(meta) if local_assigns.key?(:meta)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Contributing to apes
|
|
165
|
+
|
|
166
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
|
167
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
|
168
|
+
* Fork the project.
|
|
169
|
+
* Start a feature/bugfix branch.
|
|
170
|
+
* Commit and push until you are happy with your contribution.
|
|
171
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
|
172
|
+
|
|
173
|
+
## Copyright
|
|
174
|
+
|
|
175
|
+
Copyright (C) 2016 and above Shogun <shogun@cowtech.it>.
|
|
176
|
+
|
|
177
|
+
Licensed under the MIT license, which can be found at http://opensource.org/licenses/MIT.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of the apes gem. Copyright (C) 2016 and above Shogun <shogun@cowtech.it>.
|
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require "bundler/gem_tasks"
|
|
7
|
+
require "rspec/core/rake_task"
|
|
8
|
+
|
|
9
|
+
# Compatibility layer for Rake 11.0
|
|
10
|
+
Rake.application.class.send(:alias_method, :last_comment, :last_description) unless Rake.application.respond_to?(:last_comment)
|
|
11
|
+
|
|
12
|
+
RSpec::Core::RakeTask.new("spec")
|
|
13
|
+
|
|
14
|
+
RSpec::Core::RakeTask.new("spec:coverage") do
|
|
15
|
+
ENV["COVERAGE"] = "true"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
RSpec::Core::RakeTask.new("spec:ci") do
|
|
19
|
+
ENV["COVERAGE"] = "true"
|
|
20
|
+
ENV["NO_COLOR"] = "true"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
desc "Performs linting of the code using rubocop"
|
|
24
|
+
task "lint" do
|
|
25
|
+
Kernel.exec("rubocop -ED lib")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
desc "Generates the documentation"
|
|
29
|
+
task :docs do
|
|
30
|
+
system("yardoc") || raise("Failed Execution of: yardoc")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
desc "Gets the current release version"
|
|
34
|
+
task :version, :with_name do |_, args|
|
|
35
|
+
gem = Bundler::GemHelper.instance.gemspec
|
|
36
|
+
puts [args[:with_name] == "true" ? gem.name : nil, gem.version].compact.join("-")
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
desc "Prepares the release"
|
|
40
|
+
task :prerelease => ["spec:coverage", "docs"] do
|
|
41
|
+
["git add -A", "git commit -am \"Version #{Bundler::GemHelper.instance.gemspec.version}\""].each do |cmd|
|
|
42
|
+
system(cmd) || raise("Failed Execution of: #{cmd}")
|
|
43
|
+
end
|
|
44
|
+
end
|
data/apes.gemspec
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#
|
|
2
|
+
# This file is part of the apes gem. Copyright (C) 2016 and above Shogun <shogun@cowtech.it>.
|
|
3
|
+
# Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
require File.expand_path("../lib/apes/version", __FILE__)
|
|
7
|
+
|
|
8
|
+
Gem::Specification.new do |gem|
|
|
9
|
+
gem.name = "apes"
|
|
10
|
+
gem.version = Apes::Version::STRING
|
|
11
|
+
gem.homepage = "https://github.com/ShogunPanda/apes"
|
|
12
|
+
gem.summary = %q{A tiny JSON API framework for Ruby on Rails.}
|
|
13
|
+
gem.description = %q{A tiny JSON API framework for Ruby on Rails.}
|
|
14
|
+
gem.rubyforge_project = "apes"
|
|
15
|
+
|
|
16
|
+
gem.authors = ["Shogun"]
|
|
17
|
+
gem.email = ["shogun@cowtech.it"]
|
|
18
|
+
gem.license = "MIT"
|
|
19
|
+
|
|
20
|
+
gem.files = `git ls-files`.split($\)
|
|
21
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
22
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
23
|
+
gem.require_paths = ["lib"]
|
|
24
|
+
|
|
25
|
+
gem.required_ruby_version = ">= 2.3.0"
|
|
26
|
+
|
|
27
|
+
# Add gem dependencies here
|
|
28
|
+
gem.add_dependency("lazier", "~> 4.2")
|
|
29
|
+
gem.add_dependency("mustache", "~> 1.0")
|
|
30
|
+
gem.add_dependency("jwt", "~> 1.5")
|
|
31
|
+
gem.add_dependency("jbuilder", "~> 2.5")
|
|
32
|
+
gem.add_dependency("rails", "~> 4.2")
|
|
33
|
+
gem.add_dependency("rails-api", "~> 0.4")
|
|
34
|
+
end
|
data/doc/Apes.html
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
4
|
+
<head>
|
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
6
|
+
<title>
|
|
7
|
+
Module: Apes
|
|
8
|
+
|
|
9
|
+
— Documentation by YARD 0.8.7.6
|
|
10
|
+
|
|
11
|
+
</title>
|
|
12
|
+
|
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
|
14
|
+
|
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
|
19
|
+
relpath = '';
|
|
20
|
+
framesUrl = "frames.html#!Apes.html";
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
|
25
|
+
|
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
</head>
|
|
30
|
+
<body>
|
|
31
|
+
<div id="header">
|
|
32
|
+
<div id="menu">
|
|
33
|
+
|
|
34
|
+
<a href="_index.html">Index (A)</a> »
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
<span class="title">Apes</span>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<div id="search">
|
|
44
|
+
|
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
|
46
|
+
href="class_list.html">
|
|
47
|
+
Class List
|
|
48
|
+
</a>
|
|
49
|
+
|
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
|
51
|
+
href="method_list.html">
|
|
52
|
+
Method List
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
|
56
|
+
href="file_list.html">
|
|
57
|
+
File List
|
|
58
|
+
</a>
|
|
59
|
+
|
|
60
|
+
</div>
|
|
61
|
+
<div class="clear"></div>
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
<iframe id="search_frame"></iframe>
|
|
65
|
+
|
|
66
|
+
<div id="content"><h1>Module: Apes
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</h1>
|
|
71
|
+
|
|
72
|
+
<dl class="box">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
|
82
|
+
<dd class="r1 last">lib/apes/model.rb<span class="defines">,<br />
|
|
83
|
+
lib/apes/errors.rb,<br /> lib/apes/version.rb,<br /> lib/apes/validators.rb,<br /> lib/apes/controller.rb,<br /> lib/apes/urls_parser.rb,<br /> lib/apes/serializers.rb,<br /> lib/apes/concerns/errors.rb,<br /> lib/apes/concerns/request.rb,<br /> lib/apes/pagination_cursor.rb,<br /> lib/apes/concerns/response.rb,<br /> lib/apes/concerns/pagination.rb,<br /> lib/apes/runtime_configuration.rb</span>
|
|
84
|
+
</dd>
|
|
85
|
+
|
|
86
|
+
</dl>
|
|
87
|
+
<div class="clear"></div>
|
|
88
|
+
|
|
89
|
+
<h2>Overview</h2><div class="docstring">
|
|
90
|
+
<div class="discussion">
|
|
91
|
+
<p>This file is part of the apes gem. Copyright (C) 2016 and above Shogun <a href="mailto:shogun@cowtech.it">shogun@cowtech.it</a>.
|
|
92
|
+
Licensed under the MIT license, which can be found at http://www.opensource.org/licenses/mit-license.php.</p>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
<div class="tags">
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
</div><h2>Defined Under Namespace</h2>
|
|
101
|
+
<p class="children">
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Apes/Concerns.html" title="Apes::Concerns (module)">Concerns</a></span>, <span class='object_link'><a href="Apes/Errors.html" title="Apes::Errors (module)">Errors</a></span>, <span class='object_link'><a href="Apes/Model.html" title="Apes::Model (module)">Model</a></span>, <span class='object_link'><a href="Apes/Serializers.html" title="Apes::Serializers (module)">Serializers</a></span>, <span class='object_link'><a href="Apes/Validators.html" title="Apes::Validators (module)">Validators</a></span>, <span class='object_link'><a href="Apes/Version.html" title="Apes::Version (module)">Version</a></span>
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Apes/Controller.html" title="Apes::Controller (class)">Controller</a></span>, <span class='object_link'><a href="Apes/PaginationCursor.html" title="Apes::PaginationCursor (class)">PaginationCursor</a></span>, <span class='object_link'><a href="Apes/RuntimeConfiguration.html" title="Apes::RuntimeConfiguration (class)">RuntimeConfiguration</a></span>, <span class='object_link'><a href="Apes/UrlsParser.html" title="Apes::UrlsParser (class)">UrlsParser</a></span>
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</p>
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
</div>
|
|
122
|
+
|
|
123
|
+
<div id="footer">
|
|
124
|
+
Generated on Sat Jun 4 12:41:53 2016 by
|
|
125
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
126
|
+
0.8.7.6 (ruby-2.3.0).
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
</body>
|
|
130
|
+
</html>
|