make directory tasks handle both "a/" and "a" #93

wants to merge 6 commits into


None yet

3 participants

rctay commented Dec 9, 2011

That way, if you write

directory "a/b"

both Task["a/"] and Task["a"] will be handled as the same FileCreationTasks.

Some fixes and cleanups are included too.

NAKAMURA Usaku and others added some commits Nov 28, 2011
@rctay NAKAMURA Usaku * test/rake/test_rake_directory_task.rb
  (TestRakeDirectoryTask#test_directory_win32): shouldn't create any
  file/directory on root directory.  create on @tempdir (= Dir.pwd).
  see jimweirich#91

(backported from ruby trunk r33885)
@rctay rctay show that directory tasks 'a/' and 'a' are (incorrectly) handled sepa…

Add a new assertion to test_directory_win32, as well as a new test
(which fails).
@rctay rctay introduce task aliases (weak) f8a067a
@rctay rctay directory: alias 'a/' to 'a'
This fixes TestRakeDirectoryTask.test_lookup_should_ignore_trailing_slash.
@rctay rctay do away with redundant TestRakeDirectoryTask.test_directory_win32
Most of what is tested is already covered in the other 2 tests - ie.
lookup of slashed/non-slashed directory tasks, absence of comments on
"parent" tasks, and laziness of directory creation.

test_directory_win32 also looks at absolute paths (by prepending
Dir.pwd), but we don't have to worry about this case since it boils down
to the correctness about File.dirname; leave that to ruby core
developers. :)
@rctay rctay do away with redundant TestRakeFileCreationTask.test_directory
We already have TestRakeDirectoryTask to test the directory task.
rctay commented Dec 9, 2011

I'm wondering, what if there is a separate task with the same name only differentiated by the trailing slash (e.g. task :build and directory 'build/')? Would this change result in them conflicting where they hadn't before?


I'm not inclined to include this change. I'm wondering why you need to include the trailing slash. Is this a problem you run into often?


I'm closing this ... seems to be to be bad practice to leave trailing slashes on directory names (emacs conventions not withstanding).

@jimweirich jimweirich closed this Oct 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment