Rename all snake cased coffeescript files to CamelCase

December 13, 2012 John Barker

While I don’t necessarily think CamelCase is the best way to name your coffeescript files, I was unhappy that we weren’t consistent on my project.

I was going to write a pure find/sed/mv script but found Mac OS X’s sed doesn’t support text transforms like L so I finally delved into ruby -n:

  find . -iname *_*.coffee | ruby -ne 'puts "mv #{$_.chomp} #{$_.gsub(/_(.)/) { $1.upcase }}"' | bash

About the Author

Biography

More Content by John Barker
Previous
The Naked Gemspec
The Naked Gemspec

Before we start, the .gemspec itself only appears once. Here it is, as generated by bundle init and hand-t...

Next
Designing Portable Applications With Cloud Foundry
Designing Portable Applications With Cloud Foundry

In the cloud computing world, preserving a choice of clouds is critical. The risks of being locked into a s...

Enter curious. Exit smarter.

Learn More