Sha256: c7d94cdadbb7834f24473b9e4e4d47cce7e7b04c53175fd248c07a9f3d5ecc2f

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

require 'sinatra/base'
require 'json'
require_relative '../../pairing_matrix'
require_relative '../config/config_reader'
require_relative '../commit_reader'
require_relative '../github_commit_reader'

module PairingMatrix
  class Server < Sinatra::Base
    set :bind, '0.0.0.0'

    config_reader = PairingMatrix::ConfigReader.new('pairing_matrix.yml')
    config = config_reader.config
    commit_reader = PairingMatrix::CommitReader.new(config)
    commit_reader = PairingMatrix::GithubCommitReader.new(config) if config.fetch_from_github?

    get '/data/:days' do
      commit_reader.authors_with_commits(params['days'].to_i).to_json
    end

    get '/matrix' do
      File.read(File.join(File.dirname(__FILE__), 'public/index.html'))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pairing_matrix-1.0.1 lib/pairing_matrix/server/server.rb