class Dod::Runner

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# File lib/dod/commands/runner.rb, line 11
def initialize(argv)
  donefile = argv.option("donefile", "Donefile")
  @donefile_path = donefile if File.exist?(donefile)
  @repository = Repository.new
  @donefile = Donefile.new
  super
end
options() click to toggle source
# File lib/dod/commands/runner.rb, line 26
def self.options
  [
    ["--donefile=<path/to/donefile>", "Path to the Donefile where all tasks for Definition of Done are defined."]
  ]
end

Public Instance Methods

run() click to toggle source
# File lib/dod/commands/runner.rb, line 32
def run
  tasks = @donefile.parse_tasks(@donefile_path)
  project_name = @repository.project_name(ENV)
  repo_name = @repository.repo_name(ENV)
  current_branch = ENV["bamboo_repository_git_branch"]
  unless project_name && repo_name && current_branch
    puts "Lack of definition of one of the environment variable (bamboo_repository_git_branch or bamboo_planRepository_repositoryUrl).".red
    return
  end
  bitbucket = BitbucketServerAPI.new(ENV, project_name, repo_name, current_branch)
  bitbucket.create_definition_of_done(tasks)
end
validate!() click to toggle source
Calls superclass method
# File lib/dod/commands/runner.rb, line 19
def validate!
  super
  if self.class == Runner && !@donefile_path
    help!("Could not find a Donefile.")
  end
end