scuttlebutt

package module
Version: v0.0.0-...-f83ecaa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 11, 2018 License: MIT Imports: 18 Imported by: 3

README

Scuttlebutt

Scuttlebutt is a daemon for tracking and tweeting trending Github repositories by language. It works by using the Twitter Search API to find mentions of "github.com" URLs and then uses the GitHub API to extract repository information. Ba-da-bing!

Twitter Accounts

Below is a list of all the languages which have Twitter accounts:

Please report any problems you see on those accounts.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRepositoryNotFound is returned when operating on a non-existent repo.
	ErrRepositoryNotFound = errors.New("repository not found")
)

Functions

func ExtractRepositoryID

func ExtractRepositoryID(u *url.URL) (string, error)

Extracts the repository identifier from a given URL.

Types

type Handler

type Handler struct {
	Store *Store
}

Handler represents an HTTP interface to the store.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Message

type Message struct {
	ID           uint64
	Text         string
	RepositoryID string
}

Message represents a message associated with a project and language.

type Repositories

type Repositories []*Repository

Repositories represents a sortable list of repositories.

func (Repositories) Len

func (p Repositories) Len() int

func (Repositories) Less

func (p Repositories) Less(i, j int) bool

func (Repositories) Swap

func (p Repositories) Swap(i, j int)

type Repository

type Repository struct {
	ID          string
	Description string
	Language    string
	Notified    bool
	Messages    []*Message
}

Repository represents a code repository.

func (*Repository) Name

func (r *Repository) Name() string

Name returns the name of the repository.

func (*Repository) URL

func (r *Repository) URL() string

URL returns the URL for the repository.

type Store

type Store struct {

	// The remote backing store.
	RemoteStore interface {
		Repository(id string) (*Repository, error)
	}
	// contains filtered or unexported fields
}

Store represents the data storage for storing messages received and sent. The store acts as a cache to the backing remote store for repository info.

func NewStore

func NewStore(path string) *Store

NewStore returns a new instance of Store.

func (*Store) AddMessage

func (s *Store) AddMessage(m *Message) error

AddMessage adds a message related to a repository. Retrieves repository data from the remote store, if needed.

func (*Store) Close

func (s *Store) Close() error

Close closes the store.

func (*Store) MarkNotified

func (s *Store) MarkNotified(repositoryID string) error

MarkNotified flags a repository as notified.

func (*Store) Open

func (s *Store) Open() error

Open opens and initializes the database.

func (*Store) Path

func (s *Store) Path() string

Path returns the data path.

func (*Store) Ping

func (s *Store) Ping() error

Ping connects to the database. Returns nil if successful.

func (*Store) Repositories

func (s *Store) Repositories() (a []*Repository, err error)

Repositories returns all repositories.

func (*Store) Repository

func (s *Store) Repository(id string) (r *Repository, err error)

Repository returns a repository by id.

func (*Store) RepositoryN

func (s *Store) RepositoryN() (n int, err error)

RepositoryN returns the number of repositories in the store.

func (*Store) TopRepositories

func (s *Store) TopRepositories() (m map[string]*Repository, err error)

TopRepositories returns the most mentioned repositories by language.

func (*Store) WriteTo

func (s *Store) WriteTo(w io.Writer) (n int64, err error)

WriteTo writes the length and contents of the engine to w.

Directories

Path Synopsis
cmd
Package internal is a generated protocol buffer package.
Package internal is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL