Class: TesttrackCli

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
app/models/testtrack_cli.rb

Instance Method Summary collapse

Instance Method Details

#call(*args) ⇒ Object



15
16
17
18
# File 'app/models/testtrack_cli.rb', line 15

def call(*args)
  system(path, *args)
  $CHILD_STATUS
end

#filenameObject



24
25
26
27
28
29
30
31
32
33
# File 'app/models/testtrack_cli.rb', line 24

def filename
  case host_os
    when /darwin/
      "testtrack.darwin"
    when /linux/
      "testtrack.linux"
    else
      raise "no testtrack binary for platform #{host_os}"
  end
end

#pathObject



20
21
22
# File 'app/models/testtrack_cli.rb', line 20

def path
  TestTrackRailsClient::Engine.root.join("vendor", "bin", "testtrack-cli", filename).to_s
end

#project_initialized?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'app/models/testtrack_cli.rb', line 11

def project_initialized?
  File.exist?(File.join('testtrack', 'schema.yml'))
end

#skip_testtrack_cli?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'app/models/testtrack_cli.rb', line 7

def skip_testtrack_cli?
  Rails.env.test? || (Rails.env.development? && project_initialized?) || ENV.key?('SKIP_TESTTRACK_CLI')
end