Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

it's all broken ... got entangled ... time for bed

  • Loading branch information...
commit f53b6ccbbcd768bd6ffad440e133563d7ce9c6cf 1 parent 536c710
@msuarz msuarz authored
View
15 src/frankendoc.coffee
@@ -14,16 +14,21 @@ class Frank
@files.read()
@classes.read @files.code
- run:->
+ run: ->
@report.start()
@read()
- for doc in @files.docs
- @report.running doc.name
- results = @runner.run_steps @classes.new(), doc.steps
- @report.finished results
+ console.log doc.name for doc in @files.docs
+ #if doc.is_suite
+ #then @report.suite doc
+ #else @run_doc doc
@report.stop()
+ run_doc: (doc) ->
+ @report.running doc.name
+ results = @runner.run_steps @classes.new(), doc.steps
+ @report.finished results
+
@frank = -> Fiber(-> new Frank().run()).run()
View
17 src/readers/confluence.coffee
@@ -7,22 +7,31 @@ class @Reader
return unless @root?
@pending_docs = [ @root ]
while @pending_docs.length
- @sync.read_doc @pending_docs.shift()
+ doc @pending_docs.shift()
+ if doc.is_suite
+ @docs.push doc
+ else
+ @sync.read_doc doc
read_doc: (id, done) ->
uri = "#{@root_uri}/content/#{id}?expand=children"
rest.get(uri, @options).on 'complete', (data) =>
+ children = @children data
+ @add_suite data if children.length
@add_doc data
- @queue_children data
+ @pending_docs.unshift children
done()
+ add_suite: (data) -> @pending_docs.unshift @docs.push
+ name: data.title
+ is_suite: true
+
add_doc: (data) -> @docs.push
name: data.title
steps: @doc.read data.body.value
- queue_children: (data) ->
- @pending_docs.push child.id for child in data.children.content
+ children: (data) -> child.id for child in data.children.content
constructor: ->
@docs = []
View
19 src/readers/files.coffee
@@ -13,12 +13,15 @@ class @Files
is_dir: -> fs.statSync(@file).isDirectory()
- find_files: (dir, ext, add) -> for file in fs.readdirSync dir
- @file = path.resolve dir, file
- if @is_dir()
- @find_files @file, ext, add unless file is 'node_modules'
- else if @file.match ext
- add()
+ find_files: (dir, ext, add) ->
+ @add_suite dir
+ for file in fs.readdirSync dir
+ @file = path.resolve dir, file
+ if @is_dir()
+ @find_files @file, ext, add unless file is 'node_modules'
+ else if @file.match ext
+ add()
+ @add_suite dir
read: ->
@read_docs()
@@ -40,6 +43,10 @@ class @Files
name: path.basename @file, settings.docs.type
steps: @doc.read @contents()
+ add_suite: (name) -> @docs.push
+ name: name
+ is_suite: true
+
contents: -> fs.readFileSync @file, 'utf8'
read_code: ->
View
2  src/reports/console.coffee
@@ -18,6 +18,8 @@ class @Report
@empty_line()
@stats = new Stats
+ suite: ->
+
running: (@name) ->
@stats.start()
View
20 src/reports/suites.coffee
@@ -0,0 +1,20 @@
+class @Suites
+
+ constructor: (@reporter) ->
+ @suites = []
+
+ report: (@suite) ->
+ if @suite.name isnt @current?.name
+ then @start()
+ else @finish()
+
+ start: ->
+ @reporter.start_suite @suite
+ @suite.started = new Date
+ @suites.push @current if @current?
+ @current = @suite
+
+ finish: ->
+ @current.duration = new Date() - @current.started
+ @reporter.stop_suite @current
+ @current = @suites.pop()
View
14 src/reports/teamcity.coffee
@@ -1,14 +1,21 @@
{ Stats } = require './stats'
+{ Suites } = require './suites'
_ = require 'underscore'
class @Report
- suite_name: settings.name ? 'frankendoc'
-
start: ->
@stats = new Stats
- @report "SuiteStarted name='#{@suite_name}'"
+ @suites = new Suites this
+
+ suite: (it) -> @suites.report it
+ start_suite: (suite) ->
+ @report "SuiteStarted name='#{@suite.name}'"
+
+ stop_suite: (suite) ->
+ @report "SuiteFinished name='#{@suite.name}' duration='#{@suite.duration}'"
+
running: (@name) ->
@stats.start()
@report "Started name='#{@name}'"
@@ -24,7 +31,6 @@ class @Report
message: -> _.escape @stats.messages().join '\n'
stop: ->
- @report "SuiteFinished name='#{@suite_name}' duration='#{@stats.time}'"
report: (message) ->
console.log '##teamcity[test' + message + ']'
Please sign in to comment.
Something went wrong with that request. Please try again.