cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [29/50] git commit: ubuntu: use common.copyFile
Date Fri, 05 Sep 2014 18:14:34 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/55c3d1ee
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/55c3d1ee
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/55c3d1ee

Branch: refs/heads/master
Commit: 55c3d1ee4f9641cf69a42c74c11f811eaefddf22
Parents: d4ea790
Author: Maxim Ermilov <maxim.ermilov@canonical.com>
Authored: Tue Aug 19 16:03:07 2014 +0400
Committer: Anis Kadri <anis@apache.org>
Committed: Fri Sep 5 11:12:19 2014 -0700

----------------------------------------------------------------------
 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/55c3d1ee/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