Created
May 10, 2012 22:34
-
-
Save aseemk/2656319 to your computer and use it in GitHub Desktop.
Helper script to migrate Streamline files to the new ._js/._coffee extensions.
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 _coffee | |
# | |
# Migrates our Streamline v0.1 files to the new Streamline v0.3 extensions, | |
# i.e. git-moves all foo_.coffee files to foo._coffee. | |
{exec} = require 'child_process' | |
Path = require 'path' | |
# regex to recognize old-style streamline files: | |
STREAMLINE_REGEX = /_\.(js|coffee)$/ | |
# step 1: get all checked-in files | |
files = exec 'git ls-files', _ | |
files = files.trim().split '\n' | |
# step 2: iterate over all of them... | |
for file in files | |
# ignore the ones that aren't streamlined: | |
match = file.match STREAMLINE_REGEX | |
continue if not match | |
# for the ones that are, git mv them to the new extension: | |
# ( https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace#Specifying_a_function_as_a_parameter ) | |
before = file | |
after = file.replace STREAMLINE_REGEX, (str, type) -> "._#{type}" | |
exec "git mv '#{before}' '#{after}'", _ |
Weird, I have no idea!
Cool, contacted GitHub support and they fixed it!
Cool! Now I don’t have to miss out on all your gems :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sweet. How come I can’t see any public gists for you? Is that on purpose?