osxc / legacy-common

DEPRECATED: Common tools for hackers
http://osxc.github.io
MIT License
71 stars 14 forks source link

configuration files should cater to humans. #6

Closed paulp closed 9 years ago

paulp commented 10 years ago

The example config has maybe 30 lines of information in 160 lines of yaml. I find this fairly obscene. Is there any hope for a more concise syntax?

As a strawman for illustrative purposes only, something like

  - role: brew_package
    package_names: node, maven, leiningen, sbt, go, rust, android-sdk, android-ndk, postgres, ...
  - role: npm_package
    package_names: aglio, bower, grunt, ...
  - role: cask_package
    package_names: firefox, dropbox, chromium, ....

would be a huge improvement.

rricard commented 10 years ago

Good point, we could do something like this !

paulp commented 10 years ago

I'll slightly modify that suggestion: space delimited, much better.

laughedelic commented 10 years ago

:+1:

paulp commented 10 years ago

After some struggling with the ansible syntax I have determined that one can already do this as follows:

  vars:
  - casks: [ alfred, asepsis, bartender, bettertouchtool, caffeine, filebot,
             google-chrome, iterm2, keyboard-cleaner, lastpass-universal,
             sublime-text-dev, textexpander ]
  tasks:
  - name: install homebrew casks
    homebrew_cask: name={{ item }} state=present
    with_items: casks
paulp commented 10 years ago

Another approach is to have a file casks.yml containing e.g.

- name: install homebrew casks
  homebrew_cask: name={{ item }} state=present
  with_items:
    - adapter
    - alfred
    - appcleaner
    - asepsis
    - bartender
    - bettertouchtool
    - bonjour-browser
    - caffeine
    - cocktail
    - dropbox
    - fantastical
    - filebot
    - firefox
    - font-source-code-pro
    - gitx-rowanj
    - google-chrome
    - google-chrome-canary
    - growlnotify
    - hazel
    - iterm2
    - key-codes
    - keyboard-cleaner
    - lastpass-universal
    - launchcontrol
    - musicbrainz-picard
    - skim
    - sonos
    - sublime-text-dev
    - subtitles
    - textexpander
    - tinkertool
    - tvshows
    - vlc
    - xquartz

And in all.yaml,

  tasks:
  - include: casks.yml

What I'd really like is to have a file with one cask to a line, plus any options it needs for building, with no yaml syntax confusing the matter. This might be possible but I haven't found it yet, ansible seems keen on everything being yaml.

octplane commented 10 years ago

I like you last suggestion a lot. Copying-it :-). Thanks for sharing

rricard commented 10 years ago

Or, we could make a conditional in the role either it can accept this syntax:

  - role: cask_package
    package_name: firefox

or this one:

  - role: cask_package
    package_names: [firefox, dropbox, chromium]
paulp commented 10 years ago

Since I don't think it's possible to have a space delimited or otherwise non-yaml list without resorting to slurping a file in via the shell, I'd say the package_names which takes a list is the sensible measure.