Skip to content

Commit

Permalink
Merge pull request #38 from Temasys/development
Browse files Browse the repository at this point in the history
Version 0.10.3 accepted.

AJS-1 #close
  • Loading branch information
serrynaimo committed Jan 19, 2015
2 parents 689528c + 538fd7c commit 20179d3
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 55 deletions.
13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,5 @@ dwsync.xml
.svn
.CVS
.idea
appdirectory-build
pids
logs
results
staging
_site
source/config/local.json
node_modules/
demo/
doc/
doc-style/
bamboo

106 changes: 99 additions & 7 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = function (grunt) {

grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
Expand All @@ -16,10 +17,34 @@ module.exports = function (grunt) {

production: 'publish',

bamboo: 'bamboo',

clean: {
production: ['<%= production %>/']
production: ['<%= production %>/'],
bamboo: ['<%= bamboo %>/']
},

copy: {
bamboo: {
files: [{
expand: true,
cwd: '<%= production %>/',
src: ['**'],
dest: '<%= bamboo %>/adapterjs/<%= pkg.version %>'
}, {
expand: true,
cwd: '<%= production %>/',
src: ['**'],
dest: '<%= bamboo %>/adapterjs/<%= pkg.version_major %>.<%= pkg.version_minor %>.x'
}, {
expand: true,
cwd: '<%= production %>/',
src: ['**'],
dest: '<%= bamboo %>/adapterjs/latest'
}],
},
},

concat: {
options: {
separator: '\n',
Expand All @@ -43,15 +68,15 @@ module.exports = function (grunt) {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
production_min: {
production: {
files: {
'<%= production %>/adapter.min.js': ['<%= production %>/adapter.debug.js']
}
}
},

replace: {
dist: {
production: {
options: {
variables: {
'version': '<%= pkg.version %>'
Expand Down Expand Up @@ -103,10 +128,77 @@ module.exports = function (grunt) {
}
});


grunt.registerTask('versionise', 'Adds version meta intormation', function() {
var done = this.async(),
arr = [];

grunt.util.spawn({
cmd: 'git',
args: ['log', '-1', '--pretty=format:%h\n %ci']
}, function(err, result) {
if (err) {
return done(false);
}
arr = result.toString().split('\n ');
grunt.config('meta.rev', arr[0]);
grunt.config('meta.date', arr[1]);
});

try {
var version = grunt.config('pkg.version').match('^([0-9]+)\.([0-9]+)\.([0-9]+)$')
grunt.config('pkg.version_major', version[1]);
grunt.config('pkg.version_minor', version[2]);
grunt.config('pkg.version_release', version[3]);
}
catch (e) {
grunt.fatal('Version ' + grunt.config('pkg.version') + ' has not the correct format.');
}

grunt.util.spawn({
cmd: 'git',
args: [
'for-each-ref',
'--sort=*authordate',
'--format="%(tag)"',
'refs/tags'
]
}, function(err, result) {
if (err) {
return done(false);
}
arr = result.toString().split('\n');

var tag = arr[arr.length - 1];
tag = tag.toString();
grunt.config('meta.tag', tag);

grunt.log.write('Version: ' + grunt.config('pkg.version') +
'\nRevision: ' + grunt.config('meta.rev') +
'\nDate: ' + grunt.config('meta.date') +
'\nGit Tag: ' + grunt.config('meta.tag') + '\n');

done(result);
});
});

grunt.registerTask('bamboovars', 'Write bamboo variables to file', function() {
grunt.file.write('bamboo/vars', 'version=' + grunt.config('pkg.version'));
grunt.log.writeln('bamboo/vars file successfully created');
});

grunt.registerTask('publish', [
'versionise',
'clean:production',
'concat:production',
'replace:dist',
'uglify:production_min'
'concat',
'replace',
'uglify'
]);

grunt.registerTask('bamboo', [
'publish',
'clean:bamboo',
'copy',
'bamboovars'
]);
};
};
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Find the most recent version hosted on our CDN.

- Minified version: `//cdn.temasys.com.sg/adapterjs/latest/adapter.min.js`
- Debug version `//cdn.temasys.com.sg/adapterjs/latest/adapter.debug.js`
- Minified version: `//cdn.temasys.com.sg/adapterjs/0.10.x/adapter.min.js`
- Debug version `//cdn.temasys.com.sg/adapterjs/0.10.x/adapter.debug.js`


## Compatibility
Expand Down
27 changes: 5 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"dependencies": {},
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-jshint": "^0.10.0",
Expand All @@ -32,30 +34,11 @@
"files": "tests/*.js",
"browsers": [
"ie/9",
"chrome/23.0",
"chrome/24.0",
"chrome/25.0",
"chrome/26.0",
"chrome/27.0",
"chrome/28.0",
"chrome/29.0",
"chrome/30.0",
"chrome/31.0",
"chrome/32.0",
"chrome/30..latest",
"chrome/canary",
"firefox/18.0",
"firefox/19.0",
"firefox/20.0",
"firefox/21.0",
"firefox/22.0",
"firefox/23.0",
"firefox/24.0",
"firefox/25.0",
"firefox/26.0",
"firefox/27.0",
"firefox/26..latest",
"firefox/nightly",
"opera/18.0",
"opera/19.0",
"opera/17..latest",
"opera/next",
"safari/latest",
"iphone/latest",
Expand Down
46 changes: 40 additions & 6 deletions publish/adapter.debug.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! adapterjs - v0.10.3 - 2015-01-12 */
/*! adapterjs - v0.10.3 - 2015-01-16 */

// Adapter's interface.
AdapterJS = { options:{} };
Expand Down Expand Up @@ -31,14 +31,19 @@ if(!!navigator.platform.match(/^Mac/i)) {
}
else if(!!navigator.platform.match(/^Win/i)) {
AdapterJS.WebRTCPlugin.pluginInfo.downloadLink = 'http://bit.ly/1kkS4FN';
};
}

// Unique identifier of each opened page
AdapterJS.WebRTCPlugin.pageId = Math.random().toString(36).slice(2);

// Use this whenever you want to call the plugin.
AdapterJS.WebRTCPlugin.plugin = null;

// Set log level for the plugin once it is ready.
// The different values are
// This is an asynchronous function that will run when the plugin is ready
AdapterJS.WebRTCPlugin.setLogLevel = null;

// Defines webrtc's JS interface according to the plugin's implementation.
// Define plugin Browsers as WebRTC Interface.
AdapterJS.WebRTCPlugin.defineWebRTCInterface = null;
Expand All @@ -54,6 +59,8 @@ AdapterJS.WebRTCPlugin.pluginInjectionInterval = null;
// Inject the HTML DOM object element into the page.
AdapterJS.WebRTCPlugin.injectPlugin = null;

// States of readiness that the plugin goes through when
// being injected and stated
AdapterJS.WebRTCPlugin.PLUGIN_STATES = {
NONE : 0, // no plugin use
INITIALIZING : 1, // Detected need for plugin
Expand All @@ -66,6 +73,24 @@ AdapterJS.WebRTCPlugin.PLUGIN_STATES = {
// equal to AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY
AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.NONE;

// Log levels for the plugin.
// To be set by calling AdapterJS.WebRTCPlugin.setLogLevel
/*
Log outputs are prefixed in some cases.
INFO: Information reported by the plugin.
ERROR: Errors originating from within the plugin.
WEBRTC: Error originating from within the libWebRTC library
*/
// From the least verbose to the most verbose
AdapterJS.WebRTCPlugin.PLUGIN_LOG_LEVELS = {
NONE : 'NONE',
ERROR : 'ERROR',
WARNING : 'WARNING',
INFO: 'INFO',
VERBOSE: 'VERBOSE',
SENSITIVE: 'SENSITIVE'
};

// Does a waiting check before proceeding to load the plugin.
AdapterJS.WebRTCPlugin.WaitForPluginReady = null;

Expand All @@ -80,13 +105,17 @@ AdapterJS.WebRTCPlugin.pluginNeededButNotInstalledCb = null;
// !!!! WARNING: DO NOT OVERRIDE THIS FUNCTION. !!!
// This function will be called when plugin is ready. It sends necessary
// details to the plugin.
// The function will wait for the document to be ready and the set the
// plugin state to AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY,
// indicating that it can start being requested.
// This function is not in the IE/Safari condition brackets so that
// TemPluginLoaded function might be called on Chrome/Firefox.
// This function is the only private function that is not encapsulated to
// allow the plugin method to be called.
__TemWebRTCReady0 = function () {
arguments.callee.StaticWasInit = arguments.callee.StaticWasInit || 1;
if (arguments.callee.StaticWasInit === 1) {
if (document.readyState === 'complete') {
AdapterJS.WebRTCPlugin.pluginState = AdapterJS.WebRTCPlugin.PLUGIN_STATES.READY;
} else {
AdapterJS.WebRTCPlugin.documentReadyInterval = setInterval(function () {
if (document.readyState === 'complete') {
// TODO: update comments, we wait for the document to be ready
Expand All @@ -95,7 +124,6 @@ __TemWebRTCReady0 = function () {
}
}, 100);
}
arguments.callee.StaticWasInit++;
};

// The result of ice connection states.
Expand Down Expand Up @@ -599,6 +627,12 @@ if (navigator.mozGetUserMedia) {
}
};

AdapterJS.WebRTCPlugin.setLogLevel = function(logLevel) {
AdapterJS.WebRTCPlugin.callWhenPluginReady(function() {
AdapterJS.WebRTCPlugin.plugin.setLogLevel(logLevel);
});
};

AdapterJS.WebRTCPlugin.injectPlugin = function () {
// only inject once the page is ready
if (document.readyState !== 'complete')
Expand All @@ -624,7 +658,7 @@ if (navigator.mozGetUserMedia) {
'" />' +
// uncomment to be able to use virtual cams
(AdapterJS.options.getAllCams ? '<param name="forceGetAllCams" value="True" />':'') +
'</object>';
while (AdapterJS.WebRTCPlugin.plugin.firstChild) {
frag.appendChild(AdapterJS.WebRTCPlugin.plugin.firstChild);
Expand Down
4 changes: 2 additions & 2 deletions publish/adapter.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 20179d3

Please sign in to comment.