Class: Suspenders::StylelintGenerator::YarnInstall

Inherits:
Object
  • Object
show all
Defined in:
lib/suspenders/generators/stylelint_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(base, dependencies, flags) ⇒ YarnInstall

Returns a new instance of YarnInstall.


53
54
55
56
57
# File 'lib/suspenders/generators/stylelint_generator.rb', line 53

def initialize(base, dependencies, flags)
  @base = base
  @dependencies = dependencies.join(" ")
  @flags = flags
end

Instance Method Details

#invoke!Object


59
60
61
# File 'lib/suspenders/generators/stylelint_generator.rb', line 59

def invoke!
  @base.run "bin/yarn add #{@dependencies} #{@flags}"
end

#revoke!Object


63
64
65
66
67
68
# File 'lib/suspenders/generators/stylelint_generator.rb', line 63

def revoke!
  @base.behavior = :invoke
  @base.run "bin/yarn remove #{@dependencies}"
ensure
  @base.behavior = :revoke
end