Module: Jekyll::Esm::Managers::Bower
- Defined in:
- lib/jekyll-esm/managers/bower.rb
Defined Under Namespace
Classes: Error
Class Method Summary collapse
- .add(package:, site:) ⇒ Object
- .dist(config) ⇒ Object
- .location(config) ⇒ Object
- .remove(packages:, site:) ⇒ Object
Class Method Details
.add(package:, site:) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/jekyll-esm/managers/bower.rb', line 18 def self.add(package:, site:) stdout, stderr, status = Open3.capture3( "bower install #{package}", chdir: File.(site.source) ) if site.config.dig('esm', 'strict') runtime_error = stdout =~ /ERROR in|SyntaxError/ raise Error, stderr if stderr.size > 0 raise Error, stdout if !runtime_error.nil? end end |
.dist(config) ⇒ Object
14 15 16 |
# File 'lib/jekyll-esm/managers/bower.rb', line 14 def self.dist(config) config.dig('esm', 'dist') || location(config) || 'bower_components' end |
.location(config) ⇒ Object
10 11 12 |
# File 'lib/jekyll-esm/managers/bower.rb', line 10 def self.location(config) config.dig('esm', 'bower', 'dir') || 'bower_components' end |
.remove(packages:, site:) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/jekyll-esm/managers/bower.rb', line 32 def self.remove(packages:, site:) stdout, stderr, status = Open3.capture3( "bower uninstall #{packages}", chdir: File.(site.source) ) if site.config.dig('esm', 'strict') runtime_error = stdout =~ /ERROR in|SyntaxError/ raise Error, stderr if stderr.size > 0 raise Error, stdout if !runtime_error.nil? end end |