Class: Dod::Runner

Inherits:
CLAide::Command
  • Object
show all
Defined in:
lib/dod/commands/runner.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Runner



11
12
13
14
15
16
17
# File 'lib/dod/commands/runner.rb', line 11

def initialize(argv)
  donefile = argv.option("donefile", "Donefile")
  @donefile_path = donefile if File.exist?(donefile)
  @git = GitHelper.new
  @donefile = Donefile.new
  super
end

Class Method Details

.optionsObject



29
30
31
32
33
# File 'lib/dod/commands/runner.rb', line 29

def self.options
  [
    ["--donefile=<path/to/donefile>", "Path to the Donefile where all tasks for Definition of Done are defined."]
  ]
end

Instance Method Details

#runObject



35
36
37
38
39
# File 'lib/dod/commands/runner.rb', line 35

def run
  tasks = @donefile.parse_tasks(@donefile_path)
  bitbucket = BitbucketServerAPI.new(ENV, @git.project_name, @git.repo_name, @git.current_branch)
  bitbucket.create_definition_of_done(tasks)
end

#validate!Object



19
20
21
22
23
24
25
26
27
# File 'lib/dod/commands/runner.rb', line 19

def validate!
  super
  if self.class == Runner && !@donefile_path
    help!("Could not find a Donefile.")
  end
  if not File.directory?(".git") 
    help!("Not a git repository.")
  end
end