Created
July 25, 2012 18:15
-
-
Save sw17ch/3177650 to your computer and use it in GitHub Desktop.
Get all files for a Gemspec using SVN.
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
# This function asks svn to list the status of all | |
# files in the repository. Then we filter out files | |
# that aren't versioned and aren't files. | |
# See also: svn help st | |
# $ svn help st | |
# status (stat, st): Print the status of working copy files and directories. | |
# ... | |
# With -v, print full revision information on every item. | |
def get_svn_files | |
`svn st -v`.lines.map do |line| | |
unless line.match(/^\?/) | |
line.match(/\S+$/)[0] | |
end | |
end.compact.reject {|p| File.directory? p} | |
end |
Personally, I use it like this
files = get_svn_files
test_files = files.find_all {|f| f.match(/^spec|feature/)}
gem.files = files
gem.test_files = test_files
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use this instead of
svn ls -R -r BASE
because thesvn list
command makes requests to the server. This can feel dreadfully slow at times.