schedule

package
v0.0.0-...-05ac8c3 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMPTY         = 0
	NUM_WEEK_DAYS = 7
)
View Source
const (
	COMMIT_MESSAGE_BASE       = `` /* 207-byte string literal not displayed */
	BASE_SEPARATOR            = " "
	MIN_COMMIT_MESSAGE_LENGTH = 2
	MAX_COMMIT_MESSAGE_LENGTH = 8
)
View Source
const (
	// ScheduleWidth is the width of the schedule
	ScheduleWidth = 53
	// TextRegex is the regular expression used to check the given text
	TextRegex = "[a-z ]{1,26}"
)

Variables

View Source
var NOT_A_FIELD = Entry{NumCommits: -1}

Functions

func GenerateRandomCommits

func GenerateRandomCommits(day time.Time, numCommits int, messageBase []string) <-chan Commit

GenerateRandomCommits returns a channel of random commits for a given day. These commits are a random selection of numCommits number of words from the given message base.

func GetCommitMessageBase

func GetCommitMessageBase() []string

func GetDaysSinceDateMinusOneYear

func GetDaysSinceDateMinusOneYear(givenDate time.Time) <-chan time.Time

GetDaysSinceDateMinusOneYear returns a channel of days since the given date minus one year. E.g. 01.01.2015 starts at the 01.01.2014.

func GetDaysSinceNowMinusOneYear

func GetDaysSinceNowMinusOneYear() []time.Time

func GetRandomNumber

func GetRandomNumber(min, max int) int

GetRandomNumber returns a number in the range of min and max.

func IsNotAField

func IsNotAField(entry Entry) bool

IsNotAField returns true if the given entry has the same datetime as NOT_A_FIELD.

func RandomSchedule

func RandomSchedule(min, max int, repo git.Git, filegen utils.FileGenerator)

RandomSchedule creates random commits over the past 365/366 days. These commits will be created in the given git repo using the FileGenerator.

func TextSchedule

func TextSchedule(text string, repo git.Git, filegen utils.FileGenerator) error

TextSchedule creates commits over the past 365/366 days to build the given text. These commits will be created in the given git repo using the FileGenerator.

Types

type Commit

type Commit struct {
	DateTime time.Time
	Message  string
}

Commit represents a git commit given a time and a message.

func GetRandomCommit

func GetRandomCommit(day time.Time, messageBase []string) Commit

GetRandomCommit returns a commit with a randomly selected string from the given message base and a commit time, based on the given day.

type CommitSchedule

type CommitSchedule [7][53]Entry

func BuildCommitSchedule

func BuildCommitSchedule(days []time.Time) CommitSchedule

BuildCommitSchedule returns an empty CommitSchedule, where all fiels are initialized with EMPTY except those which are not in the range of days. The CommitSchedule is a table of ints.

func (CommitSchedule) String

func (schedule CommitSchedule) String() string

String returns a string representing the CommitSchedule.

type Entry

type Entry struct {
	DateTime   time.Time
	NumCommits int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL