From 15ffd8354a91e44522e6a9feb880b13a077d92b8 Mon Sep 17 00:00:00 2001 From: Pablo Terradillos Date: Sun, 9 Mar 2014 18:12:41 -0300 Subject: [PATCH 1/5] Added gulp for building tasks - Fix #41 --- app/css/app.css | 70 +++++++++++++++---------------- app/index.html | 44 ++++++++++++-------- app/js/app.js | 9 ++-- app/js/background.js | 2 +- app/js/controllers.js | 8 ++-- app/js/directives.js | 6 +-- app/js/filters.js | 2 +- app/js/lib/aes_worker.js | 2 +- app/js/lib/mtproto.js | 2 +- app/js/lib/pq_worker.js | 2 +- app/js/lib/sha1_worker.js | 2 +- app/js/services.js | 10 ++--- app/js/util.js | 2 +- app/partials/im.html | 2 +- app/partials/login.html | 4 +- app/partials/welcome.html | 4 +- gulpfile.js | 86 +++++++++++++++++++++++++++++++++++++++ package.json | 36 ++++++++++++++++ 18 files changed, 212 insertions(+), 81 deletions(-) create mode 100644 gulpfile.js create mode 100644 package.json diff --git a/app/css/app.css b/app/css/app.css index 7defae5b..ad0860a3 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -1,7 +1,7 @@ /* app css stylesheet */ html { - background: #dee4e9 url(../img/bg_tile.png?1) 0 0 repeat; + background: #dee4e9 url(../img/bg_tile.png) 0 0 repeat; /*background-size: 300px 468px;*/ } body { @@ -255,12 +255,12 @@ input[type="number"]::-webkit-inner-spin-button { height: 18px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -15px -419px no-repeat; + background: url(../img/icons/IconsetW.png) -15px -419px no-repeat; background-size: 42px 560px; opacity: 0.6; } .is_1x .icon-back { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .tg_page_head .navbar-quick-nav a:hover .icon-back { opacity: 1; @@ -510,7 +510,7 @@ input[type="number"]::-webkit-inner-spin-button { .im_dialogs_search_field { font-size: 12px; line-height: normal; - background: #F2F2F2 url(../img/icons/IconsetW.png?1) -6px -205px no-repeat; + background: #F2F2F2 url(../img/icons/IconsetW.png) -6px -205px no-repeat; background-size: 42px 560px; border: 1px solid #F2F2F2; border-radius: 3px; @@ -519,7 +519,7 @@ input[type="number"]::-webkit-inner-spin-button { margin: 0; } .is_1x .im_dialogs_search_field { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_dialogs_search_field:focus, .im_dialogs_search_field:active { @@ -534,12 +534,12 @@ input[type="number"]::-webkit-inner-spin-button { width: 13px; height: 13px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -15px -192px no-repeat; + background: url(../img/icons/IconsetW.png) -15px -192px no-repeat; background-size: 42px 560px; opacity: 0.6; } .is_1x .im_dialogs_search_clear { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_dialogs_search_clear:hover { opacity: 1; @@ -787,11 +787,11 @@ a.im_dialog:hover .im_dialog_date { margin-top: 7px; margin-left: 6px; - background: url(../img/icons/IconsetW.png?1) -17px -444px no-repeat; + background: url(../img/icons/IconsetW.png) -17px -444px no-repeat; background-size: 42px 560px; } .is_1x .icon-caret { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_history_panel_media_dropdown .dropdown-menu { @@ -986,11 +986,11 @@ div.im_message_video_thumb { width: 15px; height: 19px; - background: url(../img/icons/IconsetW.png?1) -14px -389px no-repeat; + background: url(../img/icons/IconsetW.png) -14px -389px no-repeat; background-size: 42px 560px; } .is_1x .icon-geo-point { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } @@ -1014,7 +1014,7 @@ div.im_message_video_thumb { height: 38px; vertical-align: text-top; - background: #F2F2F2 url(../img/icons/IconsetW.png?1) -2px -229px no-repeat; + background: #F2F2F2 url(../img/icons/IconsetW.png) -2px -229px no-repeat; background-size: 42px 560px; border-radius: 3px; margin-right: 10px; @@ -1022,7 +1022,7 @@ div.im_message_video_thumb { .is_1x .icon-document, .is_1x .icon-photo, .is_1x .icon-video { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_message_selected .icon-document, @@ -1075,13 +1075,13 @@ div.im_message_video_thumb { height: 38px; vertical-align: text-top; - background: #F2F2F2 url(../img/icons/IconsetW.png?1) -2px -277px no-repeat; + background: #F2F2F2 url(../img/icons/IconsetW.png) -2px -277px no-repeat; background-size: 42px 560px; border-radius: 3px; margin-right: 10px; } .is_1x .icon-audio { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_message_audio_info { @@ -1202,14 +1202,14 @@ div.im_message_video_thumb { display: none; width: 16px; height: 10px; - background: url(../img/icons/Checks2_2x.png?1) 0 0 no-repeat; + background: url(../img/icons/Checks2_2x.png) 0 0 no-repeat; background-size: 16px 10px; top: 2px; position: relative; } .icon-message-status-tick.message-status-unread-tick { /*width: 13px;*/ - background: url(../img/icons/Checks1_2x.png?1) 0 0 no-repeat; + background: url(../img/icons/Checks1_2x.png) 0 0 no-repeat; background-size: 16px 10px; } .im_message_date { @@ -1334,12 +1334,12 @@ textarea.im_message_field { width: 19px; height: 23px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -12px -68px no-repeat; + background: url(../img/icons/IconsetW.png) -12px -68px no-repeat; background-size: 42px 560px; opacity: 0.8; } .is_1x .icon-paperclip { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_attach:hover .icon-paperclip { opacity: 1; @@ -1362,12 +1362,12 @@ textarea.im_message_field { width: 23px; height: 23px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -10px -4px no-repeat; + background: url(../img/icons/IconsetW.png) -10px -4px no-repeat; background-size: 42px 560px; opacity: 0.8; } .is_1x .icon-emoji { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_emoji_btn:hover .icon-emoji { opacity: 1; @@ -1412,12 +1412,12 @@ textarea.im_message_field { width: 25px; height: 21px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -9px -132px no-repeat; + background: url(../img/icons/IconsetW.png) -9px -132px no-repeat; background-size: 42px 560px; opacity: 0.8; } .is_1x .icon-camera { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_media_attach:hover .icon-camera { opacity: 1; @@ -1832,14 +1832,14 @@ img.img_fullsize { .emoji-menu-tail { display: none; - background: url(../img/icons/IconsetW.png?1) -14px -268px no-repeat; + background: url(../img/icons/IconsetW.png) -14px -268px no-repeat; background-size: 42px 560px; width: 14px; height: 7px; margin: 0 83px; } .is_1x .emoji-menu-tail { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } @@ -1983,7 +1983,7 @@ img.img_fullsize { .contacts_modal_search_field { font-size: 12px; line-height: normal; - background: #F2F2F2 url(../img/icons/IconsetW.png?1) -6px -205px no-repeat; + background: #F2F2F2 url(../img/icons/IconsetW.png) -6px -205px no-repeat; background-size: 42px 560px; border: 1px solid #F2F2F2; border-radius: 3px; @@ -1992,7 +1992,7 @@ img.img_fullsize { margin: 0; } .is_1x .contacts_modal_search_field { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .contacts_modal_search_field:focus, .contacts_modal_search_field:active { @@ -2007,12 +2007,12 @@ img.img_fullsize { width: 13px; height: 13px; vertical-align: text-top; - background: url(../img/icons/IconsetW.png?1) -15px -192px no-repeat; + background: url(../img/icons/IconsetW.png) -15px -192px no-repeat; background-size: 42px 560px; opacity: 0.6; } .is_1x .contacts_modal_search_clear { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .contacts_modal_search_clear:hover { opacity: 1; @@ -2084,12 +2084,12 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { top: 22px; width: 17px; height: 15px; - background: url(../img/icons/IconsetW.png?1) -13px -366px no-repeat; + background: url(../img/icons/IconsetW.png) -13px -366px no-repeat; background-size: 42px 560px; opacity: 0.5; } .is_1x .icon-contact-tick { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .contacts_modal_members_list a.contacts_modal_contact:hover .icon-contact-tick { background-position: -13px -366px; @@ -2182,11 +2182,11 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { width: 12px; height: 15px; - background: url(../img/icons/IconsetW.png?1) -15px -319px no-repeat; + background: url(../img/icons/IconsetW.png) -15px -319px no-repeat; background-size: 42px 560px; } .is_1x .icon-delete { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_message_selected { background: #f2f6fa; @@ -2229,11 +2229,11 @@ a.contacts_modal_contact:hover .contacts_modal_contact_status { width: 26px; height: 26px; margin: 13px 0 0 40px; - background: url(../img/icons/IconsetW.png?1) -9px -516px no-repeat; + background: url(../img/icons/IconsetW.png) -9px -516px no-repeat; background-size: 42px 560px; } .is_1x .icon-select-tick { - background-image: url(../img/icons/IconsetW_1x.png?2); + background-image: url(../img/icons/IconsetW_1x.png); } .im_history_selectable .icon-select-tick, .im_content_message_select_area:hover .icon-select-tick { diff --git a/app/index.html b/app/index.html index 29a5a0b1..6ece9a17 100644 --- a/app/index.html +++ b/app/index.html @@ -4,10 +4,14 @@ Webogram + + - + - + + + @@ -21,31 +25,35 @@
- + + - + - - - - - + + + + + - + - - - - - - - - + + + + + + + + + + + diff --git a/app/js/app.js b/app/js/app.js index 9d6ea783..cddd3249 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -30,6 +30,7 @@ angular.module('myApp', [ 'ngAnimate', 'ngSanitize', 'ui.bootstrap', + 'partials', 'myApp.filters', 'myApp.services', 'mtproto.services', @@ -63,9 +64,9 @@ config(['$locationProvider', '$routeProvider', '$compileProvider', function($loc // $locationProvider.html5Mode(true); - $routeProvider.when('/', {templateUrl: 'partials/welcome.html?4', controller: 'AppWelcomeController'}); - $routeProvider.when('/login', {templateUrl: 'partials/login.html?5', controller: 'AppLoginController'}); - $routeProvider.when('/im', {templateUrl: 'partials/im.html?13', controller: 'AppIMController', reloadOnSearch: false}); + $routeProvider.when('/', {templateUrl: 'partials/welcome.html', controller: 'AppWelcomeController'}); + $routeProvider.when('/login', {templateUrl: 'partials/login.html', controller: 'AppLoginController'}); + $routeProvider.when('/im', {templateUrl: 'partials/im.html', controller: 'AppIMController', reloadOnSearch: false}); $routeProvider.otherwise({redirectTo: '/'}); }]); diff --git a/app/js/background.js b/app/js/background.js index 09020469..2f8ac9ad 100644 --- a/app/js/background.js +++ b/app/js/background.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/controllers.js b/app/js/controllers.js index 30cdbd95..4f8e1cba 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -168,7 +168,7 @@ angular.module('myApp.controllers', []) $scope.isLoggedIn = true; $scope.openSettings = function () { $modal.open({ - templateUrl: 'partials/settings_modal.html?3', + templateUrl: 'partials/settings_modal.html', controller: 'SettingsModalController', scope: $rootScope.$new(), windowClass: 'settings_modal_window' @@ -191,7 +191,7 @@ angular.module('myApp.controllers', []) scope.userIDs = userIDs; $modal.open({ - templateUrl: 'partials/chat_create_modal.html?3', + templateUrl: 'partials/chat_create_modal.html', controller: 'ChatCreateModalController', scope: scope, windowClass: 'contacts_modal_window' @@ -965,7 +965,7 @@ angular.module('myApp.controllers', []) scope.chatID = $scope.chatID; $modal.open({ - templateUrl: 'partials/chat_edit_modal.html?3', + templateUrl: 'partials/chat_edit_modal.html', controller: 'ChatEditModalController', scope: scope, windowClass: 'contacts_modal_window' diff --git a/app/js/directives.js b/app/js/directives.js index 29bbd22d..93d9ae14 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -16,7 +16,7 @@ angular.module('myApp.directives', ['myApp.filters']) restrict: 'AE', scope: true, translude: false, - templateUrl: 'partials/dialog.html?5' + templateUrl: 'partials/dialog.html' }; }) @@ -25,7 +25,7 @@ angular.module('myApp.directives', ['myApp.filters']) restrict: 'AE', scope: true, translude: false, - templateUrl: 'partials/message.html?7' + templateUrl: 'partials/message.html' }; }) diff --git a/app/js/filters.js b/app/js/filters.js index b2fedc6e..1ede38eb 100644 --- a/app/js/filters.js +++ b/app/js/filters.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/aes_worker.js b/app/js/lib/aes_worker.js index a8418fe7..0c5ef9d9 100644 --- a/app/js/lib/aes_worker.js +++ b/app/js/lib/aes_worker.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/mtproto.js b/app/js/lib/mtproto.js index f032152c..8cae493f 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/pq_worker.js b/app/js/lib/pq_worker.js index 3cc216a7..4123a7d5 100644 --- a/app/js/lib/pq_worker.js +++ b/app/js/lib/pq_worker.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/sha1_worker.js b/app/js/lib/sha1_worker.js index 5dee15f0..5d677b1a 100644 --- a/app/js/lib/sha1_worker.js +++ b/app/js/lib/sha1_worker.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/services.js b/app/js/services.js index 928563b6..8efd1641 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -289,7 +289,7 @@ angular.module('myApp.services', []) scope.userID = userID; var modalInstance = $modal.open({ - templateUrl: 'partials/user_modal.html?2', + templateUrl: 'partials/user_modal.html', controller: 'UserModalController', scope: scope, windowClass: 'user_modal_window' @@ -425,7 +425,7 @@ angular.module('myApp.services', []) scope.chatID = chatID; var modalInstance = $modal.open({ - templateUrl: 'partials/chat_modal.html?4', + templateUrl: 'partials/chat_modal.html', controller: 'ChatModalController', windowClass: 'chat_modal_window', scope: scope @@ -1724,7 +1724,7 @@ angular.module('myApp.services', []) scope.photoID = photoID; var modalInstance = $modal.open({ - templateUrl: 'partials/photo_modal.html?1', + templateUrl: 'partials/photo_modal.html', controller: 'PhotoModalController', scope: scope }); @@ -1824,7 +1824,7 @@ angular.module('myApp.services', []) scope.player = {}; var modalInstance = $modal.open({ - templateUrl: 'partials/video_modal.html?1', + templateUrl: 'partials/video_modal.html', controller: 'VideoModalController', scope: scope }); diff --git a/app/js/util.js b/app/js/util.js index ac0d08ee..51d3a57f 100644 --- a/app/js/util.js +++ b/app/js/util.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.19 - messaging web application for MTProto + * Webogram v0.0.1 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/partials/im.html b/app/partials/im.html index 54ce1021..735e2e22 100644 --- a/app/partials/im.html +++ b/app/partials/im.html @@ -1,4 +1,4 @@ -
+
diff --git a/app/partials/login.html b/app/partials/login.html index 5cd289d5..b52c3b38 100644 --- a/app/partials/login.html +++ b/app/partials/login.html @@ -1,4 +1,4 @@ -
+
\ No newline at end of file +
diff --git a/app/partials/welcome.html b/app/partials/welcome.html index c4c721ba..3071b474 100644 --- a/app/partials/welcome.html +++ b/app/partials/welcome.html @@ -1,4 +1,4 @@ -
+
@@ -14,4 +14,4 @@ Start Messaging
- \ No newline at end of file + diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..c93bdf2e --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,86 @@ +var gulp = require('gulp'); +var es = require('event-stream'); +var pj = require('./package.json'); +var $ = require('gulp-load-plugins')(); +var concat = require('gulp-concat'); + +// The generated file is being created at src +// so it can be fetched by usemin. +gulp.task('templates', function() { + return gulp.src('app/partials/*.html') + .pipe($.angularTemplatecache('partials.js', { + root: 'partials', + module: 'partials', + standalone: true + })) + .pipe(gulp.dest('app/js')); +}); + +gulp.task('copy', function() { + return es.concat( + gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js', 'app/img/**/*', '!app/img/screenshot*']) + .pipe(gulp.dest('dist')), + gulp.src('app/vendor/console-polyfill/console-polyfill.js') + .pipe(gulp.dest('dist/vendor/console-polyfill')), + gulp.src('app/js/lib/mtproto.js') + .pipe(gulp.dest('dist/js/lib')), + gulp.src('app/js/lib/config.js') + .pipe(gulp.dest('dist/js/lib')), + gulp.src('app/vendor/jsbn/jsbn_combined.js') + .pipe(gulp.dest('dist/vendor/jsbn')), + gulp.src('app/vendor/cryptoJS/crypto.js') + .pipe(gulp.dest('dist/vendor/cryptoJS')) + ); +}); + +gulp.task('update-version-manifests', function() { + return gulp.src(['app/manifest.webapp', 'app/manifest.json']) + .pipe($.replace(/"version": ".*",/, '"version": "' + pj.version + '",')) + .pipe(gulp.dest('app')); +}); + +gulp.task('update-version-settings', function() { + return gulp.src('app/partials/settings_modal.html') + .pipe($.replace(/alpha .*<\/span>/, 'alpha ' + pj.version + '<\/span>')) + .pipe(gulp.dest('app/partials')); +}); + +gulp.task('update-version-comments', function() { + return gulp.src('app/**/*') + .pipe($.grepStream('Webogram v')) + .pipe($.replace(/Webogram v[0-9.]*/, 'Webogram v' + pj.version)) + .pipe(gulp.dest('app')); +}); + +gulp.task('usemin', ['templates'], function() { + return gulp.src('app/index.html') + .pipe($.usemin({ + html: [$.minifyHtml({empty: true})], + js: ['concat', $.rev()], + css: [$.minifyCss(), 'concat'] + })) + .pipe(gulp.dest('dist')); +}); + +gulp.task('clean', function() { + return gulp.src('dist').pipe($.clean()); +}); + +gulp.task('compress-dist', function() { + return es.concat( + gulp.src('dist/*') + .pipe($.zip('webogram_v' + pj.version + '.zip')) + .pipe(gulp.dest('package')), + gulp.src('package/*.zip') + .pipe(gulp.dest('.')), + gulp.src('package/**/*').pipe($.clean()) + ); +}); + +gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']); +gulp.task('build', ['clean', 'templates', 'usemin', 'copy']); +gulp.task('package', ['build', 'compress-dist']); + +gulp.task('default', function() { + gulp.start('build'); +}); diff --git a/package.json b/package.json new file mode 100644 index 00000000..5a453e4a --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "webogram", + "version": "0.0.1", + "description": "UNOFFICIAL Telegram Web App.", + "main": "server.js", + "scripts": { + "start": "node server.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/zhukov/webogram.git" + }, + "author": "zhukov", + "license": "GPL", + "bugs": { + "url": "https://github.com/zhukov/webogram/issues" + }, + "homepage": "http://zhukov.github.io/webogram", + "devDependencies": { + "gulp": "~3.5.5", + "gulp-angular-templatecache": "^1.1.0", + "gulp-load-plugins": "^0.4.0", + "gulp-usemin": "^0.3.3", + "gulp-uglify": "^0.2.1", + "gulp-rev": "^0.3.0", + "gulp-minify-css": "^0.3.0", + "gulp-minify-html": "^0.1.1", + "gulp-imagemin": "^0.1.5", + "gulp-clean": "^0.2.4", + "gulp-replace": "^0.2.0", + "gulp-concat": "^2.1.7", + "gulp-grep-stream": "0.0.2", + "event-stream": "^3.1.0", + "gulp-zip": "^0.1.2" + } +} From d356b6f67d1362d8d9e3f69691da17950fe545ee Mon Sep 17 00:00:00 2001 From: Pablo Terradillos Date: Sun, 9 Mar 2014 18:25:15 -0300 Subject: [PATCH 2/5] Added gulp for building tasks - Fix #41 --- .gitignore | 3 ++- gulpfile.js | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 27af7609..7b820477 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ dist package_dist webogram*.zip -*.sublime-workspace \ No newline at end of file +app/js/partials.js +*.sublime-workspace diff --git a/gulpfile.js b/gulpfile.js index c93bdf2e..56493b72 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -18,8 +18,10 @@ gulp.task('templates', function() { gulp.task('copy', function() { return es.concat( - gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js', 'app/img/**/*', '!app/img/screenshot*']) + gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js']) .pipe(gulp.dest('dist')), + gulp.src(['app/img/**/*', '!app/img/screenshot*']) + .pipe(gulp.dest('dist/img')), gulp.src('app/vendor/console-polyfill/console-polyfill.js') .pipe(gulp.dest('dist/vendor/console-polyfill')), gulp.src('app/js/lib/mtproto.js') @@ -78,9 +80,9 @@ gulp.task('compress-dist', function() { }); gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']); -gulp.task('build', ['clean', 'templates', 'usemin', 'copy']); +gulp.task('build', ['templates', 'usemin', 'copy']); gulp.task('package', ['build', 'compress-dist']); -gulp.task('default', function() { +gulp.task('default', ['clean'], function() { gulp.start('build'); }); From b8a32cae65adf85055d02531d3b53d133f16bdfb Mon Sep 17 00:00:00 2001 From: Pablo Terradillos Date: Sun, 9 Mar 2014 18:48:36 -0300 Subject: [PATCH 3/5] Added gulp for building tasks - Fix #41 --- gulpfile.js | 49 ++++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 56493b72..7c9316f6 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,6 +4,16 @@ var pj = require('./package.json'); var $ = require('gulp-load-plugins')(); var concat = require('gulp-concat'); +gulp.task('usemin', ['templates'], function() { + return gulp.src('app/index.html') + .pipe($.usemin({ + html: [$.minifyHtml({empty: true})], + js: ['concat', $.rev()], + css: [$.minifyCss(), 'concat'] + })) + .pipe(gulp.dest('dist')); +}); + // The generated file is being created at src // so it can be fetched by usemin. gulp.task('templates', function() { @@ -35,6 +45,23 @@ gulp.task('copy', function() { ); }); +gulp.task('compress-dist', ['add-csp'], function() { + return es.concat( + gulp.src('dist/*') + .pipe($.zip('webogram_v' + pj.version + '.zip')) + .pipe(gulp.dest('package')), + gulp.src('package/*.zip') + .pipe(gulp.dest('.')), + gulp.src('package/**/*').pipe($.clean()) + ); +}); + +gulp.task('add-csp', ['build'], function() { + return gulp.src('dist/index.html') + .pipe($.replace('', '')) + .pipe(gulp.dest('dist')); +}); + gulp.task('update-version-manifests', function() { return gulp.src(['app/manifest.webapp', 'app/manifest.json']) .pipe($.replace(/"version": ".*",/, '"version": "' + pj.version + '",')) @@ -54,34 +81,14 @@ gulp.task('update-version-comments', function() { .pipe(gulp.dest('app')); }); -gulp.task('usemin', ['templates'], function() { - return gulp.src('app/index.html') - .pipe($.usemin({ - html: [$.minifyHtml({empty: true})], - js: ['concat', $.rev()], - css: [$.minifyCss(), 'concat'] - })) - .pipe(gulp.dest('dist')); -}); gulp.task('clean', function() { return gulp.src('dist').pipe($.clean()); }); -gulp.task('compress-dist', function() { - return es.concat( - gulp.src('dist/*') - .pipe($.zip('webogram_v' + pj.version + '.zip')) - .pipe(gulp.dest('package')), - gulp.src('package/*.zip') - .pipe(gulp.dest('.')), - gulp.src('package/**/*').pipe($.clean()) - ); -}); - gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']); gulp.task('build', ['templates', 'usemin', 'copy']); -gulp.task('package', ['build', 'compress-dist']); +gulp.task('package', ['compress-dist']); gulp.task('default', ['clean'], function() { gulp.start('build'); From 96525d4933a13a7f66eefc49bc2746f2085929be Mon Sep 17 00:00:00 2001 From: Pablo Terradillos Date: Wed, 12 Mar 2014 01:40:04 -0300 Subject: [PATCH 4/5] Cleans the package folder after package generation - fix #41 --- gulpfile.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 7c9316f6..fc268a38 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -51,8 +51,7 @@ gulp.task('compress-dist', ['add-csp'], function() { .pipe($.zip('webogram_v' + pj.version + '.zip')) .pipe(gulp.dest('package')), gulp.src('package/*.zip') - .pipe(gulp.dest('.')), - gulp.src('package/**/*').pipe($.clean()) + .pipe(gulp.dest('.')) ); }); @@ -88,7 +87,9 @@ gulp.task('clean', function() { gulp.task('bump', ['update-version-manifests', 'update-version-settings', 'update-version-comments']); gulp.task('build', ['templates', 'usemin', 'copy']); -gulp.task('package', ['compress-dist']); +gulp.task('package', ['compress-dist'], function() { + gulp.src('package').pipe($.clean()); +}); gulp.task('default', ['clean'], function() { gulp.start('build'); From e362ff26da5cd83c973ec319f8a57e72b7c918c4 Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Wed, 12 Mar 2014 22:55:12 +0100 Subject: [PATCH 5/5] Fixed gulp bugs --- .gitignore | 10 ++--- app/css/app.css | 2 +- app/index.html | 10 +++-- app/js/app.js | 8 ++-- app/js/background.js | 2 +- app/js/controllers.js | 2 +- app/js/directives.js | 2 +- app/js/filters.js | 2 +- app/js/lib/aes_worker.js | 2 +- app/js/lib/mtproto.js | 8 ++-- app/js/lib/pq_worker.js | 4 +- app/js/lib/sha1_worker.js | 6 +-- app/js/services.js | 2 +- app/js/util.js | 2 +- gulpfile.js | 77 ++++++++++++++++++++++++++------------- package.json | 2 +- 16 files changed, 87 insertions(+), 54 deletions(-) diff --git a/.gitignore b/.gitignore index 7b820477..ec388491 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ .DS_Store .idea +*.sublime-workspace # Node.js package manager -/node_modules -/npm-debug.log +node_modules +npm-debug.log dist -package_dist +releases webogram*.zip -app/js/partials.js -*.sublime-workspace +app/js/templates.js \ No newline at end of file diff --git a/app/css/app.css b/app/css/app.css index ad0860a3..77ac1bfb 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -484,7 +484,7 @@ input[type="number"]::-webkit-inner-spin-button { margin-right: -7px; } .im_dialogs_col .nano > .pane { - background : rgba(0,0,0,.0); + background : rgba(0,0,0,0.0); width : 12px; right: 0px; -webkit-transition : .2s; diff --git a/app/index.html b/app/index.html index 6ece9a17..4e23df0d 100644 --- a/app/index.html +++ b/app/index.html @@ -44,16 +44,20 @@ - - + + + + - + \ No newline at end of file diff --git a/app/js/app.js b/app/js/app.js index cddd3249..cb8b4501 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -30,10 +30,12 @@ angular.module('myApp', [ 'ngAnimate', 'ngSanitize', 'ui.bootstrap', - 'partials', + 'mtproto.services', 'myApp.filters', 'myApp.services', - 'mtproto.services', + /*PRODUCTION_ONLY_BEGIN + 'myApp.templates', + PRODUCTION_ONLY_END*/ 'myApp.directives', 'myApp.controllers' ]). diff --git a/app/js/background.js b/app/js/background.js index 2f8ac9ad..09020469 100644 --- a/app/js/background.js +++ b/app/js/background.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/controllers.js b/app/js/controllers.js index 4f8e1cba..fa8e062c 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/directives.js b/app/js/directives.js index 93d9ae14..d87312d1 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/filters.js b/app/js/filters.js index 1ede38eb..b2fedc6e 100644 --- a/app/js/filters.js +++ b/app/js/filters.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/aes_worker.js b/app/js/lib/aes_worker.js index 0c5ef9d9..a8418fe7 100644 --- a/app/js/lib/aes_worker.js +++ b/app/js/lib/aes_worker.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/lib/mtproto.js b/app/js/lib/mtproto.js index 8cae493f..4682afa5 100644 --- a/app/js/lib/mtproto.js +++ b/app/js/lib/mtproto.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE @@ -1122,7 +1122,7 @@ factory('MtpAuthorizer', function (MtpDcConfigurator, MtpRsaKeysManager, MtpSecu console.log('PQ factorization start'); if (!!window.Worker) { - var worker = new Worker('js/lib/pq_worker.js?1'); + var worker = new Worker('js/lib/pq_worker.js'); worker.onmessage = function (e) { auth.p = e.data[0]; @@ -1416,7 +1416,7 @@ factory('MtpAesService', function ($q) { }; } - var worker = new Worker('js/lib/aes_worker.js?2'), + var worker = new Worker('js/lib/aes_worker.js'), taskID = 0, awaiting = {}; @@ -1468,7 +1468,7 @@ factory('MtpSha1Service', function ($q) { }; } - var worker = new Worker('js/lib/sha1_worker.js?2'), + var worker = new Worker('js/lib/sha1_worker.js'), taskID = 0, awaiting = {}; diff --git a/app/js/lib/pq_worker.js b/app/js/lib/pq_worker.js index 4123a7d5..721a2c24 100644 --- a/app/js/lib/pq_worker.js +++ b/app/js/lib/pq_worker.js @@ -1,12 +1,12 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE */ importScripts( - '../../vendor/console-polyfill/console-polyfill.js?1', + '../../vendor/console-polyfill/console-polyfill.js', 'mtproto.js', '../../vendor/jsbn/jsbn_combined.js' ); diff --git a/app/js/lib/sha1_worker.js b/app/js/lib/sha1_worker.js index 5d677b1a..1d7cd87f 100644 --- a/app/js/lib/sha1_worker.js +++ b/app/js/lib/sha1_worker.js @@ -1,14 +1,14 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE */ importScripts( - '../../vendor/console-polyfill/console-polyfill.js?1', + '../../vendor/console-polyfill/console-polyfill.js', 'mtproto.js', - '../../vendor/cryptoJS/crypto.js?1' + '../../vendor/cryptoJS/crypto.js' ); onmessage = function (e) { diff --git a/app/js/services.js b/app/js/services.js index 8efd1641..313fc240 100644 --- a/app/js/services.js +++ b/app/js/services.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/app/js/util.js b/app/js/util.js index 51d3a57f..ac0d08ee 100644 --- a/app/js/util.js +++ b/app/js/util.js @@ -1,5 +1,5 @@ /*! - * Webogram v0.0.1 - messaging web application for MTProto + * Webogram v0.0.19 - messaging web application for MTProto * https://github.com/zhukov/webogram * Copyright (C) 2014 Igor Zhukov * https://github.com/zhukov/webogram/blob/master/LICENSE diff --git a/gulpfile.js b/gulpfile.js index fc268a38..ff7d5b0d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -4,28 +4,29 @@ var pj = require('./package.json'); var $ = require('gulp-load-plugins')(); var concat = require('gulp-concat'); -gulp.task('usemin', ['templates'], function() { - return gulp.src('app/index.html') - .pipe($.usemin({ - html: [$.minifyHtml({empty: true})], - js: ['concat', $.rev()], - css: [$.minifyCss(), 'concat'] - })) - .pipe(gulp.dest('dist')); -}); -// The generated file is being created at src +// The generated file is being created at src // so it can be fetched by usemin. gulp.task('templates', function() { return gulp.src('app/partials/*.html') - .pipe($.angularTemplatecache('partials.js', { + .pipe($.angularTemplatecache('templates.js', { root: 'partials', - module: 'partials', + module: 'myApp.templates', standalone: true })) .pipe(gulp.dest('app/js')); }); +gulp.task('usemin', ['templates', 'enable-production'], function() { + return gulp.src('app/index.html') + .pipe($.usemin({ + html: [$.minifyHtml({empty: true})], + js: ['concat', $.rev()], + css: [$.minifyCss(), 'concat'] + })) + .pipe(gulp.dest('dist')); +}); + gulp.task('copy', function() { return es.concat( gulp.src(['app/favicon.ico', 'app/favicon_unread.ico', 'app/manifest.webapp', 'app/manifest.json', 'app/**/*worker.js']) @@ -46,13 +47,13 @@ gulp.task('copy', function() { }); gulp.task('compress-dist', ['add-csp'], function() { - return es.concat( - gulp.src('dist/*') - .pipe($.zip('webogram_v' + pj.version + '.zip')) - .pipe(gulp.dest('package')), - gulp.src('package/*.zip') - .pipe(gulp.dest('.')) - ); + return gulp.src('dist/**/*') + .pipe($.zip('webogram_v' + pj.version + '.zip')) + .pipe(gulp.dest('releases')); +}); + +gulp.task('cleanup-dist', ['compress-dist'], function() { + return gulp.src(['releases/**/*', '!releases/*.zip']).pipe($.clean()); }); gulp.task('add-csp', ['build'], function() { @@ -74,22 +75,48 @@ gulp.task('update-version-settings', function() { }); gulp.task('update-version-comments', function() { - return gulp.src('app/**/*') - .pipe($.grepStream('Webogram v')) + return gulp.src('app/**/*.js') .pipe($.replace(/Webogram v[0-9.]*/, 'Webogram v' + pj.version)) .pipe(gulp.dest('app')); }); +gulp.task('enable-production', function() { + return es.concat( + gulp.src('app/**/*.html') + .pipe($.replace(/PRODUCTION_ONLY_BEGIN/g, 'PRODUCTION_ONLY_BEGIN-->')) + .pipe($.replace(/PRODUCTION_ONLY_END/, '/g, 'PRODUCTION_ONLY_BEGIN')) + .pipe($.replace(/