Class: Orly::Tester

Inherits:
Object
  • Object
show all
Defined in:
lib/orly/tester.rb

Instance Method Summary collapse

Constructor Details

#initializeTester

Returns a new instance of Tester.



8
9
10
11
12
13
14
15
16
17
18
# 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
  run_tests
rescue ArgumentError
  raise NoRepo.new
end

Instance Method Details

#get_diffObject



36
37
38
39
# File 'lib/orly/tester.rb', line 36

def get_diff
  git = Git.open('.')
  git.diff('HEAD@{1}','HEAD')
end

#need_bower?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/orly/tester.rb', line 53

def need_bower?
  @need_bower
end

#need_bundle_install?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/orly/tester.rb', line 45

def need_bundle_install?
  @need_bundle
end

#need_dotenv?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/orly/tester.rb', line 67

def need_dotenv?
  @need_dotenv
end

#need_migrate?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/orly/tester.rb', line 41

def need_migrate?
  @need_migrate
end

#need_npm?Boolean

Returns:

  • (Boolean)


57
58
59
60
# File 'lib/orly/tester.rb', line 57

def need_npm?
  return false if uses_yarn?
  @need_npm
end

#need_pod?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/orly/tester.rb', line 49

def need_pod?
  @need_pod
end

#need_yarn?Boolean

Returns:

  • (Boolean)


62
63
64
65
# File 'lib/orly/tester.rb', line 62

def need_yarn?
  return false unless uses_yarn?
  @need_npm
end

#run_testsObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/orly/tester.rb', line 20

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
    end
  end
rescue Git::GitExecuteError
  false
end

#uses_yarn?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/orly/tester.rb', line 71

def uses_yarn?
  @uses_yarn
end