Example #1
0
 def find_babel(self):
     exename = 'babel'
     exepath = get_executable(exename)
     npminstall = "npm install -g babel --no-color"
     if not exepath:
         if win32:
             self.ctx.run(npminstall, echo=False, encoding="utf-8")
             exepath = get_executable(exename)
         else:
             raise MissingCommand("Missing babel (%s)" % npminstall)
     return exepath
Example #2
0
 def find_uglify(self):
     exename = 'uglifyjs'
     exepath = get_executable(exename)
     if not exepath:
         npminstall = "npm install -g uglify-js --no-color"
         if win32:
             self.ctx.run(npminstall, echo=False, encoding="utf-8")
             exepath = get_executable(exename)
         else:
             raise MissingCommand("Missing uglifyjs (%s)" % npminstall)
     return exepath
Example #3
0
    def find_nodejs(self):  # pragma: nocover
        """Find :program:`node`.
        """
        if sys.platform == 'win32':
            node_exe = get_executable('node')
        else:
            node_exe = get_executable('nodejs') or get_executable('node')

        if not node_exe:  # pragma: nocover
            raise MissingCommand("""
            Install Node.js using your OS package manager
            https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
            """)
        return node_exe
Example #4
0
 def _find_exe(self, name, requires=(), install_txt=None):
     fexe = get_executable(name)
     if not fexe:  # pragma: nocover
         if not install_txt:  # pragma: nocover
             install_txt = "Missing command: %r [requires: %s]" % (name, requires)
         raise MissingCommand(install_txt)
     return fexe
Example #5
0
 def find_npm(self):
     """Find the node package manager (:program:`npm`).
     """
     npm_exe = get_executable('npm')
     if not npm_exe:  # pragma: nocover
         raise MissingCommand("""
         Install Node.js using your OS package manager
         https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
         """)
     return npm_exe
Example #6
0
def test_missing_executable():
    assert not which.get_executable('chewbaccascousin')
Example #7
0
def test_get_executable():
    assert which.get_executable('find')