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
# File 'lib/orly/tester.rb', line 8

def initialize
  @need_bundle = false
  @need_migrate = false
  run_tests
rescue ArgumentError
  raise NoRepo.new
end

Instance Method Details

#get_diffObject



28
29
30
31
# File 'lib/orly/tester.rb', line 28

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

#need_bundle_install?Boolean

Returns:

  • (Boolean)


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

def need_bundle_install?
  @need_bundle
end

#need_migrate?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/orly/tester.rb', line 33

def need_migrate?
  @need_migrate
end

#need_pod?Boolean

Returns:

  • (Boolean)


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

def need_pod?
  @need_pod
end

#run_testsObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/orly/tester.rb', line 16

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