Browse Source

Merge branch 'master' of github.com:jcbrand/converse.js

Conflicts:
	Makefile
JC Brand 10 years ago
parent
commit
ff7f312672
10 changed files with 99 additions and 22 deletions
  1. 22 13
      Gruntfile.js
  2. 3 3
      Makefile
  3. 55 0
      Makefile.win
  4. 1 1
      bower.json
  5. 2 2
      converse.js
  6. 2 0
      docs/CHANGES.rst
  7. 11 1
      docs/source/development.rst
  8. 1 1
      main.js
  9. 1 1
      non_amd.html
  10. 1 0
      package.json

+ 22 - 13
Gruntfile.js

@@ -1,4 +1,5 @@
 module.exports = function(grunt) {
+    var path = require('path');
     var cfg = require('./package.json');
     grunt.initConfig({
         jst: {
@@ -62,6 +63,10 @@ module.exports = function(grunt) {
                 dest: 'css/converse.min.css',
                 src: ['css/converse.css']
             }
+        },
+        touch: {
+            npm: ['stamp-npm'],
+            bower: ['stamp-bower']
         }
     });
     grunt.loadNpmTasks('grunt-contrib-cssmin');
@@ -69,6 +74,7 @@ module.exports = function(grunt) {
     grunt.loadNpmTasks('grunt-contrib-jst');
     grunt.loadNpmTasks('grunt-json');
     grunt.loadNpmTasks('grunt-contrib-requirejs');
+    grunt.loadNpmTasks('grunt-touch');
 
     grunt.registerTask('test', 'Run Tests', function () {
         var done = this.async();
@@ -107,23 +113,26 @@ module.exports = function(grunt) {
         var child_process = require('child_process');
         var exec = child_process.exec;
         var callback = function (err, stdout, stderr) {
+            grunt.log.write(stdout);
             if (err) {
                 grunt.log.write('build failed with error code '+err.code);
                 grunt.log.write(stderr);
-            }
-            grunt.log.write(stdout);
-            done();
+                done(false);
+            } else
+                done();
         };
-        exec('./node_modules/requirejs/bin/r.js -o src/build.js && ' +
-             './node_modules/requirejs/bin/r.js -o src/build.js optimize=none out=builds/converse.js && ' +
-             './node_modules/requirejs/bin/r.js -o src/build-no-jquery.js &&' +
-             './node_modules/requirejs/bin/r.js -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' +
-             './node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js && ' +
-             './node_modules/requirejs/bin/r.js -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js && ' +
-             './node_modules/requirejs/bin/r.js -o src/build-no-otr.js &&' +
-             './node_modules/requirejs/bin/r.js -o src/build-no-otr.js optimize=none out=builds/converse-no-otr.js && ' +
-             './node_modules/requirejs/bin/r.js -o src/build-website-no-otr.js &&' +
-             './node_modules/requirejs/bin/r.js -o src/build-website.js', callback);
+        var rjsext = (process.platform === 'win32') ? '.cmd' : '';
+        var rjs = path.resolve('./node_modules/.bin/r.js' + rjsext);
+        exec(rjs + ' -o src/build.js && ' +
+             rjs + ' -o src/build.js optimize=none out=builds/converse.js && ' +
+             rjs + ' -o src/build-no-jquery.js &&' +
+             rjs + ' -o src/build-no-jquery.js optimize=none out=builds/converse.nojquery.js && ' +
+             rjs + ' -o src/build-no-locales-no-otr.js && ' +
+             rjs + ' -o src/build-no-locales-no-otr.js optimize=none out=builds/converse-no-locales-no-otr.js && ' +
+             rjs + ' -o src/build-no-otr.js &&' +
+             rjs + ' -o src/build-no-otr.js optimize=none out=builds/converse-no-otr.js && ' +
+             rjs + ' -o src/build-website-no-otr.js &&' +
+             rjs + ' -o src/build-website.js', callback);
         // XXX: It might be possible to not have separate build config files. For example:
         // 'r.js -o src/build.js paths.converse-dependencies=src/deps-no-otr paths.locales=locale/nolocales out=builds/converse-no-locales-no-otr.min.js'
     });

+ 3 - 3
Makefile

@@ -1,5 +1,5 @@
 # You can set these variables from the command line.
-BOWER           ?= ./node_modules/.bin/bower
+BOWER           ?= node_modules/.bin/bower
 BUILDDIR     	= ./docs
 PAPER        	=
 PHANTOMJS       ?= ./node_modules/.bin/phantomjs
@@ -86,14 +86,14 @@ clean::
 
 dev: clean
 	npm install
-	${BOWER} update;
+	$(BOWER) update;
 	bundler install --path=.
 
 ########################################################################
 ## Builds
 
 css::
-	${SASS} sass/converse.scss > css/converse.css
+	$(SASS) sass/converse.scss > css/converse.css
 
 build::
 	$(GRUNT) jst

+ 55 - 0
Makefile.win

@@ -0,0 +1,55 @@
+# You can set these variables from the command line.
+GRUNT   ?= node_modules\.bin\grunt.cmd
+BOWER           ?= node_modules\.bin\bower
+PHANTOMJS       ?= node_modules\.bin\phantomjs
+SASS 			?= sass 
+RMRF ?= rmdir /q /s 
+RMF ?= del /q 
+
+.PHONY: all help clean css minjs build
+
+all: dev
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  dev        to set up the development environment"
+	@echo "  build      create minified builds containing converse.js and all its dependencies"
+
+########################################################################
+## Install dependencies
+
+stamp-npm: package.json
+	npm install
+    $(GRUNT) touch:npm
+
+stamp-bower: stamp-npm bower.json
+	$(BOWER) install
+	$(GRUNT) touch:bower
+
+clean::
+	@if EXIST stamp-npm $(RMF) stamp-npm
+	@if EXIST stamp-bower $(RMF) stamp-bower
+	@if EXIST node_modules\. $(RMRF) node_modules
+	@if EXIST components\. $(RMRF) components
+
+dev: clean
+	npm install
+	$(BOWER) update
+    bundler install --path=.
+
+########################################################################
+## Builds
+
+css::
+	$(SASS) sass/converse.scss > css/converse.css
+
+build::
+	$(GRUNT) jst
+	$(GRUNT) minify
+
+########################################################################
+## Tests
+
+check:: stamp-npm
+	$(PHANTOMJS) node_modules/phantom-jasmine/lib/run_jasmine_test.coffee tests.html
+

+ 1 - 1
bower.json

@@ -23,7 +23,7 @@
     "requirejs-text": "~2.0.12",
     "requirejs-tpl-jcbrand": "*",
     "momentjs": "~2.6.0",
-    "jquery.browser": "https://raw.githubusercontent.com/jcbrand/jquery-browser-plugin/ae5e88aa7a26f583e8865c3961ba857918c4c9c1/dist/jquery.browser.js",
+    "jquery.browser": ">=0.0.7",
     "jquery-easing-original": "https://raw.githubusercontent.com/jcbrand/jquery.easing/7de3458b1845a72c1f407debf6b223c8446396bf/jquery.easing.1.3.js",
     "bootstrap": "~3.2.0",
     "bootstrapJS": "https://raw.githubusercontent.com/jcbrand/bootstrap/7d96a5f60d26c67b5348b270a775518b96a702c8/dist/js/bootstrap.js",

+ 2 - 2
converse.js

@@ -163,8 +163,8 @@
         var converse = this;
 
         // Logging
-        Strophe.log = function (level, msg) { console.log(level+' '+msg); };
-        Strophe.error = function (msg) { console.log('ERROR: '+msg); };
+        Strophe.log = function (level, msg) { converse.log(level+' '+msg, level); };
+        Strophe.error = function (msg) { converse.log(msg, 'error'); };
 
         // Add Strophe Namespaces
         Strophe.addNamespace('CHATSTATES', 'http://jabber.org/protocol/chatstates');

+ 2 - 0
docs/CHANGES.rst

@@ -12,6 +12,8 @@ Changelog
 * #292 Better support for XEP-0085 Chat State Notifications. [jcbrand]
 * #295 Document "allow_registration". [gbonvehi]
 * #304 Added Polish translations. [ser]
+* New Makefile.win to build in Windows environments. [gbonvehi]
+* Strophe.log and Strophe.error now uses converse.log to output messages. [gbonvehi]
 
 0.8.6 (2014-12-07)
 ------------------

+ 11 - 1
docs/source/development.rst

@@ -12,6 +12,8 @@ follow the instructions below to create this folder and fetch Converse's
 3rd-party dependencies.
 
 .. note::
+    Windows environment: We recommend installing the required tools using `Chocolatey <https://chocolatey.org/>`_
+    You will need Node.js (nodejs.install), Git (git.install) and optionally to build using Makefile, GNU Make (make)
     If you have trouble setting up a development environment on Windows,
     please read `this post <http://librelist.com/browser//conversejs/2014/11/5/openfire-converse-and-visual-studio-questions/#b28387e7f8f126693b11598a8acbe810>`_
     in the mailing list.:
@@ -27,6 +29,9 @@ version `here <https://nodejs.org/download>`_.
 
 Also make sure you have ``Git`` installed. `Details <http://git-scm.com/book/en/Getting-Started-Installing-Git>`_.
 
+.. note::
+    Windows users should use Chocolatey as recommended above.:
+
 Once you have *Node.js* and *git* installed, run the following command inside the Converse.js
 directory:
 
@@ -34,13 +39,18 @@ directory:
 
     make dev
 
+On Windows you need to specify Makefile.win to be used by running:
+    
+::
+    make -f Makefile.win dev
+    
 Or alternatively, if you don't have GNU Make:
 
 ::
 
     npm install
     bower update
-
+    
 This will first install the Node.js development tools (like Grunt and Bower)
 and then use Bower to install all of Converse.js's front-end dependencies.
 

+ 1 - 1
main.js

@@ -24,7 +24,7 @@ require.config({
         "eventemitter":             "components/otr/build/dep/eventemitter",
         "jquery":                   "components/jquery/dist/jquery",
         "jquery-private":           "src/jquery-private",
-        "jquery.browser":           "components/jquery.browser/index",
+        "jquery.browser":           "components/jquery.browser/dist/jquery.browser",
         "jquery.easing":            "components/jquery-easing-original/index",          // XXX: Only required for https://conversejs.org website
         "moment":                   "components/momentjs/moment",
         "strophe":                  "components/strophe/strophe",

+ 1 - 1
non_amd.html

@@ -41,7 +41,7 @@
     <script type="text/javascript" src="components/backbone.browserStorage/backbone.browserStorage.js"></script>
     <script type="text/javascript" src="components/backbone.overview/backbone.overview.js"></script>
     <script type="text/javascript" src="components/momentjs/moment.js"></script>
-    <script type="text/javascript" src="components/jquery.browser/index.js"></script>
+    <script type="text/javascript" src="components/jquery.browser/dist/jquery.browser.js"></script>
     <script type="text/javascript" src="components/typeahead.js/index.js"></script>
     <script type="text/javascript" src="components/jed/jed.js"></script>
     <script type="text/javascript" src="builds/locales.js"></script>

+ 1 - 0
package.json

@@ -40,6 +40,7 @@
     "grunt-contrib-jst": "~0.6.0",
     "grunt-contrib-requirejs": "~0.4.3",
     "grunt-json": "^0.1.3",
+    "grunt-touch": "^0.1.0",
     "less": "~1.7.0",
     "phantom-jasmine": "0.1.8",
     "phantomjs": "~1.9.7-1",