Commit ad4b94b4 authored by Michał Siwek's avatar Michał Siwek

Make the repo look like a mess

parent 3a30eb44
......@@ -12,4 +12,4 @@ Installation
Download and run installation script
wget -q -O - https://raw.github.com/skycocker/chromebrew/master/install_chromebrew.sh | sudo bash
wget -q -O - https://raw.github.com/skycocker/chromebrew/master/install.sh | sudo bash
program = require 'commander'
fs = require 'fs'
events = require 'events'
global.eventDispatch = new events.EventEmitter
program.version '0.0.1'
program.parse process.argv
action = process.argv[2]
pkgName = process.argv[3]
search = (pkgName, callback) ->
fs.readdir '.', (err, files) =>
callback file for file in files when file.indexOf(pkgName) isnt -1
download = (pkgName) ->
pkg = require './' + pkgName + '.coffee'
pkg.getBinary()
install = (pkgName) ->
download pkgName
eventDispatch.on 'gotFile', ->
console.log "installing..."
switch action
when "search" then search pkgName, console.log
when "download" then download pkgName
when "install" then install pkgName
network = require './network.coffee'
module.exports =
binary_url: "https://dl.dropboxusercontent.com/s/u3cp7mpdyfx99ij/binutils-2.23.2-chromeos-i686.tar.gz?token_hash=AAGsFB9HXNb5tSAm_Wd2GyIUL59BkZYgMTHkj4CkHLxggg&dl=1"
binary_sha1: ""
binary_install: ->
getBinary: ->
network.getFile @binary_url
build: ->
system './configure'
system 'make'
install: ->
system 'make install'
network = require './network.coffee'
module.exports =
binary_url: "https://dl.dropboxusercontent.com/s/lo9ks3g7ar3zpfu/mpfr-3.1.2-chromeos-i686.tar.gz?token_hash=AAH1GlLfYtUs4uxl1ayeGTBe8RJ5uTXzOAsXgSlv8G5rrA&dl=1"
binary_sha1: ""
getBinary: (callback) ->
network.getFile @binary_url
https = require 'https'
progressbar = require 'progress'
fs = require 'fs'
module.exports.getFile = (url) ->
https.get url, (res) ->
len = parseInt res.headers['content-length'], 10
content_disposition = res.headers['content-disposition']
filename = content_disposition.substring content_disposition.indexOf('"')+1, content_disposition.length-1
console.log();
bar = new progressbar ' downloading [:bar] :percent :etas', {
complete: '='
incomplete: ' '
width: 20
total: len
}
res.on 'data', (chunk) ->
fs.appendFileSync filename, chunk
bar.tick chunk.length
res.on 'end', ->
eventDispatch.emit 'gotFile'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment