Skip to content

Commit 7dc16ac

Browse files
Merge pull request sailshq#9 from treelinehq/expose-library
Expose 'mysql' property on driver. Also update lodash + normalize boilerplate files.
2 parents 8263b6b + 1380269 commit 7dc16ac

17 files changed

+168
-52
lines changed

.editorconfig

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
# http://editorconfig.org
1+
# ╔═╗╔╦╗╦╔╦╗╔═╗╦═╗┌─┐┌─┐┌┐┌┌─┐┬┌─┐
2+
# ║╣ ║║║ ║ ║ ║╠╦╝│ │ ││││├┤ ││ ┬
3+
# o╚═╝═╩╝╩ ╩ ╚═╝╩╚═└─┘└─┘┘└┘└ ┴└─┘
4+
#
5+
# This file (`.editorconfig`) exists to help maintain consistent formatting
6+
# throughout this package, the Sails framework, and the Node-Machine project.
7+
#
8+
# To review what each of these options mean, see:
9+
# http://editorconfig.org/
210
root = true
311

412
[*]
513
indent_style = space
614
indent_size = 2
15+
end_of_line = lf
716
charset = utf-8
817
trim_trailing_whitespace = true
918
insert_final_newline = true
10-
11-
[*.md]
12-
trim_trailing_whitespace = false

.eslintrc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
2+
// ╔═╗╔═╗╦ ╦╔╗╔╔╦╗┬─┐┌─┐
3+
// ║╣ ╚═╗║ ║║║║ ║ ├┬┘│
4+
// o╚═╝╚═╝╩═╝╩╝╚╝ ╩ ┴└─└─┘
5+
// A set of basic conventions designed to complement the .jshintrc file.
6+
// For the master copy of this file, see the `.eslintrc` template file in
7+
// the `sails-generate` package (https://www.npmjs.com/package/sails-generate.)
28
"env": {
39
"node": true,
410
"mocha": true
511
},
612
"rules": {
7-
"array-bracket-spacing": [2, "never"],
813
"callback-return": [2, ["callback", "cb", "next", "done", "proceed"]],
914
"camelcase": [2, {"properties": "always"}],
1015
"comma-style": [2, "last"],

.gitignore

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,46 @@
1+
# ┌─┐┬┌┬┐╦╔═╗╔╗╔╔═╗╦═╗╔═╗
2+
# │ ┬│ │ ║║ ╦║║║║ ║╠╦╝║╣
3+
# o└─┘┴ ┴ ╩╚═╝╝╚╝╚═╝╩╚═╚═╝
4+
#
5+
# This file (`.gitignore`) exists to signify to `git` that certain files
6+
# and/or directories should be ignored for the purposes of version control.
7+
#
8+
# This is primarily useful for excluding temporary files of all sorts; stuff
9+
# generated by IDEs, build scripts, automated tests, package managers, or even
10+
# end-users (e.g. file uploads). `.gitignore` files like this also do a nice job
11+
# at keeping sensitive credentials and personal data out of version control systems.
12+
#
13+
114
############################
2-
# npm
15+
# sails / node.js / npm
316
############################
417
node_modules
518
npm-debug.log
6-
19+
.node_history
720

821
############################
9-
# tmp, editor & OS files
22+
# editor & OS files
1023
############################
11-
.tmp
1224
*.swo
1325
*.swp
1426
*.swn
1527
*.swm
28+
*.seed
29+
*.log
30+
*.out
31+
*.pid
32+
lib-cov
1633
.DS_STORE
1734
*#
35+
*\#
36+
.\#*
1837
*~
1938
.idea
39+
.netbeans
2040
nbproject
2141

22-
2342
############################
24-
# Tests
43+
# misc
2544
############################
26-
coverage
27-
28-
29-
############################
30-
# Other
31-
############################
32-
.node_history
33-
simple-test-script.js
45+
.tmp
46+
dump.rdb

.jshintrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@
8484
// read, albeit a bit less exciting)
8585
"laxcomma": false,
8686

87+
// Do NOT allow avant garde use of commas in conditional statements.
88+
// (this prevents accidentally writing code like:
89+
// ```
90+
// if (!_.contains(['+ci', '-ci', '∆ci', '+ce', '-ce', '∆ce']), change.verb) {...}
91+
// ```
92+
// See the problem in that code? Neither did we-- that's the problem!)
93+
"nocomma": true,
94+
8795
// Strictly enforce the consistent use of single quotes.
8896
// (this is a convention that was established primarily to make it easier
8997
// to grep [or FIND+REPLACE in Sublime] particular string literals in

.npmignore

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,34 @@
1-
*#
1+
.git
2+
./.gitignore
3+
./.jshintrc
4+
./.editorconfig
5+
./.travis.yml
6+
./appveyor.yml
7+
./example
8+
./examples
9+
./test
10+
./tests
11+
./.github
12+
213
node_modules
3-
ssl
4-
.DS_STORE
14+
npm-debug.log
15+
.node_history
516
*.swo
617
*.swp
718
*.swn
819
*.swm
20+
*.seed
21+
*.log
22+
*.out
23+
*.pid
24+
lib-cov
25+
.DS_STORE
26+
*#
27+
*\#
28+
.\#*
929
*~
1030
.idea
31+
.netbeans
1132
nbproject
12-
.git
13-
.gitignore
1433
.tmp
15-
.jshintrc
16-
.editorconfig
17-
CONTRIBUTING.md
18-
*.md
19-
**/*.md
20-
test
34+
dump.rdb

README.md

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
machinepack-mysql
44
</h1>
55

6-
### [Docs](http://node-machine.org/machinepack-mysql) &nbsp; [Browse other machines](http://node-machine.org/machinepacks) &nbsp; [FAQ](http://node-machine.org/implementing/FAQ) &nbsp; [Newsgroup](https://groups.google.com/forum/?hl=en#!forum/node-machine)
6+
Structured Node.js bindings for MySQL.
77

8-
Structured Node.js bindings for MySql.
8+
> See https://github.com/node-machine/driver-interface for more background information about this package.
99
1010

1111
## Installation &nbsp; [![NPM version](https://badge.fury.io/js/machinepack-mysql.svg)](http://badge.fury.io/js/machinepack-mysql) [![Build Status](https://travis-ci.org/treelinehq/machinepack-mysql.png?branch=master)](https://travis-ci.org/treelinehq/machinepack-mysql)
@@ -14,16 +14,35 @@ Structured Node.js bindings for MySql.
1414
$ npm install machinepack-mysql
1515
```
1616

17+
1718
## Usage
1819

19-
For the latest usage documentation, version information, and test status of this module, see <a href="http://node-machine.org/machinepack-mysql" title="Structured Node.js bindings for MySql. (for node.js)">http://node-machine.org/machinepack-mysql</a>. The generated manpages for each machine contain a complete reference of all expected inputs, possible exit states, and example return values. If you need more help, or find a bug, jump into [Gitter](https://gitter.im/node-machine/general) or leave a message in the project [newsgroup](https://groups.google.com/forum/?hl=en#!forum/node-machine).
20+
For the latest usage documentation, version information, and test status of this module, see <a href="http://node-machine.org/machinepack-mysql" title="Structured Node.js bindings for MySql. (for node.js)">http://node-machine.org/machinepack-mysql</a>. The generated manpages for each machine contain a complete reference of all expected inputs, possible exit states, and example return values.
21+
22+
23+
## Help
24+
25+
For more examples, or if you get stuck or have questions, click [here](http://sailsjs.com/support).
26+
27+
28+
## Bugs &nbsp; [![NPM version](https://badge.fury.io/js/machinepack-mysql.svg)](http://npmjs.com/package/machinepack-mysql)
29+
30+
To report a bug, [click here](http://sailsjs.com/bugs).
2031

21-
## About &nbsp; [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/node-machine/general?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2232

23-
This is a [machinepack](http://node-machine.org/machinepacks), an NPM module which exposes a set of related Node.js [machines](http://node-machine.org/spec/machine) according to the [machinepack specification](http://node-machine.org/spec/machinepack).
24-
Documentation pages for the machines contained in this module (as well as all other NPM-hosted machines for Node.js) are automatically generated and kept up-to-date on the <a href="http://node-machine.org" title="Public machine registry for Node.js">public registry</a>.
25-
Learn more at <a href="http://node-machine.org/implementing/FAQ" title="Machine Project FAQ (for implementors)">http://node-machine.org/implementing/FAQ</a>.
33+
## Contributing &nbsp; [![Build Status](https://travis-ci.org/balderdashy/machinepack-mysql.svg?branch=master)](https://travis-ci.org/balderdashy/machinepack-mysql)
34+
35+
Please observe the guidelines and conventions laid out in the [Sails project contribution guide](http://sailsjs.com/contribute) when opening issues or submitting pull requests.
36+
37+
[![NPM](https://nodei.co/npm/machinepack-mysql.png?downloads=true)](http://npmjs.com/package/machinepack-mysql)
38+
39+
## Acknowledgements
40+
41+
Thanks to [felixge](https://github.com/felixge) and [dougwilson](https://github.com/dougwilson) for all of their great work on [mysql](http://npmjs.com/package/mysql).
2642

2743
## License
2844

29-
MIT &copy; 2015 - 2016 Cody Stoltman, Mike McNeil, Scott Gress
45+
MIT &copy; 2015-2017 The Sails Company
46+
47+
This package, like the [Sails framework](http://sailsjs.com), is free and open-source under the [MIT License](http://sailsjs.com/license).
48+

appveyor.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# # # # # # # # # # # # # # # # # # # # # # # # # #
2+
# ╔═╗╔═╗╔═╗╦ ╦╔═╗╦ ╦╔═╗╦═╗ ┬ ┬┌┬┐┬ #
3+
# ╠═╣╠═╝╠═╝╚╗╔╝║╣ ╚╦╝║ ║╠╦╝ └┬┘││││ #
4+
# ╩ ╩╩ ╩ ╚╝ ╚═╝ ╩ ╚═╝╩╚═o ┴ ┴ ┴┴─┘ #
5+
# #
6+
# This file configures Appveyor CI. #
7+
# (i.e. how we run the tests on Windows) #
8+
# #
9+
# https://www.appveyor.com/docs/lang/nodejs-iojs/ #
10+
# # # # # # # # # # # # # # # # # # # # # # # # # #
11+
12+
13+
# Test against these versions of Node.js.
14+
environment:
15+
matrix:
16+
- nodejs_version: "4"
17+
- nodejs_version: "6"
18+
- nodejs_version: "7"
19+
20+
# Install scripts. (runs after repo cloning)
21+
install:
22+
# Get the latest stable version of Node.js
23+
# (Not sure what this is for, it's just in Appveyor's example.)
24+
- ps: Install-Product node $env:nodejs_version
25+
# Install declared dependencies
26+
- npm install
27+
28+
29+
# Post-install test scripts.
30+
test_script:
31+
# Output Node and NPM version info.
32+
# (Presumably just in case Appveyor decides to try any funny business?
33+
# But seriously, always good to audit this kind of stuff for debugging.)
34+
- node --version
35+
- npm --version
36+
# Run the actual tests.
37+
- npm test
38+
39+
40+
# Don't actually build.
41+
# (Not sure what this is for, it's just in Appveyor's example.
42+
# I'm not sure what we're not building... but I'm OK with not
43+
# building it. I guess.)
44+
build: off

helpers/validate-connection.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ module.exports = require('machine').build({
2929
exits: {
3030

3131
success: {
32-
outputVariableName: 'isProbablyMySQLConnection',
32+
outputFriendlyName: 'Is probably MySQL connection',
3333
outputDescription: 'If the provided appears to be a valid MySQL connection instance.',
34-
example: true
34+
outputExample: true
3535
},
3636

3737
},
3838

3939

4040
fn: function validateConnection(inputs, exits) {
41-
var _ = require('lodash');
41+
var _ = require('@sailshq/lodash');
4242

4343
// Validate some basic assertions about the provided connection.
4444
// (this doesn't guarantee it's still active or anything, but it does let

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,10 @@ module.exports = require('machine').pack({
33
pkg: require('./package.json'),
44
dir: __dirname
55
});
6+
7+
8+
9+
//... well except for this.
10+
// Also give the driver a `mysql` property, so that it provides access
11+
// to the `mysql` library for Node.js. (See http://npmjs.com/package/mysql)
12+
module.exports.mysql = require('mysql');

machines/create-manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Dependencies
22
var util = require('util');
33
var Url = require('url');
4-
var _ = require('lodash');
4+
var _ = require('@sailshq/lodash');
55
var felix = require('mysql');
66

77
module.exports = {

0 commit comments

Comments
 (0)