Sha256: 7208f93b7dfc06ca1362b244ab535102741400a5cbc7f10c5b764f5a1fd0fa64

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

#= require_self
#= require teabag/base/runner
#= require teabag/base/fixture
#= require teabag/base/reporters/html
#= require teabag/base/reporters/console

class @Teabag
  @defer:     false
  @slow:      75
  @root:      null
  @started:   false
  @finished:  false
  @Reporters: {}
  @Date:      Date
  @location:  window.location
  @messages:  []

  @execute: ->
    if @defer
      @defer = false
      return
    @started = true
    new Teabag.Runner()


  # provides interface for AMD usage -- pass all dependencies in as an array, and params will be checked for matches
  @resolveDependenciesFromParams: (all = []) ->
    deps = []
    return all if (paths = @location.search.match(/[\?&]file(\[\])?=[^&\?]*/gi)) == null

    for path in paths
      parts = decodeURIComponent(path.replace(/\+/g, " ")).match(/\/(.+)\.(js|js.coffee|coffee)$/i)
      continue if parts == null
      file = parts[1].substr(parts[1].lastIndexOf("/") + 1)
      for dep in all then deps.push(dep) if dep.indexOf(file) >= 0
    deps


  # logging methods -- used by selenium / phantomJS to get information back to ruby
  @log: ->
    @messages.push(arguments[0])
    try console.log(arguments...)
    catch e
      throw new Error("Unable to use console.log for logging")


  @getMessages: ->
    messages = @messages
    @messages = []
    messages

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
teabag-0.7.2 app/assets/javascripts/teabag/base/teabag.coffee
teabag-0.7.1 app/assets/javascripts/teabag/base/teabag.coffee
teabag-0.7.0 app/assets/javascripts/teabag/base/teabag.coffee
teabag-0.6.0 app/assets/javascripts/teabag/base/teabag.coffee