apicasso 0.2.14 → 0.2.15

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
- SHA1:
3
- metadata.gz: 6c858b47915748e38882c68f8c8dc34819451c94
4
- data.tar.gz: d4e97b6bc9b9e87d0c5a394e2edeee03ae25443f
2
+ SHA256:
3
+ metadata.gz: 2333303ea6a663920f810765bbfca80b1e7e833415749852824c3d625107f982
4
+ data.tar.gz: be8b5074c6e9db405b995143ded4d9c4b1420219cee2c7a8fe7e1fc3f7e38823
5
5
  SHA512:
6
- metadata.gz: 18219217aba19f7a119a71d87b9c6681b0787bb6083a7198933226e388358e7238bd773d7bfb3e8540b424f3cc2e4d8a66defb53d41b44e5c0475c53fa5cd8ba
7
- data.tar.gz: 3ce3d1260e8088216b61a7d7561bb5f18691f4e07789769621b249cc9b5f8c1a39ae31df18568741062196d218f29da373244c4d92c6a53da7f82df68c0a9da6
6
+ metadata.gz: 74d2dfa791ddf679c42e6dba1229ffa09ef8661b5ce778e517194f6e1af325cbbae1e06205e84beb06fb4e81e119f6bb188892880736c7ac1a52ce84cce49e44
7
+ data.tar.gz: 88b3c93ec33fb37f3bdf84fcd1c74facd2a2779eeb472b3043df4a4301f0528519552d3d3037646775de0df2d4c4385ac1bf8566272174ff536864b9062264fd
data/README.md CHANGED
@@ -1,176 +1,176 @@
1
- <img src="https://raw.githubusercontent.com/ErvalhouS/APIcasso/master/APIcasso.png" width="300" /> [![Gem Version](https://badge.fury.io/rb/apicasso.svg)](https://badge.fury.io/rb/apicasso) [![Docs Coverage](https://inch-ci.org/github/autoforce/APIcasso.svg?branch=master)](https://inch-ci.org/github/autoforce/APIcasso.svg?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/b58bbd6b9a0376f7cfc8/maintainability)](https://codeclimate.com/github/autoforce/APIcasso/maintainability) [![codecov](https://codecov.io/gh/autoforce/APIcasso/branch/master/graph/badge.svg)](https://codecov.io/gh/autoforce/APIcasso) [![Build Status](https://travis-ci.org/autoforce/APIcasso.svg?branch=master)](https://travis-ci.org/autoforce/APIcasso)
2
-
3
- JSON API development can get boring and time consuming. If you think it through, every time you make one you use almost the same route structure, pointing to the same controller actions, with the same ordering, filtering and pagination features.
4
-
5
- **APIcasso** is intended to be used as a full-fledged CRUD JSON API or as a base controller to speed-up development.
6
- It is a route-based resource abstraction using API key scoping. This makes it possible to make CRUD-only applications just by creating functional Rails' models. It is a perfect candidate for legacy Rails projects that do not have an API. Access to your application's resources is managed by a `.scope` JSON object per API key. It uses that permission scope to restrict and extend access.
7
-
8
- # Installation
9
- Add this line to your application's `Gemfile`:
10
-
11
- ```ruby
12
- gem 'apicasso'
13
- ```
14
-
15
- And then execute this to generate the required migrations:
16
- ```bash
17
- $ bundle install && rails g apicasso:install
18
- ```
19
- You will need to use a database with JSON fields support to use this gem.
20
-
21
- # Usage
22
-
23
- **APIcasso** is meant to be used as an engine, which means you don't need to configure any route or controller to build a working CRUD API. Sometimes you also need some customized controller actions or even a specific logic to access some of your application's resources. In that case you will use `Apicasso::CrudController` class to easily build only your own logic around the API abstraction.
24
-
25
- ## Mounting engine into `config/routes.rb`
26
-
27
- After installing it, you can mount a full-fledged CRUD JSON API just by attaching into some route. Usually you will have it under a scoped route like `/api/v1` or a subdomain. You can do that by adding this into your `config/routes.rb`:
28
- ```ruby
29
- # To mount your APIcasso routes under the path scope `/api/v1`
30
- mount Apicasso::Engine, at: "/api/v1"
31
- # or, if you prefer subdomain scope isolation
32
- constraints subdomain: 'apiv1' do
33
- mount Apicasso::Engine, at: "/"
34
- end
35
- ```
36
- Your API will reflect very similarly a `resources :resource` statement with the following routes:
37
- ```ruby
38
- get '/:resource/' # Index action, listing a `:resource` collection from your application
39
- post '/:resource/' # Create action for one `:resource` from your application
40
- get '/:resource/:id' # Show action for one `:resource` from your application
41
- patch '/:resource/:id' # Update action for one `:resource` from your application
42
- delete '/:resource/:id' # Destroy action for one `:resource` from your application
43
- get '/:resource/:id/:nested/' # Index action, listing a collection of a `:nested` relation from one of your application's `:resource`
44
- options '/:resource/' # A schema dump for the required `:resource`
45
- options '/:resource/:id/:nested/' # A schema dump for the required `:nested` relation from one of your application's `:resource`
46
- ```
47
-
48
- This means all your application's models will be exposed as `:resource` and it's relations will be exposed as `:nested`. It will enable you to CRUD and get schema metadata from your records.
49
-
50
- ## Extending base API actions
51
-
52
- When your application needs some kind of custom interaction that is not covered by APIcasso's CRUD approach you can make your own actions using our base classes and objects to go straight into your logic. If you have built the APIcasso's engine into a route it is important that your custom action takes precedence over the gem's ones. To do that you need to declare your custom route before the engine on you `config/routes.rb`
53
- ```ruby
54
- match '/:resource/:id/a-custom-action' => 'custom#not_a_crud', via: :get
55
- mount Apicasso::Engine, at: "/api/v1"
56
- ```
57
- And in your `app/controllers/custom_controller.rb` you would have something like:
58
- ```ruby
59
- class CustomController < Apicasso::CrudController
60
- def not_a_crud
61
- render json: @object.some_operation
62
- end
63
- end
64
- ```
65
- This way you enjoy all our object finder, authorization and authentication features, making your job more straight into your business logic.
66
-
67
- ## Authorization/Authentication
68
-
69
- > But exposing my models to the internet is permissive as hell! Haven't you thought about security?
70
-
71
- *Sure!* The **APIcasso** suite is exposing your application using authentication through `Authorization: Token` [HTTP header authentication](http://tools.ietf.org/html/draft-hammer-http-token-auth-01). The API key objects are manageable through the `Apicasso::Key` model, which gets setup at install. When a new key is created a `.token` is generated using an [Universally Unique Identifier(RFC 4122)](https://tools.ietf.org/html/rfc4122).
72
-
73
- Each `Apicasso::Key` object has a token attribute, which is used to define the authorized access identification.
74
-
75
- Your Models are then exposed based on each `Apicasso::Key.scope` definition, which is a way to configure how much of your application each key can access. I.E.:
76
- ```ruby
77
- Apicasso::Key.create(scope:
78
- { manage:
79
- [{ order: true }, { user: { account_id: 1 } }],
80
- read:
81
- [{ account: { manager_id: 1 } }]
82
- })
83
- ```
84
- > The key from this example will have full access to all orders and to users with `account_id == 1`. It will have also read-only access to accounts with `id == 1`.
85
-
86
- A scope configured like this translates directly into which kind of access each key has on all of your application's models. This kind of authorization is why one of the dependencies for this gem is [CanCanCan](https://github.com/CanCanCommunity/cancancan), which abstracts the scope field into your API access control.
87
-
88
- You can have two kind of access control:
89
- * `true` - This will mean the key will have the declared clearance on **ALL** of this model's records
90
- * `Hash` - This will build a condition to what records this key have access to. A scope as `{ read: [{ account: { manager_id: 1 } }] }` will have read access into accounts with `manager_id == 1`
91
-
92
- This saves you the trouble of having to setup every controller for each model. And even if your application really needs it, just make your controllers inherit from `Apicasso::CrudController` extending it and enabling the use of `@object` and `@resource` variables to access what is being resquested.
93
-
94
- ## Features on index actions
95
-
96
- The index actions present in the gem are already equipped with pagination, ordering, grouping, fieldset selection and filtering. This will save you a lot of trouble, adding some best-practices conventions into your application's API.
97
-
98
- ### Sort
99
-
100
- You can sort a collection query by using a URL parameter with field names preffixed with `+` or `-` to configure custom ordering per request.
101
-
102
- To order a collection with ascending `updated_at` and descending `name` you can add the `sort` parameter with those fields as options, indicating which kind of ordination you want to give to each one:
103
- ```
104
- ?sort=+updated_at,-name
105
- ```
106
-
107
- ### Filtering/Search
108
-
109
- APIcasso has [ransack's search matchers](https://github.com/activerecord-hackery/ransack#search-matchers) on it's index actions. This means you can dynamically build search queries with any of your resource's fields, this will be done by using a `?q` parameter which groups all your filtering options on your requests. If you wanted to search all your records and return only the ones with `full_name` starting with `Picasso` your query would look something like this:
110
- ```
111
- ?q[full_name_start]=Picasso
112
- ```
113
- To build complex search queries you can chain many parameter options or check [ransack's wiki](https://github.com/activerecord-hackery/ransack/wiki/) on how to adapt this feature into your project's needs.
114
-
115
- ### Pagination
116
-
117
- Automatic pagination is done in index actions, with the adittion of some metadata to help on the data consumption. You can pass page and per page parameters to build pagination options into your needs. And on requests that you need unpaginated collections, just pass a lower than zero `per_page`. Example of a pagination query string:
118
- ```
119
- ?page=2&per_page=12
120
- ```
121
- Your colletion will be build inside a JSON along with some metadata about it. The response structure is:
122
- ```
123
- { entries: [{Record1}, {Record2}, {Record3} ... {Record12}],
124
- total: 1234,
125
- total_pages: 102,
126
- last_page: false,
127
- previous_page: localhost:3000/my_records?page=1&per_page=12,
128
- next_page: localhost:3000/my_records?page=3&per_page=12,
129
- out_of_bounds: false,
130
- offset: 12 }
131
- ```
132
-
133
- ### Fieldset selecting
134
-
135
- Sometimes your data can grow large in some tables and you need to consumed only a limited set of data on a given frontend application. To avoid large requests and filtering a lot of unused data with JS you can restrict which fields you need on your API's reponse. This is done adding a `?select` parameter. Just pass the field names you desire splitted by `,`
136
- Let's say you are building a user list with their name, e-mails and phones, to get only those fields your URL query would look something like:
137
- ```
138
- ?select=name,email,phone
139
- ```
140
- This will change the response to filter out the unwanted attributes.
141
-
142
- ### Grouping operations
143
-
144
- If you need to make grouping calculations, like:
145
- * Counting of all records, or by one **optional** field presence
146
- * Maximum value of one field
147
- * Minimum value of one field
148
- * Average value of one field
149
- * Value sum of one field
150
-
151
- Grouping is done by the combination of 3 parameters
152
- ```
153
- ?group[by]=a_field&group[calculate]=count&group[fields]=another_field
154
- ```
155
- Each of those attributes on the `?group` parameter represent an option of the query being made.
156
- - `group[by]` - Represents which field will be the key for the grouping behavior
157
- - `group[calculate]` - Which calculation will be sent in the response. Options are: `count`, `maximum`, `minimum`, `average`, `sum`
158
- - `group[fields]` - Represents which field will be the base for the response calculation.
159
-
160
- # Contributing
161
- Bug reports and pull requests are welcome on GitHub at https://github.com/ErvalhouS/APIcasso. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant code of conduct](http://contributor-covenant.org/). To find good places to start contributing, try looking into our issue list and our Codeclimate profile, or if you want to participate actively on what the core team is working on checkout our todo list:
162
-
163
- ### TODO
164
-
165
- - Abstract a configurable CORS approach, maybe using middleware.
166
- - Add gem options like: Token rotation, Alternative authentication methods
167
- - Add latest auto-documentation feature into README
168
- - Rate limiting
169
- - Testing suite
170
- - Travis CI
171
-
172
- # Code of conduct
173
- Everyone interacting in the APIcasso project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ErvalhouS/APIcasso/blob/master/CODE_OF_CONDUCT.md).
174
-
175
- # License
176
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
1
+ <img src="https://raw.githubusercontent.com/ErvalhouS/APIcasso/master/APIcasso.png" width="300" /> [![Gem Version](https://badge.fury.io/rb/apicasso.svg)](https://badge.fury.io/rb/apicasso) [![Docs Coverage](https://inch-ci.org/github/autoforce/APIcasso.svg?branch=master)](https://inch-ci.org/github/autoforce/APIcasso.svg?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/b58bbd6b9a0376f7cfc8/maintainability)](https://codeclimate.com/github/autoforce/APIcasso/maintainability) [![codecov](https://codecov.io/gh/autoforce/APIcasso/branch/master/graph/badge.svg)](https://codecov.io/gh/autoforce/APIcasso) [![Build Status](https://travis-ci.org/autoforce/APIcasso.svg?branch=master)](https://travis-ci.org/autoforce/APIcasso)
2
+
3
+ JSON API development can get boring and time consuming. If you think it through, every time you make one you use almost the same route structure, pointing to the same controller actions, with the same ordering, filtering and pagination features.
4
+
5
+ **APIcasso** is intended to be used as a full-fledged CRUD JSON API or as a base controller to speed-up development.
6
+ It is a route-based resource abstraction using API key scoping. This makes it possible to make CRUD-only applications just by creating functional Rails' models. It is a perfect candidate for legacy Rails projects that do not have an API. Access to your application's resources is managed by a `.scope` JSON object per API key. It uses that permission scope to restrict and extend access.
7
+
8
+ # Installation
9
+ Add this line to your application's `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'apicasso'
13
+ ```
14
+
15
+ And then execute this to generate the required migrations:
16
+ ```bash
17
+ $ bundle install && rails g apicasso:install
18
+ ```
19
+ You will need to use a database with JSON fields support to use this gem.
20
+
21
+ # Usage
22
+
23
+ **APIcasso** is meant to be used as an engine, which means you don't need to configure any route or controller to build a working CRUD API. Sometimes you also need some customized controller actions or even a specific logic to access some of your application's resources. In that case you will use `Apicasso::CrudController` class to easily build only your own logic around the API abstraction.
24
+
25
+ ## Mounting engine into `config/routes.rb`
26
+
27
+ After installing it, you can mount a full-fledged CRUD JSON API just by attaching into some route. Usually you will have it under a scoped route like `/api/v1` or a subdomain. You can do that by adding this into your `config/routes.rb`:
28
+ ```ruby
29
+ # To mount your APIcasso routes under the path scope `/api/v1`
30
+ mount Apicasso::Engine, at: "/api/v1"
31
+ # or, if you prefer subdomain scope isolation
32
+ constraints subdomain: 'apiv1' do
33
+ mount Apicasso::Engine, at: "/"
34
+ end
35
+ ```
36
+ Your API will reflect very similarly a `resources :resource` statement with the following routes:
37
+ ```ruby
38
+ get '/:resource/' # Index action, listing a `:resource` collection from your application
39
+ post '/:resource/' # Create action for one `:resource` from your application
40
+ get '/:resource/:id' # Show action for one `:resource` from your application
41
+ patch '/:resource/:id' # Update action for one `:resource` from your application
42
+ delete '/:resource/:id' # Destroy action for one `:resource` from your application
43
+ get '/:resource/:id/:nested/' # Index action, listing a collection of a `:nested` relation from one of your application's `:resource`
44
+ options '/:resource/' # A schema dump for the required `:resource`
45
+ options '/:resource/:id/:nested/' # A schema dump for the required `:nested` relation from one of your application's `:resource`
46
+ ```
47
+
48
+ This means all your application's models will be exposed as `:resource` and it's relations will be exposed as `:nested`. It will enable you to CRUD and get schema metadata from your records.
49
+
50
+ ## Extending base API actions
51
+
52
+ When your application needs some kind of custom interaction that is not covered by APIcasso's CRUD approach you can make your own actions using our base classes and objects to go straight into your logic. If you have built the APIcasso's engine into a route it is important that your custom action takes precedence over the gem's ones. To do that you need to declare your custom route before the engine on you `config/routes.rb`
53
+ ```ruby
54
+ match '/:resource/:id/a-custom-action' => 'custom#not_a_crud', via: :get
55
+ mount Apicasso::Engine, at: "/api/v1"
56
+ ```
57
+ And in your `app/controllers/custom_controller.rb` you would have something like:
58
+ ```ruby
59
+ class CustomController < Apicasso::CrudController
60
+ def not_a_crud
61
+ render json: @object.some_operation
62
+ end
63
+ end
64
+ ```
65
+ This way you enjoy all our object finder, authorization and authentication features, making your job more straight into your business logic.
66
+
67
+ ## Authorization/Authentication
68
+
69
+ > But exposing my models to the internet is permissive as hell! Haven't you thought about security?
70
+
71
+ *Sure!* The **APIcasso** suite is exposing your application using authentication through `Authorization: Token` [HTTP header authentication](http://tools.ietf.org/html/draft-hammer-http-token-auth-01). The API key objects are manageable through the `Apicasso::Key` model, which gets setup at install. When a new key is created a `.token` is generated using an [Universally Unique Identifier(RFC 4122)](https://tools.ietf.org/html/rfc4122).
72
+
73
+ Each `Apicasso::Key` object has a token attribute, which is used to define the authorized access identification.
74
+
75
+ Your Models are then exposed based on each `Apicasso::Key.scope` definition, which is a way to configure how much of your application each key can access. I.E.:
76
+ ```ruby
77
+ Apicasso::Key.create(scope:
78
+ { manage:
79
+ [{ order: true }, { user: { account_id: 1 } }],
80
+ read:
81
+ [{ account: { manager_id: 1 } }]
82
+ })
83
+ ```
84
+ > The key from this example will have full access to all orders and to users with `account_id == 1`. It will have also read-only access to accounts with `id == 1`.
85
+
86
+ A scope configured like this translates directly into which kind of access each key has on all of your application's models. This kind of authorization is why one of the dependencies for this gem is [CanCanCan](https://github.com/CanCanCommunity/cancancan), which abstracts the scope field into your API access control.
87
+
88
+ You can have two kind of access control:
89
+ * `true` - This will mean the key will have the declared clearance on **ALL** of this model's records
90
+ * `Hash` - This will build a condition to what records this key have access to. A scope as `{ read: [{ account: { manager_id: 1 } }] }` will have read access into accounts with `manager_id == 1`
91
+
92
+ This saves you the trouble of having to setup every controller for each model. And even if your application really needs it, just make your controllers inherit from `Apicasso::CrudController` extending it and enabling the use of `@object` and `@resource` variables to access what is being resquested.
93
+
94
+ ## Features on index actions
95
+
96
+ The index actions present in the gem are already equipped with pagination, ordering, grouping, fieldset selection and filtering. This will save you a lot of trouble, adding some best-practices conventions into your application's API.
97
+
98
+ ### Sort
99
+
100
+ You can sort a collection query by using a URL parameter with field names preffixed with `+` or `-` to configure custom ordering per request.
101
+
102
+ To order a collection with ascending `updated_at` and descending `name` you can add the `sort` parameter with those fields as options, indicating which kind of ordination you want to give to each one:
103
+ ```
104
+ ?sort=+updated_at,-name
105
+ ```
106
+
107
+ ### Filtering/Search
108
+
109
+ APIcasso has [ransack's search matchers](https://github.com/activerecord-hackery/ransack#search-matchers) on it's index actions. This means you can dynamically build search queries with any of your resource's fields, this will be done by using a `?q` parameter which groups all your filtering options on your requests. If you wanted to search all your records and return only the ones with `full_name` starting with `Picasso` your query would look something like this:
110
+ ```
111
+ ?q[full_name_start]=Picasso
112
+ ```
113
+ To build complex search queries you can chain many parameter options or check [ransack's wiki](https://github.com/activerecord-hackery/ransack/wiki/) on how to adapt this feature into your project's needs.
114
+
115
+ ### Pagination
116
+
117
+ Automatic pagination is done in index actions, with the adittion of some metadata to help on the data consumption. You can pass page and per page parameters to build pagination options into your needs. And on requests that you need unpaginated collections, just pass a lower than zero `per_page`. Example of a pagination query string:
118
+ ```
119
+ ?page=2&per_page=12
120
+ ```
121
+ Your colletion will be build inside a JSON along with some metadata about it. The response structure is:
122
+ ```
123
+ { entries: [{Record1}, {Record2}, {Record3} ... {Record12}],
124
+ total: 1234,
125
+ total_pages: 102,
126
+ last_page: false,
127
+ previous_page: localhost:3000/my_records?page=1&per_page=12,
128
+ next_page: localhost:3000/my_records?page=3&per_page=12,
129
+ out_of_bounds: false,
130
+ offset: 12 }
131
+ ```
132
+
133
+ ### Fieldset selecting
134
+
135
+ Sometimes your data can grow large in some tables and you need to consumed only a limited set of data on a given frontend application. To avoid large requests and filtering a lot of unused data with JS you can restrict which fields you need on your API's reponse. This is done adding a `?select` parameter. Just pass the field names you desire splitted by `,`
136
+ Let's say you are building a user list with their name, e-mails and phones, to get only those fields your URL query would look something like:
137
+ ```
138
+ ?select=name,email,phone
139
+ ```
140
+ This will change the response to filter out the unwanted attributes.
141
+
142
+ ### Grouping operations
143
+
144
+ If you need to make grouping calculations, like:
145
+ * Counting of all records, or by one **optional** field presence
146
+ * Maximum value of one field
147
+ * Minimum value of one field
148
+ * Average value of one field
149
+ * Value sum of one field
150
+
151
+ Grouping is done by the combination of 3 parameters
152
+ ```
153
+ ?group[by]=a_field&group[calculate]=count&group[fields]=another_field
154
+ ```
155
+ Each of those attributes on the `?group` parameter represent an option of the query being made.
156
+ - `group[by]` - Represents which field will be the key for the grouping behavior
157
+ - `group[calculate]` - Which calculation will be sent in the response. Options are: `count`, `maximum`, `minimum`, `average`, `sum`
158
+ - `group[fields]` - Represents which field will be the base for the response calculation.
159
+
160
+ # Contributing
161
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ErvalhouS/APIcasso. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant code of conduct](http://contributor-covenant.org/). To find good places to start contributing, try looking into our issue list and our Codeclimate profile, or if you want to participate actively on what the core team is working on checkout our todo list:
162
+
163
+ ### TODO
164
+
165
+ - Abstract a configurable CORS approach, maybe using middleware.
166
+ - Add gem options like: Token rotation, Alternative authentication methods
167
+ - Add latest auto-documentation feature into README
168
+ - Rate limiting
169
+ - Testing suite
170
+ - Travis CI
171
+
172
+ # Code of conduct
173
+ Everyone interacting in the APIcasso project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/ErvalhouS/APIcasso/blob/master/CODE_OF_CONDUCT.md).
174
+
175
+ # License
176
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,32 +1,32 @@
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
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'Apicasso'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.md')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
- load 'rails/tasks/engine.rake'
19
-
20
- load 'rails/tasks/statistics.rake'
21
-
22
- require 'bundler/gem_tasks'
23
-
24
- require 'rake/testtask'
25
-
26
- Rake::TestTask.new(:test) do |t|
27
- t.libs << 'test'
28
- t.pattern = 'test/**/*_test.rb'
29
- t.verbose = false
30
- end
31
-
32
- task default: :test
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
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Apicasso'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+ load 'rails/tasks/statistics.rake'
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
+ t.verbose = false
30
+ end
31
+
32
+ task default: :test