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

stack dsl #20

Open
tj opened this issue Aug 22, 2014 · 4 comments
Open

stack dsl #20

tj opened this issue Aug 22, 2014 · 4 comments

Comments

@tj
Copy link
Member

tj commented Aug 22, 2014

just realized it doesn't really make sense to use commits at the command level in some cases, for example:

mkdir /tmp/redis
curl -L# http://download.redis.io/releases/redis-stable.tar.gz | tar -zx --strip 1 -C /tmp/redis
cd /tmp/redis && make install

If you were to change the release tarball it would re-execute but make install would not, so what we really need is:

redis {
  tmp {
    curl -L# http://download.redis.io/releases/redis-stable.tar.gz | tar -zx --strip 1
    make install
  }
}

where "redis {}" is the stack and "tmp {}" is just an example directive

@wilmoore
Copy link

wilmoore commented Sep 1, 2014

The alternative way to solve this (if you wanted to avoid the DSL) is to put the redis related lines in a new file, then call/source it from the main script. You'd commit the SHA of the external script contents.

Not saying this is necessarily better; but could potentially be less to maintain.

On the other hand, writing DSLs is always fun, so there's that :)

@tj
Copy link
Member Author

tj commented Sep 1, 2014

haha yeah that's just an example, lots of use-cases where a few commands should be considered a single commit

@wilmoore
Copy link

wilmoore commented Sep 1, 2014

😄 - Right on.

@l3pp4rd
Copy link

l3pp4rd commented Sep 1, 2015

you could probably treat group of commands as related, without two newlines, example:

# one command, hashed with newlines as block
mkdir /tmp/dir
cd /tmp/dir
echo /hello/world

# command two, could also reset some state, like **pwd**
pwd # /home/user

The group could be executed in sh -c "group of commands" in order to restore EXPORTs and other state..

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

No branches or pull requests

3 participants