Project

yamlclean

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Clean issues out of yaml files. Thanks to yamllint.com and ya2yaml
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.13
~> 5.0
~> 10.0

Runtime

 Project Readme

yamlclean

Build Status

This simple ruby gem provides a command-line tool for cleaning up yaml files. It's based on the ya2yaml library.

One notable use-case for this is to make Transifex translation files work with PHP's yaml parsers. That's why I first wrote it. :-)

Installation

$> sudo gem install yamlclean

Usage

$> yamlclean input.yml > output.yml

What does it do?

The most significant change that this script makes is reformatting of multi-line strings.

It will convert this:

en_GB:
  GroupImportForm:
    Help2:                '<div class="advanced">

      <h4>Advanced usage</h4>

      <ul><li>Allowed columns: <em>%s</em></li><li>Existing groups are matched by their unique <em>Code</em> value, and updated with any new values from the imported file</li><li>Group hierarchies can be created by using a <em>ParentCode</em> column.</li><li>Permission codes can be assigned by the <em>PermissionCode</em> column. Existing permission codes are not cleared.</li>

      </ul>

      </div>'

To this:

en_GB:
  GroupImportForm:
    Help2: |-
        <div class="advanced">
        <h4>Advanced usage</h4>
        <ul><li>Allowed columns: <em>%s</em></li><li>Existing groups are matched by their unique <em>Code</em> value, and updated with any new values from the imported file</li><li>Group hierarchies can be created by using a <em>ParentCode</em> column.</li><li>Permission codes can be assigned by the <em>PermissionCode</em> column. Existing permission codes are not cleared.</li>
        </ul>
        </div>

This is important because many PHP and JavaScript yaml parsers won't parse the former syntax.

Contributing and development

After checking out the code, you can run the tests as follows:

$> bundle install
$> bundle exec rake

You can compile and install the gem locally as follows:

$> bundle exec rake install

To publish a new release, first ensure that the correct version is listed in lib/yamlclean/version.rb. Then run these commands:

$> bundle exec rake release

Note that the last command will require permissions to publish the gem. If you've been contributing to this through pull requests and would like to be granted core commit and publish access, let me know!