Class: PivotalDoc::Generator

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

Class Method Summary collapse

Class Method Details

.collect_sprints!(config) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/pivotal_doc/generator.rb', line 19

def collect_sprints!(config)
  sprints= []
  config.projects.each do |name, _attrs|
    project= PT::Project.find(_attrs['id'].to_i)
    sprints << PivotalDoc::Sprint.new(project, _attrs['current'])
  end
  return sprints
end

.generate(format, settings = {}) ⇒ Object

Raises:



4
5
6
7
8
9
10
11
12
13
# File 'lib/pivotal_doc/generator.rb', line 4

def generate(format, settings={})
  raise FormatNotSupported.new(format) unless generators.has_key?(format)
  config= PivotalDoc::Configuration.new(settings)
  config.authenticate!
  sprints= collect_sprints!(config)
  sprints.each do |sprint|
    generators[format].new(sprint, config.settings).render_doc
  end
  true
end

.generatorsObject



15
16
17
# File 'lib/pivotal_doc/generator.rb', line 15

def generators
  { :html=>Generators::HTML, :csv=>Generators::CSV }
end