Class: FubuRake::Storyteller

Inherits:
Object
  • Object
show all
Defined in:
lib/fuburake.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Storyteller

Returns a new instance of Storyteller.



371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/fuburake.rb', line 371

def initialize(options)
  # :path

    # :compilemode -- take it from @solution.compiletarget

    # :results

    # :workspace

    # :profile

    # :title

    # :source

    # :prefix

    # :st_path

    # :specs

    
    @directory = options[:dir]
  @prefix = options.fetch(:prefix, 'st')
    @src = options.fetch(:source, 'src')
    @results = options.fetch(:results, 'results.htm')
    @st_path = options.fetch(:st_path, "#{@src}/packages/Storyteller2/tools")
    @title = options.fetch(:title, 'Storyteller Specs')
  @specs = options.fetch(:specs, 'specs')
    @suites = options.fetch(:suites, [])

  to_task 'run', 'ST.exe', "run #{to_args(options, @results)}", "Run the Storyteller tests for #{@directory}"
    to_task 'specs', 'ST.exe', "specs #{to_args(options, @specs)} --title \"#{@title}\"", "dump the specs for Storyteller tests at #{@directory}"
  
    @suites.each do |s|
to_task "run:#{s.downcase}", 'ST.exe', "run #{to_args(options, @results)} -w #{s}", "Run the Storyteller tests for suite #{s}"
    end
    
    openTask = Rake::Task.define_task "#{@prefix}:open" do
 tool = 'StorytellerUI.exe'
 cmd = "start #{File.join(@st_path, tool)} #{to_args(options, @results)}"
 puts "Opening the Storyteller UI to #{@directory}"
 sh cmd
    end
    openTask.add_description "Open the Storyteller UI for tests at #{@directory}"
    openTask.enhance [:compile]
end

Instance Method Details

#to_args(options, output) ⇒ Object



421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/fuburake.rb', line 421

def to_args(options, output)
  args = "#{options[:path]} #{output}"
    
    if (options[:compilemode] != nil)
 args += " --compile #{options[:compilemode]}"
    end
    
    if (options[:workspace] != nil)
 args += " --workspace #{options[:workspace]}"
    end
    
    if (options[:profile] != nil)
 args += " --profile #{options[:profile]}"
    end
    
    return args
end

#to_task(name, tool, args, description) ⇒ Object



410
411
412
413
414
415
416
417
418
419
# File 'lib/fuburake.rb', line 410

def to_task(name, tool, args, description)
  task = Rake::Task.define_task "#{@prefix}:#{name}" do
 sh "#{File.join(@st_path, tool)} #{args}"
  end
    
  task.add_description description
    task.enhance [:compile]
    
  return task
end