Skip to content

Commit

Permalink
Add install script
Browse files Browse the repository at this point in the history
Remove unnecessary files

Fix updating apps from cache to database
  • Loading branch information
geblanco committed Apr 8, 2020
1 parent 7d8c157 commit 66275f3
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 8,498 deletions.
19 changes: 5 additions & 14 deletions apps/native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,16 @@ function removeFromDB(database, apps, callback){
.find({ type: '_native_', name: { $nin: apps.map( a => a.name ) } })
.exec(( err, docs ) => {
if( err ) return callback(err)
Logger.log(`[NATIVE APPS] Cleaning ${docs.length} old apps`)
async.each( docs, ( doc, cb ) => { doc.remove( cb ) }, callback)
})
}

function updateDB(database, apps, callback){
database.find({ type: '_native_' }, ( err, docs ) => {
if( err ) return callback(err)
// Update every application with the new apps
// Save unstored ones
// by now, only save apps not present in db
let docNames = docs.map(a => a.name)
let unsavedApps = apps.reduce((acc, app) => {
if( docNames.indexOf(app.name) === -1 ){
acc.push(app)
}
return acc
}, [])
database.save(unsavedApps, callback)
})
// Update apps, saving the ones not present
async.each(apps, (app, cb) => {
database.update({ type: '_native_', name: app.name }, app, { upsert: true }, cb)
}, callback)
}

function fetchAppsFromDB(database){
Expand Down
12 changes: 0 additions & 12 deletions install/gtkcc.sh

This file was deleted.

20 changes: 20 additions & 0 deletions install/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Enter Working Dir (shall be project root)
prevDir=$(pwd)
cd "$1"

# Electron's version.
export npm_config_target=$(electron -v | cut -c 2-)
# The architecture of Electron, can be ia32 or x64.
export npm_config_arch=x64
# Download headers for Electron.
export npm_config_disturl=https://atom.io/download/atom-shell
# Tell node-pre-gyp that we are building for Electron.
export npm_config_runtime=electron
# Tell node-pre-gyp to build module from source code.
export npm_config_build_from_source=true
# Install all dependencies
npm install

cd $prevDir
Loading

0 comments on commit 66275f3

Please sign in to comment.