Skip to content

Instantly share code, notes, and snippets.

func runClient(dir, user, after string) error {
commits, err := getGitHistory(dir, user, after)
if err != nil {
return err
}
f, err := os.Create("standup.json")
if err != nil {
return err
}
@Lebonesco
Lebonesco / main.go
Last active October 19, 2019 22:14
...
type commit struct {
Author string `xml:"author"`
Date string `xml:"date"`
Message string `xml:"message"`
}
...
func getGitHistory(dir, user, after string) ([]commit, error) {
var commits []commit
func getCommits(path, user, after string) ([]byte, error) {
format := `
<entry>
<author>%an</author>
<date>%cd</date>
<message>%B</message>
</entry>`
cmd := exec.Command("git", "log", "--author="+user, "--pretty=format:"+format, "--after="+after)
cmd.Dir = path
out, err := cmd.Output()
func runClient(dir, user, after string) error {
commits, err := getGitHistory(dir, user, after)
if err != nil {
return err
}
f, err := os.Create("standup.json")
if err != nil {
return err
}
package main
func main() {
app := cli.NewApp()
info(app)
@Lebonesco
Lebonesco / main.go
Last active October 19, 2019 21:35
package main
import (
"log"
"os"
"time"
"github.com/mitchellh/go-homedir"
"github.com/urfave/cli"
)
func generateContainer(repo, port string) (string, error) {
// get container name
ss := strings.Split(repo, "/")
name := strings.Split(ss[len(ss)-1], ".")[0]
// init docker client
fmt.Println("initializing docker client...")
cli, err := client.NewClientWithOpts(client.WithVersion("1.37"))
if err != nil {
return "", err
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"os"
"os/exec"
#! /bin/bash
repo=$1 # first argument
ss=$(echo $repo | tr "/" " ") # splits repo by '/'
IFS=' ' read -a arr <<< "${ss}"# converts 'ss' into array
len=${#arr[@]} # gets length of array
end=${arr[len-1]} # gets last value in repo (aka project name)
name=${end%????} # remove '.git'
FROM node:8
ARG repo
ARG name
ARG port
RUN git clone $repo
WORKDIR /$name
COPY package*.json ./