Top Level Namespace

Defined Under Namespace

Modules: Evergreen, Jasmine Classes: JasmineDev

Instance Method Summary collapse

Instance Method Details

#capture_output(capture = true) ⇒ Object


23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jasmine/spec/spec_helper.rb', line 23

def capture_output(capture = true)
  if capture
    output = StringIO.new
    $stdout = output
  end
  yield
  if capture
    output.string
  end
ensure
  $stdout = STDOUT
end

#jasmine_versionObject


41
42
43
44
45
46
47
# File 'lib/jasmine/spec/spec_helper.rb', line 41

def jasmine_version
  version = jasmine_version_object

  version_string = "#{version['major']}.#{version['minor']}.#{version['build']}"
  version_string += ".rc#{version['release_candidate']}" if version['release_candidate']
  version_string
end

#jasmine_version_objectObject


49
50
51
# File 'lib/jasmine/spec/spec_helper.rb', line 49

def jasmine_version_object
  @version_object ||= JSON.parse(File.read(File.join(JasmineDev.project_root, 'src', 'version.json')))
end

#project_rootObject


17
18
19
# File 'lib/jasmine/spec/spec_helper.rb', line 17

def project_root
  File.join(File.expand_path(File.dirname(__FILE__)), '..')
end

#reset_dir(dir) ⇒ Object


36
37
38
39
# File 'lib/jasmine/spec/spec_helper.rb', line 36

def reset_dir(dir)
  FileUtils.rm_r dir if File.exists?(dir)
  FileUtils.mkdir_p dir
end