[bowen] init project.

This commit is contained in:
Bowen
2013-06-18 09:51:58 +08:00
commit bb1ccbef8d
30 changed files with 3676 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
########################
# sails
########################
.sails
.waterline
.rigging
.tmp
########################
# node.js / npm
########################
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
pids
logs
results
node_modules
npm-debug.log
########################
# misc / editors
########################
*~
*#
.DS_STORE
.netbeans
nbproject
.idea
########################
# local config
########################
config/local.js
+2
View File
@@ -0,0 +1,2 @@
# SoHub
### a Sails application
View File
View File
View File
+15
View File
@@ -0,0 +1,15 @@
/**
* Allow any authenticated user.
*/
module.exports = function (req,res,ok) {
// User is allowed, proceed to controller
if (req.session.authenticated) {
return ok();
}
// User is not allowed
else {
return res.send("You are not permitted to perform this action.",403);
}
};
View File
+2
View File
@@ -0,0 +1,2 @@
// Start sails and pass it command line arguments
require('sails').lift(require('optimist').argv);
View File
+16
View File
@@ -0,0 +1,16 @@
/*
* The purpose of this CSS reset file is to a provide a sane starting place for stylesheet development by
* normalizing browser differences, eliminating margin and padding, and providing a clear-fix.
*/
html, body {text-align:left;font-size: 1em;}
html,body,img,form,textarea,input,fieldset,div,p,div,ul,li,ol,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,code { margin: 0;padding: 0;}
ul,li {list-style: none;}
img {display: block;}
a img{border:none;}
a {text-decoration:none;font-weight: normal;font-family: inherit;}
*:active,*:focus { /* Clear mozilla/ie dotted line around active links */
outline: none;
-moz-outline-style: none;
}
h1,h2,h3,h4,h5,h6,h7 {font-weight: normal; font-size:1em;} /* Fix heading font styles and size */
div.clear {clear:both;}
File diff suppressed because it is too large Load Diff
View File
View File
+37
View File
@@ -0,0 +1,37 @@
// Configure installed adapters
// If you define an attribute in your model definition,
// it will override anything from this global config.
module.exports.adapters = {
// If you leave the adapter config unspecified
// in a model definition, 'default' will be used.
'default': 'disk',
// In-memory adapter for DEVELOPMENT ONLY
// (data is NOT preserved when the server shuts down)
memory: {
module: 'sails-dirty',
inMemory: true
},
// Persistent adapter for DEVELOPMENT ONLY
// (data IS preserved when the server shuts down)
// PLEASE NOTE: disk adapter not compatible with node v0.10.0 currently
// because of limitations in node-dirty
// See https://github.com/felixge/node-dirty/issues/34
disk: {
module: 'sails-dirty',
filePath: './.tmp/dirty.db',
inMemory: false
},
// MySQL is the world's most popular relational database.
// Learn more: http://en.wikipedia.org/wiki/MySQL
mysql: {
module : 'sails-mysql',
host : 'YOUR_MYSQL_SERVER_HOSTNAME_OR_IP_ADDRESS',
user : 'YOUR_MYSQL_USER',
password : 'YOUR_MYSQL_PASSWORD',
database : 'YOUR_MYSQL_DB'
}
};
+30
View File
@@ -0,0 +1,30 @@
module.exports = {
// Name of the application (used as default <title>)
appName: "Sails Application",
// Port this Sails application will live on
port: 1337,
// The environment the app is deployed in
// (`development` or `production`)
//
// In `production` mode, all css and js are bundled up and minified
// And your views and templates are cached in-memory. Gzip is also used.
// The downside? Harder to debug, and the server takes longer to start.
environment: 'development',
// Logger
// Valid `level` configs:
//
// - error
// - warn
// - debug
// - info
// - verbose
//
log: {
level: 'info'
}
};
+13
View File
@@ -0,0 +1,13 @@
// Asset rack configuration
module.exports.assets = {
// A list of directories, in order, which will be recursively parsed for css, javascript, and templates
// and then can be automatically injected in your layout/views via the view partials:
// ( assets.css(), assets.js() and assets.templateLibrary() )
sequence: [
'assets/mixins',
'assets/js',
'assets/styles',
'assets/templates'
]
};
+7
View File
@@ -0,0 +1,7 @@
// App bootstrap
// Code to run before launching the app
//
// Make sure you call cb() when you're finished.
module.exports.bootstrap = function (cb) {
cb();
};
+13
View File
@@ -0,0 +1,13 @@
// Local configuration
//
// Included in the .gitignore by default,
// this is where you include configuration overrides for your local system
// or for a production deployment.
// For example, to use port 80 on the local machine, override the `port` config
// module.exports.port = 80;
// or to keep your db credentials out of the repo, but to use them on the local machine
// override the `modelDefaults` config
// module.exports.modelDefaults = { database: 'foo', user: 'bar', password: 'baZ'}
+8
View File
@@ -0,0 +1,8 @@
/*
* English string set
*
*/
var english = {
};
module.exports = english;
+21
View File
@@ -0,0 +1,21 @@
/**
* Policy defines middleware that is run before each controller/controller.
* Any policy dropped into the /middleware directory is made globally available through sails.middleware
* Below, use the string name of the middleware
*/
module.exports.policies = {
// Default policy (allow public access)
'*': true
/** Example mapping:
someController: {
// Apply the "authenticated" policy to all actions
'*': 'authenticated',
// For someAction, apply 'somePolicy' instead
someAction: 'somePolicy'
}
*/
};
+69
View File
@@ -0,0 +1,69 @@
// Routes
// *********************
//
// This table routes urls to controllers/actions.
//
// If the URL is not specified here, the default route for a URL is: /:controller/:action/:id
// where :controller, :action, and the :id request parameter are derived from the url
//
// If :action is not specified, Sails will redirect to the appropriate action
// based on the HTTP verb: (using REST/Backbone conventions)
//
// GET: /:controller/read/:id
// POST: /:controller/create
// PUT: /:controller/update/:id
// DELETE: /:controller/destroy/:id
//
// If the requested controller/action doesn't exist:
// - if a view exists ( /views/:controller/:action.ejs ), Sails will render that view
// - if no view exists, but a model exists, Sails will automatically generate a
// JSON API for the model which matches :controller.
// - if no view OR model exists, Sails will respond with a 404.
//
module.exports.routes = {
// To route the home page to the "index" action of the "home" controller:
'/' : {
controller : 'home'
}
// If you want to set up a route only for a particular HTTP method/verb
// (GET, POST, PUT, DELETE) you can specify the verb before the path:
// 'post /signup': {
// controller : 'user',
// action : 'signup'
// }
// Keep in mind default routes exist for each of your controllers
// So if you have a UserController with an action called "juggle"
// a route will be automatically exist mapping it to /user/juggle.
//
// Additionally, unless you override them, new controllers will have
// create(), find(), findAll(), update(), and destroy() actions,
// and routes will exist for them as follows:
/*
// Standard RESTful routing
// (if index is not defined, findAll will be used)
'get /user': {
controller : 'user',
action : 'index'
},
'get /user/:id': {
controller : 'user',
action : 'find'
},
'post /user': {
controller : 'user',
action : 'create'
},
'put /user/:id': {
controller : 'user',
action : 'update'
},
'delete /user/:id': {
controller : 'user',
action : 'destroy'
}
*/
};
+3
View File
@@ -0,0 +1,3 @@
module.exports = {
'viewEngine': 'ejs'
};
+18
View File
@@ -0,0 +1,18 @@
{
"name": "SoHub",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"dependencies": {
"sails": "0.8.91",
"optimist": "0.4.0"
},
"scripts": {
"start": "node app.js",
"debug": "node debug app.js"
},
"main": "app.js",
"repository": "",
"author": "",
"license": "MIT"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 920 B

View File
+6
View File
@@ -0,0 +1,6 @@
# The robots.txt file is used to control how search engines index your live URLs.
# See http://www.robotstxt.org/wc/norobots.html for more information.
#
# To prevent search engines from seeing the site altogether, uncomment the next two lines:
# User-Agent: *
# Disallow: /
+10
View File
@@ -0,0 +1,10 @@
<h1>Page not found</h1>
<h2>The view you were trying to reach does not exist.</h2>
<style type="text/css">
/* Styles included inline since you'll probably be deleting this page anyway */
body{font:14px Helvetica,Arial,sans-serif}html{background:#e0e0e0}p{margin:3% 1% 3% 0}a{color:#00b7ff}input{padding:.5em;width:50%}h1{font-size:28px;font-weight:bold;margin:20px 0 15px;color:#444;text-shadow:0 0 5px rgba(150,150,150,0.6)}h2{color:#444;text-shadow:0 0 5px rgba(150,150,150,0.6);font-size:18px;font-weight:bold;margin:10px 0 10px}h3{font-size:18px;font-weight:bold;margin:10px 0 10px;color:#eee;text-shadow:0 0 5px rgba(0,0,0,0.6)}#controllers li a{background:#eee;border-radius:8px;padding:.5em 1em;margin-bottom:.3em;display:block;width:50%}#topbar{width:100%;padding:0 2em;background:black;position:fixed;top:0;left:0;z-index:100;box-shadow:0 2px 2px rgba(100,100,100,0.5)}#branding{margin:0;text-shadow:none;padding:12px 0 0;height:35px;font-size:19px;font-weight:normal;color:white;width:100px;float:left}#branding a{color:white}#topbar{overflow:auto}#topbar li{float:left}#topbar li a{color:#aaa;font-size:.94em;height:30px;padding:17px 1.5em 0;display:block}#topbar li a:hover{color:#ccc}#topbar li a.selected{color:#ddd;background:#444;font-weight:bold;font-size:.94em;height:30px;padding:17px 1.5em 0;display:block}#topbar-dropdown{float:right;margin-top:15px;margin-right:45px}#content{background:#c0c0c0;padding:50px 20px 30px;box-shadow:0 3px 1px rgba(150,150,150,0.2)}img.spinner{padding:.5em;margin:0 auto;display:block}#footer{padding:1em 0 3em;color:#999;font-size:.85em}#footer .copyright{color:#777;margin-left:2em;opacity:.8}#footer .copyright:hover{opacity:1;text-decoration:underline}input.error{border-color:red}span.error{display:block;font-size:85%;color:red}.mobile-only{display:none}@media screen and (max-width:980px){input.ui-list-search{width:45%;padding-top:7px;padding-bottom:7px}}@media screen and (max-width:480px){.widescreen-nav{display:none}a.create-node{margin-bottom:1em}input.ui-list-search{width:auto;display:block;float:none!important;margin-left:0;margin-right:0;margin-top:1em;clear:both}.mobile-only{display:block}}
</style>
+17
View File
@@ -0,0 +1,17 @@
<h1>Error</h1>
<% _.each(errors, function (error) { %>
<code>
<%= error %>
</code>
<% }) %>
<style type="text/css">
/* Styles included inline since you'll probably be deleting this page anyway */
body{font:14px Helvetica,Arial,sans-serif}html{background:#e0e0e0}p{margin:3% 1% 3% 0}a{color:#00b7ff}input{padding:.5em;width:50%}h1{font-size:28px;font-weight:bold;margin:20px 0 15px;color:#444;text-shadow:0 0 5px rgba(150,150,150,0.6)}h2{color:#444;text-shadow:0 0 5px rgba(150,150,150,0.6);font-size:18px;font-weight:bold;margin:10px 0 10px}h3{font-size:18px;font-weight:bold;margin:10px 0 10px;color:#eee;text-shadow:0 0 5px rgba(0,0,0,0.6)}#controllers li a{background:#eee;border-radius:8px;padding:.5em 1em;margin-bottom:.3em;display:block;width:50%}#topbar{width:100%;padding:0 2em;background:black;position:fixed;top:0;left:0;z-index:100;box-shadow:0 2px 2px rgba(100,100,100,0.5)}#branding{margin:0;text-shadow:none;padding:12px 0 0;height:35px;font-size:19px;font-weight:normal;color:white;width:100px;float:left}#branding a{color:white}#topbar{overflow:auto}#topbar li{float:left}#topbar li a{color:#aaa;font-size:.94em;height:30px;padding:17px 1.5em 0;display:block}#topbar li a:hover{color:#ccc}#topbar li a.selected{color:#ddd;background:#444;font-weight:bold;font-size:.94em;height:30px;padding:17px 1.5em 0;display:block}#topbar-dropdown{float:right;margin-top:15px;margin-right:45px}#content{background:#c0c0c0;padding:50px 20px 30px;box-shadow:0 3px 1px rgba(150,150,150,0.2)}img.spinner{padding:.5em;margin:0 auto;display:block}#footer{padding:1em 0 3em;color:#999;font-size:.85em}#footer .copyright{color:#777;margin-left:2em;opacity:.8}#footer .copyright:hover{opacity:1;text-decoration:underline}input.error{border-color:red}span.error{display:block;font-size:85%;color:red}.mobile-only{display:none}@media screen and (max-width:980px){input.ui-list-search{width:45%;padding-top:7px;padding-bottom:7px}}@media screen and (max-width:480px){.widescreen-nav{display:none}a.create-node{margin-bottom:1em}input.ui-list-search{width:auto;display:block;float:none!important;margin-left:0;margin-right:0;margin-top:1em;clear:both}.mobile-only{display:block}}
</style>
+23
View File
@@ -0,0 +1,23 @@
<h1 id="header">
<a href="/">New Sails App</a>
</h1>
<div id="content">
<h2>It works!</h2>
<p>You've successfully installed the Sails Framework.</p>
<p>Sails is a modern, realtime MVC framework for the Node.js platform. <br/> <span class="highlight">It helps you build apps fast.</span></p>
<p>
<a href="https://github.com/balderdashy/sails/wiki" class="button"><span>Documentation</span></a>
<a href="https://github.com/balderdashy/sails/wiki/Changelog" class="button"><span>Changelog</span></a>
</p>
</div>
<div id="footer">
<a target="_blank" href="http://sailsjs.com" class="copyright">Built with Sails.js</a>
</div>
<style type="text/css">
body{font-size:1em;line-height:1.5;background:#e7e7e7;font-family:'Helvetica Neue',Helvetica,Arial,serif;text-shadow:0 1px 0 rgba(255,255,255,0.8);color:#6d6d6d}#header{width:100%;background:#fff;margin-bottom:25px}#header a{padding:25px 0;width:620px;margin:0 auto;color:#158ea1;display:block;font-weight:800}#content,#footer{width:620px;margin:0 auto}h2{font-size:32px}p{font-weight:300;margin-bottom:20px}a,a:hover{color:#c5000c}p a{font-weight:bold}a.button{-moz-border-radius:30px;-webkit-border-radius:30px;border-radius:30px;border-top:solid 1px #cbcbcb;border-left:solid 1px #b7b7b7;border-right:solid 1px #b7b7b7;border-bottom:solid 1px #b3b3b3;color:#303030;line-height:25px;font-weight:bold;font-size:15px;padding:12px 8px 12px 8px;display:inline-block;width:179px;margin-right:14px;background:#fdfdfd;background:-moz-linear-gradient(top,#fdfdfd 0,#f2f2f2 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#fdfdfd),color-stop(100%,#f2f2f2));background:-webkit-linear-gradient(top,#fdfdfd 0,#f2f2f2 100%);background:-o-linear-gradient(top,#fdfdfd 0,#f2f2f2 100%);background:-ms-linear-gradient(top,#fdfdfd 0,#f2f2f2 100%);background:linear-gradient(top,#fdfdfd 0,#f2f2f2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdfdfd',endColorstr='#f2f2f2',GradientType=0);-webkit-box-shadow:10px 10px 5px #888;-moz-box-shadow:10px 10px 5px #888;box-shadow:0 1px 5px #e8e8e8}a.button:hover{border-top:solid 1px #b7b7b7;border-left:solid 1px #b3b3b3;border-right:solid 1px #b3b3b3;border-bottom:solid 1px #b3b3b3;background:#fafafa;background:-moz-linear-gradient(top,#fdfdfd 0,#f6f6f6 100%);background:-webkit-gradient(linear,left top,left bottom,color-stop(0%,#fdfdfd),color-stop(100%,#f6f6f6));background:-webkit-linear-gradient(top,#fdfdfd 0,#f6f6f6 100%);background:-o-linear-gradient(top,#fdfdfd 0,#f6f6f6 100%);background:-ms-linear-gradient(top,#fdfdfd 0,#f6f6f6 100%);background:linear-gradient(top,#fdfdfd 0,#f6f6f6,100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdfdfd',endColorstr='#f6f6f6',GradientType=0)}a.button span{padding-left:30px;padding-right:30px;display:block;height:23px;text-align:center}.highlight{border-bottom:1px solid #158ea1}#footer{border-top:1px solid #cacaca;margin-top:40px;padding-top:20px;padding-bottom:30px;font-size:13px;color:#AAA}
</style>
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<title><%- title %></title>
<!-- Viewport mobile tag for sensible mobile support -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!-- Stylesheets from your assets folder are included here -->
<%- assets.css() %>
</head>
<body>
<%- body %>
<!-- Templates from your view path are included here -->
<%- assets.templateLibrary() %>
<!-- Javascripts from your assets folder are included here -->
<%- assets.js() %>
</body>
</html>