Class: Paquette::NpmRepacker
- Inherits:
-
Object
- Object
- Paquette::NpmRepacker
- Defined in:
- lib/paquette/npm_repacker.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(npm_path) ⇒ NpmRepacker
constructor
A new instance of NpmRepacker.
- #repack(&block) ⇒ Object
Constructor Details
#initialize(npm_path) ⇒ NpmRepacker
Returns a new instance of NpmRepacker.
14 15 16 17 18 |
# File 'lib/paquette/npm_repacker.rb', line 14 def initialize(npm_path) @npm_path = npm_path @temp_dir = nil @unpacked_package_dir = nil end |
Class Method Details
.repack(npm_path, &block) ⇒ Object
10 11 12 |
# File 'lib/paquette/npm_repacker.rb', line 10 def self.repack(npm_path, &block) new(npm_path).repack(&block) end |
Instance Method Details
#repack(&block) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/paquette/npm_repacker.rb', line 20 def repack(&block) raise ArgumentError, "Block required" unless block_given? raise ArgumentError, "NPM package not found: #{@npm_path}" unless File.exist?(@npm_path) unpack_package process_js_files(&block) new_package_path = repackage_package cleanup new_package_path end |