Created
November 3, 2011 04:00
-
-
Save joshed-io/1335745 to your computer and use it in GitHub Desktop.
Ruby script to automate running js2coffee against existing javascript folders
This file contains 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
#!/usr/bin/env ruby | |
#run from within a folder containing your .js files | |
#each file will be converted to a .coffee file and copied to ../coffeescripts | |
#respects nested directory structure, creating what's necessary | |
Dir.glob("**/*.js").each do |file| | |
`mkdir -p ../coffeescripts/#{file_path = file.gsub(/[\/]?[^\/]*\.js/, "")}` unless file_path == "" | |
`js2coffee #{file} > ../coffeescripts/#{file.gsub(/\.js/, "")}.coffee` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment