presskit

package module
v0.0.0-...-72bfcbf Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2019 License: GPL-3.0 Imports: 15 Imported by: 0

README

Gopresskit

Build Status Go Report Card cover.run go

Go implementation of presskit().

Generation

To generate your set up presskit you can generate the output files with

gopresskit -input presskit-data/ -output press/

Run gopresskit -help for usage information.

Why

I like the idea of the original presskit() but there are a view things I don't like.

Deployment

If you want to deploy presskit() you need a PHP server which you have to set up and which is always a potential secure gap. Although it's no web application where are often changes or need user interaction therefore static files would do their job and be a lot faster.

Simplicity

I'm a friend of single binaries and very simple configuration for the user. So I like the idea of a simple folder structure for the data, a single config file for page meta data and a single executable for easy generation of static html files.

Compatibility

I try to be most compatible with the original presskit() but there are a few concepts I don't like so there are a few incompatibilities.

For easy conversion there might be a future command to migrate presskit() data to the structure of this project.

Setup

If you want to generate your presskit you have to create following directory structure in a folder of your choice:

games/
    my-game-name/
        images/
            _header.png
            _icon.png
            _logo.png
            menu.png
            ingame.png
            ...
        videos/
            tailer.mp4
        game.xml
images/
    _header.png
    _icon.png
    _logo.png
    office_1.jpg
    ...
videos/
    short-movie.mp4
company.xml
favicon.ico
Optional

All images/ and videos/ folders and the favicon.ico file are optional and only have to be created if needed.

Images

The three images with an underscore prefix are special images (header, icon, logo) that are displayed in their sections. All other images in an image/ folder are displayed in the Images section of the presskit.

Videos

There are two ways of adding videos to your presskit, using externally hosted ones or adding your self hosted mp4 files (other formats can be implemented, feel free to open an issue). The videos in this folder are like the images automatically added to your presskit's Videos section.

xml files

The *.xml files hold the data for your presskit on company and game level. See configuration for explanation.

Testing

Currently the project has very low coverage. I want to write more unit tests to increase this.
This process takes some time because of some rewrites of the code base for easier testing.

Documentation

Overview

Code generated by go-bindata. (@generated) DO NOT EDIT. sources: static/css/style.css static/css/style_classic.css static/css/uikit.gradient.min.css static/favicon.ico static/js/mansory.min.js static/js/script.js static/templates/classic_company.html static/templates/classic_game.html static/templates/company.html static/templates/game.html

here are structs stored that are only used for unmarshalling

Index

Constants

This section is empty.

Variables

View Source
var CompanyTemplate = "company"
View Source
var GameTemplate = "game"

just a simple (not perfect) solution because implemented after first working release

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Parser

type Parser interface {
	Extension() string
	Company([]byte) (*company, error)
	Game([]byte) (*game, error)
}

Parser parses all data files

type Presskit

type Presskit struct {
	// parser manages the parsing from the data file (e.g. company.xml) to a company object
	Parser Parser
	// input paths contains the company data, games and assets
	InputPath string
	// output path contains all generated data
	OutputPath string
	// if enabled, the output folder will removed and overwritten instead of a error
	ForceMode bool
	// use original dopresskit style
	ClassicStyle bool
}

Presskit is created by the caller script and wraps all generation functions

func (Presskit) Generate

func (p Presskit) Generate() error

Generate handles the whole generation process

type XMLParser

type XMLParser struct{}

XMLParser parses the data from xml files

func (XMLParser) Company

func (p XMLParser) Company(data []byte) (*company, error)

Company parses the company data

func (XMLParser) Extension

func (p XMLParser) Extension() string

Extension returns the file extension the parser uses

func (XMLParser) Game

func (p XMLParser) Game(data []byte) (*game, error)

Game parses data of a game

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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