README

Publish Build Status

The publish is command and its libs publish documents to multi web service. Document block is human can manage, not raw log.

See Godoc at https://godoc.org/github.com/ynishi/publish

Current status

  • Version 1.0(v1)
  • basic feature is implemented

Install

go get "github.com/ynihsi/publish/..."

Example

  • prepare config file
$ cp $GOPATH/src/github.com/ynishi/publish/config.toml .
$ vi config.toml
  • prepare document file
$ touch doc.md
  • do pubish in same dir
$ publish --content=doc.md

Contribute

  • Welcome to participate develop, send pull request, add issue(question, bugs, wants and so on).
Start develop
  • fork, clone, develop and pull request.
$ git clone ...
$ cd publish
$ go test

Credit and License

  • License is Apache-2.0
  • Copyright (c) 2017, Yutaka Nishimura.

Documentation

Overview

The publish package implements a simple library and clients for document publish tool to web services.

Publish do Publish method each publishers. Support context and concurrent execution. Count goroutines and return when all jobs has done.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitConfAwsS3

func InitConfAwsS3(as3 *PublishAwsS3, c *viper.Viper) (err error)

InitConfAwsS3 initialize config and set option to PublishAwsS3.

func InitConfGitHub

func InitConfGitHub(gh *PublishGitHub, c *viper.Viper) (err error)

InitConfGitHub initialize config and set option to PublishGitHub.

func Publish

func Publish(publishers []Publisher) error

Publish do Publish method of each publishers.

func SetLogger

func SetLogger(l *log.Logger)

SetLogger set logger

func SetReader

func SetReader(r io.Reader)

SetReader set reader

func SetTimeout

func SetTimeout(t time.Duration)

SetTimeout set timeout

Types

type PublishAwsS3

type PublishAwsS3 struct {
	Publisher
	Svc      *s3.S3
	AwsS3    *PublishAwsS3Opts
	AwsS3POI *s3.PutObjectInput
}

PublishAwsS3 is Publisher for aws s3.

func (*PublishAwsS3) Publish

func (p *PublishAwsS3) Publish(ctx context.Context, r io.Reader) (err error)

Publish for PublishAwsS3 publish document to aws s3.

func (*PublishAwsS3) String

func (p *PublishAwsS3) String() string

String return name of PublishAwsS3.

type PublishAwsS3Opts

type PublishAwsS3Opts struct {
	Bucket    string
	Key       string
	Accesskey string
	Secretkey string
	Token     string
	Region    string
}

PublishAwsS3Opts is option for PublishAwsS3.

type PublishGitHub

type PublishGitHub struct {
	Publisher
	GitHub *PublishGitHubOpts
}

PublishGitHub is Publisher for github.com

func (*PublishGitHub) Publish

func (pgh *PublishGitHub) Publish(ctx context.Context, r io.Reader) error

Publish for PublishGitHub publish document to github.com(commit).

func (*PublishGitHub) String

func (gh *PublishGitHub) String() string

String return name of PublishGitHub.

type PublishGitHubOpts

type PublishGitHubOpts struct {
	Owner    string
	Repo     string
	Token    string
	Branch   string
	Endpoint string
	Encoding string
	Path     string
}

PublishGitHubOpts is option for PublishGitHub.

type Publisher

type Publisher interface {
	Publish(context.Context, io.Reader) error
}

Publisher is able to Publish document.

Directories

Path Synopsis
cmd
The publish/cmd package implement command line interface for publish.
The publish/cmd package implement command line interface for publish.
v1
The publish package implements a simple library and clients for document publish tool to web services.
The publish package implements a simple library and clients for document publish tool to web services.
cmd
The publish/cmd package implement command line interface for publish.
The publish/cmd package implement command line interface for publish.