Config and naming

- issue #154, issue #224 and issue #220
- change port number from 3333 to 2368
- change main file name from app.js to index.js
- update README & package.json to match
This commit is contained in:
Hannah Wolfe 2013-07-07 16:50:50 +01:00
parent b37f542448
commit 3d2b56b6a9
8 changed files with 75 additions and 32 deletions

View File

@ -1,5 +0,0 @@
{
"glob": ["README.md", "config.js", "app.js", "core/ghost.js", "core/admin/assets/js/*.js", "core/frontend/helpers/index.js", "core/lang/i18n.js"],
"except": ["core/admin/assets/lib/chart.min.js"],
"out": "./docs"
}

View File

@ -138,7 +138,7 @@ var path = require('path'),
"glob": [
"README.md",
"config.js",
"app.js",
"index.js",
"core/ghost.js",
"core/admin/assets/js/*.js",
"core/admin/assets/js/**/*.js",

View File

@ -36,7 +36,7 @@ Note - this is still very alpha. Not everything works yet.
* Database
* The database is created and populated with basic data on first run of the server
* New posts and edits save and last forever
* The data can be reset by opening data/datastore.db and emptying the file. The next restart of the server will cause the database to be recreated and repopulated.
* The data can be reset by finding core/shared/data/*.db and emptying or deleting the file. The next restart of the server will cause the database to be recreated and repopulated.
* Frontend
* Homepage lists a number of posts as configured in config.js
* Clicking on an individual post loads an individual post page
@ -53,7 +53,7 @@ Note - this is still very alpha. Not everything works yet.
* Usually if you're within vagrant, and have installed the guest plugins and updated that, this will not happen
3. run `grunt init` from the root. (make sure you have Casper 1.1 installed though, or have installed `bourbon` on your vagrant. See Ghost-Vagrant for that)
Frontend can be located at [localhost:3333](localhost:3333), Admin is at [localhost:3333/ghost](localhost:3333/ghost)
Frontend can be located at [localhost:2368](localhost:2368), Admin is at [localhost:2368/ghost](localhost:2368/ghost)
Whist developing you may wish to use **grunt watch** to watch for changes to handlebars and sass and recompile automatically
@ -64,7 +64,7 @@ Pulling down the latest changes from master will often require more than just a
* **npm install** - fetch any new dependencies
* **grunt** - will recompile handlebars templates and sass for the admin (as long as you have previously run grunt init to install bourbon)
* git submodule update - fetch the latest changes to Casper (the default theme)
* delete core/shared/data/testdb.db - delete the database and allow Ghost to recreate the fixtures
* delete core/shared/data/*.db - delete the database and allow Ghost to recreate the fixtures
### SQLite3 Install Instructions
Ghost depends upon SQLite3, which has to be built for each OS. NPM is as smart as it can be about this, and as long as your machine has all the pre-requisites for compiling/building a C++ program, the npm install still works.

View File

@ -53,34 +53,74 @@ config.nav = [{
url: '/'
}];
config.database = {
config.env = {
testing: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/core/shared/data/tests.db')
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/core/shared/data/ghost-test.db')
}
},
url: {
host: '127.0.0.1',
port: '2368'
}
},
travis: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/core/shared/data/tests.db')
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/core/shared/data/ghost-travis.db')
}
},
url: {
host: '127.0.0.1',
port: '2368'
}
// debug: true
},
development: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/core/shared/data/testdb.db')
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/core/shared/data/ghost-dev.db')
},
debug: true
},
debug: false
// debug: true
url: {
host: '127.0.0.1',
port: '2368'
}
},
staging: {},
staging: {
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/core/shared/data/ghost-staging.db')
},
debug: false
},
url: {
host: '127.0.0.1',
port: '2368'
}
},
production: {}
production: {
database: {
client: 'sqlite3',
connection: {
filename: path.join(__dirname, '/core/shared/data/ghost.db')
},
debug: false
},
url: {
host: '127.0.0.1',
port: '2368'
}
}
};
/**

View File

@ -47,7 +47,7 @@ module.exports = {
{
"uuid": uuid.v4(),
"key": "url",
"value": "http://localhost:3333",
"value": "http://localhost:2368",
"created_by": 1,
"updated_by": 1,
"type": "blog"

View File

@ -4,7 +4,7 @@ var GhostBookshelf,
// Initializes Bookshelf as its own instance, so we can modify the Models and not mess up
// others' if they're using the library outside of ghost.
GhostBookshelf = Bookshelf.Initialize('ghost', config.database[process.env.NODE_ENV || 'development']);
GhostBookshelf = Bookshelf.Initialize('ghost', config.env[process.env.NODE_ENV || 'development'].database);
// The Base Model which other Ghost objects will inherit from,
// including some convenience functions as static properties on the model.

18
app.js → index.js Executable file → Normal file
View File

@ -181,11 +181,19 @@ when.all([ghost.init(), filters.loadCoreFilters(ghost), helpers.loadCoreHelpers(
ghost.app().get('/', frontend.homepage);
ghost.app().get('/page/:page/', frontend.homepage);
ghost.app().listen(3333, function () {
// console.log("Express server listening on port " + 3333);
// Let everyone know we have finished loading
loading.resolve();
});
ghost.app().listen(
ghost.config().env[process.env.NODE_ENV || 'development'].url.port,
ghost.config().env[process.env.NODE_ENV || 'development'].url.host,
function () {
console.log("Express server listening on address:",
ghost.config().env[process.env.NODE_ENV || 'development'].url.host + ':'
+ ghost.config().env[process.env.NODE_ENV || 'development'].url.port);
// Let everyone know we have finished loading
loading.resolve();
}
);
}, errors.logAndThrowError);

View File

@ -3,7 +3,7 @@
"version": "0.1.1",
"private": true,
"scripts": {
"start": "node app",
"start": "node index",
"test": "grunt validate --verbose"
},
"dependencies": {