module Grapethor::Utils

Constants

ATTRS_MAP
CONFIG_FILENAME
TEST_FRAMEWORK_DIRNAME

Private Instance Methods

alert(msg, color='red') click to toggle source
# File lib/grapethor/utils/utils.rb, line 71
def alert(msg, color='red')
  say "\n#{msg}\n\n", color.to_sym
end
config_filename(app_path) click to toggle source
# File lib/grapethor/utils/utils.rb, line 90
def config_filename(app_path)
  begin
    YAML.load(File.read(File.join(app_path, CONFIG_FILENAME)))
  rescue Errno::ENOENT, Errno::EACCES
    say "\n ERROR: Config file not found. Try grapethor command with -p, [--path=PATH] option."
  end
end
report(msg) { || ... } click to toggle source
# File lib/grapethor/utils/utils.rb, line 76
    def report(msg)
      arguments = self.class.arguments.inject({}) { |args, a| args.merge!(a.name => instance_eval(a.name)) }
      say <<~MSG

        #{msg}
        arguments: #{arguments}
        options: #{options}

      MSG
      yield
      say "\nWell done!"
    end
test_dirname() click to toggle source
# File lib/grapethor/utils/utils.rb, line 99
def test_dirname
  TEST_FRAMEWORK_DIRNAME[app_test_framework.to_sym]
end