infra

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package infra mainly treats side effects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeGenerater

type CodeGenerater struct {
	Renderer   domain.TemplateRenderer
	DirMaker   domain.DirMaker
	FileWriter domain.FileWriter
}

CodeGenerater generates code.

func (CodeGenerater) Exec

func (cg CodeGenerater) Exec(dest, cfgTmpl string, config domain.TemplateData) error

Exec generates code with template and configuration.

type DirMaker

type DirMaker struct{}

DirMaker makes a directory.

func (DirMaker) Make

func (maker DirMaker) Make(dest string) error

Make makes a directory.

type FileExist

type FileExist struct{}

FileExist checks whether a file exists.

func (FileExist) Exist

func (exist FileExist) Exist(src string) bool

Exist returns whether a file exists.

type FileReader

type FileReader struct{}

FileReader reads a file.

func (FileReader) Read

func (reader FileReader) Read(src string) (string, error)

Read reads a file.

type FileWriter

type FileWriter struct{}

FileWriter writes data to a file.

func (FileWriter) Write

func (writer FileWriter) Write(dest string, content []byte) error

Write writes data to a file.

type OSExecExecuter

type OSExecExecuter struct{}

OSExecExecuter executes command.

func (OSExecExecuter) Exec

func (executer OSExecExecuter) Exec(cmd, dest string) error

Exec executes a command.

type StrFormatter

type StrFormatter struct{}

StrFormatter formats string by commands.

func (StrFormatter) Format

func (formatter StrFormatter) Format(dest, text string, formatters []string, reader domain.FileReader, executer domain.CmdExecuter) (string, error)

Format formats a string by given commands. Write a given string to a temporary file and execute commands to the file and read the file.

type TextTemplateRenderer

type TextTemplateRenderer struct{}

TextTemplateRenderer renders template.

func (TextTemplateRenderer) Render

func (txtTmpl TextTemplateRenderer) Render(txt string, data interface{}) (string, error)

Render renders a template with given data.

type YAMLCfgReader

type YAMLCfgReader struct{}

YAMLCfgReader is reads the configuration file as YAML.

func (YAMLCfgReader) Read

func (reader YAMLCfgReader) Read(src string) (domain.Cfg, error)

Read reads the configuration file and parses as YAML and returns domain.Cfg .

Jump to

Keyboard shortcuts

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