jujusvg

package module
v0.0.0-...-805fd9a Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2014 License: LGPL-3.0 Imports: 10 Imported by: 0

README

jujusvg

A library for generating SVGs from Juju bundles and environments.

Installation

To start using jujusvg, first ensure you have a valid Go environment, then run the following:

go get github.com/juju/jujusvg

Dependencies

The project uses godeps (https://launchpad.net/godeps) to manage Go dependencies. To install this, run:

go get launchpad.net/godeps

After installing it, you can update the dependencies to the revision specified in the dependencies.tsv file with the following:

make deps

Use make create-deps to update the dependencies file.

Usage

Given a Juju bundle, you can convert this to an SVG programatically. This generates a simple SVG representation of a bundle or bundles that can then be included in a webpage as a visualization.

For an example of how to use this library, please see examples/generatesvg.go. You can run this example like:

go run generatesvg.go bundle.yaml > bundle.svg

The examples directory also includes three sample bundles that you can play around with, or you can use the Juju GUI to generate your own bundles.

Some assets are specified based on assets provided by the design team. These assets are specified in the defs section of the generated SVG, and can thus be found in the Canvas.definition() method. Should these assets be updated, the SVGo code will need to be updated to reflect these changes. Unfortunately, this can only be done by hand, so care must be made to match the SVGs provided by design exactly. These original SVG assets live in the assets directory.

Current assets in use:

  • The service block
  • The relation health indicator

Documentation

Overview

jujusvg generates SVG representations of various Juju artifacts, such as charm bundles or live environments.

For more information, please refer to the README file in this directory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

type Canvas struct {
	// contains filtered or unexported fields
}

Canvas holds the parsed form of a bundle or environment.

func NewFromBundle

func NewFromBundle(b *charm.BundleData, iconURL func(*charm.Reference) string) (*Canvas, error)

NewFromBundle returns a new Canvas that can be used to generate a graphical representation of the given bundle data. The iconURL function is used to generate a URL that refers to an SVG for the supplied charm URL.

func (*Canvas) Marshal

func (c *Canvas) Marshal(w io.Writer)

Marshal renders the SVG to the given io.Writer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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