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

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

Instance Method Details

#get_diffObject



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

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

#need_bower?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/orly/tester.rb', line 51

def need_bower?
  @need_bower
end

#need_bundle_install?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/orly/tester.rb', line 43

def need_bundle_install?
  @need_bundle
end

#need_dotenv?Boolean

Returns:

  • (Boolean)


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

def need_dotenv?
  @need_dotenv
end

#need_migrate?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/orly/tester.rb', line 39

def need_migrate?
  @need_migrate
end

#need_npm?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/orly/tester.rb', line 55

def need_npm?
  @need_npm
end

#need_pod?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/orly/tester.rb', line 47

def need_pod?
  @need_pod
end

#run_testsObject



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

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 /^.dotenv-encrypted/ then @need_dotenv = true
    end
  end
rescue Git::GitExecuteError
  false
end