Created
March 25, 2015 07:18
-
-
Save wcooley/84f3028a1ecf04e36e1c to your computer and use it in GitHub Desktop.
Puppet => alignment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Starts like this... | |
class strictly_following_style_guide { | |
yumrepo { 'puppetlabs-products': | |
descr => 'Puppet Labs Products El $releasever - $basearch', | |
baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
gpgcheck => '1', | |
} | |
} | |
# Dammit, I've added another param that's long. Better move everything over | |
# to line up! | |
class strictly_following_style_guide { | |
yumrepo { 'puppetlabs-products': | |
descr => 'Puppet Labs Products El $releasever - $basearch', | |
baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
gpgcheck => '1', | |
metadata_expire => '3h', | |
} | |
} | |
# And you get a lovely, confusing diff... | |
@@ -1,8 +1,9 @@ | |
class strictly_following_style_guide { | |
yumrepo { 'puppetlabs-products': | |
- descr => 'Puppet Labs Products El $releasever - $basearch', | |
- baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
- gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
- gpgcheck => '1', | |
+ descr => 'Puppet Labs Products El $releasever - $basearch', | |
+ baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
+ gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
+ gpgcheck => '1', | |
+ metadata_expire => '3h', | |
} | |
} | |
# Or you could've just given it a nice wide inner-indent to begin with... | |
class start_wide { | |
yumrepo { 'puppetlabs-products': | |
descr => 'Puppet Labs Products El $releasever - $basearch', | |
baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
gpgcheck => '1', | |
} | |
} | |
# And everything still lines up even after you add a long parameter | |
class start_wide { | |
yumrepo { 'puppetlabs-products': | |
descr => 'Puppet Labs Products El $releasever - $basearch', | |
baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
gpgcheck => '1', | |
metadata_expire => '3h', | |
} | |
} | |
# And you get a reasonable diff | |
@@ -4,5 +4,6 @@ | |
baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
gpgcheck => '1', | |
+ metadata_expire => '3h', | |
} | |
} | |
# Or you could've started with a narrow inner-indent... | |
class grouped_indents { | |
descr => 'Puppet Labs Products El $releasever - $basearch', | |
baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
gpgcheck => '1', | |
} | |
# And just grouped into narrow and wide indents | |
class grouped_indents { | |
descr => 'Puppet Labs Products El $releasever - $basearch', | |
baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
gpgcheck => '1', | |
repo_gpgcheck => '1', | |
metadata_expire => '3h', | |
mirrorlist_expire => '30', | |
} | |
# And still get a reasonable diff | |
@@ -3,4 +3,7 @@ | |
baseurl => 'http://yum.puppetlabs.com/el/$releasever/products/$basearch', | |
gpgkey => 'file:///etc/pki/rpm-gpg/PUPPETLABS_GPG_KEY', | |
gpgcheck => '1', | |
+ repo_gpgcheck => '1', | |
+ metadata_expire => '3h', | |
+ mirrorlist_expire => '30', | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment