Viewing File: /usr/lib/python2.7/site-packages/sos/plugins/npm.pyo
ó
ÑKjc @ s| d d l Z d d l Z d d l m Z m Z m Z m Z m Z d e e e e e f d „ ƒ YZ d e f d „ ƒ YZ d S( iÿÿÿÿN( t Plugint RedHatPlugint DebianPlugint UbuntuPlugint
SuSEPlugint Npmc B sG e Z d Z d Z d
Z d g Z d Z d
d „ Z d „ Z d „ Z
RS( s.
Get info about available npm modules
t npmt systemt project_paths/ List npm modules of a project specified by patht fastt c C s# | j | d | d t d | ƒd S( Nt suggest_filenamet stderrt runat( t add_cmd_outputt False( t selft cmdt filenamet working_directory( ( s3 /usr/lib/python2.7/site-packages/sos/plugins/npm.pyt _get_npm_output s
c C s i } | j d d t ƒ} | d d k rÚ x¬ g | d j ƒ D] } | j d ƒ r? | ^ q? D]u } | j t j j ƒ } t | ƒ d k r‘ q^ n | \ } } } } }
| | k r | g | | <q^ | | j | ƒ q^ Wn | j
d | ƒ | j d ƒ } | j t
j | ƒ | ƒ d
S( sY
Example 'npm cache ls' output
~/.npm
~/.npm/acorn
~/.npm/acorn/1.2.2
~/.npm/acorn/1.2.2/package.tgz
~/.npm/acorn/1.2.2/package
~/.npm/acorn/1.2.2/package/package.json
~/.npm/acorn/4.0.3
~/.npm/acorn/4.0.3/package.tgz
~/.npm/acorn/4.0.3/package
~/.npm/acorn/4.0.3/package/package.json
~/.npm/registry.npmjs.org
~/.npm/registry.npmjs.org/acorn
~/.npm/registry.npmjs.org/acorn/.cache.json
https://docs.npmjs.com/cli/cache
s npm cache lst chroott statusi t outputs package.tgzi s modules in cache: %st npm_cache_modulesN( t collect_cmd_outputR t
splitlinest endswitht splitt ost patht sept lent appendt
_log_debugt _make_command_filenamet add_string_as_filet jsont dumps( R R t
user_cachet lt packaget
five_tuplet homet cachet namet versiont package_tgzt outfn( ( s3 /usr/lib/python2.7/site-packages/sos/plugins/npm.pyt _find_modules_in_npm_cache) s c C s“ | j d ƒ re t j j t j j | j d ƒ ƒ ƒ } | j d d d | ƒ| j d d d | ƒn | j d d ƒ | j d d ƒ | j ƒ d S(
NR s
npm ls --jsont npm_ls_projectR s npm config list -lt npm_config_list_projects npm ls -g --jsont
npm_ls_globalt npm_config_list_global( t
get_optionR R t abspatht
expanduserR R1 ( R R ( ( s3 /usr/lib/python2.7/site-packages/sos/plugins/npm.pyt setupP s
( s system( s project_paths/ List npm modules of a project specified by pathR R
( R N( t __name__t
__module__t __doc__t plugin_namet profilest option_listt packagest NoneR R1 R9 ( ( ( s3 /usr/lib/python2.7/site-packages/sos/plugins/npm.pyR s 't NpmViaNodeJSc B s e Z d Z d Z RS( sG
some distribution methods don't provide 'npm' via npm package
t nodejs( RC ( R: R; R<