Module: Trackler

Defined in:
lib/trackler.rb,
lib/trackler/path.rb,
lib/trackler/track.rb,
lib/trackler/tracks.rb,
lib/trackler/problem.rb,
lib/trackler/version.rb,
lib/trackler/metadata.rb,
lib/trackler/problems.rb,
lib/trackler/null_track.rb,
lib/trackler/description.rb,
lib/trackler/file_bundle.rb,
lib/trackler/implementation.rb,
lib/trackler/guaranteed_file.rb,
lib/trackler/implementations.rb

Defined Under Namespace

Modules: Path Classes: CommonFile, Description, FileBundle, GuaranteedFile, Implementation, Implementations, Metadata, NullFile, NullTrack, Problem, Problems, Track, TrackFile, Tracks

Constant Summary collapse

VERSION =
"2.0.8.38"

Class Method Summary collapse

Class Method Details

.implementationsObject



35
36
37
38
39
40
41
42
43
44
45
# File 'lib/trackler.rb', line 35

def self.implementations
  return @implementations if !!@implementations

  @implementations = Hash.new { |h, k| h[k] = [] }
  tracks.each do |track|
    track.implementations.each do |implementation|
      @implementations[implementation.problem.slug] << implementation
    end
  end
  @implementations
end

.pathObject



13
14
15
# File 'lib/trackler.rb', line 13

def self.path
  @path ||= Trackler::Path.root
end

.problemsObject



27
28
29
# File 'lib/trackler.rb', line 27

def self.problems
  @problems ||= Problems.new(path)
end

.resetObject



5
6
7
8
9
10
11
# File 'lib/trackler.rb', line 5

def self.reset
  @path = nil
  @implementations = nil
  @problems = nil
  @tracks = nil
  @todos = nil
end

.todosObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/trackler.rb', line 47

def self.todos
  return @todos if !!@todos

  slugs = problems.map(&:slug)

  @todos = Hash.new { |h, k| h[k] = [] }
  tracks.each do |track|
    todos = slugs - track.slugs
    @todos[track.id] = problems.select { |problem|
      todos.include?(problem.slug)
    }.sort_by { |problem|
      [implementations[problem.slug].count * -1, problem.name]
    }
  end
  @todos
end

.tracksObject



31
32
33
# File 'lib/trackler.rb', line 31

def self.tracks
  @tracks ||= Tracks.new(path)
end

.use_fixture_dataObject



22
23
24
25
# File 'lib/trackler.rb', line 22

def self.use_fixture_data
  reset
  @path = Trackler::Path.fixtures
end

.use_real_dataObject



17
18
19
20
# File 'lib/trackler.rb', line 17

def self.use_real_data
  reset
  @path = Trackler::Path.root
end