Ejemplo n.º 1
0
 exportMisc(options) {
     let source = jet.dir(options.root + '/export');
     let target = jet.dir(options.target);
     jet.copy(source.path(), target.path(), {
         matching: [
             '**'
         ],
         overwrite: true
     });
     /**
      * update config
      */
     let template = io.read(path.resolve(source.path() + '/profile_device_server.json'));
     let content = StringUtils_1.replace(template, null, options, {
         begin: '%',
         end: '%'
     });
     if (options.linux32) {
         jet.exists(target.path() +
             path.sep + '/server/linux_32/nxappmain/profile_device_server.json') && io.write(target.path() + path.sep +
             '/server/linux_32/nxappmain/profile_device_server.json', content);
     }
     if (options.linux64) {
         jet.exists(target.path() +
             path.sep + '/server/linux_64/nxappmain/profile_device_server.json') && io.write(target.path() + path.sep +
             '/server/linux_64/nxappmain/profile_device_server.json', content);
     }
     if (options.windows) {
         jet.exists(target.path() +
             path.sep + '/server/windows/nxappmain/profile_device_server.json') && io.write(target.path() + path.sep +
             '/server/windows/nxappmain/profile_device_server.json', content);
     }
     if (options.arm) {
         jet.exists(target.path() +
             path.sep + '/server/arm/nxappmain/profile_device_server.json') && io.write(target.path() + path.sep +
             '/server/arm/nxappmain/profile_device_server.json', content);
     }
     if (options.osx) {
         jet.exists(target.path() +
             path.sep + '/server/osx_64/nxappmain/profile_device_server.json') && io.write(target.path() + path.sep + '/server/osx_64/nxappmain/profile_device_server.json', content);
     }
     /**
      * update boot start.js
      */
     template = io.read(path.resolve(source.path() + '/start.js'));
     content = StringUtils_1.replace(template, null, options, {
         begin: '%',
         end: '%'
     });
     options.linux32 !== false && jet.exists(target.path() + '/server/linux_32/start.js') && io.write(target.path() + '/server/linux_32/start.js', content);
     options.linux64 !== false && jet.exists(target.path() + '/server/linux_64/start.js') && io.write(target.path() + '/server/linux_64/start.js', content);
     options.windows !== false && io.write(target.path() + '/server/windows/start.js', content);
     options.arm !== false && jet.exists(target.path() + '/server/arm/start.js') && io.write(target.path() + '/server/arm/start.js', content);
     options.osx !== false && jet.exists(target.path() + '/server/osx_64/start.js') && io.write(target.path() + '/server/osx_64/start.js', content);
 }
Ejemplo n.º 2
0
 update () {
   if (!jetpack.exists(this.path)) {
     return Promise.reject(new Error('Package' + this.url + ' does not exist'))
   }
   this.logger.log('info', 'pull package')
   return this.pull(this.url, this.path)
 }
Ejemplo n.º 3
0
 return installStatus.get(name).then((status) => {
   if (status && jetpack.exists(packagePath)) return status
   return retry(`git clone [${name}]`, () => {
     const packageUrl = 'https://github.com/' + name + '.git'
     return new Promise((resolve, reject) => {
       mkdirp(path.dirname(packagePath), (err) => {
         err ? reject(err) : resolve()
       })
     }).then(() => {
       return git(['clone', packageUrl, packagePath]).catch((err) => {
         if (err.message.match(/already exists/i)) {
           return true// futher promises will resolve
         } else if (err.message.match(/Repository not found/i)) {
           throw new Error('Package "' + name + '" does not exist on github')
         } else {
           throw err
         }
       })
     }).then(() => {
       return installStatus.set(name, 'cloned')
     })
   }, {
     clean: () => {
       return jetpack.removeAsync(packagePath)
     },
   })
 })
Ejemplo n.º 4
0
  load () {
    if (this.loaded) return

    if (!jetpack.exists(this.profilePath)) {
      const template = require('../templates/zazurc.json')
      jetpack.write(this.profilePath, template)
    }

    try {
      const data = require(this.profilePath)
      this.plugins = data.plugins
      this.theme = data.theme
      this.hotkey = data.hotkey
      this.displayOn = data.displayOn !== 'primary' ? 'detect' : 'primary'
      this.disableAnalytics = data.disableAnalytics
      this.debug = data.debug
      this.hideTrayItem = data.hideTrayItem
      this.loaded = true
      this.height = data.height || this.height
    } catch (e) {
      const logger = require('./logger')
      logger.error('Attempted to load an invalid ~/.zazurc.json file', e)
    }

    return this.loaded
  }
Ejemplo n.º 5
0
 create: (dir, outfile) => {
   // Move nxtpm.json to tmp dir
   let tempFile;
   const manifest = path.resolve(
     path.join(dir, config.get('filename'))
   );
   if (jetpack.exists(manifest)) {
     tempFile = tmp.tmpNameSync();
     jetpack.move(manifest, tempFile);
   }
   const compress = new Targz();
   return new Promise((resolve, reject) => {
     compress.compress(dir, outfile, err => {
       if (err) {
         return reject(err);
       }
       log.info('Created', path.resolve(outfile));
       const hash = crypto.createHash('sha256');
       const stream = fs.createReadStream(outfile);
       stream.on('data', data => hash.update(data, 'utf8'));
       stream.on('end', () => {
         const checksum = hash.digest('hex');
         log.info('Checksum %s (sha256)', checksum);
         if (tempFile) {
           jetpack.move(tempFile, manifest);
         }
         resolve(checksum);
       });
     });
   });
 },
Ejemplo n.º 6
0
 beforeEach(() => {
   jetpack.write(configuration.profilePath, 'module.exports = ' + JSON.stringify({
     hotkey: 'alt+space',
     theme: 'tinytacoteam/dark-purple',
     plugins: ['abc'],
   }))
   expect(jetpack.exists(configuration.profilePath)).to.be.okay
   configuration.load()
 })
Ejemplo n.º 7
0
    return new Promise((resolve, reject) => {
      if (!jetpack.exists(this.profilePath)) {
        jetpack.copy('./templates/zazurc.js', this.profilePath, {
          overwrite: false,
        })
      }

      const data = require(this.profilePath)
      this.plugins = data.plugins
      this.theme = data.theme
      this.hotkey = data.hotkey
      resolve()
    })
Ejemplo n.º 8
0
 copyServer(options, platform) {
     let target = jet.dir(options.target + '/server/' + platform);
     let isDebug = false;
     let source = "";
     if (options.nodeServers) {
         if (!jet.exists(options.nodeServers + '/' + platform)) {
             return;
         }
         source = jet.dir(options.nodeServers + '/' + platform);
     }
     else {
         if (!isDebug) {
             source = jet.dir(options.root + '/server/' + platform);
         }
         else {
             source = jet.dir(options.root + '/server/nodejs/dist/' + platform);
         }
     }
     if (!jet.exists(source.path())) {
         return;
     }
     console_1.console.info('export Device-Server ' + platform + ' from : ' + source.path());
     try {
         jet.copy(source.path(), target.path(), {
             matching: [
                 '**'
             ],
             overwrite: true
         });
     }
     catch (err) {
         if (err.code === 'EEXIST') {
             console_1.console.error('Error copying, file exists!', err);
         }
         if (err.code === 'EACCES') {
             console_1.console.error('Error copying, file access perrmissions!', err);
         }
     }
 }
Ejemplo n.º 9
0
 create(path) {
   switch (fs.exists(path)) {
     case "dir":
       let files = fs.list(fs.path(path, "commands"));
       return class FactoryPluginClass extends Plugin {
         constructor() {
           super();
           for (let file of files) {
             this.addCommand(new (require(fs.path(path, "commands", file)))());
           }
         }
       };
     case "file":
       // Assume a file is the index file for a plugin
       return require(path);
     default:
       return null;
   }
 }
Ejemplo n.º 10
0
function checkForAlerts() {
    if (lastAlertFile === undefined) {
        lastAlertFile = path.join(app.getPath('userData'), 'lastAlert.txt');
        if (fs.exists(lastAlertFile)) {
            var ws = fs.read(lastAlertFile, 'utf-8');
            lastAlert = parseInt(ws);
        }
    }

    if (!loginDetails) {
        // not logged in
        return;
    }

    var options = {
        url: config.settings.webService + '/v1/alerts?iid=' + loginDetails.id + '&last=' + lastAlert,
        headers: {
            'Authorization': `Bearer ${loginDetails.accessToken}`
        }
    };

    //console.log(options);
    request(options, function(err, response, results) {
        if (err) {
            console.error('Unable to poll for alerts: ' + err);
            return;
        }
        var alerts = JSON.parse(results);
        for (var a = 0; a < alerts.length; a++) {
            var alert = alerts[a];
            alert.id = +alert.id; // Make sure it is an number
            if (alert.id > lastAlert) {
                lastAlert = alert.id;
                fs.write(lastAlertFile, lastAlert.toString(), 'utf-8');
            }
            eNotify.notify({
                title: 'InView Notification',
                text: `${alert.message}`,
                onClickFunc: notifyClickHandler
            });
        }
    });
}
Ejemplo n.º 11
0
 getModuleDependencies(_file = '') {
     let modArr = [],
         //cjsRequireRegExp = /\s*require\s*\(\s*["\']([^\'"\s]+)["\']\s*\)/g;
         cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g;
     if (! jetpack.exists(_file)) { 
         console.log('\x1b[31m%s\x1b[0m', 'File does not exists! ' + _file);
         return; 
     }
     let content = jetpack.read(_file, 'utf8');
     try {
         content = stripComments(content);
     } catch(err) {}
     content.replace(cjsRequireRegExp, (match, dep) => {
         if (this.modules.indexOf(dep) == -1 && modArr.indexOf(dep) == -1) {
             modArr.push(dep);
         }       
     });
     if (modArr.length) {
         modArr.forEach((dep) => {
             this.getModuleDependencies(this._makeFilename(dep));
             this.modules.push(dep);
         });
     }
 }
Ejemplo n.º 12
0
module.exports.getProjectRootJetpack = function() {
    if (ardublocklyRootDir === null) {
        // Cannot use relative paths in build, so let's try to find the
        // ardublockly folder in a node from the executable file path tree
        ardublocklyRootDir = jetpack.dir(__dirname);
        var oldArdublocklyRootDir = '';
        while (ardublocklyRootDir.path() != oldArdublocklyRootDir) {
            // Check if /ardublokly/index.html exists within current path
            if (jetpack.exists(
                    ardublocklyRootDir.path('ardublockly', 'index.html'))) {
                // Found the right folder, break with this dir loaded
                break;
            }
            oldArdublocklyRootDir = ardublocklyRootDir.path();
            ardublocklyRootDir = ardublocklyRootDir.dir('../');
        }

        if (ardublocklyRootDir.path() == oldArdublocklyRootDir) {
            ardublocklyRootDir = jetpack.dir('.');
            ardublocklyNotFound(ardublocklyRootDir.path('.'));
        }
    }
    return ardublocklyRootDir;
};
Ejemplo n.º 13
0
 .then(() => {
   // Key 'abc' hashed with sha1: 'a9993e364706816aba3e25717850c26c9cd0d89d'
   const path = jetpack.path(testDir, 'a9', '993e364706816aba3e25717850c26c9cd0d89d');
   expect(jetpack.exists(path)).toBe('file');
   done();
 });
Ejemplo n.º 14
0
    ipcMain.once('loginResults', function(event, arg) {
        try {
            //console.info(arg);
            var loginResults = JSON.parse(arg);
            loginDetails = loginResults.loginDetails;
            userDetails = loginResults.userDetails;
            dataSettings = loginResults.dataSettings;

            if (contextMenu) {
                for (var i = 0; i < contextMenu.items.length; i++) {
                    if (contextMenu.items[i].label == 'Snooze') {
                        // console.info(`Setting ${contextMenu.items[i].label} to ${userDetails.snooze == 1}`);
                        contextMenu.items[i].enabled = userDetails.snooze == 1;
                    }
                }
                appIcon.setContextMenu(contextMenu);
            }

            setInterval(checkForAlerts, 20000);
            var initialHeight = Math.floor(monitor.height * .80);
            var initialWidth = Math.floor((initialHeight / 16) * 9);
            var options = {
                width: initialWidth,
                height: initialHeight,
                useContentSize: true,
                center: true,
                show: true,
                frame: false,
                transparent: true,
                maximizable: false,
                minimizable: userDetails.snooze == 1,
                resizable: userDetails.resizable == 1,
                alwaysOnTop: userDetails.always_on_top == 1,
                closable: false
            };

            var lastPositionFile = path.join(app.getPath('userData'), 'lastposition.json');
            console.info(lastPositionFile);
            if (fs.exists(lastPositionFile)) {
                var hadError = false;
                var bounds;
                try {
                    console.info("Loading " + lastPositionFile);
                    var ws = fs.read(lastPositionFile, 'utf-8');
                    bounds = JSON.parse(ws);
                    options.x = bounds.x;
                    options.y = bounds.y;
                    options.width = bounds.width;
                    options.height = bounds.height;
                } catch (err) {
                    console.error(err);
                    hadError = true;
                }
                console.info(JSON.stringify(options));
                mainWindow = createWindow('main', options);
                if (!hadError) {
                    setTimeout(function() {
                        console.info("Bounds read from file: " + JSON.stringify(bounds));
                        if (bounds.width > monitor.width) {
                            bounds.width = monitor.width;
                        }

                        if (bounds.height > monitor.height) {
                            bounds.height = monitor.height;
                        }

                        if ((bounds.x + bounds.width) > monitor.width) {
                            bounds.x = (monitor.width - bounds.width) / 2;
                        }

                        if ((bounds.y + bounds.height) > monitor.height) {
                            bounds.y = (monitor.height - bounds.height) / 2;
                        }
                        console.info("Setting bounds to: " + JSON.stringify(bounds));
                        mainWindow.setBounds(bounds);
                    }, 1000);
                }
            } else {
                mainWindow = createWindow('main', options);
            }


            mainWindow.loadURL(path.join(__dirname, 'PageHost.html'));

            if ((userDetails.snooze == 1) && (userDetails.duration_of_snooze > 0)) {
                console.info('Setting a minimize (snooze) event handler');

                mainWindow.on('minimize', function(e) {
                    if (snoozeTimer) {
                        clearTimeout(snoozeTimer);
                        snoozeTimer = undefined;
                    }
                    var minutes = userDetails.duration_of_snooze;
                    var units;

                    console.info(`Setting a snooze timer for ${userDetails.duration_of_snooze} minutes`);
                    snoozeTimer = setTimeout(function() {

                        snoozeTimer = undefined;
                        if (mainWindow.isMinimized()) {
                            console.info("Time for snoozing is over, waking up and restoring the window");
                            mainWindow.restore();
                        }
                    }, minutes * 60 * 1000);
                });
            }

            ipcMain.on('ready', function() {
                var uri = getInviewUri();
                console.info("Launching: " + uri);
                var req = { cmd: 'goto', args: [uri] };
                mainWindow.webContents.send('request', JSON.stringify(req));
            });

            ipcMain.on('message', function(event, msgString) {
                try {
                    console.info('Received: ' + msgString);
                    var msg = JSON.parse(msgString);
                    switch (msg.cmd.toLowerCase()) {
                        case 'getloginresults':
                            console.info('Sending login results');
                            var lr = { type: 'loginResults', loginDetails: loginDetails, userDetails: userDetails };
                            event.sender.send('loginResults', JSON.stringify(lr));
                            break;
                        case 'snooze':
                            mainWindow.minimize();
                            break;
                        case 'poptotop':
                            if (mainWindow.isMinimized) {
                                mainWindow.restore();
                            } else {
                                mainWindow.minimize();
                                setTimeout(function() { mainWindow.restore(); }, 100);
                            }
                            break;
                        case 'setwindowtitle':
                            if (mainWindow) {
                                mainWindow.setWindo
                            }
                            break;
                        case 'setwindowsize':
                            if (mainWindow) {
                                var pos = mainWindow.getBounds();
                                var arg = msg.arg;
                                var anchor = 'top';
                                if (arg.anchor) {
                                    anchor = arg.anchor.toLowerCase();
                                }

                                arg.width = arg.width === undefined ? pos.width : arg.width;
                                arg.height = arg.height === undefined ? pos.height : arg.height;
                                if (arg.width < 1) {
                                    arg.width = pos.width;
                                }
                                if (arg.height < 1) {
                                    arg.height = pos.height;
                                }

                                switch (anchor) {
                                    case 'bottomleft':
                                    case 'bl':
                                    case 'bottom':
                                    case 'b':
                                        pos.y += pos.height - arg.height;
                                        break;
                                    case 'topright':
                                    case 'tr':
                                    case 'right':
                                    case 'r':
                                        pos.x += pos.width - arg.width;
                                        break;
                                    case 'bottomright':
                                    case 'br':
                                        pos.y += pos.height - arg.height;
                                        pos.x += pos.width - arg.width;
                                        break;
                                    case 'center':
                                    case 'c':
                                        pos.y += Math.floor((pos.height - arg.height) / 2);
                                        pos.x += Math.floor((pos.width - arg.width) / 2);
                                        break;
                                }
                                pos.width = arg.width;
                                pos.height = arg.height;
                                mainWindow.setBounds(pos);
                            }
                            break;
                    }
                } catch (err) {
                    console.error(err);
                }
            });

            if (loginWindow) {
                loginWindow.destroy();
                loginWindow = null;
            }

            setApplicationMenu(null);
        } catch (err) {
            console.error('Error getting loginDetails ' + err);
        }
    });
Ejemplo n.º 15
0
const FS = require('fs-jetpack')

/**
    Collect all commands in this directory. Returns a collection
    of what was found.
*/
var commands = [];
var registry = __dirname.split('/').pop() == 'commands' ? __dirname + '/registry.json' : __dirname + '/commands/registry.json';

if( !FS.exists(registry) ){
  commands = FS.cwd(__dirname).find(__dirname, { matching: ['*.cmd.js'] })
  FS.write(registry, JSON.stringify(commands, null, 2))
} else {
  commands = JSON.parse(FS.read(registry))
}

module.exports = commands.map(function(file_name){ return require(`${__dirname}/${file_name}`)})
Ejemplo n.º 16
0
export async function createWindowsInstaller(options) {
  let useMono = false;
  let monoExe = await locateExecutableInPath('mono');
  let wineExe = await locateExecutableInPath('wine');

  if (process.platform !== 'win32') {
    useMono = true;
    if (!wineExe || !monoExe) {
      throw new Error("You must install both Mono and Wine on non-Windows");
    }

    d(`Using Mono: '${monoExe}'`);
    d(`Using Wine: '${wineExe}'`);
  }
  let { appDirectory, outputDirectory, loadingGif } = options;
  outputDirectory = p`${outputDirectory || 'installer'}`;

  await jetpack.copyAsync(
    p`${__dirname}/../vendor/Update.exe`,
    p`${appDirectory}/Update.exe`);

  let defaultLoadingGif = p`${__dirname}/../resources/install-spinner.gif`;
  loadingGif = loadingGif ? p`${loadingGif}` : defaultLoadingGif;

  let {certificateFile, certificatePassword, remoteReleases, signWithParams, githubToken} = options;

  let appMetadata = null;
  let asarFile = p`${appDirectory}/resources/app.asar`;
  if (await jetpack.existsAsync(asarFile)) {
    appMetadata = JSON.parse(asar.extractFile(asarFile, 'package.json'));
  } else {
    appMetadata = JSON.parse(await jetpack.readAsync(p`${appDirectory}/resources/app/package.json`, 'utf8'));
  }

  let defaults = {
    description: appMetadata.description || '',
    exe: `${appMetadata.name}.exe`,
    iconUrl: 'https://raw.githubusercontent.com/atom/electron/master/atom/browser/resources/win/atom.ico',
    title: appMetadata.productName || appMetadata.name
  };

  let metadata = _.assign({}, appMetadata, options, defaults);

  if (!metadata.authors) {
    if (typeof(metadata.author) === 'string') {
      metadata.authors = metadata.author;
    } else {
      metadata.authors = (metadata.authors || {}).name || '';
    }
  }

  metadata.owners = metadata.owners || metadata.authors;
  metadata.version = convertVersion(metadata.version);
  metadata.copyright = metadata.copyright ||
    `Copyright © ${new Date().getFullYear()} ${metadata.authors || metadata.owners}`;

  let templateStamper = _.template(await jetpack.readAsync(p`${__dirname}/../template.nuspec`));
  let nuspecContent = templateStamper(metadata);

  d(`Created NuSpec file:\n${nuspecContent}`);

  let nugetOutput = temp.mkdirSync('si');
  let targetNuspecPath = p`${nugetOutput}/${metadata.name}.nuspec`;
  await jetpack.writeAsync(targetNuspecPath, nuspecContent);

  let cmd = p`${__dirname}/../vendor/nuget.exe`;
  let args = [
    'pack', targetNuspecPath,
    '-BasePath', appDirectory,
    '-OutputDirectory', nugetOutput,
    '-NoDefaultExcludes'
  ];

  if (useMono) {
    args.unshift(cmd);
    cmd = monoExe;
  }

  // Call NuGet to create our package
  d(await spawn(cmd, args));
  let nupkgPath = p`${nugetOutput}/${metadata.name}.${metadata.version}.nupkg`;

  if (remoteReleases) {
    cmd = p`${__dirname}/../vendor/SyncReleases.exe`;
    args = ['-u', remoteReleases, '-r', outputDirectory];

    if (useMono) {
      args.unshift(cmd);
      cmd = monoExe;
    }

    if (githubToken) {
      args.push('-t', githubToken);
    }

    d(await spawn(cmd, args));
  }

  cmd = p`${__dirname}/../vendor/Update.com`;
  args = [
    '--releasify', nupkgPath,
    '--releaseDir', outputDirectory,
    '--loadingGif', loadingGif
  ];

  if (useMono) {
    args.unshift(p`${__dirname}/../vendor/Update-Mono.exe`);
    cmd = monoExe;
  }

  if (signWithParams) {
    args.push('--signWithParams');
    args.push(signWithParams);
  } else if (certificateFile && certificatePassword) {
    args.push('--signWithParams');
    args.push(`/a /f "${path.resolve(certificateFile)}" /p "${certificatePassword}"`);
  }

  if (options.setupIcon) {
    let setupIconPath = p`${options.setupIcon}`;
    args.push('--setupIcon');
    args.push(setupIconPath);
  }

  if (options.noMsi) {
    args.push('--no-msi');
  }

  d(await spawn(cmd, args));

  if (metadata.productName) {
    d('Fixing up paths');
    let setupPath = p`${outputDirectory}/${metadata.productName}Setup.exe`;
    let setupMsiPath = p`${outputDirectory}/${metadata.productName}Setup.msi`;

    // NB: When you give jetpack two absolute paths, it acts as if './' is appended
    // to the target and mkdirps the entire path
    d(`Renaming ${outputDirectory}/Setup.exe => ${setupPath}`);
    fs.renameSync(p`${outputDirectory}/Setup.exe`, setupPath);

    if (jetpack.exists(p`${outputDirectory}/Setup.msi`)) {
      fs.renameSync(p`${outputDirectory}/Setup.msi`, setupMsiPath);
    }
  }
}
Ejemplo n.º 17
0
const file = {
    read(file, json) {
        if (!file) return;
        return jetpack.read(sanitize(file), json ? 'json' : undefined);
    },
    write(file, data, append) {
        if (!file) return;

        if (append) {
            data += os.EOL;
            jetpack.append(sanitize(file), data);
        } else {
            jetpack.write(sanitize(file), data);
        }
    },
    exists(file) {
        if (!file) return;
        return jetpack.exists(sanitize(file));
    }
};

function sanitize(file) {
    if (!file.endsWith('.txt')) file += '.txt';
    if (file.startsWith('/')) file = file.slice(1);
    return path.resolve(Settings.get('botLoggingPath'), file);
}

export default file;

$.file = file;
		it( "should create the config file", () => {
			let exists = fs.exists( configFile );
			exists.should.equal( "file" );
		} );
Ejemplo n.º 19
0
import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App'
import Main from './components/views/main'
import RegisterComponent from './components/register'
import {remote} from 'electron'
import jetpack from 'fs-jetpack'
import fs from 'fs'

Vue.use(VueRouter)
RegisterComponent.registerAllGlobalComponents()

const useDataDir = jetpack.cwd(remote.app.getAppPath()).cwd(remote.app.getPath('userData'))

let dirYes = jetpack.exists(useDataDir.path('streams'))
let dirFav = jetpack.exists(useDataDir.path('favicons'))
if (!dirYes) {
  fs.mkdir(useDataDir.path('streams'))
}
if (!dirFav) {
  fs.mkdir(useDataDir.path('favicons'))
}

const router = new VueRouter({
  hashbang: false,
  abstract: true
})

router.map({
  '/:type/:name': {
    component: Main
Ejemplo n.º 20
0
 getFileSize: function(filePath) {
     var size = (fs.exists(filePath) && fs.inspectTree(filePath).size) || 0;
     return utils.getReadableFileSize(size);
 },
Ejemplo n.º 21
0
 beforeEach(() => {
   expect(jetpack.exists(configuration.profilePath)).to.be.false
   configuration.load()
 })
Ejemplo n.º 22
0
var filesToCopy = [
    './app/*.html',
    './app/assets/**/*',
    './app/main.js',
    '!./app/vendor/**/*',
    '!./app/node_modules/**/*',
]

// Make a dev copy of the config w/ source maps and debug enabled
var devConfig = Object.create(webpackConfig)
devConfig.devtool = 'source-map'
devConfig.debug = true

// Determine the node_modules dir is exists or not
var moduleExists = jetpack.exists(dest + '/node_modules') || jetpack.exists(dest + '/vendor')

gulp.task('clean', function() {
    if (!moduleExists) {
        return jetpack.cwd(dest).dir('.', {
            empty: true
        })
    } else {
        return jetpack.find(dest, {
            matching: ['*.json', '*.html', '*.css', '*.js', '*.map', '!vendor/**/*', '!node_modules/**/*']
        }).forEach(jetpack.remove)
    }
})

gulp.task('css', function() {
    var stylesheets = [
Ejemplo n.º 23
0
var electron = require('electron');
var jetpack = require('fs-jetpack');
var app = electron.app;
var BrowserWindow = electron.BrowserWindow;
const globalShortcut = electron.globalShortcut;

console.log(require.resolve('electron'));

var homeDirectory = process.env.HOME || process.env.USERPROFILE;
//return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']
var filePath = homeDirectory + "/.clipManager";
var shortcutKey = 'e';
var acceptedKeys = "e|g|k|l|j"
if (jetpack.exists(filePath)) {
  var valueSet = jetpack.read(filePath, 'json');
  var key = valueSet.shortcutKey;
  if (key && key.length == 1 && key.match(acceptedKeys)) {
    shortcutKey = key;
  }
}

app.on('ready', function() {
  console.log("App getting started..");
  var mainWindow = new BrowserWindow({
    width: 800,
    height: 500,
    transparent: true,
    focusable: true,
    title: "Clip Manager",
    // alwaysontop: false,
    frame: false,
Ejemplo n.º 24
0
 it('creates zazurc file', () => {
   expect(jetpack.exists(configuration.profilePath)).to.be.okay
 })