Sha256: cd207796b359503fe3b4ddefcd861abb32e124755e53edd7cb0d1704da4c2e5a
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
# This module holds methods that are shared between Katapult's element generators # and the Rails generators it uses (e.g. BasicsGenerator) # module Katapult::GeneratorGoodies def yarn(*args) command = 'bin/yarn --silent --non-interactive ' + args.join(' ') run command end def file_contains?(path, content) file_content = File.read(path) file_content.include? content end private def app_name(kind = nil) machine_name = File.basename(Dir.pwd) human_name = machine_name.tr('_', ' ').gsub(/\w+/, &:capitalize) case kind.to_s when '' then machine_name when 'human' then human_name else raise ArgumentError, "Unknown formatting: #{kind.inspect}" end end # Override Thor method def run(command, config={}) config[:capture] ||= false # false = return boolean instead of cmd output Bundler.with_clean_env do super(command, config) or exit(1) end end # Override Thor method def rake(command, config = {}) command.prepend 'bundle exec rake ' run command, config end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
katapult-0.5.0 | lib/katapult/support/generator_goodies.rb |