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

Feature request: add optional tasks #96

Closed
nagromc opened this issue Sep 26, 2016 · 5 comments
Closed

Feature request: add optional tasks #96

nagromc opened this issue Sep 26, 2016 · 5 comments

Comments

@nagromc
Copy link
Contributor

nagromc commented Sep 26, 2016

I would like Dotbot to install the required softwares by my dotfiles. For instance, if I use i3, I would add to install.conf.yaml:

- shell:
    - sudo apt-get install -y i3

- link:
    - ~/.config/i3/config: i3/config

But imagine I need multiple softwares like fish, tmux, Vim, etc. and with multiple package managers (npm install -g bower gulp yo, sudo pip install pre-commit pre-commit-hooks thefuck, etc.), each time I run ./install, the whole installation process will take several minutes to run, especially on low resource systems such as the Raspberry Pi v1.

I know Dotbot should be idempotent, but wouldn't be great to run ./install --init or something to execute specific part of the file (for instance, install the required softwares)? Then, the install.conf.yaml would become:

- optional:
    # Only executed if `--init` is specified
    - name: init
      tasks:
        - shell:
            - [sudo apt-get install -y i3, Installing required softwares]

# Executed in any case
- link:
    - ~/.config/i3/config: i3/config
@anishathalye
Copy link
Owner

Sounds interesting. I would be in favor of incorporating some form of this functionality.

This seems closely related to #44 / #81. It would be great to come up with a single design that unifies all of these ideas.

@nagromc
Copy link
Contributor Author

nagromc commented Sep 26, 2016

Well, you're right. Hope we'll find a solution! It seems many of us would love such a feature.

@gwerbin
Copy link

gwerbin commented Jan 18, 2017

Obviously @anishathalye you have the final word here, but I'd be concerned about feature creep. One of Dotbot's great strengths is that it's dead simple, and starting to add advanced configuration options might remove some of that simplicity.

You already have a plugin API -- I'd much rather see this kind of functionality implemented as a plugin than in the Dotbot core.

@gwerbin
Copy link

gwerbin commented Jan 18, 2017

However, letting tasks have some kind of name or group attribute seems like a useful feature to have in the core program. Then you can resolve #81 easily by grouping the output together for tasks that share a groups attribute:

- groups:
  - "init"
  shell:
    - [sudo apt-get install -y i3, Installing required softwares]

- link:
    - ~/.config/i3/config: i3/config

Alternatively you can require that all additional attributes have to be specified in an "attributes" element, which can then be passed on to plugins etc:

- shell:
    - [sudo apt-get install -y i3, Installing required softwares]
  attributes:
  - "optional"
  - name: "install-i3"
  - groups: ["init"]

- link:
    - ~/.config/i3/config: i3/config

Heck, this way you could even have a depends-on attribute and then write a plugin to resolve dependencies or something, or an arguments attribute that fills in templated strings, etc. Pretty sure you could re-implement Make this way if you really wanted to, but again with the benefit of it only existing outside the core program.

@anishathalye
Copy link
Owner

I've merged in #214 to allow --only and --except to only run certain sections.

For groups of tasks, I think the right solution is splitting them into foo.yaml, bar.yaml and then tweaking the install script to take an argument that is the config name, e.g. ./install foo which will call Dotbot on foo.yaml.

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

3 participants