Skip to content

Commit

Permalink
Reorganitzation and updated to robfig/cron v3
Browse files Browse the repository at this point in the history
  • Loading branch information
prodrigestivill committed Feb 11, 2020
1 parent 6f160c2 commit c6de7a1
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 39 deletions.
8 changes: 5 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
This code is based on the work of Michał Rączka and forked from the
michaloo/go-cron Github project. All extensions were made under same
MIT license.
This code is based on the work of Michał Rączka and Jan Nabbefeld
from their michaloo/go-cron and odise/go-cron Github projects respectively.
All extensions were made under same MIT license.

The MIT License (MIT)

Copyright (c) 2014 Michał Rączka
Copyright (c) 2014 Jan Nabbefeld
Copyright (c) 2020 Pau Rodriguez-Estivill

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
16 changes: 0 additions & 16 deletions Makefile

This file was deleted.

5 changes: 5 additions & 0 deletions build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh -e

cd $(dirname $0)

exec docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp golang ./build.sh
19 changes: 19 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh -e

TARGETS="linux-amd64 linux-arm64 linux-arm linux-386 darwin-amd64 windows-amd64"
STATIC_TARGETS="linux-amd64 linux-arm64 linux-arm linux-386"
BUILD=`git rev-parse --short HEAD`
VERSION=`git describe --tags`
MAIN_GO="main.go"
DEPS="github.com/robfig/cron"

cd $(dirname $0)
mkdir -p dist

for TARGET in $TARGETS; do
GOOS=${TARGET%-*} GOARCH=${TARGET#*-} go build -o dist/go-cron-$TARGET -ldflags "-X main.build=$BUILD -X main.version=$VERSION" "$MAIN_GO"
done
for TARGET in $STATIC_TARGETS; do
CGO_ENABLED=0 GOOS=${TARGET%-*} GOARCH=${TARGET#*-} go build -o dist/go-cron-$TARGET-static -ldflags "-X main.build=$BUILD -X main.version=$VERSION"' -extldflags "-static"' "$MAIN_GO"
done
gzip -v -k -9 dist/go-cron-*
14 changes: 0 additions & 14 deletions crane.yml

This file was deleted.

5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/prodrigestivill/go-cron

go 1.12

require github.com/robfig/cron/v3 v3.0.1
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
2 changes: 1 addition & 1 deletion go-cron.go → gocron/go-cron.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package gocron

import (
"github.com/robfig/cron"
"github.com/robfig/cron/v3"
"io"
"log"
"os"
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions bin/go-cron.go → main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package main

import (
"flag"
gocron "github.com/odise/go-cron"
"github.com/prodrigestivill/go-cron/gocron"
"log"
"os"
"os/signal"
"syscall"
)

var build string
var version string

func main() {
flagArgs, execArgs := splitArgs()
Expand All @@ -29,7 +30,7 @@ func main() {
flag.PrintDefaults()
os.Exit(1)
}
log.Println("Running version:", build)
log.Println("Running version:", version)

c, wg := gocron.Create(*schedule, execArgs[0], execArgs[1:len(execArgs)])

Expand Down
3 changes: 3 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

go run ./main.go "* * * * * *" /bin/bash -c "echo 1;"
3 changes: 0 additions & 3 deletions test/run

This file was deleted.

0 comments on commit c6de7a1

Please sign in to comment.