Skip to content

Commit

Permalink
Merge pull request #169 from sourcejs/0.5.4-dev
Browse files Browse the repository at this point in the history
0.5.4
  • Loading branch information
robhrt7 committed Aug 15, 2015
2 parents 12c7fd2 + 9336c71 commit 6ef3924
Show file tree
Hide file tree
Showing 80 changed files with 811 additions and 10,889 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ node_js:
- "0.10"
- "0.11"
- "0.12"
sudo: false
notifications:
email:
on_success: never
on_failure: always
before_script: "git clone https://github.com/sourcejs/init.git user"
before_script: "git clone https://github.com/sourcejs/init.git user"
script: npm run ci-test
62 changes: 25 additions & 37 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ global.opts = loadOptions();
// Arguments parse */
commander
.option('-l, --log [string]', 'Log level (default: ' + global.opts.core.common.defaultLogLevel + ').', global.opts.core.common.defaultLogLevel)
.option('-p, --port [number]', 'Server port (default: ' + global.opts.core.common.port + ').', global.opts.core.common.port)
.option('-p, --port [number]', 'Server port (default: ' + global.opts.core.server.port + ').')
.option('--hostname [string]', 'Server hostname (default: ' + global.opts.core.server.hostname + ').')
.option('--html', 'Turn on HTML parser on app start (requires installed and enabled parser).')
.option('--test', 'Run app with tests.')
.option('--no-watch', 'Run with disabled watcher.')
.parse(process.argv);

global.commander = commander;
Expand All @@ -48,8 +50,13 @@ var logger = require('./core/logger');
var log = logger.log;
global.log = log;

if (commander.html) global.opts.core.parseHTML.onStart = true;
if (commander.port) global.opts.core.common.port = parseInt(commander.port);
if (commander.html) {
global.opts.plugins.htmlParser.enabled = true;
global.opts.plugins.htmlParser.onStart = true;
}
if (commander.port) global.opts.core.server.port = parseInt(commander.port);
if (commander.hostname) global.opts.core.server.hostname = commander.hostname;
if (!commander.watch) global.opts.core.watch.enabled = false;
/* /Globals */


Expand Down Expand Up @@ -97,14 +104,15 @@ app.use(bodyParser.json());



/* Middlewares */
/* Includes */

// Middlewares
require('./core/middlewares/loader').process(app, global.opts);

// Auth initializing
var auth = require('./core/auth')(app);
app.use(auth.everyauth.middleware());

// Clarify
app.use(require('./core/middleware/clarify'));

// File tree module
var fileTree = require('./core/file-tree');
Expand Down Expand Up @@ -133,29 +141,6 @@ app.use('/api/updateFileTree', function(req, res){
});


// Middleware that loads spec content
var read = require("./core/middleware/read");
app.use(read.process);

// Markdown
app.use(require("./core/middleware/md").process);
app.use(require("./core/middleware/mdTag").process);

// Load user defined middleware, that processes spec content
require("./core/middleware/userMiddleware");

// Middleware that wraps spec with Source template
app.use(require("./core/middleware/wrap").process);

// Middleware that sends final spec response
app.use(require("./core/middleware/send").process);

/* /Middlewares */



/* Includes */

// Routes
require('./core/routes');

Expand Down Expand Up @@ -194,15 +179,18 @@ app.use(express.static(app.get('user')));

// Page 404
app.use(function(req, res){

if (req.accepts('html')) {
if (req.url === '/') {
res.redirect('/docs');
return;
}

var headerFooterHTML = headerFooter.getHeaderAndFooter();
res.status(404).render(path.join(__dirname, '/core/views/404.ejs'), {
header: headerFooterHTML.header,
footer: headerFooterHTML.footer
});
}

});
/* /Serving content */

Expand Down Expand Up @@ -231,14 +219,13 @@ app.use(logErrors);



// Server start
/* Server start */
if (!module.parent) {
var port = global.opts.core.common.port;

app.listen(port);
var portString = port.toString();
var serverOpts = global.opts.core.server;
var port = serverOpts.port;

log.info('[SOURCEJS] launched on http://127.0.0.1:'.blue + portString.red + ' in '.blue + MODE.blue + ' mode...'.blue);
app.listen(port, serverOpts.hostname, serverOpts.backlog, serverOpts.callback);
log.info('[SOURCEJS] launched on http://127.0.0.1:'.blue + (port.toString()).red + ' in '.blue + MODE.blue + ' mode...'.blue);

if (commander.test) {
var spawn = require('cross-spawn');
Expand All @@ -255,3 +242,4 @@ if (!module.parent) {
});
}
}
/* Server start */
5 changes: 2 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ build: off
before_test: "git clone https://github.com/sourcejs/init.git user"

test_script:
# Output useful info for debugging.
- node --version && npm --version
- ps: "npm test # PowerShell" # Pass comment to PS for easier debugging
- cmd: npm test
- ps: "npm run ci-test # PowerShell" # Pass comment to PS for easier debugging
- cmd: "npm run ci-test-nw" # Run without watch because of CI bug

matrix:
fast_finish: true
Expand Down
4 changes: 4 additions & 0 deletions assets/css/cosmetic/highlights.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
.source_code;
});

.source-main-only(code,{
.source_code;
});

.lang-source_wide-code {
padding: 10px !important;
font-size: @fz-size-xs !important;
Expand Down
17 changes: 0 additions & 17 deletions assets/css/cosmetic/links.less
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,5 @@
}
}

/* fallback for ie which not support SVG */
.ie8 {
.source_a_d { /* Design link */

&:before {
background-image: url(/source/assets/i/spec_design_link.png);
}
}

.source_a_s { /* Spec link */

&:before {
background-image: url(/source/assets/i/spec_link.png);
}
}
}

/* /Links
---------------------------------------------------------------------------------- */
1 change: 1 addition & 0 deletions assets/css/project/footer.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
}

.source_footer h2 {
.reset();
margin-bottom: 10px;
font-weight: normal;
font-size: 15px;
Expand Down
9 changes: 8 additions & 1 deletion assets/css/project/layout.less
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
margin-bottom: 40px;

flex: 1;
-ms-flex: none; /* ie fucks up */
-ms-flex: none;

width: 100%;
box-sizing: border-box;
Expand Down Expand Up @@ -69,6 +69,13 @@
color: @black;
}

.source_header-meta {
font-size: @fz-size-xs !important;
line-height: 1.2 !important;
color: @color-aux;
margin-bottom: 20px;
}

.source-main-only(h1,{
.source_main_h1;
});
Expand Down
8 changes: 0 additions & 8 deletions assets/css/project/section.less
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@
body & > h2:first-child { //body for weihgt
display: block;
}

.ie9 & > *:not(.source_example) {
display: block;
}

.ie9 .source_example {
display: inline-block !important;
}
}

.source_section__open {
Expand Down
2 changes: 2 additions & 0 deletions assets/css/reset.less
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ body {
});

.source-only(ol li,{
font-size: @fz-size-m;
line-height: 1.5;
list-style: decimal inside !important;
});

Expand Down
4 changes: 2 additions & 2 deletions assets/js/_require.bundle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"{%= grunt.file.read('assets/js/lib/require.js') %}"
"{%= grunt.file.read('assets/js/lib/jquery-1.11.1.js') %}"
"{%= grunt.file.read('assets/js/lib/jquery-2.1.4.min.js') %}"
"{%= grunt.file.read('assets/js/require-config.js') %}"

// Extending base js config with npm packages list
Expand All @@ -19,4 +19,4 @@ requirejs.config({

return npmPackages;
}()
});
});
4 changes: 3 additions & 1 deletion assets/js/lib/codeFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ define([
;

var indentCode = function (line) {
return new Array(tabs + 1).join(' ') + line;
var _tabs = tabs < 0 ? 0 : tabs;

return new Array(_tabs + 1).join(' ') + line;
};

if (code.length > 0) {
Expand Down
Loading

0 comments on commit 6ef3924

Please sign in to comment.