Giter Club home page Giter Club logo

boilr's People

Contributors

adarnimrod avatar aluriak avatar andrewhowdencom avatar iancmcc avatar jdoklovic avatar rawkode avatar tmrts avatar unforswearing avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boilr's Issues

Current error messages are not helpful

The API feels very heavy to me : laconic outputs, and at least 5 words for most used commands (!).

The problem have a good illustration here:

>boilr template use mytemplate
[✘] not enough arguments

This is annoying, because i have to forge again a long line
in order to understand why:

>boilr template use --help

And finally forge the full line (which is exactly what i type before… except a dot):

>boilr template use mytemplate .

The common practice to avoid the first problem is to print the help directly, eventually with an error message like [✘] not enough arguments.
A compromise could be to print something like [✘] not enough arguments (expected: 'boilr template use <template> <dir>'), which gives a big hint about missing & misplaced arguments.

Fixing the second problem can be done (user-side) by adding shell shortcuts, like function blues() {~/bin/boilr template use $1 .}, or by providing them in the API directly:

> boilr save mytemplate
> boilr use mytemplate

Or, just by use working directory if no path is provided:

> boilr template save mytemplate
> boilr template use mytemplate

In both cases, the idea is to provides shortcuts for most common calls. Chances are peoples mostly want to register and use templates in current directory.

Also, the fact that boilr template save and boilr template use don't expect arguments in the same order is… unexpected.

Template hooks

Implement hook system using either UNIX domain sockets or a hooks.json file that contains references to scripts to be executed

Cut a release.

It'd be nice to get the folder changes in a distributed package. It affects us, as we create a template for PHP software called "Magento", which heavily relies on folders.

If i can help in any way, please let me know!

Make directory creation permissions a more lax 755

Hi,

In Linux, users that are not in the same group as the user that is not the owner of the file require the execute permission on folders to traverse that folder.

At the minute, you're specifying 744 on created folders, which means (if I understand correctly -- a stretch) that the user not in the original group can read the folder, but not traverse it.

Ideally, you could pick up the permissions from the machine umask, or whatever else mkdir is using to generate the inital set of permissions.

Ref:

if err := os.MkdirAll(path, 0744); err != nil {

Cheers!

Installation error: VIRTUAL_ENV not set - using the install script

I am getting the following installation error (after the files have been downloaded), using the install version of the latest release:

Boilr executable is installed to ~/bin/boilr

For more information, see: https://github.com/tmrts/boilr
prompt_virtualenv:1: VIRTUAL_ENV: parameter not set
prompt_virtualenv:2: virtualenv_path: parameter not set

I am running it on MacOS, installed Go 1.8.3, darwin/amd64.
Using the install script of release 0.3.0.

BTW: I have realized that the script is actually breaking my terminal window (iTerm), after running the script also go doesn't return the version anymore (go version).

I have finally installed boilr from source to solve the issues described above, so finally all fine. Feel free to close this issue ;-)

Add template possibility to default values

Like I mentioned in #5

It would be nice to template the default values as well. i.e. run the default variables through go-templates first.

Like:

"AppName": "Demo",
"FolderName": "{{AppName}}"

Unwanted Whitespace

When composing slightly more complicated templates, there's no way to trim the whitespace.

Example:

my_key:
    my_super_app: {{ template app_type }}
    my_super_app_version: {{ template app_version }}

{{ define "template_app_type" }}
{{ if eq app_type "php" }}
    {{ if eq php_version "7" }}
        php_7
    {{ else if eq php_version "5" }}
        php_5
    {{ end }}
{{ else if eq app_type "ruby" }}
    ruby
{{ end }}
{{ end }}

Outputs:

my_key:
    my_super_app: 

        php_7
    my_super_app_version: version

I know | trimSpace exists, but not when using template. Also go template support {{- -}} - but that doesn't seem to work with boilr?

Please advise when you can - I'm assuming maybe I'm doing something wrong :)

signal SIGSEGV: segmentation violation

On a Docker image with Debian 8 and boilr 0.3.0

Example command:

docker run dmstr/roj:0.3.0-beta3 boilr version
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x4596c2]

goroutine 1 [running]:
panic(0x8290c0, 0xc42000e050)
	/home/travis/.gimme/versions/go1.7.linux.amd64/src/runtime/panic.go:500 +0x1a1
github.com/tmrts/boilr/pkg/cmd.GetStringFlag(0xad3720, 0x8a86d0, 0x9, 0xaf37d8, 0x0)
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/flags.go:12 +0x52
github.com/tmrts/boilr/pkg/cmd.glob..func10(0xad3720, 0xaf37d8, 0x0, 0x0)
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/version.go:18 +0x55
github.com/spf13/cobra.(*Command).execute(0xad3720, 0xaf37d8, 0x0, 0x0, 0xad3720, 0xaf37d8)
	/home/travis/gopath/src/github.com/spf13/cobra/command.go:648 +0x443
github.com/spf13/cobra.(*Command).ExecuteC(0xad21e0, 0xc4200a9f00, 0x2f, 0xc4201136fa)
	/home/travis/gopath/src/github.com/spf13/cobra/command.go:735 +0x367
github.com/spf13/cobra.(*Command).Execute(0xad21e0, 0xc4200a9ef8, 0x1)
	/home/travis/gopath/src/github.com/spf13/cobra/command.go:693 +0x2b
github.com/tmrts/boilr/pkg/cmd.Run()
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/root.go:52 +0x6c8
main.main()
	/home/travis/gopath/src/github.com/tmrts/boilr/boilr.go:6 +0x14

Version 0.2.0 of boilr works fine

docker run dmstr/roj:0.2.6 boilr version

Outputs

[...]
[i] Current version is 0.2.0

Note: roj version only coincidentally are the same as boilr

Issues while installing from source

I'm running into issues while trying to install the package via go get when starting from a completely fresh Go workspace.

$ go get github.com/tmrts/boilr
src/srcd.works/go-git.v4/repository.go:10:2: use of internal package not allowed

I'm using Go 1.8 locally.

 $ go version
go version go1.8 darwin/amd64

Let me know if there's any additional information I can provide to help debug the issue.

Clarify instructions for compiling from source.

For some environments (eg fresh install of Go on Gentoo/RPi) the listed go install instruction will throw messages about missing packages. Instead, setting GOPATH and using go get github.com/tmrts/boilr will fetch and build the dependencies and result in the boilr binary in GOPATH/bin/.

File existence control

Some files could possibly be useless in some cases, like a requirement file when user always choose the options that lead to no requirements.

I can't find anything about that.

Panic on trying to template images [JPG]

Reproduction

Folder structure:

.
├── project.json
├── template
|   ├── img
|         └── ksenia-makagonova-229007.jpg

Commands:

boilr template download HaoZeke/boilr-docuYoda boilr-docuYoda
boilr template use boilr-docuYoda test

The above is actually found at this commit .

Errors

The following is obtained:

[✔] Created .babelrc
[✔] Created .gitignore
[?] Please choose a value for "License" [default: "MIT"]: 
[?] Please choose a value for "Year" [default: "2018"]: 
[?] Please choose a value for "Author" [default: "Rohit Goswami"]: 
[?] Please choose a value for "Email" [default: "HaoZeke[at]yandex.com"]: 
[✔] Created LICENSE.md
[?] Please choose a value for "DocumentName" [default: "docuYoda"]: 
[?] Please choose a value for "PayPalMeID" [default: "HaoZeke"]: 
[?] Please choose a value for "SemaUserName" [default: "haozeke"]: 
[?] Please choose a value for "GithubUserName" [default: "HaoZeke"]: 
[?] Please choose a value for "RepoName" [default: "boilr-docuYoda"]: 
[✔] Created README.md
[✔] Created gulpfile.babel.js
[✔] Created package.json
[✔] Created scripts/TeXLive.sh
[?] Please choose a value for "GithubEmail" [default: "[email protected]"]: 
[✔] Created scripts/deploy.sh
[✔] Created scripts/firaFonts.sh
[✔] Created scripts/getPandoc.sh
[✔] Created scripts/semaphoreBuilder
[✔] Created scripts/texlive.profile
[✔] Created src/conf/.latexmkrc
[?] Please choose a value for "SubTitle" [default: "Pandoc documents for Turtles."]: 
[?] Please choose a value for "Date" [default: "14-02-18"]: 
[?] Please choose a value for "Subject" [default: "docuYoda"]: 
[✔] Created src/conf/commonConf.yml
[?] Please choose a value for "DocumentClass" [default: "scrbook"]: 
[✔] Created src/conf/texConf.yml
[✔] Created src/filters/panfHeaderList.py
[✔] Created src/filters/panfluteInc.py
panic: template: ksenia-makagonova-229007.jpg:36: unexpected bad character U+FFFD '' in command

goroutine 1 [running]:
text/template.Must(0x0, 0xc7e300, 0xc420050310, 0x1)
	/usr/lib/go/src/text/template/helper.go:23 +0x54
github.com/tmrts/boilr/pkg/template.(*dirTemplate).Execute.func2(0xc420024930, 0x62, 0xc88940, 0xc420319110, 0x0, 0x0, 0x0, 0x0)
	/home/haozeke/src/github.com/tmrts/boilr/pkg/template/template.go:236 +0x65d
path/filepath.walk(0xc420024930, 0x62, 0xc88940, 0xc420319110, 0xc42015cbd0, 0x0, 0x0)
	/usr/lib/go/src/path/filepath/path.go:356 +0x81
path/filepath.walk(0xc420021590, 0x45, 0xc88940, 0xc420318ea0, 0xc42015cbd0, 0x0, 0x0)
	/usr/lib/go/src/path/filepath/path.go:381 +0x3a0
path/filepath.walk(0xc4200212c0, 0x41, 0xc88940, 0xc4202ba680, 0xc42015cbd0, 0x0, 0x0)
	/usr/lib/go/src/path/filepath/path.go:381 +0x3a0
path/filepath.walk(0xc42001f100, 0x3d, 0xc88940, 0xc42015f110, 0xc42015cbd0, 0x0, 0x30)
	/usr/lib/go/src/path/filepath/path.go:381 +0x3a0
path/filepath.Walk(0xc42001f100, 0x3d, 0xc42015cbd0, 0x8a15ff, 0xc4200c79c0)
	/usr/lib/go/src/path/filepath/path.go:403 +0x11d
github.com/tmrts/boilr/pkg/template.(*dirTemplate).Execute(0xc420186850, 0xc4201689c0, 0x20, 0x20, 0xc4201689c0)
	/home/haozeke/src/github.com/tmrts/boilr/pkg/template/template.go:172 +0xb9
github.com/tmrts/boilr/pkg/cmd.glob..func8.1(0x0, 0x0)
	/home/haozeke/src/github.com/tmrts/boilr/pkg/cmd/use.go:89 +0x15f
github.com/tmrts/boilr/pkg/cmd.glob..func8(0xcd3900, 0xc420157e40, 0x2, 0x2)
	/home/haozeke/src/github.com/tmrts/boilr/pkg/cmd/use.go:97 +0x479
github.com/spf13/cobra.(*Command).execute(0xcd3900, 0xc420157d80, 0x2, 0x2, 0xcd3900, 0xc420157d80)
	/home/haozeke/src/github.com/spf13/cobra/command.go:757 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xcd2600, 0x9e012e, 0x2f, 0xc4200c7ec0)
	/home/haozeke/src/github.com/spf13/cobra/command.go:843 +0x334
github.com/spf13/cobra.(*Command).Execute(0xcd2600, 0xc4200c7ec0, 0x1)
	/home/haozeke/src/github.com/spf13/cobra/command.go:791 +0x2b
github.com/tmrts/boilr/pkg/cmd.Run()
	/home/haozeke/src/github.com/tmrts/boilr/pkg/cmd/root.go:52 +0x6b4
main.main()
	/home/haozeke/src/github.com/tmrts/boilr/boilr.go:20 +0xcd

Expected

No such error is expected.

System Details

Neofetch output

$ boilr version
[i] Current version is 0.3.0

Meta-Templates

We should add templates for templates to make maintaining templates easier for the authors.

Benefits

  • Every template contains or needs a README to increase discoverability, this makes it easier
  • Quality improvements in README, CI, repository will be shared by everyone

In tmrts/boilr-electron#1 the documentation became outdated, and it could've been avoided

Usage

The author defines a repository.json with description, author info, links etc. and the meta-template will use the information to fill out .travis.yml, documentation, README, etc.

panic: template index.js:3 function "Name" not defined

When attempting to save a local template of the following i get the title'd error

Command

boilr template save templates/feature feature

Output

panic: template: index.js:3: function "Name" not defined

goroutine 1 [running]:
panic(0x41c800, 0xc42011dde0)
	/home/travis/.gimme/versions/go1.7.linux.amd64/src/runtime/panic.go:500 +0x1a1
text/template.Must(0x0, 0x6a6dc0, 0xc42011dde0, 0x1)
	/home/travis/.gimme/versions/go1.7.linux.amd64/src/text/template/helper.go:23 +0x66
github.com/tmrts/boilr/pkg/template.(*dirTemplate).Execute.func2(0xc420188120, 0x58, 0x6af6e0, 0xc42017ac30, 0x0, 0x0, 0x0, 0x0)
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/template/template.go:240 +0x76c
path/filepath.walk(0xc420188120, 0x58, 0x6af6e0, 0xc42017ac30, 0xc420149470, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.7.linux.amd64/src/path/filepath/path.go:351 +0x81
path/filepath.walk(0xc42000bd60, 0x4f, 0x6af6e0, 0xc420115ba0, 0xc420149470, 0x0, 0x1)
	/home/travis/.gimme/versions/go1.7.linux.amd64/src/path/filepath/path.go:376 +0x344
path/filepath.Walk(0xc42000bd60, 0x4f, 0xc420149470, 0x0, 0x0)
	/home/travis/.gimme/versions/go1.7.linux.amd64/src/path/filepath/path.go:398 +0xd5
github.com/tmrts/boilr/pkg/template.(*dirTemplate).Execute(0xc42016a1c0, 0xc42000bbd0, 0x4f, 0xc42016a1c0, 0x0)
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/template/template.go:254 +0xc1
github.com/tmrts/boilr/pkg/cmd/util.testTemplate(0x7fff5fbff7a4, 0x11, 0x0, 0x0)
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/util/validation.go:86 +0x15e
github.com/tmrts/boilr/pkg/cmd/util.ValidateTemplate(0x7fff5fbff7a4, 0x11, 0xc4200abaa0, 0x59926, 0xc420147701)
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/util/validation.go:107 +0x27c
github.com/tmrts/boilr/pkg/cmd.MustValidateTemplate(0x7fff5fbff7a4, 0x11)
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/must_validate.go:31 +0x41
github.com/tmrts/boilr/pkg/cmd.glob..func7(0x6d4220, 0xc420147740, 0x2, 0x2)
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/save.go:31 +0x12f
github.com/spf13/cobra.(*Command).execute(0x6d4220, 0xc4201475a0, 0x2, 0x2, 0x6d4220, 0xc4201475a0)
	/home/travis/gopath/src/github.com/spf13/cobra/command.go:648 +0x443
github.com/spf13/cobra.(*Command).ExecuteC(0x6d3340, 0xc4200abf00, 0x2f, 0xc42011d94a)
	/home/travis/gopath/src/github.com/spf13/cobra/command.go:735 +0x367
github.com/spf13/cobra.(*Command).Execute(0x6d3340, 0xc4200abef8, 0x1)
	/home/travis/gopath/src/github.com/spf13/cobra/command.go:693 +0x2b
github.com/tmrts/boilr/pkg/cmd.Run()
	/home/travis/gopath/src/github.com/tmrts/boilr/pkg/cmd/root.go:52 +0x6c8
main.main()
	/home/travis/gopath/src/github.com/tmrts/boilr/boilr.go:6 +0x14

project.json

{
  "Name": "feature"
}

index.js

import React, { Component, PropTypes } from 'react';

class {{Name}} extends Component {

  state = {};

  static propTypes = {};

  static defaultProps = {};

  render() {
    return (
      <div></div>
    );
  }
}

export default {{Name}};

am i missing something?

Suggestion: Use only one file from a template.

I really like boilr, thx for this great solution. I love the simplicity of boilr.

One suggestion:

  • It would be nice to be able to use just one file of a template repo

My use case:

  • I'd love to use boilr to insert misc code/readme templates to several projects, but I actually do not want to create a separate boilr repo for each of the templates
  • Instead (beside using boilr for scaffolding project), I'd like to create a bigger project with a lot of different single templates (README files, code files, config files, etc.)

Sample how this could work:

  • boilr template use <tag>[/<?filepath-within-template>] <target>

What do you think? Does this fit in your plans ...
I am unfortunately still a learner in the GoLang space, but with some help I could think of trying to contribute to this project with a PR ...

Add at lest undersore as allowed character to TAGs names.

Currently boilr is not allowing use one of character _ - in tag name. I think that this will be more very helpful.

Examples:

# Not easy to read
sometag01
sometag02

# Easier to read
some_tag_01
some_tag_02

For example if there is 'testing' template and would be nice to add is with different name (version). So this can help test and approve template before renaming (re importing) with the same tag name.

boilr failing with time parsing errors

Just running a template that works for other members of my team, seems there is no date parsing that we are doing in these templates, and this is internal to boilr.

[✘] use: parsing time "Thu Dec 14 11:16 +0700 +07 2017" as "Mon Jan 2 15:04 -0700 MST 2006": cannot parse "+07 2017" as "MST"

Malformed zipURL on Windows

templateURL == tmrts/boilr-license
zipURL == https://codeload.github.com/tmrts\boilr-license\zip\master

This leads to an error, which is:
[✘] download: zip: not a valid zip file

The culprit:
This line from boilr/pkg/host/github.go:
return "https://codeload.github.com/" + filepath.Join(url, "/zip/"+version)

This happens because:
"Package filepath implements utility routines for manipulating filename paths in a way compatible with the target operating system-defined file paths." As Windows file paths are backward slashed by default, this malformed zipURL is the result.

Suggested fix:
return "https://codeload.github.com/" + url + "/zip/" + version

Testing template with predefined variables.

I think would be valuable to add testing templates with some predefined variables (maybe passing as json). For example initial project.json file can have a lot of options, and template file processing them - would be nice to test auto-creation based on passed file with values. Default options are not always sufficient to test.

For example:

boilr template use tag folder --testdata some.file

Escape templating

Hi,

I have created a circleci template which contains the following line:

key: dependency-cache-{{ checksum "package.json" }}

Creating this as a boilr-template fails, as I get the message:

panic: template: config.yml:14: function "checksum" not defined

How can I escape GoLang templating for specific files?

Thx for your help in advance!

allow "-" in template tag

When naming a template it would be nice if boilr would be not "overly" strict about its name.

Action:

boilr template save -f . something-local

Expected:

Actually nothing, but no error message

Actual:

[✘] invalid argument for "template-tag": "something-local", should be a valid alphanumeric

Workaround:

boilr template save -f . somethinglocal

Tested with 0.2.0

[RFC]: Move to a simpler model

Instead of performing template life-cycle operations, encapsulate these operations

Example workflow

boilr render github:tmrts/boilr-license .

boilr render file:/home/tmrts/template .

Behind the scenes:

  • Execution metadata recorded for usage with boilr template log or boilr list
  • Template caching from github
  • Removes template template download/save/delete/update/validate

Why?:

  • Most workflows are similar, and users shouldn't have to write a couple of lines to get what they want
  • Less mental overhead thanks to simplified template management

Why not?:

  • Latency concerns due to cache invalidations and staleness checks
  • Consistency concerns due to using a cache

Validation, required values, etc...

How can I add validation to the project.json variables?

  • I.e. default empty value, but it's required to enter at least 10 chars?
  • or pregenerated random stings

Escaping double curly brackets '{{}}' that are not intended to be in the template

Hi,
Would it be possible to somehow escape non-relevant double curly brackets? One of the files in my template folder is a concourse template file (e.g. _helper.tpl) which has multiple {{some text}} in it, and makes boilr panic. It would be great if there were some workarounds for this.

Btw, boilr is great, thanks for the time and effort!

Allow multiple values for a single option

This is a feature request.

The use case is as follows: I use boilr to create various kinds of configuration files, such as configuration for Kubernetes deployments or XML configuration for Magento. In both these kinds of configuration, there's the possibility to have multiple values under a single "option". Below is an example of Volumes in Kubernetes, where you might have multiple assigned to each pod:

  role: "{{ Role | toLower }}"
    spec:
      volumes:
      # Record 1
      - name: "{{ Service | toLower }}-etc-conf-d"
        {{ VolumeType }}:
          {{ if eq VolumeType "HostVolume" }}path: /data/{{ Service | toLower }}/
          {{ else if eq VolumeType "ConfigMap"}}name: "{{ Service | toLower }}-etc-conf-d"
          {{ end }}
      # Record 2
      - name: "{{ Service | toLower }}-data"
        {{ VolumeType }}:
          {{ if eq VolumeType "HostVolume" }}path: /data/{{ Service | toLower }}/
          {{ else if eq VolumeType "ConfigMap"}}name: "{{ Service | toLower }}-etc-conf-d"
          {{ end }}

https://github.com/littlemanco/boilr-k8sdeployment/blob/master/template/50-%7B%7B%20Service%20%7C%20toLower%20%7D%7D.dep.yml#L48-L52

The ideal here would be to a foreach iteration of a set of values, such as

{ 
  "Volumes": [
    { 
      "VolumeName": "ExampleVolumeName",
      "VolumeType": [
        "HostVolume", 
        "ConfigMap"
      ]
    }
  ],
  ... // record 2, record 3, {n}
}

At the moment, I'm just commenting out stubs of the configuration that I need replicated many times, as you can see in the template above.

I'm writing this hastily as I'm waiting for a report to complete, so if it's at all unclear, please let me know. I also understand that it'd be considerable work, so you're welcome to decline the request!

Cheers,

Doc on using as package

Hi, is there any documentation on using boilr as a package instead of as a binary?

I'm trying to call cmd.Use.Run(cmd.Use, []string{...}) but it panics, I'm not sure what arguments I'm supposed to pass in here.

Optional File Creation

It would be good if we could specify that a file is only created when an assertion is true, rather than every file inside of template being created

Invalid syntax in project.json doesn't seem to be reported

I've noticed that when you have an invalid project.json file, this isn't reported. Instead, boilr will complain about the usage of unknown values inside the template instead.

Just filing this in case anyone else has the same problem, I may get around to making a PR!

Panic on templating TeX files.

Reproduction

Folder structure:

.
├── project.json
├── template
|   ├── templates
|         └── eisvogel.tex

Commands:

boilr template download HaoZeke/boilr-docuYoda boilr-docuYoda
boilr template use boilr-docuYoda test

The above is actually found at this commit .

Errors

The following is obtained:

[✔] Created .babelrc
[✔] Created .gitignore
[?] Please choose a value for "License" [default: "MIT"]: 
[?] Please choose a value for "Year" [default: "2018"]: 
[?] Please choose a value for "Author" [default: "Rohit Goswami"]: 
[?] Please choose a value for "Email" [default: "HaoZeke[at]yandex.com"]: 
[✔] Created LICENSE.md
[?] Please choose a value for "DocumentName" [default: "docuYoda"]: 
[?] Please choose a value for "PayPalMeID" [default: "HaoZeke"]: 
[?] Please choose a value for "SemaUserName" [default: "haozeke"]: 
[?] Please choose a value for "GithubUserName" [default: "HaoZeke"]: 
[?] Please choose a value for "RepoName" [default: "boilr-docuYoda"]: 
[✔] Created README.md
[✔] Created gulpfile.babel.js
[✔] Created package.json
[✔] Created scripts/TeXLive.sh
[?] Please choose a value for "GithubEmail" [default: "[email protected]"]: 
[✔] Created scripts/deploy.sh
[✔] Created scripts/firaFonts.sh
[✔] Created scripts/getPandoc.sh
[✔] Created scripts/semaphoreBuilder
[✔] Created scripts/texlive.profile
[✔] Created src/conf/.latexmkrc
[?] Please choose a value for "SubTitle" [default: "Pandoc documents for Turtles."]: 
[?] Please choose a value for "Date" [default: "14-02-18"]: 
[?] Please choose a value for "Subject" [default: "docuYoda"]: 
[✔] Created src/conf/commonConf.yml
[?] Please choose a value for "DocumentClass" [default: "scrbook"]: 
[✔] Created src/conf/texConf.yml
[✔] Created src/filters/panfHeaderList.py
[✔] Created src/filters/panfluteInc.py
[✔] Created src/md/docuYoda.md
[✔] Created src/refs.bib
[✔] Created src/templates/classicThesis.tex
panic: template: eisvogel.tex:581: unexpected "\\" in command

goroutine 1 [running]:
text/template.Must(0x0, 0xc7e300, 0xc4203b6040, 0x1)
	/usr/lib/go/src/text/template/helper.go:23 +0x54
github.com/tmrts/boilr/pkg/template.(*dirTemplate).Execute.func2(0xc42031aa20, 0x58, 0xc88940, 0xc4203668f0, 0x0, 0x0, 0x0, 0x0)
	/home/haozeke/src/github.com/tmrts/boilr/pkg/template/template.go:236 +0x65d
path/filepath.walk(0xc42031aa20, 0x58, 0xc88940, 0xc4203668f0, 0xc42015ebd0, 0x0, 0x0)
	/usr/lib/go/src/path/filepath/path.go:356 +0x81
path/filepath.walk(0xc4200217c0, 0x4b, 0xc88940, 0xc420366000, 0xc42015ebd0, 0x0, 0x0)
	/usr/lib/go/src/path/filepath/path.go:381 +0x3a0
path/filepath.walk(0xc4200212c0, 0x41, 0xc88940, 0xc4202b0820, 0xc42015ebd0, 0x0, 0x0)
	/usr/lib/go/src/path/filepath/path.go:381 +0x3a0
path/filepath.walk(0xc42001f100, 0x3d, 0xc88940, 0xc42015b2b0, 0xc42015ebd0, 0x0, 0x30)
	/usr/lib/go/src/path/filepath/path.go:381 +0x3a0
path/filepath.Walk(0xc42001f100, 0x3d, 0xc42015ebd0, 0x8a15ff, 0xc4200c79c0)
	/usr/lib/go/src/path/filepath/path.go:403 +0x11d
github.com/tmrts/boilr/pkg/template.(*dirTemplate).Execute(0xc420186850, 0xc4201689c0, 0x20, 0x20, 0xc4201689c0)
	/home/haozeke/src/github.com/tmrts/boilr/pkg/template/template.go:172 +0xb9
github.com/tmrts/boilr/pkg/cmd.glob..func8.1(0x0, 0x0)
	/home/haozeke/src/github.com/tmrts/boilr/pkg/cmd/use.go:89 +0x15f
github.com/tmrts/boilr/pkg/cmd.glob..func8(0xcd3900, 0xc420157e80, 0x2, 0x2)
	/home/haozeke/src/github.com/tmrts/boilr/pkg/cmd/use.go:97 +0x479
github.com/spf13/cobra.(*Command).execute(0xcd3900, 0xc420157dc0, 0x2, 0x2, 0xcd3900, 0xc420157dc0)
	/home/haozeke/src/github.com/spf13/cobra/command.go:757 +0x2c1
github.com/spf13/cobra.(*Command).ExecuteC(0xcd2600, 0x9e012e, 0x2f, 0xc4200c7ec0)
	/home/haozeke/src/github.com/spf13/cobra/command.go:843 +0x334
github.com/spf13/cobra.(*Command).Execute(0xcd2600, 0xc4200c7ec0, 0x1)
	/home/haozeke/src/github.com/spf13/cobra/command.go:791 +0x2b
github.com/tmrts/boilr/pkg/cmd.Run()
	/home/haozeke/src/github.com/tmrts/boilr/pkg/cmd/root.go:52 +0x6b4
main.main()
	/home/haozeke/src/github.com/tmrts/boilr/boilr.go:20 +0xcd

Expected

No such error is expected.

System Details

Neofetch output

$ boilr version
[i] Current version is 0.3.0

"[✘] environment variable ${HOME} should be set" error on Windows

The title basically describes the error. I've created a environment variable HOME to my user directory but it's not getting recognized. I'm assuming Windows isn't supported, but is there a solution to this?

I built from source by running go get github.com/tmrts/boilr.

Plan for updating projects when templates change?

I'm currently toying around with the makeup project and would love to see the makeup cli be fully ported to the boilr tool. However, I'm held up by what boilr's offerings for a "template update" feature might be.

Creating a project for the first time is a fairly automateable and understandable task, but having the ability to take a project from an initial creation and slowly add in advancements/features down the line is a trickier endeavor (think: when the templates add awesome functionality and people want that new functionality...). Have you thought about how you might accomplish this?

A common use case of boilr for me starts with the initial bootstrapping:

  • create a repository (named: repoA) that runs boilr template type: makeup with version: 1
    • this boilr template would inject a few fancy includeable makefiles into the project
  • finally, I'd ask the user to place the include script logic into the makefile in order to reap the benefits of the nice makefile targets that the boilr template just gave them

Somewhere down the road, I'm going to want to use boilr to move the repoA project from version 1 to version 2 (after adding some more makefile targets).

I have a few possible directions:

  • have the template creator be in charge of providing upgrade scripts within the template "plugin" that people use... such that people could initiate: boilr upgrade license <project> and that would:
    • identify the version of the template that the current license was created by
    • identify which "upgrade script" to use to upgrade the resultant file (from template) to the latest resultant file (from latest template)
  • have an "upgradeable" template type where people can't modify the results of the boilr creation, but they're "injected/imported" into their project somehow (this is makeup's strategy). This is similar to the above strategy but also encourages people will have less surface area to worry about mucking up existing projects.
    • upgrades turn into just simple replacements of the original resultant file with the output of a new processed template
    • the leftover minimal surface area could possibly be delegated to the user in some fashon. (see: brew info or kubectl edit type workflows).
  • do nothing (don't handle this case) 😄

Possibility of "if" in templates?

Hey @tmrts

I'm really tempted to use boilr, but one critical feature is missing. I need the possibility to create a condition in the questions. Nothing very complicated, but still. I had the idea of implementing it on my own, but there are so many libraries and tools out there, I didn't want to make "just another templater".

So I found your boilr.

Do you think it would be possible to add an if condition to the project.json?

Like:

{
    "AppName": "Demo",
    "ExpertMode": [
        true,
        false
    ],
    "FolderName": {
        "value": "Demo",
        "condition": "ExpertMode"
    }
}

Only ask the question about the FolderName if the answer to ExpertMode is evaluated truthly.

Cheers
Chris

non deterministic template saving

It seems that my boilr template save . python -f is not deterministic: follows a terminal session. I don't change any files during the session.

lucas@host:~/boilr-python-template➤ alias m='~/bin/boilr template save . python -f'
lucas@host:~/boilr-python-template➤ m
[✘] validate: template: LICENSE:1:6: executing "LICENSE" at <eq License "Apache S...>: error calling eq: incompatible types for comparison
lucas@host:~/boilr-python-template➤ m
[✔] Successfully saved the template python
lucas@host:~/boilr-python-template➤ m
[✘] validate: template: LICENSE:1:6: executing "LICENSE" at <eq License "Apache S...>: error calling eq: incompatible types for comparison
lucas@host:~/boilr-python-template➤ m
[✔] Successfully saved the template python
lucas@host:~/boilr-python-template➤ m
[✘] validate: template: LICENSE:1:6: executing "LICENSE" at <eq License "Apache S...>: error calling eq: incompatible types for comparison
lucas@host:~/boilr-python-template➤ m
[✘] validate: template: LICENSE:1:6: executing "LICENSE" at <eq License "Apache S...>: error calling eq: incompatible types for comparison
lucas@host:~/boilr-python-template➤ m
[✔] Successfully saved the template python

The error here is raised on this line, and should not (i think) appear while License is defined as string.

What am i missing ?

Conditional creation of directories

Is there a way to conditionally create a directory, based on a parameter? For example:

.
├── project.json
└── template
    └── LICENSE
    ├── README.md
    └── {{if eq ConditionalDir "conditional"}}

With a project.json of:

{
    "ConditionalDir": false
}

This of course wouldn't work, being an invalid template, but is there a way? I have a Go package I often don't want to include.

I think v needs to be in a closure here

I've made a few hacks on this code to support loading project.json from an input parameter. (it's super crude - I have never worked with Go before, but if you like you can see my hatchet job here: https://github.com/themaven-net/boilr).

In the process, I saw a strange bug where things would work normally if I went through the prompts, but if I used defaults, then all the replacements were ending up being the same value. This has the smell of a closure-related bug all over it, and I seemed to find a spot where we are failing to enclose some key variables:

if t.ShouldUseDefaults {
   t.FuncMap[s] = func() interface{} {
	switch v := v.(type) {
	// First is the default value if it's a slice
	case []interface{}:
		return v[0]
	}
	return v
    }
} else {
        t.FuncMap[s] = prompt.New(s, v)
}

Notice how we put s and v into a closure when we invoke prompt.New, but we don't do it for the shouldUseDefaults case.

I ended up "fixing it" by putting the funcMap[s] assignment into a closure:

if t.ShouldUseDefaults {
      t.FuncMap[s] = func(s2 string, v2 interface{}) func() interface{} {
	return func() interface{} {
	  switch v2 := v2.(type) {
	  // First is the default value if it's a slice
	  case []interface{}:
	    tlog.Error(fmt.Sprintf("s: %v, v[0]: %s\n", s2, v2[0]))
	    return v2[0]
	  }
	  tlog.Error(fmt.Sprintf("s: %v, %v \n", s2, v2))
	  return v2
	}
      }(s, v)
    } else {
      t.FuncMap[s] = prompt.New(s, v)
    }

And now it works correctly for me. This is essentially what the prompt (non-default) mode is doing. It makes sense to me that we would need to retain s and v inside of a closure for the defaults like we do for the prompt path. I don't understand why the change I introduced would have caused this, but I can't imagine I'm the first person to see this behavior if it is indeed a bug.

Any idea what I'm not seeing? I can live with this, but it's definitely puzzling.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.