Three steps:
node_modules
(which might take long)$ brew install mysql postgres sqlite
$ brew service start mysql
$ brew service start postgres
$ npm install
# prepare table schema, run all tests
$ npm run test
# run unit tests
$ npm run test:unit
# run integration tests
$ npm run test:integration
# run typescript definition tests
$ npm run test:dts
To be more specific, we can filter test files and cases:
$ npm run test -- test/unit/test.connect.js --grep "should work"
$ npm run test:unit --grep "=> Sequelize adapter"
$ npm run test:mysql --grep "bone.toJSON()"
If --grep [pattern]
isn’t specific enough, we can always insert .only
:
describe('=> Spell', function() {
it.only('supports error convention with nodeify', async function() {
// asserts
});
});
Please remember to remove them before commit.
The Leoric documentation is served with Github Pages, which requries Jekyll to build. See the Jekyll on macOS instructions, refer to the guide Install Ruby on Mac, or use Moncef Belyamani’s Ruby setup scripts. If you only intend to use Jekyll, you can install Ruby with Homebrew without a version manager. After Ruby is installed, follow instructions to install Jekyll.
If your network struggles to connect to https://rubygems.org, consider changing the Ruby Gems source in docs/Gemfile
:
diff --git a/docs/Gemfile b/docs/Gemfile
index 4382725..b4dba82 100644
--- a/docs/Gemfile
+++ b/docs/Gemfile
@@ -1,4 +1,4 @@
-source "https://rubygems.org"
+source "https://gems.ruby-china.com"
When bundle install completes, you can now build docs locally:
$ cd docs # if you're not at this directory yet
$ jekyll serve
Configuration file: leoric/docs/_config.yml
Source: leoric/docs
Destination: leoric/docs/_site
Incremental build: disabled. Enable with --incremental
Generating...
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
done in 3.73 seconds.
Auto-regeneration: enabled for 'leoric/docs'
Server address: http://127.0.0.1:4000/
Server running... press ctrl-c to stop.
The documentation will be available at http://localhost:4000/.
The code basically breaks into following layers (from bottom to top):
lib/expr.js
lib/spell.js
, which breaks SQL into accessible propertieslib/drivers/*.js
, which generates vendor specific SQLs then queries said SQLslib/bone.js
, which serve as the base modellib/sequelize.js
The model driver provides following abilities:
lib/drivers/*/attribute.js
lib/drivers/*/data_types.js
lib/drivers/*/schema.js
lib/drivers/*/spellbook.js
lib/drivers/*/index.js