vigetlabs / sprig-reap

Sprig-Reap is a gem that allows you to output your application's data state to seed files.
MIT License
18 stars 18 forks source link

sprig-reap broke the yaml formatting #11

Closed alexanderadam closed 9 years ago

alexanderadam commented 10 years ago

I already hat a sprig definition with the structure

options:
  find_existing_by: ['identifier']

records:
  - sprig_id: 1
    identifier: lorem
  - sprig_id: 2
    identifier: ipsum

After using sprig-reap the structure was

options:
  find_existing_by: ['identifier']

records:
  - sprig_id: 1
    identifier: lorem
  - sprig_id: 2
    identifier: ipsum

- sprig_id: 3
  identifier: dolor
- sprig_id: 3
  identifier: sit

So there was wrong indention (the duplicated id is already mentioned in another issue)

h0tl33t commented 10 years ago

The output from sprig-reap is standard in terms of indentation and you're unable to affect the indentation in newer versions of Ruby. Older versions exposed some of the options of Psych (yaml lib Ruby used under the covers), but unfortunately that's no longer the case.

Is the issue purely aesthetic or is Sprig unable to parse files like this? If it's an aesthetics thing, you could select all the records that aren't indented and then indent them all at once.

alexanderadam commented 10 years ago

Psych/Spring is unable to parse this while the new "Array"-keys are on the same height as the other "Hash"-keys.

When the table is empty, an

--- []

will be appended which destroys the yaml file even when there is nothing to add. :wink:

h0tl33t commented 10 years ago

Ah, ok. I'll look into this.