tmrts / boilr Goto Github PK
View Code? Open in Web Editor NEW:zap: boilerplate template manager that generates files or directories from template repositories
License: Apache License 2.0
:zap: boilerplate template manager that generates files or directories from template repositories
License: Apache License 2.0
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.
Implement hook system using either UNIX domain sockets or a hooks.json
file that contains references to scripts to be executed
I am intrigued by the idea, but it seems like there haven't been any recent commits.
According to this page: https://golang.org/pkg/text/template/ - section 'text and spaces' GO templating allows control spaces:
{{- and -}}
For all my test boilr is crashing when one of his syntax is used.
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!
The Install Script section of the Installation doc in the wiki points to a script with URL: https://github.com/tmrts/boilr/install but needs to point to:
Boilr looks really neat!
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:
Line 49 in 04e56be
Cheers!
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 ;-)
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}}"
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 :)
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
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.
Implement logging levels for pkg tlog
See https://github.com/tmrts/boilr/blob/master/pkg/util/tlog/log.go#L32
Users should be able to use tab to auto-complete the names of saved/downloaded templates.
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/
.
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.
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 .
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
No such error is expected.
$ boilr version
[i] Current version is 0.3.0
We should add templates for templates to make maintaining templates easier for the authors.
In tmrts/boilr-electron#1 the documentation became outdated, and it could've been avoided
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.
Convert the logo to ASCII and print it when using boilr help
.
See cowsay utility to get a better idea.
When attempting to save a local template of the following i get the title'd error
boilr template save templates/feature feature
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
{
"Name": "feature"
}
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?
I really like boilr, thx for this great solution. I love the simplicity of boilr.
One suggestion:
My use case:
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 ...
It would be cool if boilr prompted/informed people that the template they're using has been updated and if they wish to update it.
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.
there should be an easy way for external contributors to get started with required deps.
Here's a PR that includes a small glide.yaml #49
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"
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
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
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!
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
Instead of performing template life-cycle operations, encapsulate these operations
boilr render github:tmrts/boilr-license .
boilr render file:/home/tmrts/template .
Behind the scenes:
boilr template log
or boilr list
template download/save/delete/update/validate
Why?:
Why not?:
How can I add validation to the project.json variables?
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!
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 }}
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,
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.
Yo. Helm (kubernetes) is using the Spring template library, and it's proved hella useful for generating the Yaml files that Kubernetes requires. Such a thing should be reasonably easy to integrate with a project like this. It would dramatically increase the possible template outputs, and make this tool heaps more useful for more complex files.
It would be nice to use -
and _
in template tags. Is there a reason why not to do this?
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
When using template use repo/repo
- support repo/repo:branch
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!
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 .
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
No such error is expected.
$ boilr version
[i] Current version is 0.3.0
I suggest to create home brew boilr package.
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
.
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:
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:
boilr upgrade license <project>
and that would:
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.
brew info
or kubectl edit
type workflows).TOML files are easier on the eyes and less verbose.
Allow using TOML instead of JSON
Thanks for your work:)
Will you add private git(such as gitlab EE) support to download template?
Hi @tmrts,
I just noticed you starred https://github.com/schmunk42/docker-boilr
Let me know if you'd like to integrate Docker support for boilr.
The above repo is a bit experimental at the moment, especially regarding host-volumes. But any feedback is very welcome!
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
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 ?
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'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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.