cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/4] git commit: ubuntu: use common.copyFile
Date Wed, 20 Aug 2014 14:41:30 GMT
ubuntu: use common.copyFile


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/cc768706
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/cc768706
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/cc768706

Branch: refs/heads/master
Commit: cc768706d0fbcd0cadf0e2102719415493a890ce
Parents: ead6074
Author: Maxim Ermilov <maxim.ermilov@canonical.com>
Authored: Tue Aug 19 16:03:07 2014 +0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Wed Aug 20 10:41:18 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/plugman/platforms/ubuntu.js | 29 ++++++++----------------
 1 file changed, 9 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/cc768706/cordova-lib/src/plugman/platforms/ubuntu.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/platforms/ubuntu.js b/cordova-lib/src/plugman/platforms/ubuntu.js
index c422d7c..89e0ed8 100644
--- a/cordova-lib/src/plugman/platforms/ubuntu.js
+++ b/cordova-lib/src/plugman/platforms/ubuntu.js
@@ -32,8 +32,10 @@ function toCamelCase(str) {
     }).join('');
 }
 
-var fs = require('fs')
+var shell = require('shelljs')
+   , fs = require('fs')
    , path = require('path')
+   , common = require('./common')
    , events = require('../../events')
    , xml_helpers = require(path.join(__dirname, '..', '..', 'util', 'xml-helpers'));
 
@@ -49,26 +51,18 @@ module.exports = {
     },
     'source-file':{
         install:function(source_el, plugin_dir, project_dir, plugin_id) {
-            var shell = require('shelljs');
-            var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
-            shell.mkdir(dest);
-            shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
-
-            shell.exec('touch ' + path.join(project_dir, 'CMakeLists.txt'));
+            var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(source_el.attrib.src));
+            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
         },
         uninstall:function(source_el, project_dir, plugin_id) {
-            var shell = require('shelljs');
-
             var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
             shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
         }
     },
     'header-file':{
         install:function(source_el, plugin_dir, project_dir, plugin_id) {
-            var shell = require('shelljs');
-            var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
-            shell.mkdir(dest);
-            shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
+            var dest = path.join('build', 'src', 'plugins', plugin_id, path.basename(source_el.attrib.src));
+            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
 
             var plugins = path.join(project_dir, 'build', 'src', 'coreplugins.cpp');
             var src = String(fs.readFileSync(plugins));
@@ -81,7 +75,6 @@ module.exports = {
             fs.writeFileSync(plugins, src);
         },
         uninstall:function(source_el, project_dir, plugin_id) {
-            var shell = require('shelljs');
             var dest = path.join(project_dir, 'build', 'src', 'plugins', plugin_id);
             shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
 
@@ -98,14 +91,10 @@ module.exports = {
     },
     'resource-file':{
         install:function(source_el, plugin_dir, project_dir, plugin_id) {
-            var shell = require('shelljs');
-            var dest = path.join(project_dir, 'qml');
-            shell.mkdir(dest);
-            shell.cp(path.join(plugin_dir, source_el.attrib.src), dest);
+            var dest = path.join('qml', path.basename(source_el.attrib.src));
+            common.copyFile(plugin_dir, source_el.attrib.src, project_dir, dest);
         },
         uninstall:function(source_el, project_dir, plugin_id) {
-            var shell = require('shelljs');
-
             var dest = path.join(project_dir, 'qml');
             shell.rm(path.join(dest, path.basename(source_el.attrib.src)));
         }


Mime
View raw message