Something like hab create {planname} or such that would generate a plan.sh with some boilerplate variables.
Maybe similar to Homebrew's create - where passing in a github release tag url activates a lot of the default variables
This would lower the "getting started" bar for a new plan.
Added value: tries to get the correct sha during invocation - either with a curl header, or some other trickery.
Apparently there's _something_ already here: https://github.com/habitat-sh/habitat/blob/master/plans/plan-tmpl.sh
We originally had make new-plan plan=foo in the plans/ directory, but removed it with the expectation that we would come up with something more fully integrated in the future. The future is now!
We should do this.
@rmoshier and I are going to take a look at this next week.
For the first iteration, we'll create a subcommand titled hab pkg create <PKG_NAME>, which does the following:
PKG_NAME/plan.sh file with the following contents:pkg_name=<PKG_NAME>
pkg_origin=<HAB_ORIGIN env var or some other value?>
pkg_version=0.0.1
pkg_description="The package description"
# Please choose a license from http://spdx.org/licenses/
pkg_license=('Apache-2.0')
pkg_maintainer="The Habitat Maintainers <[email protected]>"
pkg_source=http://some_source_url/releases/${pkg_name}-${pkg_version}.tar.gz
pkg_shasum=TODO
pkg_bin_dirs=(bin)
pkg_build_deps=(core/make core/gcc)
pkg_deps=(core/glibc)
hab pkg create may be aliased to hab create.default.toml, config/** etc), but we can certainly discuss them in followup issues + PR's.pkg_shasumA few ideas I brainstormed
Run in the current directory:
hab plan create [PLAN]
If PLAN is not specified:
A habitat directory is created with a templated plan.sh using the PWD as the pkg_name. This is intended to be used inside an application.
If PLAN is specified:
A PLAN directory is specified with a templated plan.sh using PLAN as the pkg_name. This is intended to be used in the core-plans repository or other similar collections of Habitat plans.
The pkg_origin will be set from ~/.hab/etc/cli.toml.
Should this be a top-level cli command? As @metadave pointed out earlier, hab pkg create foo seems to map nicely with my brainspace of where I would find a command like this.
we've been sticking with hab [noun] [verb], as noted in @juliandunn's post here.
We can alias frequently used commands, for example:
ALIASES:
apply Alias for: 'config apply'
install Alias for: 'pkg install'
setup Alias for: 'cli setup'
start Alias for: 'sup start'
also: ping @ryankeairns
Then hab pkg createplan ? hab pkg scaffold?
A few thoughts:
hab plan create but as discussed above, there is a natural extension from hab pkg and I personally like hab pkg create with future possible flags for different app flavors --java, etc. Also, you could get a bit more of the tree (as stated in the future) so it's more than just the plan/habitat/plan.sh directory. This is not only cleaner, but allows for us to more easily locate habitat files that we may want to auto-detect for certain commands (as we do with hab setup currently).Great work, look forward to seeing it come alive!
@miketheman I'm 馃憥 on hab pkg createplan, as createplan combines verb + noun.
@metadave I'm all ears for a better verb, I'm 馃憥 for creating more top-level namespaces without a compelling reason to do so.
I don't understand, is there a new top-level namespace?
The proposal of hab plan create introduces a new namespace plan.
https://github.com/habitat-sh/habitat/issues/953#issuecomment-239907833 item 2 seems to indicate that the command will be hab pkg create
@metadave @miketheman Hey guys, after further thought and discussion we'd prefer to use hab plan create . The reason is that 'hab pkg create' insinuates you're creating an actual package (when it's just a the hab files) and other commands for the pkg noun only deal with 'real' packages.
It seems quite likely we'll be iterating on this new plan noun in the near future and that it warrants its own namespace.
Thanks for sifting through this discussion, it all pays off down the road when we're judicious up front!
I have been hacking away on this. https://github.com/bdangit/habitat/tree/add-hab-plan-create
While waiting for a flight I implemented the bulk of a hab pkg init command. @bdangit maybe we can collaborate and get something nice this week for a PR? Will be on slack monday after flying!
Hey @hoverbear
Sure! Although I'm computerless for the next 4 days. Tuesday I'll be on late.
Also you mean hab plan init?
@bdangit Hm I suppose that would work too. :) I was offline so couldn't reference this issue.
In the next release, thanks to #1416, we will be shipping a hab plan init.
Most helpful comment
I have been hacking away on this. https://github.com/bdangit/habitat/tree/add-hab-plan-create