Skip to content

Commit

Permalink
Release version 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tmrts committed Jan 2, 2016
1 parent 0bfd83e commit bd036e6
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sudo: false
matrix:
include:
- go: 1.5
env: VERSION=0.1.0
env: VERSION=0.2.0

before_deploy:
- GOARCH=amd64 GOOS=linux go build boilr.go && tar czvf boilr-$VERSION-linux_amd64.tgz boilr
Expand Down
62 changes: 53 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[Travis]: http://travis-ci.org/tmrts/boilr
[License Widget]: https://img.shields.io/badge/license-Apache%20License%202.0-E91E63.svg?style=flat-square
[License]: https://github.com/tmrts/boilr/blob/master/LICENSE
[Release Widget]: https://img.shields.io/badge/release-v0.1.0-blue.svg?style=flat-square
[Release Widget]: https://img.shields.io/badge/release-v0.2.0-blue.svg?style=flat-square
[Release]: https://github.com/tmrts/boilr/releases
[Gitter Widget]: https://img.shields.io/badge/chat-on%20gitter-00BCD4.svg?style=flat-square
[Gitter]: https://gitter.im/tmrts/boilr
Expand All @@ -20,6 +20,8 @@ Are you doing the same steps over and over again every time you start a new prog

`boilr` is a powerful language-agnostic command-line boilerplate template tool here to help you.

![Usage Demonstration](usage.gif)

For more details, see [Introduction](https://github.com/tmrts/boilr/wiki/Introduction) page.

# Features
Expand All @@ -28,17 +30,51 @@ For more details, see [Introduction](https://github.com/tmrts/boilr/wiki/Introdu
- Full power of [golang templates](https://golang.org/pkg/text/template/) (Easy to learn & powerful)

# Usage
To use templates shared by others and create your own please take a look at the
[Usage](https://github.com/tmrts/boilr/wiki/Usage) and [Creating Templates](https://github.com/tmrts/boilr/wiki/Creating-Templates)
pages in the wiki.
Use `boilr help` to get the list of available commands.

# Template Catalog
Take a look at [Templates](https://github.com/tmrts/boilr/wiki/Templates) page for a list of project templates, examples, and more information.
## Download a Template
In order to download a template from a github repository, use the following command:

# Contributing
If you'd like to contribute, share your opinions or learn more, please feel free to open an issue.
```bash
boilr template download <github-repo-path> <template-tag>
boilr template download tmrts/boilr-license license
```

At this stage, user feedback is of **utmost importance**, every contribution is welcome however small it may be.
The downloaded template will be saved to local `boilr` registry.

## Save a Local Template
In order to save a template from filesystem to the template registry use the following command:

```bash
boilr template save <template-path> <template-tag>
boilr template save ~/boilr-license license
```

The saved template will be saved to local `boilr` registry.

## Use a Template
In order to use a template from template registry use the following command:

```bash
boilr template use <template-tag> <target-dir>
boilr template use license ~/Workspace/example-project/
```

You will be prompted for values when using a template.

```bash
[?] Please choose an option for "License"
1 - "Apache Software License 2.0"
2 - "MIT"
3 - "GNU GPL v3.0"
Select from 1..3 [default: 1]: 2
[?] Please choose a value for "Year" [default: "2015"]:
[?] Please choose a value for "Author" [default: "Tamer Tas"]:
[✔] Created /home/tmrts/project/LICENSE
[✔] Successfully executed the project template license in /home/tmrts/project
```

For more information please take a look at [Usage](https://github.com/tmrts/boilr/wiki/Usage) and [Creating Templates](https://github.com/tmrts/boilr/wiki/Creating-Templates) pages in the wiki.

## Reporting Issues
You can report issues **directly from the command-line** by using the command, `boilr report`.
Expand All @@ -49,6 +85,14 @@ is the issue body.
After creating the issue, save & exit the editor and you will be
prompted for github credentials needed to create the issue.

# Template Catalog
Take a look at [Templates](https://github.com/tmrts/boilr/wiki/Templates) page for a list of project templates, examples, and more information.

# Contributing
If you'd like to contribute, share your opinions or learn more, please feel free to open an issue.

At this stage, user feedback is of **utmost importance**, every contribution is welcome however small it may be.

# How Do I Get It?
There are binaries available for Linux & OSX. You can download them directly,
or run the installation script. Please see [Installation](https://github.com/tmrts/boilr/wiki/Installation) page for more information.
8 changes: 4 additions & 4 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

set -u

[[ "$@" =~ --pre ]] && version=0.1.0 pre=1 ||
version=0.1.0 pre=0
[[ "$@" =~ --pre ]] && version=0.2.0 pre=1 ||
version=0.2.0 pre=0

# If stdin is a tty, we are "interactive".
interactive=
Expand Down Expand Up @@ -37,7 +37,7 @@ configure() {
auto_completion=$?
fi

if [ $auto_completion -eq ]; then
if [ $auto_completion -eq 1 ]; then
sudo $HOME/bin/boilr configure-bash-completion
fi

Expand All @@ -51,7 +51,7 @@ configure() {
check_binary() {
echo -n " - Checking boilr executable ... "
local output
output=$("$HOME"/bin/boilr version 2>&1)
output=$("$HOME"/bin/boilr version --dont-prettify 2>&1)
if [ $? -ne 0 ]; then
echo "Error: $output"
binary_error="Invalid binary"
Expand Down
2 changes: 1 addition & 1 deletion pkg/boilr/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (
AppName = "boilr"

// Version of the application
Version = "0.1.0"
Version = "0.2.0"

// ConfigDirPath is the configuration directory of the application
ConfigDirPath = ".config/boilr"
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,6 @@ var Download = &cli.Command{
exit.Error(fmt.Errorf("download: %s", err))
}

exit.OK("Successfully downloaded the template %v", templateName)
exit.OK("Successfully downloaded the template %#v", templateName)
},
}
8 changes: 1 addition & 7 deletions pkg/cmd/init.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cmd

import (
"errors"
"fmt"

cli "github.com/spf13/cobra"
Expand All @@ -10,11 +9,6 @@ import (
"github.com/tmrts/boilr/pkg/util/osutil"
)

var (
// ErrUninitializedboilrDir indicates that the local template registry is not initialized for boilr.
ErrUninitializedboilrDir = errors.New("boilr: .boilr directory is not initialized")
)

// Init contains the cli-command for initializing the local template
// registry in case it's not initialized.
var Init = &cli.Command{
Expand All @@ -24,7 +18,7 @@ var Init = &cli.Command{
// Check if .config/boilr exists
if exists, err := osutil.DirExists(boilr.Configuration.TemplateDirPath); exists {
if shouldRecreate := GetBoolFlag(c, "force"); !shouldRecreate {
exit.Error(ErrUninitializedboilrDir)
exit.GoodEnough("template registry is already initialized use -f to reinitialize")
}
} else if err != nil {
exit.Error(fmt.Errorf("init: %s", err))
Expand Down
3 changes: 1 addition & 2 deletions pkg/cmd/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ func getIssue() (*github.IssueRequest, error) {
}
f.Close()

// TODO allow gedit, vi, emacs
cmd := exec.Command("vim", fname)
cmd := exec.Command("vi", fname)

cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
Expand Down
1 change: 0 additions & 1 deletion pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ func Run() {
// TODO use command factories instead of global command variables
// TODO add describe command that shows template metadata information
// TODO add create command that creates a minimal template template
// TODO rename template-tag to template-tag

Template := &cli.Command{
Use: "template",
Expand Down
2 changes: 0 additions & 2 deletions pkg/cmd/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (

// Save contains the cli-command for saving templates to template registry.
var Save = &cli.Command{
// TODO rename template-tag to template-tag
Use: "save <template-path> <template-tag>",
Short: "Save a project template to local template registry",
Run: func(c *cli.Command, args []string) {
Expand Down Expand Up @@ -53,7 +52,6 @@ var Save = &cli.Command{
}

if _, err := exec.Cmd("cp", "-r", tmplDir, targetDir); err != nil {
// TODO create exec package
exit.Error(err)
}

Expand Down
7 changes: 6 additions & 1 deletion pkg/cmd/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"os"
"path/filepath"

cli "github.com/spf13/cobra"

Expand Down Expand Up @@ -36,7 +37,11 @@ var Use = &cli.Command{

MustValidateTemplateDir()

tmplName, targetDir := args[0], args[1]
tmplName := args[0]
targetDir, err := filepath.Abs(args[1])
if err != nil {
exit.Fatal(fmt.Errorf("use: %s", err))
}

if ok, err := TemplateInRegistry(tmplName); err != nil {
exit.Fatal(fmt.Errorf("use: %s", err))
Expand Down
3 changes: 0 additions & 3 deletions pkg/prompt/prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/tmrts/boilr/pkg/util/tlog"
)

// TODO align brackets used in the prompt message
const (
// PromptFormatMessage is a format message for value prompts.
PromptFormatMessage = "Please choose a value for %q"
Expand All @@ -36,8 +35,6 @@ func newString(name string, defval interface{}) func() interface{} {
return func() interface{} {
if cache == nil {
cache = func() interface{} {
// TODO use colored prompts
//fmt.Printf(PromptFormatMessage, name, defval)
tlog.Prompt(fmt.Sprintf(PromptFormatMessage, name), defval)

line, err := scanLine()
Expand Down
6 changes: 3 additions & 3 deletions pkg/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ func (t *dirTemplate) Execute(dirPrefix string) error {
if err := contentsTmpl.ExecuteTemplate(f, fileTemplateName, nil); err != nil {
return err
}
}

if !t.ShouldUseDefaults {
tlog.Success(fmt.Sprintf("Created %s", target))
if !t.ShouldUseDefaults {
tlog.Success(fmt.Sprintf("Created %s", target))
}
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/exit/exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func Error(err error) {

// GoodEnough terminates execution successfully, but indicates that something is missing.
func GoodEnough(fmtStr string, s ...interface{}) {
tlog.Debug(fmt.Sprintf(fmtStr, s...))
tlog.Info(fmt.Sprintf(fmtStr, s...))

os.Exit(CodeOK)
}
Expand Down
1 change: 0 additions & 1 deletion pkg/util/tlog/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const (
ErrorMark = "✘"

// QuestionMark character indicates prompt message.
// TODO use for prompts
QuestionMark = "?"
)

Expand Down
Binary file added usage.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bd036e6

Please sign in to comment.