class Orly::Tester

Public Class Methods

new() click to toggle source
# File lib/orly/tester.rb, line 8
def initialize
  @need_bundle = false
  @need_migrate = false
  @need_bower = false
  @need_npm = false
  @uses_yarn = false
  @need_dotenv = false
  @need_mix = false
  @need_ecto_migrate = false
  @need_ecto_seed = false
  run_tests
rescue ArgumentError
  raise NoRepo.new
end

Public Instance Methods

get_diff() click to toggle source
# File lib/orly/tester.rb, line 42
def get_diff
  git = Git.open('.')
  git.diff('HEAD@{1}','HEAD')
end
need_bower?() click to toggle source
# File lib/orly/tester.rb, line 59
def need_bower?
  @need_bower
end
need_bundle_install?() click to toggle source
# File lib/orly/tester.rb, line 51
def need_bundle_install?
  @need_bundle
end
need_dotenv?() click to toggle source
# File lib/orly/tester.rb, line 73
def need_dotenv?
  @need_dotenv
end
need_ecto_migrate?() click to toggle source
# File lib/orly/tester.rb, line 85
def need_ecto_migrate?
  @need_ecto_migrate
end
need_ecto_seed?() click to toggle source
# File lib/orly/tester.rb, line 89
def need_ecto_seed?
  @need_ecto_seed
end
need_migrate?() click to toggle source
# File lib/orly/tester.rb, line 47
def need_migrate?
  @need_migrate
end
need_mix?() click to toggle source
# File lib/orly/tester.rb, line 81
def need_mix?
  @need_mix
end
need_npm?() click to toggle source
# File lib/orly/tester.rb, line 63
def need_npm?
  return false if uses_yarn?
  @need_npm
end
need_pod?() click to toggle source
# File lib/orly/tester.rb, line 55
def need_pod?
  @need_pod
end
need_yarn?() click to toggle source
# File lib/orly/tester.rb, line 68
def need_yarn?
  return false unless uses_yarn?
  @need_npm
end
run_tests() click to toggle source
# File lib/orly/tester.rb, line 23
def run_tests
  get_diff.each do |file|
    case(file.path)
      when /^Gemfile/ then @need_bundle = true
      when /^db\/migrate/ then @need_migrate = true
      when /^Podfile/ then @need_pod = true
      when /^bower\.json/ then @need_bower = true
      when /package\.json/ then @need_npm = true
      when /^yarn\.lock/ then @uses_yarn = true
      when /^.dotenv-encrypted/ then @need_dotenv = true
      when /^mix\.lock/ then @need_mix = true
      when /priv\/[-_.A-Za-z0-9]*\/migrations/ then @need_ecto_migrate = true
      when /priv\/[-_.A-Za-z0-9]*\/(?:seeds\.exs|fixtures\/[-_.A-Za-z0-9]*\.exs)/ then @need_ecto_seed = true
    end
  end
rescue Git::GitExecuteError
  false
end
uses_yarn?() click to toggle source
# File lib/orly/tester.rb, line 77
def uses_yarn?
  @uses_yarn
end