Skip to content

Commit

Permalink
chore(refactor-api-documentation): use slate for api documentation
Browse files Browse the repository at this point in the history
- fix user should be able to change password feeature
- refactor readme documentation
- remove multiple eslint config files
- fix restart dyno issues in production
  • Loading branch information
adesege committed Dec 13, 2017
1 parent 8d18e5a commit cad5def
Show file tree
Hide file tree
Showing 69 changed files with 15,716 additions and 194 deletions.
33 changes: 0 additions & 33 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ client/build
.vscode
e2e-tests
e2e-test-output
nightwatch.**
nightwatch.**
server/src/docs
2 changes: 1 addition & 1 deletion .hound.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
eslint:
enabled: true
config_file: .eslintrc.json
config_file: .eslintrc
ignore_file: .eslintignore
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ before_script:
- psql -c 'create database travis;' -U postgres
- npm run build
script:
- npm run coveralls
- npm run test:coverage
after_success:
- istanbul-combine -d merged-coverage -p summary -r lcov client/coverage/coverage-*.json coverage/coverage-*.json
- codeclimate-test-reporter < merged-coverage/lcov.info
Expand Down
13 changes: 13 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ruby '>=2.3.1'
source 'https://rubygems.org'

# Middleman
gem 'middleman', '~>4.2.1'
gem 'middleman-syntax', '~> 3.0.0'
gem 'middleman-autoprefixer', '~> 2.7.0'
gem "middleman-sprockets", "~> 4.1.0"
gem 'rouge', '~> 2.0.5'
gem 'redcarpet', '~> 3.4.0'
gem 'nokogiri', '~> 1.6.8'

gem "rake"
131 changes: 131 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.0.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.0)
public_suffix (~> 2.0, >= 2.0.2)
autoprefixer-rails (6.6.1)
execjs
backports (3.6.8)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
concurrent-ruby (1.0.4)
contracts (0.13.0)
dotenv (2.2.0)
erubis (2.7.0)
execjs (2.7.0)
fast_blank (1.0.0)
fastimage (2.0.1)
addressable (~> 2)
ffi (1.9.17)
haml (4.0.7)
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.5.1)
i18n (0.7.0)
kramdown (1.13.2)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
memoist (0.15.0)
middleman (4.2.1)
coffee-script (~> 2.2)
compass-import-once (= 1.0.5)
haml (>= 4.0.5)
kramdown (~> 1.2)
middleman-cli (= 4.2.1)
middleman-core (= 4.2.1)
sass (>= 3.4.0, < 4.0)
middleman-autoprefixer (2.7.1)
autoprefixer-rails (>= 6.5.2, < 7.0.0)
middleman-core (>= 3.3.3)
middleman-cli (4.2.1)
thor (>= 0.17.0, < 2.0)
middleman-core (4.2.1)
activesupport (>= 4.2, < 5.1)
addressable (~> 2.3)
backports (~> 3.6)
bundler (~> 1.1)
contracts (~> 0.13.0)
dotenv
erubis
execjs (~> 2.0)
fast_blank
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 0.7.0)
listen (~> 3.0.0)
memoist (~> 0.14)
padrino-helpers (~> 0.13.0)
parallel
rack (>= 1.4.5, < 3)
sass (>= 3.4)
servolux
tilt (~> 2.0)
uglifier (~> 3.0)
middleman-sprockets (4.1.0)
middleman-core (~> 4.0)
sprockets (>= 3.0)
middleman-syntax (3.0.0)
middleman-core (>= 3.2)
rouge (~> 2.0)
mini_portile2 (2.1.0)
minitest (5.10.1)
nokogiri (1.6.8.1)
mini_portile2 (~> 2.1.0)
padrino-helpers (0.13.3.3)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.3)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.3)
activesupport (>= 3.1)
parallel (1.10.0)
public_suffix (2.0.5)
rack (2.0.1)
rake (12.3.0)
rb-fsevent (0.9.8)
rb-inotify (0.9.8)
ffi (>= 0.5.0)
redcarpet (3.4.0)
rouge (2.0.7)
sass (3.4.23)
servolux (0.12.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
thor (0.19.4)
thread_safe (0.3.5)
tilt (2.0.6)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.4)
execjs (>= 0.3.0, < 3)

PLATFORMS
ruby

DEPENDENCIES
middleman (~> 4.2.1)
middleman-autoprefixer (~> 2.7.0)
middleman-sprockets (~> 4.1.0)
middleman-syntax (~> 3.0.0)
nokogiri (~> 1.6.8)
rake
redcarpet (~> 3.4.0)
rouge (~> 2.0.5)

RUBY VERSION
ruby 2.3.3p222

BUNDLED WITH
1.16.0
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2017 Fadojutimi Temitayo Olusegun

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 2 additions & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
web: npm run start
clock: node server/dist/api/v1/cron/index.js
clock: node server/dist/api/v1/cron/index.js
rake: rake default
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
[![Coverage Status](https://coveralls.io/repos/github/adesege/HelloBooks/badge.svg?branch=development)](https://coveralls.io/github/adesege/HelloBooks?branch=development)
[![Issue Count](https://codeclimate.com/github/adesege/HelloBooks/badges/issue_count.svg)](https://codeclimate.com/github/adesege/HelloBooks)

# Hello-Books
# Hello-Books
A simple application that helps manage a library and its processes like stocking, tracking and renting books.

Built on `Javascript` with `Postgres` as database.
Built on `Nodejs`.

<img width="1440" alt="screen shot 2017-12-13 at 5 29 15 pm" src="https://user-images.githubusercontent.com/20769821/33949896-313c8d4c-e02b-11e7-89c6-df0f6dfd6b95.png">


## How to install
### Pre-requisites
Expand All @@ -17,7 +20,10 @@ You will need to have the following installed in your working environment before
### Installing
1. Download or clone this branch at https://github.com/adesege/HelloBooks.git
2. Install dependencies by running `npm install`. Ensure you are in your working directory. Run `cd /path/to/HelloBooks` to change.
3. Start the server by running `npm run watch`.
1. Go to client directory and run `npm run install` to install dependencies.
3. Go to the root dir `cd ../`
1. Then type `npm run transpile` to transpile from es6 to es5
1. and then run `npm run start:dev` in your terminal to start the server.
1. To start the client, `cd client`
1. Then `npm run start`

Expand All @@ -32,11 +38,27 @@ This application uses JSON web token to sign and verify users. The default expir
Some endpoints are restricted to logged users and admins only. E.g. Only admin can access `api/:versionNumber/books/stocks`.

There are two middlewares defined in this application.
* middleware - verifies a user's token and checks if the user is valid.
* adminAuthenticate middleware - checks if the user is `admin`.
* authMiddleware - verifies a user's token and checks if the user is valid.
* adminMiddleware - checks if the user is `admin`.

## Documentation
Please visit the application documentation at https://app.swaggerhub.com/apis/adesege/Hello-Books/1.0.0
> If Ruby is already installed, but the bundle command doesn't work, just run `gem install bundler` in a terminal.
### Starting the server
1. `cd slate` from the root directory.
1. Initialize and start Slate. You can either do this locally, or with Vagrant:
```js
npm run slate:install
# then
npm run slate:build
# finally
npm run slate:start
# OR run this to run with vagrant
vagrant up
```

Please visit the application documentation at http://hellobooks.herokuapp.com/docs/v1 or http://localhost:4567 to test locally

To deploy generated files into your application, run `npm run build`

# Author

Expand All @@ -60,4 +82,7 @@ To contribute,
1. Be prepared to answer questions and incorporate feedback even if requests for this arrive weeks or months after your MR submission
1. If a discussion has been addressed, select the "Resolve discussion" button beneath it to mark it resolved.
1. When writing commit messages please follow
[these guidelines](http://chris.beams.io/posts/git-commit).
[these guidelines](http://chris.beams.io/posts/git-commit).

# License
This project is licensed under the MIT license. Click **[here](blob/master/LICENSE.md)** to read the license in full
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

task default: :deploy

task :deploy do
Dir.chdir('slate') do
sh "./deploy.sh"
end
end
48 changes: 0 additions & 48 deletions client/.eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion client/.hound.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
eslint:
enabled: true
config_file: .eslintrc.json
config_file: .eslintrc
ignore_file: .eslintignore
7 changes: 4 additions & 3 deletions client/config/webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ module.exports = merge(common, {
publicPath: `http://localhost:${PORT}/`,
historyApiFallback: true,
hot: true,
proxy: {
'/api': 'http://0.0.0.0:5000'
},
proxy: [{
context: ['/api', '/docs'],
target: 'http://0.0.0.0:5000',
}],
overlay: true,
watchContentBase: true,
watchOptions: {
Expand Down
4 changes: 3 additions & 1 deletion client/src/actions/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,6 @@ export const getUsers = payload =>
export const updateUser = payload =>
(dispatch) =>
axios
.put(`users/${payload.userId}`, payload);
.put(`users/${payload.userId}`, payload)
.then((response) => response)
.catch((errors) => errors);
1 change: 0 additions & 1 deletion client/src/components/Books/ViewBooks/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ class ViewBooks extends React.Component {
ISBN,
Category
} = this.state.book;
console.log(Category, '-----------');
const {
params,
borrowBookAction,
Expand Down

0 comments on commit cad5def

Please sign in to comment.