barebones 1.0.0.0 → 1.0.0.1
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/README.md +2 -2
- data/barebones.gemspec +1 -1
- data/lib/barebones/builders/app_builder.rb +2 -3
- data/templates/Gemfile.erb +1 -0
- data/templates/README.md.erb +39 -9
- data/templates/api_defaults_concern.rb +4 -13
- data/templates/configs_controller.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6730d84018a95de05e6d6a911df3375a2bfd5d15
|
4
|
+
data.tar.gz: 3b6359919ce2d8c0f28915bf486c057817faabf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13fbdf96ed289e8fc4c642ec8cbdec3d2a39bc0fbe63242395dd8bccdcf68a50bd4e225018808a200f783ebca6d3d36b7c2115727a7051ce60e00f1f6d40e00f
|
7
|
+
data.tar.gz: dd3503fd99e785af18e154d4c1b31eaa8dd05505be8bfb1bab82f1c39f8491c65b54b88da66af7f3eb049295d8a14a54846eaf846d2f407113c1b343ba1e08af
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ Barebones' [Gemfile](templates/Gemfile.erb) includes various preconfigured gems
|
|
44
44
|
* [Byebug](https://github.com/deivid-rodriguez/byebug) for debugging
|
45
45
|
* [Pry Byebug](https://github.com/deivid-rodriguez/pry-byebug) for debugging background jobs
|
46
46
|
* [Web Console](https://github.com/rails/web-console) for debugging views
|
47
|
-
* [Awesome Print](https://github.com/
|
47
|
+
* [Awesome Print](https://github.com/awesome-print/awesome_print) for pretty printing command line objects
|
48
48
|
|
49
49
|
##Testing
|
50
50
|
* [Minitest](https://github.com/blowmage/minitest-rails) for TDD/BDD
|
@@ -76,4 +76,4 @@ PostgreSQL (9.4) on your local machine.
|
|
76
76
|
Barebones is copyright © 2015-2016 Danny Yu.
|
77
77
|
It is free software, and may be redistributed under the terms specified in the [LICENSE] file.
|
78
78
|
|
79
|
-
[LICENSE]: LICENSE
|
79
|
+
[LICENSE]: LICENSE
|
data/barebones.gemspec
CHANGED
@@ -75,9 +75,8 @@ module Barebones
|
|
75
75
|
def create_api_layouts
|
76
76
|
empty_directory "app/views/layouts/api/v1"
|
77
77
|
template "layout.json.jbuilder", "app/views/layouts/api/v1/application.json.jbuilder"
|
78
|
-
empty_directory "app/views/api/defaults"
|
79
|
-
create_file "app/views/api/defaults/
|
80
|
-
create_file "app/views/api/defaults/fail.json.jbuilder"
|
78
|
+
empty_directory "app/views/api/v1/defaults"
|
79
|
+
create_file "app/views/api/v1/defaults/default.json.jbuilder"
|
81
80
|
end
|
82
81
|
|
83
82
|
def customize_secrets
|
data/templates/Gemfile.erb
CHANGED
data/templates/README.md.erb
CHANGED
@@ -1,18 +1,48 @@
|
|
1
1
|
# <%= app_name.humanize %>
|
2
2
|
|
3
|
-
|
3
|
+
## Getting Started
|
4
4
|
|
5
|
-
|
5
|
+
### Setting Up Postgresql
|
6
6
|
`psql`
|
7
|
-
`CREATE ROLE <%= app_name.parameterize.underscore %>_admin
|
7
|
+
`CREATE ROLE <%= app_name.parameterize.underscore %>_admin;`
|
8
8
|
`ALTER ROLE <%= app_name.parameterize.underscore %>_admin WITH LOGIN CREATEDB REPLICATION SUPERUSER;`
|
9
|
-
`
|
10
|
-
`rake db:setup`
|
9
|
+
`\q`
|
11
10
|
|
12
|
-
|
11
|
+
### Installing Dependencies
|
12
|
+
|
13
|
+
To run this code, you must have Rails 5.0 and Ruby 2.3.1 installed. Then you just have to run:
|
14
|
+
|
15
|
+
`bundle install`
|
16
|
+
|
17
|
+
### Setting Up The Server
|
13
18
|
|
14
19
|
`bundle install`
|
15
|
-
`rake db:migrate db:
|
20
|
+
`rake db:setup db:migrate db:seed`
|
21
|
+
|
22
|
+
### Hosts Files
|
23
|
+
The API uses a subdomain so if you wish to run this code locally, in your `/etc/hosts` file, you should add:
|
24
|
+
|
25
|
+
```
|
26
|
+
127.0.0.1 api.localhost.local
|
27
|
+
127.0.0.1 devapi.localhost.local
|
28
|
+
```
|
29
|
+
|
30
|
+
### Running The Server
|
31
|
+
Run `rails s -p [port#]` to start the server.
|
32
|
+
|
33
|
+
## The API
|
34
|
+
|
35
|
+
All local requests to the API should be done through the subdomain: `http://devapi.localhost.local:{PORT#}/`
|
36
|
+
All API requests default to using an accept header with `application/com.<%= app_name.parameterize.underscore %>_admin.v1` unless otherwise specified.
|
37
|
+
|
38
|
+
### Standard Response Structure
|
39
|
+
|
40
|
+
The JSON response is modeled after the [JSend](https://labs.omniti.com/labs/jsend) Standard:
|
41
|
+
|
42
|
+
```
|
43
|
+
{
|
44
|
+
status : 200,
|
45
|
+
data : {...}
|
46
|
+
}
|
16
47
|
|
17
|
-
|
18
|
-
Run `rails s -p [port#]` to start the server.
|
48
|
+
```
|
@@ -3,25 +3,16 @@ module ApiDefaults
|
|
3
3
|
|
4
4
|
# Default Paths
|
5
5
|
API_VIEW_PATH = "api/v1"
|
6
|
-
|
7
|
-
API_DEFAULT_FAIL_PATH = "defaults/fail"
|
8
|
-
|
9
|
-
# Statuses
|
10
|
-
SUCCESS = 200
|
11
|
-
INTERNAL_SERVER_ERROR = 500
|
6
|
+
API_DEFAULT_PATH = "defaults/default"
|
12
7
|
|
13
8
|
included do
|
14
9
|
layout 'api/v1/application'
|
15
10
|
|
16
|
-
def
|
17
|
-
@status =
|
18
|
-
return render template: "#{API_VIEW_PATH}/#{path}", status:
|
11
|
+
def render_api(status, path=ApiDefaults::API_DEFAULT_PATH)
|
12
|
+
@status = status
|
13
|
+
return render template: "#{API_VIEW_PATH}/#{path}", status: status
|
19
14
|
end
|
20
15
|
|
21
|
-
def render_api_fail(path=ApiDefaults::API_DEFAULT_FAIL_PATH)
|
22
|
-
@status = ApiDefaults::INTERNAL_SERVER_ERROR
|
23
|
-
return render template: "#{API_VIEW_PATH}/#{path}", status: ApiDefaults::INTERNAL_SERVER_ERROR
|
24
|
-
end
|
25
16
|
end
|
26
17
|
|
27
18
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: barebones
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Yu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|