Sha256: 3e7a190b0d2414902992142ef0e8838ca9f665064465542efaa27b5b5e852f66

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 Bytes

Contents

module Katapult::GeneratorGoodies

  def yarn(*args)
    command =  'bin/yarn ' + args.join(' ')
    run command
  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

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katapult-0.4.0 lib/katapult/support/generator_goodies.rb