Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy or clone command for cli #108

Open
anithri opened this issue Sep 23, 2017 · 6 comments
Open

copy or clone command for cli #108

anithri opened this issue Sep 23, 2017 · 6 comments

Comments

@anithri
Copy link
Collaborator

anithri commented Sep 23, 2017

blueprints clone #copy? which will copy blueprints into a local directory to encourage customizing blueprints for your use case.

Blueprints will be more useful if we make it much easier to take existing blueprints and copy them for the user to customize.

@anithri
Copy link
Collaborator Author

anithri commented Sep 23, 2017

Could this be used to copy a blueprint, and inject defaults, partials or settings into the custom copy?

@walreyes
Copy link
Contributor

Hi, @anithri I'd like to work on this feature. I just have a couple of questions for clarification.

blueprints clone or blueprints copy should copy all of the default blueprints to the local directory.

Do you think there is any advantage of being able to clone a specific blueprint?

For example: blueprints clone [blueprint name] to clone a specific one, with the ability to run blueprints clone --all to clone all of them.

@anithri
Copy link
Collaborator Author

anithri commented Oct 16, 2017

Well, I misspoke if I implied copy/cloning all blueprints. My intention was to be able to copy a blueprint into the local blueprints directory to allow for easier customization.

I can't actually see the value of clone --all but I'm open to it.

The danger points as I see it are:

  1. finding out which dir to clone into from settings and/or CLI args
  2. Ensuring that there isn't a Blueprint(bp) with that name already OR allow a rename as part of the clone
  3. recursive copy, we're going to have a file black list for files generated (.ds_store, .git, ...) Not sure of a clean way to include that in a recursive copy, but it's worth a bit of thought.

The api for getting blueprint names and paths is still a bit in flux, as is the proper place for setting your blueprint path. I expect to see that soon, we're just about done with how we're going to read settings files and blueprint paths. I'm hoping to have that ready for review in the next day or two.

Thanks for the contribution!

@walreyes
Copy link
Contributor

walreyes commented Oct 16, 2017

I was getting it wrong: I was thinking that blueprint clone would clone one of the default blueprints included in the source code (dumb, duck, smart, ...) to the local directory.

I realized my mistake.

blueprint clone [blueprint-name] is supposed to clone one of the customized blueprints of the user. For example, If I created a blueprint called reducer and I run blueprint clone reducer it should clone that blueprint, right?

Is not the blueprint's path always the directory /blueprints from root?
And the blueprints names are the name of the directories inside /blueprints?

I might be able to read paths and names following that guide.

Or How are you planning the API to get the names and paths?

I'm looking forward to contribute with this feature, It's pretty interesting how you guys are building this!

@anithri
Copy link
Collaborator Author

anithri commented Oct 17, 2017

I think it should be able to find any blueprint in the blueprints search path, and then copy that blueprint dir into the users "destination" blueprint dir.

The ability to clone these means that the user can customize a bp to his own tastes.

By default, the cli work look for any "blueprints" or ".blueprints" directories that exist in the same directory as one of the .blueprintrc files.

you're rc file will look something like

  "blueprints": {
    // paths to single blueprints
    // when searching for a name, "blueprints" will be searched before "blueprintPaths"
    "default": "/this/exact/blueprint",
    "duck": "regardless/of/location",
  },
  "blueprintPaths": [ 
    // paths to blueprint directories
    // would be fully qualified paths by the time the configuration is fully loaded.
    './blueprints',
    'path/to/some/dir',
    '@bluePrintNpmModule',
  ],
  "cloneTo": '~/.local/blueprints',
  • settings.blueprints.all() is the list of all blueprints and blueprints found in all of the blueprint paths.
  • settings.cloneTo is the destination directory for cloned blueprints as well as the target for the blueprint blueprint.
  • settings.blueprints.lookup(name) will get a blueprint obj
  • settings.blueprints.lookup(foo).path is the path to the blueprint named "foo"

Note: api for settings is still in flux, property names may change. but there will be something that does those exact things

@walreyes
Copy link
Contributor

Got it!

I'll start experimenting with this, I'll try to cover what I can do without the API.

Then I should be able to plug the api in and ship it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants