Commit 6a10b922 by Adeel Mujahid

Merge pull request #717 from am11/build-fixes

Misc. improvements
parents b2d2b9a6 74ce9131
*.log
.DS_Store
.sass-cache
build
lib-cov
node_modules
vendor
test
language: node_js language: node_js
env:
SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
compiler: env: SKIP_SASS_BINARY_DOWNLOAD_FOR_CI=true
- gcc
compiler: gcc
node_js: node_js:
- "0.10" - 0.10
- "0.12" - node # will fetch the latest node.js version
- iojs - iojs # will fetch the latest io.js version
matrix: matrix:
fast_finish: true fast_finish: true
allow_failures: allow_failures:
- node_js: iojs - node_js: iojs
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test;
- sudo apt-get update;
- sudo apt-get install gcc-4.8 g++-4.8;
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20;
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20;
- g++ --version;
- sudo apt-get update -qq;
before_install:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update
- sudo apt-get install gcc-4.8 g++-4.8
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
- g++ --version
- sudo apt-get update -qq
- git submodule update --init --recursive - git submodule update --init --recursive
after_success:
- npm run-script coverage after_success: npm run-script coverage
cache: cache:
directories: directories:
- node_modules - node_modules
notifications: notifications:
webhooks: webhooks:
urls: urls:
......
...@@ -5,14 +5,31 @@ ...@@ -5,14 +5,31 @@
* Add tests for it. This is important so I don't break it in a future version unintentionally. * Add tests for it. This is important so I don't break it in a future version unintentionally.
* Send a pull request. Bonus points for topic branches. * Send a pull request. Bonus points for topic branches.
## Reporting Sass compilation and syntax issues ## Bug reports
A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful, so thanks!
Guidelines for bug reports:
1. **Use the GitHub issue search** — check if the issue has already been
reported.
2. **Check if the issue has been fixed** — try to reproduce it using the
latest `master` branch in the repository.
3. **Isolate the problem** — ideally create an
[SSCCE](http://www.sscce.org/) and a live example.
The [libsass] library is not currently at feature parity with the 3.2 [Ruby Gem](https://github.com/nex3/sass) that most Sass users will use, and has little-to-no support for 3.3 syntax. While we try our best to maintain feature parity with [libsass], we can not enable features that have not been implemented in [libsass] yet.
If you'd like to see what features are still upcoming in [libsass], [Jo Liss](http://twitter.com/jo_liss) has written [a blog post on the subject](http://www.solitr.com/blog/2014/01/state-of-libsass/). A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS experience the problem? Do other browsers show the bug differently? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
Please check for [issues on the libsass repo](https://github.com/hcatlin/libsass/issues) (as there is a good chance that it may already be an issue there for it), and otherwise [create a new issue there](https://github.com/hcatlin/libsass/issues/new). If you are facing binary related issues, please create a gist (see [Creating gists on GitHub](https://help.github.com/articles/creating-gists/)) with the output of this set of commands:
*nix: https://gist.github.com/am11/9f429c211822a9b15aee.
win: https://gist.github.com/am11/e5de3c49c219f0811e1d.
If this project is missing an API or command line flag that has been added to [libsass], then please open an issue here. We will then look at updating our [libsass] submodule and create a new release. You can help us create the new release by rebuilding binaries, and then creating a pull request to the [node-sass-binaries](https://github.com/sass/node-sass-binaries) repo. If this project is missing an API or command line flag that has been added to [libsass], then please open an issue here. We will then look at updating our [libsass] submodule and create a new release. You can help us create the new release by rebuilding binaries, and then creating a pull request to the [node-sass-binaries](https://github.com/sass/node-sass-binaries) repo.
[libsass]: https://github.com/hcatlin/libsass ## Reporting Sass compilation and syntax issues
Please check for [issues on the libsass repo](https://github.com/hcatlin/libsass/issues) (as there is a good chance that it may already be an issue there for it), and otherwise [create a new issue there](https://github.com/sass/libsass/issues/new).
[libsass]: https://github.com/sass/libsass
...@@ -232,14 +232,19 @@ console.log(result.stats); ...@@ -232,14 +232,19 @@ console.log(result.stats);
### Version information (v2 change) ### Version information (v2 change)
Both `node-sass` and `libsass` version info is now present in `package.json` and is exposed via `info()` method: Both `node-sass` and `libsass` version info is now present in `package.json` and is exposed via `info` method:
```javascript ```javascript
require('node-sass').info(); var sass = require('node-sass');
console.log(sass.info);
/*
it will output something like:
// outputs something like: node-sass 2.0.1 (Wrapper) [JavaScript]
// node-sass version: 2.0.0-beta libsass 3.1.0 (Sass Compiler) [C/C++]
// libsass version: 3.1.0-beta */
``` ```
## Integrations ## Integrations
...@@ -329,6 +334,7 @@ Output will be saved with the same name as input SASS file into the current work ...@@ -329,6 +334,7 @@ Output will be saved with the same name as input SASS file into the current work
-o, --output Output directory -o, --output Output directory
-x, --omit-source-map-url Omit source map URL comment from output -x, --omit-source-map-url Omit source map URL comment from output
-i, --indented-syntax Treat data from stdin as sass code (versus scss) -i, --indented-syntax Treat data from stdin as sass code (versus scss)
-v, --version Prints version info
--output-style CSS output style (nested|expanded|compact|compressed) --output-style CSS output style (nested|expanded|compact|compressed)
--source-comments Include debug info in output --source-comments Include debug info in output
--source-map Emit source map --source-map Emit source map
......
version: "{build}" version: "{build}"
init: build: off
- git config --global core.autocrlf input
environment: environment:
SKIP_SASS_BINARY_DOWNLOAD_FOR_CI: true SKIP_SASS_BINARY_DOWNLOAD_FOR_CI: true
matrix: matrix:
# node.js # node.js
- nodejs_version: 0.10 - nodejs_version: 0.10
- nodejs_version: 0.12 - nodejs_version: 0 # will fetch the latest node.js version
# io.js # io.js
- nodejs_version: "1.2" - nodejs_version: 1 # will fetch the latest io.js version
install: install:
- ps: Install-Product node $env:nodejs_version - ps: Install-Product node $env:nodejs_version
- cmd: SET PATH=C:\python27;%PATH%
- git submodule update --init --recursive
- ps: npm install --msvs_version=2013
- node --version - node --version
- npm --version - npm --version
- git submodule update --init --recursive
- ps: npm install --msvs_version=2013
test_script: test_script: npm test
- npm test
build: off
#!/usr/bin/env node #!/usr/bin/env node
var Emitter = require('events').EventEmitter, var Emitter = require('events').EventEmitter,
path = require('path'),
Gaze = require('gaze'), Gaze = require('gaze'),
meow = require('meow'),
stdin = require('get-stdin'),
grapher = require('sass-graph'), grapher = require('sass-graph'),
render = require('../lib/render'); meow = require('meow'),
path = require('path'),
render = require('../lib/render'),
stdin = require('get-stdin');
/** /**
* Initialize CLI * Initialize CLI
...@@ -13,9 +13,8 @@ var Emitter = require('events').EventEmitter, ...@@ -13,9 +13,8 @@ var Emitter = require('events').EventEmitter,
var cli = meow({ var cli = meow({
pkg: '../package.json', pkg: '../package.json',
version: process.sassInfo,
help: [ help: [
require('../lib/').info(),
'',
'Usage', 'Usage',
' node-sass [options] <input.scss> [output.css]', ' node-sass [options] <input.scss> [output.css]',
' cat <input.scss> | node-sass > output.css', ' cat <input.scss> | node-sass > output.css',
...@@ -30,6 +29,7 @@ var cli = meow({ ...@@ -30,6 +29,7 @@ var cli = meow({
' -o, --output Output directory', ' -o, --output Output directory',
' -x, --omit-source-map-url Omit source map URL comment from output', ' -x, --omit-source-map-url Omit source map URL comment from output',
' -i, --indented-syntax Treat data from stdin as sass code (versus scss)', ' -i, --indented-syntax Treat data from stdin as sass code (versus scss)',
' -v, --version Prints version info',
' --output-style CSS output style (nested|expanded|compact|compressed)', ' --output-style CSS output style (nested|expanded|compact|compressed)',
' --source-comments Include debug info in output', ' --source-comments Include debug info in output',
' --source-map Emit source map', ' --source-map Emit source map',
...@@ -56,12 +56,13 @@ var cli = meow({ ...@@ -56,12 +56,13 @@ var cli = meow({
'precision' 'precision'
], ],
alias: { alias: {
c: 'source-comments',
i: 'indented-syntax', i: 'indented-syntax',
o: 'output', o: 'output',
w: 'watch', r: 'recursive',
x: 'omit-source-map-url', x: 'omit-source-map-url',
c: 'source-comments', v: 'version',
r: 'recursive' w: 'watch'
}, },
default: { default: {
'include-path': process.cwd(), 'include-path': process.cwd(),
......
var fs = require('fs'); var eol = require('os').EOL,
fs = require('fs'),
package = require('../package.json');
/** /**
* Get Runtime Info * Get Runtime Info
...@@ -28,10 +30,20 @@ function getRuntimeInfo() { ...@@ -28,10 +30,20 @@ function getRuntimeInfo() {
*/ */
function getBinaryIdentifiableName() { function getBinaryIdentifiableName() {
var v8SemVersion = process.versions.v8.split('.').slice(0, 3).join('.');
return [process.platform, '-', return [process.platform, '-',
process.arch, '-', process.arch, '-',
process.versions.v8].join(''); v8SemVersion].join('');
}
function getSassInfo() {
return [
['node-sass', package.version, '(Wrapper)', '[JavaScript]'].join('\t'),
['libsass ', package.libsass, '(Sass Compiler)', '[C/C++]'].join('\t'),
].join(eol);
} }
process.runtime = getRuntimeInfo(); process.runtime = getRuntimeInfo();
process.sassInfo = getSassInfo();
process.sassBinaryName = getBinaryIdentifiableName(); process.sassBinaryName = getBinaryIdentifiableName();
...@@ -259,11 +259,4 @@ module.exports.renderSync = function(options) { ...@@ -259,11 +259,4 @@ module.exports.renderSync = function(options) {
* @api public * @api public
*/ */
module.exports.info = function() { module.exports.info = process.sassInfo;
var package = require('../package.json');
return [
'node-sass version: ' + package.version,
'libsass version: ' + package.libsass
].join('\n');
};
...@@ -43,16 +43,16 @@ ...@@ -43,16 +43,16 @@
"style" "style"
], ],
"dependencies": { "dependencies": {
"chalk": "^0.5.1", "chalk": "^1.0.0",
"cross-spawn": "^0.2.6", "cross-spawn": "^0.2.6",
"gaze": "^0.5.1", "gaze": "^0.5.1",
"get-stdin": "^4.0.1", "get-stdin": "^4.0.1",
"meow": "^3.0.0", "meow": "^3.1.0",
"mkdirp": "^0.5.0", "mkdirp": "^0.5.0",
"mocha": "^2.1.0",
"nan": "^1.6.2", "nan": "^1.6.2",
"npmconf": "^2.1.1", "npmconf": "^2.1.1",
"object-assign": "^2.0.0", "object-assign": "^2.0.0",
"pangyp": "^2.1.0",
"request": "^2.53.0", "request": "^2.53.0",
"sass-graph": "^1.0.3", "sass-graph": "^1.0.3",
"shelljs": "^0.3.0" "shelljs": "^0.3.0"
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
"coveralls": "^2.11.2", "coveralls": "^2.11.2",
"jscoverage": "^0.5.9", "jscoverage": "^0.5.9",
"jshint": "^2.6.0", "jshint": "^2.6.0",
"mocha-lcov-reporter": "^0.0.1", "mocha": "^2.1.0",
"pangyp": "^2.1.0" "mocha-lcov-reporter": "^0.0.2"
} }
} }
var fs = require('fs'), var eol = require('os').EOL,
path = require('path'), fs = require('fs'),
spawn = require('child_process').spawn,
mkdir = require('mkdirp'), mkdir = require('mkdirp'),
Mocha = require('mocha'); path = require('path'),
spawn = require('child_process').spawn;
require('../lib/extensions'); require('../lib/extensions');
...@@ -50,7 +50,7 @@ function afterBuild(options) { ...@@ -50,7 +50,7 @@ function afterBuild(options) {
*/ */
function build(options) { function build(options) {
var arguments = ['node_modules/pangyp/bin/node-gyp', 'rebuild'].concat(options.args); var arguments = [path.join('node_modules', 'pangyp', 'bin', 'node-gyp'), 'rebuild'].concat(options.args);
console.log(['Building:', process.runtime.execPath].concat(arguments).join(' ')); console.log(['Building:', process.runtime.execPath].concat(arguments).join(' '));
...@@ -58,22 +58,14 @@ function build(options) { ...@@ -58,22 +58,14 @@ function build(options) {
stdio: [0, 1, 2] stdio: [0, 1, 2]
}); });
proc.on('exit', function(code) { proc.on('exit', function(errorCode) {
if (code) { if (!errorCode) {
if (code === 127) { afterBuild(options);
console.error([
'node-gyp not found! Please upgrade your install of npm!',
'You need at least 1.1.5 (I think) and preferably 1.1.30.'
].join(' '));
return;
}
console.error('Build failed');
return; return;
} }
afterBuild(options); console.error(errorCode === 127 ? 'node-gyp not found!' : 'Build failed');
}); });
} }
...@@ -123,28 +115,19 @@ function testBinary(options) { ...@@ -123,28 +115,19 @@ function testBinary(options) {
return build(options); return build(options);
} }
console.log('`' + process.sassBinaryName + '` exists; testing'); console.log('`' + process.sassBinaryName + '` exists; testing.');
var mocha = new Mocha({ try {
ui: 'bdd', require('../').renderSync({
timeout: 999999, data: 's: { a: ss }'
reporter: function() {}
}); });
mocha.addFile(path.resolve(__dirname, '..', 'test', 'api.js')); console.log('Binary is fine; exiting.');
mocha.grep(/should compile sass to css with file/).run(function (done) { } catch (e) {
if (done !== 0) { console.log(['Problem with the binary.', 'Manual build incoming.'].join(eol));
console.log([
'Problem with the binary.',
'Manual build incoming.',
'Please consider contributing the release binary to https://github.com/sass/node-sass-binaries for npm distribution.'
].join('\n'));
return build(options); return build(options);
} }
console.log('Binary is fine; exiting');
});
}); });
} }
......
...@@ -792,11 +792,16 @@ describe('api', function() { ...@@ -792,11 +792,16 @@ describe('api', function() {
}); });
describe('.info()', function() { describe('.info()', function() {
var package = require('../package.json'),
info = sass.info;
it('should return a correct version info', function(done) { it('should return a correct version info', function(done) {
assert.equal(sass.info(), [ assert(info.indexOf(package.version) > 0);
'node-sass version: ' + require('../package.json').version, assert(info.indexOf('(Wrapper)') > 0);
'libsass version: ' + require('../package.json').libsass assert(info.indexOf('[JavaScript]') > 0);
].join('\n')); assert(info.indexOf(package.libsass) > 0);
assert(info.indexOf('(Sass Compiler)') > 0);
assert(info.indexOf('[C/C++]') > 0);
done(); done();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment