Sha256: 1f9cddfff18576ee0b8c999b285ebc248b30be5c91d0a52474a3abf9ec10a344

Contents?: true

Size: 1.33 KB

Versions: 205

Compression:

Stored size: 1.33 KB

Contents

paths = Dir[File.expand_path('../trackler/**/*.rb', __FILE__)]
paths.each { |path| require path }

module Trackler
  def self.reset
    @path = nil
    @implementations = nil
    @specifications = nil
    @tracks = nil
    @todos = nil
  end

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

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

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

  def self.specifications
    @specifications ||= Specifications.new(path)
  end

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

  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.slug] << implementation
      end
    end
    @implementations
  end

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

    slugs = specifications.map(&:slug)

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

Version data entries

205 entries across 205 versions & 1 rubygems

Version Path
trackler-2.2.1.180 lib/trackler.rb
trackler-2.2.1.179 lib/trackler.rb
trackler-2.2.1.178 lib/trackler.rb
trackler-2.2.1.177 lib/trackler.rb
trackler-2.2.1.176 lib/trackler.rb
trackler-2.2.1.175 lib/trackler.rb
trackler-2.2.1.174 lib/trackler.rb
trackler-2.2.1.173 lib/trackler.rb
trackler-2.2.1.172 lib/trackler.rb
trackler-2.2.1.171 lib/trackler.rb
trackler-2.2.1.170 lib/trackler.rb
trackler-2.2.1.169 lib/trackler.rb
trackler-2.2.1.167 lib/trackler.rb
trackler-2.2.1.166 lib/trackler.rb
trackler-2.2.1.165 lib/trackler.rb
trackler-2.2.1.164 lib/trackler.rb
trackler-2.2.1.163 lib/trackler.rb
trackler-2.2.1.162 lib/trackler.rb
trackler-2.2.1.161 lib/trackler.rb
trackler-2.2.1.160 lib/trackler.rb