Class: PackageJson::Managers::PnpmLike
- Defined in:
- lib/package_json/managers/pnpm_like.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#add(packages, type: :production) ⇒ Object
Adds the given packages.
-
#initialize(package_json) ⇒ PnpmLike
constructor
A new instance of PnpmLike.
-
#install(frozen: false) ⇒ Object
Installs the dependencies specified in the ‘package.json` file.
- #native_exec_command(script_name, args = []) ⇒ Object
-
#native_install_command(frozen: false) ⇒ Object
Provides the “native” command for installing dependencies with this package manager for embedding into scripts.
-
#native_run_command(script_name, args = [], silent: false) ⇒ Object
Provides the “native” command for running the script with args for embedding into shell scripts.
-
#remove(packages) ⇒ Object
Removes the given packages.
-
#run(script_name, args = [], silent: false) ⇒ Object
Runs the script assuming it is defined in the ‘package.json` file.
Methods inherited from Base
#add!, #install!, #remove!, #run!, #version
Constructor Details
#initialize(package_json) ⇒ PnpmLike
Returns a new instance of PnpmLike.
4 5 6 |
# File 'lib/package_json/managers/pnpm_like.rb', line 4 def initialize(package_json) super(package_json, binary_name: "pnpm") end |
Instance Method Details
#add(packages, type: :production) ⇒ Object
Adds the given packages
19 20 21 |
# File 'lib/package_json/managers/pnpm_like.rb', line 19 def add(packages, type: :production) raw("add", [package_type_install_flag(type)] + packages) end |
#install(frozen: false) ⇒ Object
Installs the dependencies specified in the ‘package.json` file
9 10 11 |
# File 'lib/package_json/managers/pnpm_like.rb', line 9 def install(frozen: false) raw("install", with_frozen_flag(frozen)) end |
#native_exec_command(script_name, args = []) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/package_json/managers/pnpm_like.rb', line 46 def native_exec_command( script_name, args = [] ) build_full_cmd("exec", build_run_args(script_name, args, silent: false)) end |
#native_install_command(frozen: false) ⇒ Object
Provides the “native” command for installing dependencies with this package manager for embedding into scripts
14 15 16 |
# File 'lib/package_json/managers/pnpm_like.rb', line 14 def native_install_command(frozen: false) build_full_cmd("install", with_frozen_flag(frozen)) end |
#native_run_command(script_name, args = [], silent: false) ⇒ Object
Provides the “native” command for running the script with args for embedding into shell scripts
38 39 40 41 42 43 44 |
# File 'lib/package_json/managers/pnpm_like.rb', line 38 def native_run_command( script_name, args = [], silent: false ) build_full_cmd("run", build_run_args(script_name, args, silent: silent)) end |
#remove(packages) ⇒ Object
Removes the given packages
24 25 26 |
# File 'lib/package_json/managers/pnpm_like.rb', line 24 def remove(packages) raw("remove", packages) end |
#run(script_name, args = [], silent: false) ⇒ Object
Runs the script assuming it is defined in the ‘package.json` file
29 30 31 32 33 34 35 |
# File 'lib/package_json/managers/pnpm_like.rb', line 29 def run( script_name, args = [], silent: false ) raw("run", build_run_args(script_name, args, silent: silent)) end |