stack icon indicating copy to clipboard operation
stack copied to clipboard

stack dsl

Open tj opened this issue 11 years ago • 4 comments

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

tj avatar Aug 22 '14 19:08 tj

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 :)

wilmoore avatar Sep 01 '14 20:09 wilmoore

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

tj avatar Sep 01 '14 22:09 tj

:smile: - Right on.

wilmoore avatar Sep 01 '14 22:09 wilmoore

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..

l3pp4rd avatar Sep 01 '15 06:09 l3pp4rd