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, exact: false) ⇒ 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, exact: false) ⇒ Object
Adds the given packages
19 20 21 22 |
# File 'lib/package_json/managers/pnpm_like.rb', line 19 def add(packages, type: :production, exact: false) flags = [package_type_install_flag(type), exact_flag(exact)].compact raw("add", flags + 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
47 48 49 50 51 52 |
# File 'lib/package_json/managers/pnpm_like.rb', line 47 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
39 40 41 42 43 44 45 |
# File 'lib/package_json/managers/pnpm_like.rb', line 39 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
25 26 27 |
# File 'lib/package_json/managers/pnpm_like.rb', line 25 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
30 31 32 33 34 35 36 |
# File 'lib/package_json/managers/pnpm_like.rb', line 30 def run( script_name, args = [], silent: false ) raw("run", build_run_args(script_name, args, silent: silent)) end |