Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes #4

Merged
4 commits merged into from Aug 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion bin/npm2archinstall
Expand Up @@ -21,7 +21,6 @@ createPkg(npmName, function(err, pkgFile){
if(err) handleError(err);
// Install the pckage via a sudo pacman -U `pkgFile`
console.log('\nsudo pacman -U ' + pkgFile);
process.stdin.resume();
var pacman = spawn('sudo', ['pacman', '-U', pkgFile], {stdio: 'inherit'});
pacman.on('exit', function (code) {
fs.unlink(pkgFile, function(err){
Expand Down
2 changes: 1 addition & 1 deletion lib/createPkg.coffee
Expand Up @@ -47,7 +47,7 @@ module.exports = (npmName, makePkgArgv, options, cb) ->
return cb2 err if err
pkgFile = (files.filter (file)-> file.indexOf('nodejs-') is 0)[0]
newPkgFile = path.join(process.cwd(), path.basename pkgFile)
fs.unlinkSync newPkgFile if path.existsSync newPkgFile
fs.unlinkSync newPkgFile if fs.existsSync newPkgFile
fs.move path.join(tmpDir, pkgFile), newPkgFile, (err)->
cb2 err if err
cb2 null, newPkgFile
14 changes: 1 addition & 13 deletions lib/npm2PKGBUILD.coffee
Expand Up @@ -26,8 +26,6 @@ module.exports = (npmName, options, cb) ->
pkg = data[version]
pkg = cleanup pkg
pkg.nameLowerCase = pkg.name.toLowerCase()
pkg.contributors = [pkg.contributors] if typeof pkg.contributors is 'string'
pkg.maintainers = [pkg.maintainers] if typeof pkg.maintainers is 'string'
pkg.homepage or= pkg.url
pkg.homepage or= pkg.repository.url.replace(/^git(@|:\/\/)/, 'http://').replace(/\.git$/, '').replace(/(\.\w*)\:/g, '$1\/') if pkg.repository?.url
pkg.depends = options.depends
Expand All @@ -42,17 +40,7 @@ module.exports = (npmName, options, cb) ->
populateTemplate = (pkg) ->
cb null, mustache.to_html(template, pkg)


template = '''{{#author}}
# Author: {{{author}}}
{{/author}}
{{#contributors}}
# Contributor: {{{.}}}
{{/contributors}}
{{#maintainers}}
# Maintainer: {{{.}}}
{{/maintainers}}
_npmname={{{name}}}
template = '''_npmname={{{name}}}
_npmver={{{version}}}
pkgname=nodejs-{{{nameLowerCase}}} # All lowercase
pkgver={{{archVersion}}}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -33,7 +33,8 @@
"uuid-js": "~0.7.4"
},
"devDependencies": {
"mocha": "~1.8.2"
"mocha": "~1.8.2",
"vows": "~0.7.0"
},
"scripts": {
"test": " ./node_modules/.bin/mocha --compilers coffee:coffee-script -R spec"
Expand Down
6 changes: 2 additions & 4 deletions test/npm2arch.coffee
@@ -1,5 +1,5 @@
{npm2PKGBUILD, createPkg} = require '../index'
mocha = require 'mocha'
mocha = require 'mocha'
vows = require 'vows'
assert = require 'assert'
path = require 'path'
Expand All @@ -14,8 +14,6 @@ describe 'Test npm2arch', ->
npm2PKGBUILD 'npm2arch', depends: ['curl', 'git'], optdepends: [ phantomjs: 'browser-run test suite'], (err, pkgbuild) ->
assert.isNull err
assert.isNotNull pkgbuild
assert.include pkgbuild, "# Author: Filirom1 <filirom1@gmail.com>"
assert.include pkgbuild, "# Maintainer: filirom1 <filirom1@gmail.com>"
assert.include pkgbuild, "license=(MIT)"
assert.include pkgbuild, 'url="https://github.com/Filirom1/npm2arch"'
assert.include pkgbuild, 'pkgdesc="Convert NPM package to a PKGBUILD for ArchLinux"'
Expand Down Expand Up @@ -47,7 +45,7 @@ describe 'Test npm2arch', ->
assert.include file, '-dir/'
assert.include file, 'nodejs-npm2arch-'
assert.include file, '.src.tar.gz'
assert.isTrue path.existsSync file
assert.isTrue fs.existsSync file
rimraf.sync path.dirname file
done()

Expand Down