Module: Bwoken

Defined in:
lib/bwoken.rb,
lib/bwoken/build.rb,
lib/bwoken/device.rb,
lib/bwoken/script.rb,
lib/bwoken/version.rb,
lib/bwoken/formatter.rb,
lib/bwoken/simulator.rb,
lib/bwoken/coffeescript.rb,
lib/bwoken/coffeescript/import_string.rb,
lib/bwoken/formatters/colorful_formatter.rb,
lib/bwoken/coffeescript/github_import_string.rb

Defined Under Namespace

Classes: Build, Coffeescript, ColorfulFormatter, Device, Formatter, Script, ScriptFailedError, Simulator

Constant Summary collapse

VERSION =
"1.3.0"

Class Method Summary collapse

Class Method Details

.app_nameObject



21
22
23
# File 'lib/bwoken.rb', line 21

def app_name
  File.basename(File.basename(workspace_or_project, '.xcodeproj'), '.xcworkspace')
end

.formatterObject



25
26
27
# File 'lib/bwoken.rb', line 25

def formatter
  @formatter ||= Bwoken::ColorfulFormatter.new
end

.pathObject



13
14
15
# File 'lib/bwoken.rb', line 13

def path
  File.join(project_path, 'integration')
end

.path_to_automation_templateObject



41
42
43
44
45
46
47
48
49
# File 'lib/bwoken.rb', line 41

def path_to_automation_template
  template = nil
  `xcrun instruments -s 2>&1 | grep Automation.tracetemplate`.split("\n").each do |path|
    path = path.gsub(/^\s*"|",\s*$/, "")
    template = path if File.exists?(path)
    break if template
  end
  template
end

.path_to_developer_dirObject



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

def path_to_developer_dir
  `xcode-select -print-path`.strip
end

.project_pathObject



29
30
31
# File 'lib/bwoken.rb', line 29

def project_path
  Dir.pwd
end

.results_pathObject



73
74
75
76
77
# File 'lib/bwoken.rb', line 73

def results_path
  File.join(tmp_path, 'results').tap do |dir_name|
    FileUtils.mkdir_p(dir_name) unless File.directory?(dir_name)
  end
end

.test_suite_pathObject



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

def test_suite_path
  File.join(tmp_path, 'javascript')
end

.tmp_pathObject



17
18
19
# File 'lib/bwoken.rb', line 17

def tmp_path
  File.join(path, 'tmp')
end

.workspace_or_projectObject



59
60
61
62
# File 'lib/bwoken.rb', line 59

def workspace_or_project
  ws = xcworkspace
  ws && File.exists?(ws) ? ws : xcodeproj
end

.workspace_or_project_flagObject



64
65
66
67
68
69
70
71
# File 'lib/bwoken.rb', line 64

def workspace_or_project_flag
  ws = xcworkspace
  if ws && File.exists?(ws)
    "-workspace #{ws}"
  else
    "-project #{xcodeproj}"
  end
end