Skip to content

Commit

Permalink
New Added client-side Sentry logging
Browse files Browse the repository at this point in the history
Using Raven.js allows logging client-side javascript errors to the
configured Sentry server.
  • Loading branch information
rdoursenaud committed Sep 4, 2015
1 parent 7ef5cbf commit a6ef289
Show file tree
Hide file tree
Showing 47 changed files with 7,872 additions and 9 deletions.
18 changes: 18 additions & 0 deletions htdocs/includes/raven-js/.bower.json
@@ -0,0 +1,18 @@
{
"name": "raven-js",
"version": "1.1.19",
"dependencies": {},
"main": "dist/raven.js",
"ignore": {},
"homepage": "https://github.com/getsentry/raven-js",
"_release": "1.1.19",
"_resolution": {
"type": "version",
"tag": "1.1.19",
"commit": "82b9c07b7545c6c10e297709a741eaa9b75f64e8"
},
"_source": "git://github.com/getsentry/raven-js.git",
"_target": "~1.1.19",
"_originalSource": "raven-js",
"_direct": true
}
22 changes: 22 additions & 0 deletions htdocs/includes/raven-js/.gitignore
@@ -0,0 +1,22 @@
.DS_Store

# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

docs/html
docs/doctrees

build
node_modules
npm-debug.log

scratch/

*.pyc

.idea
aws.json
9 changes: 9 additions & 0 deletions htdocs/includes/raven-js/.jshintrc
@@ -0,0 +1,9 @@
{
"es3": true,
"globalstrict": true,
"browser": true,
"predef": [
"TraceKit",
"console"
]
}
8 changes: 8 additions & 0 deletions htdocs/includes/raven-js/.travis.yml
@@ -0,0 +1,8 @@
# language doesn't matter, we're only using phantom.js
language: node_js
node_js:
- "0.10"
script:
- ./node_modules/.bin/grunt test build
notifications:
irc: "irc.freenode.org#sentry"
1 change: 1 addition & 0 deletions htdocs/includes/raven-js/AUTHORS
@@ -0,0 +1 @@
https://github.com/getsentry/raven-js/graphs/contributors
254 changes: 254 additions & 0 deletions htdocs/includes/raven-js/Gruntfile.js
@@ -0,0 +1,254 @@
module.exports = function(grunt) {
"use strict";

var _ = require('lodash');
var path = require('path');

var coreFiles = [
'template/_header.js',
'vendor/**/*.js',
'src/**/*.js',
'template/_footer.js'
];

var plugins = grunt.option('plugins');
// Create plugin paths and verify hey exist
plugins = _.map(plugins ? plugins.split(',') : [], function (plugin) {
var path = 'plugins/' + plugin + '.js';

if(!grunt.file.exists(path))
throw new Error("Plugin '" + plugin + "' not found in plugins directory.");

return path;
});

// Taken from http://dzone.com/snippets/calculate-all-combinations
var combine = function (a) {
var fn = function (n, src, got, all) {
if (n === 0) {
all.push(got);
return;
}

for (var j = 0; j < src.length; j++) {
fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
}
};

var all = [a];

for (var i = 0; i < a.length; i++) {
fn(i, a, [], all);
}

return all;
};

var pluginCombinations = combine(grunt.file.expand('plugins/*.js'));
var pluginConcatFiles = _.reduce(pluginCombinations, function (dict, comb) {
var key = _.map(comb, function (plugin) {
return path.basename(plugin, '.js');
});
key.sort();

var dest = path.join('build/', key.join(','), '/raven.js');
dict[dest] = coreFiles.concat(comb);

return dict;
}, {});

var gruntConfig = {
pkg: grunt.file.readJSON('package.json'),
aws: grunt.file.exists('aws.json') ? grunt.file.readJSON('aws.json'): {},

clean: ['build'],
concat: {
options: {
separator: '\n',
banner: grunt.file.read('template/_copyright.js'),
process: true
},
core: {
src: coreFiles.concat(plugins),
dest: 'build/raven.js'
},
all: {
files: pluginConcatFiles
}
},

uglify: {
options: {
sourceMap: function (dest) {
return path.join(path.dirname(dest),
path.basename(dest, '.js')) +
'.map';
},
sourceMappingURL: function (dest) {
return path.basename(dest, '.js') + '.map';
},
preserveComments: 'some'
},
dist: {
src: ['build/**/*.js'],
ext: '.min.js',
expand: true
}
},

fixSourceMaps: {
all: ['build/**/*.map']
},

jshint: {
options: {
jshintrc: '.jshintrc'
},
all: ['Gruntfile.js', 'src/**/*.js', 'plugins/**/*.js']
},

mocha: {
all: {
options: {
mocha: {
ignoreLeaks: true,
grep: grunt.option('grep')
},
log: true,
reporter: 'Dot',
run: true
},
src: ['test/index.html'],
nonull: true
}
},

release: {
options: {
npm: false,
commitMessage: 'Release <%= version %>'
}
},

s3: {
options: {
key: '<%= aws.key %>',
secret: '<%= aws.secret %>',
bucket: '<%= aws.bucket %>',
access: 'public-read',
// Limit concurrency
maxOperations: 20,
headers: {
// Surrogate-Key header for Fastly to purge by release
'x-amz-meta-surrogate-key': '<%= pkg.release %>'
}
},
all: {
upload: [{
src: 'build/**/*',
dest: '<%= pkg.release %>/',
rel: 'build/'
}]
}
},

connect: {
test: {
options: {
port: 8000,
debug: true,
keepalive: true
}
},

docs: {
options: {
port: 8000,
debug: true,
base: 'docs/html',
keepalive: true
}
}
},

copy: {
dist: {
expand: true,
flatten: true,
cwd: 'build/',
src: '**',
dest: 'dist/'
}
}
};

grunt.initConfig(gruntConfig);

// Custom Grunt tasks
grunt.registerTask('version', function() {
var pkg = grunt.config.get('pkg');
if (grunt.option('dev')) {
pkg.release = 'dev';
pkg.version = grunt.config.get('gitinfo').local.branch.current.shortSHA;
} else {
pkg.release = pkg.version;
}
grunt.config.set('pkg', pkg);
});

grunt.registerMultiTask('fixSourceMaps', function () {
this.files.forEach(function (f) {
var result;
var sources = f.src.filter(function (filepath) {
if (!grunt.file.exists(filepath)) {
grunt.log.warn('Source file "' + filepath + '" not found.');
return false;
} else {
return true;
}
}).forEach(function (filepath) {
var base = path.dirname(filepath);
var sMap = grunt.file.readJSON(filepath);
sMap.file = path.relative(base, sMap.file);
sMap.sources = _.map(sMap.sources, path.relative.bind(path, base));

grunt.file.write(filepath, JSON.stringify(sMap));
// Print a success message.
grunt.log.writeln('File "' + filepath + '" fixed.');
});
});
});

// Grunt contrib tasks
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-copy');

// 3rd party Grunt tasks
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-s3');
grunt.loadNpmTasks('grunt-gitinfo');

// Build tasks
grunt.registerTask('_prep', ['clean', 'gitinfo', 'version']);
grunt.registerTask('concat.core', ['_prep', 'concat:core']);
grunt.registerTask('concat.all', ['_prep', 'concat:all']);
grunt.registerTask('build.core', ['concat.core', 'uglify', 'fixSourceMaps']);
grunt.registerTask('build.all', ['concat.all', 'uglify', 'fixSourceMaps']);
grunt.registerTask('build', ['build.all']);
grunt.registerTask('dist', ['build.core', 'copy:dist']);

// Test task
grunt.registerTask('test', ['jshint', 'mocha']);

// Webserver tasks
grunt.registerTask('run:test', ['connect:test']);
grunt.registerTask('run:docs', ['connect:docs']);

grunt.registerTask('publish', ['test', 'build.all', 's3']);
grunt.registerTask('default', ['test']);
};
9 changes: 9 additions & 0 deletions htdocs/includes/raven-js/LICENSE
@@ -0,0 +1,9 @@
Copyright (c) 2014 Matt Robenolt and other contributors
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 changes: 20 additions & 0 deletions htdocs/includes/raven-js/Makefile
@@ -0,0 +1,20 @@
develop: update-submodules
npm install .

update-submodules:
git submodule init
git submodule update

docs:
cd docs; $(MAKE) html

docs-live:
while true; do \
sleep 2; \
$(MAKE) docs; \
done

clean:
rm -rf docs/html

.PHONY: develop update-submodules docs docs-live clean
13 changes: 13 additions & 0 deletions htdocs/includes/raven-js/README.md
@@ -0,0 +1,13 @@
# Raven.js [![Build Status](https://travis-ci.org/getsentry/raven-js.svg?branch=master)](https://travis-ci.org/getsentry/raven-js)

Raven.js is a tiny standalone JavaScript client for [Sentry](https://www.getsentry.com/).

**Raven.js v1.1 requires Sentry v6.0 or later.**

## Resources

* [Download](http://ravenjs.com)
* [Documentation](https://raven-js.readthedocs.org)
* [Bug Tracker](https://github.com/getsentry/raven-js/issues)
* [IRC](irc://chat.freenode.net/sentry) (chat.freenode.net, #sentry)
* Follow [@mattrobenolt](https://twitter.com/mattrobenolt) on Twitter for updates
7 changes: 7 additions & 0 deletions htdocs/includes/raven-js/bower.json
@@ -0,0 +1,7 @@
{
"name": "raven-js",
"version": "1.1.19",
"dependencies": {},
"main": "dist/raven.js",
"ignore": {}
}

0 comments on commit a6ef289

Please sign in to comment.