1 | # Punchcard CMS [![Build Status](https://travis-ci.org/punchcard-cms/punchcard.svg?branch=master)](https://travis-ci.org/punchcard-cms/punchcard) [![Coverage Status](https://coveralls.io/repos/github/punchcard-cms/punchcard/badge.svg?branch=master)](https://coveralls.io/github/punchcard-cms/punchcard?branch=master) [![Code Climate](https://codeclimate.com/github/punchcard-cms/punchcard/badges/gpa.svg)](https://codeclimate.com/github/punchcard-cms/punchcard)
|
2 |
|
3 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/punchcard-cms/demo)
|
4 |
|
5 | Headless Content Management System designed with content strategy at its heart. Built with Node.
|
6 |
|
7 | ## Install and Usage
|
8 |
|
9 | ```bash
|
10 | npm i punchcard-cms --save
|
11 | ```
|
12 |
|
13 | ```javascript
|
14 | const punchcard = require('punchcard-cms');
|
15 |
|
16 | punchcard().then(app => {
|
17 | app.listen(8080);
|
18 | })
|
19 | ```
|
20 |
|
21 | ## Setting File Storage
|
22 |
|
23 | Punchcard uses any [Vinyl Adapter](https://www.npmjs.com/package/vinyl#what-is-a-vinyl-adapter) that your heart desires. A good first place to start is searching for [vinyl on NPM](https://www.npmjs.com/search?q=vinyl). Punchcard assumes all vinyl adapters are named `vinyl-adapter`.
|
24 |
|
25 | ## Developing Locally
|
26 |
|
27 | Make sure PostgresSQL is set up locally (see below)
|
28 |
|
29 | Install all the things
|
30 |
|
31 | ```bash
|
32 | npm install
|
33 | ```
|
34 |
|
35 | Run the following to run both the database and get the server running:
|
36 |
|
37 | ```bash
|
38 | $ npm run dev
|
39 | ```
|
40 |
|
41 | ## debug mode
|
42 |
|
43 | Uses node's [built in inspector](https://medium.com/@paul_irish/debugging-node-js-nightlies-with-chrome-devtools-7c4a1b95ae27#.vgad4zqg9). This works in **chrome only**.
|
44 |
|
45 | ```bash
|
46 | $ npm run dev:database
|
47 | ```
|
48 |
|
49 | then in a separate window:
|
50 |
|
51 | ```bash
|
52 | $ npm run debug
|
53 | ```
|
54 |
|
55 | There will be instructions and a link to paste into chrome shown in the terminal after this `debug` command is run.
|
56 |
|
57 |
|
58 |
|
59 | ## Setting up PostgreSQL locally
|
60 |
|
61 | 1. Make sure you have homebrew installed: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
|
62 |
|
63 | 2. `brew update`
|
64 | 3. `brew install postgres`
|
65 | 4. start the postgres server: `postgres -D /usr/local/var/postgres`
|
66 |
|
67 | 5. open new terminal tab
|
68 | 6. create a postgres user (it'll prompt for a password use `W@ts0n`): `createuser punchcard -P`
|
69 |
|
70 | 7. Create local CMS database: `createdb -O punchcard punchcard`
|
71 |
|
72 | 8. Create local test database: `createdb -O punchcard punchcard_test`
|
73 |
|
74 | 9. reconnect to psql as new user: `psql -d punchcard -U punchcard`
|
75 |
|
76 | 10. connect to db: `\connect punchcard`
|
77 |
|
78 | Once you are connected you should be able to use psql cli syntax to check tables.
|
79 | * `\d+` checks table relations
|
80 | * `\l` lists all available databases
|
81 | * `select * from "database_name";` Displays all rows in database, replacing database_name with the table you want to see.
|
82 | * list all tables for user punchcard: `\c punchcard \dt`
|
83 |
|
84 | ## Changelog
|
85 |
|
86 | See the [latest release](https://github.com/punchcard-cms/punchcard/releases/latest) for the most recent changelog
|