Skip to content

Commit

Permalink
fix install correctly bin
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoIannacone committed Jun 4, 2014
1 parent 61070b2 commit 71c0701
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 5 additions & 4 deletions npm2deb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,11 @@ def create_dirs(self):
def create_links(self):
links = []
dest = self.debian_dest
if os.path.isdir('bin'):
for script in os.listdir('bin'):
links.append("%s/bin/%s usr/bin/%s" %
(dest, script, script.replace('.js', '')))
if 'bin' in self.json:
for script in self.json['bin']:
orig = os.path.normpath(self.json['bin'][script])
links.append("%s/%s usr/bin/%s" %
(dest, orig, script))
if len(links) > 0:
content = '\n'.join(links)
utils.create_debian_file('links', content)
Expand Down
7 changes: 7 additions & 0 deletions tests/npm_coherence.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def test_watch_github_with_no_tags(self):
line = self._get_debfile_line('watch', '/fakeupstream')
self.assertTrue(line is not None and len(line) > 0)

def test_install_bin(self):
n = Npm2Deb('mocha')
n.create_base_debian()
n.create_links()
line = self._get_debfile_line('links', 'mocha')
self.assertTrue(line == 'usr/lib/nodejs/mocha/bin/mocha usr/bin/mocha')


if __name__ == '__main__':
unittest.main()

0 comments on commit 71c0701

Please sign in to comment.