Module: Katapult::GeneratorGoodies

Included in:
Generator, Katapult::Generators::BasicsGenerator, TransformGenerator
Defined in:
lib/katapult/support/generator_goodies.rb

Overview

This module holds methods that are shared between Katapult’s element generators and the Rails generators it uses (e.g. BasicsGenerator)

Instance Method Summary collapse

Instance Method Details

#file_contains?(path, content) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/katapult/support/generator_goodies.rb', line 11

def file_contains?(path, content)
  file_content = File.read(path)
  file_content.include? content
end

#yarn(*args) ⇒ Object



6
7
8
9
# File 'lib/katapult/support/generator_goodies.rb', line 6

def yarn(*args)
  command =  'bin/yarn --silent --non-interactive ' + args.join(' ')
  run command
end