Skip to content

Commit

Permalink
Keep file tasks with ':' at top level
Browse files Browse the repository at this point in the history
With #232 you can now create tasks with namespaces from the task name
alone.  This did not take into account that file tasks can contain a ':'
which meant file tasks would not exist at top-level.  This was likely
missed due to a test that only ran on windows.

Now the namespace check is only performed for non-file tasks.

Fixes #262
  • Loading branch information
drbrain committed Mar 25, 2014
1 parent 3a5b4c2 commit 5ea79c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions History.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Bug fixes:

* Use sysctl for CPU count for all BSDs. Pull request #261 by Joshua Stein.
* File tasks including a ':' are now top-level tasks again. Issue #262 by
Josh Holtrop.

=== 10.2.0 / 2014-03-24

Expand Down
3 changes: 2 additions & 1 deletion lib/rake/task_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def define_task(task_class, *args, &block) # :nodoc:
task_name, arg_names, deps = resolve_args(args)

original_scope = @scope
if(task_name.is_a? String)
if String === task_name and
not task_class.ancestors.include? Rake::FileTask then
task_name, *definition_scope = *(task_name.split(":").reverse)
@scope = Scope.make(*(definition_scope + @scope.to_a))
end
Expand Down
6 changes: 6 additions & 0 deletions test/test_rake_directory_task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ def test_directory
refute File.exist?("a/b/c")
end

def test_directory_colon
directory "a:b"

assert_equal FileCreationTask, Task['a:b'].class
end unless Rake::Win32.windows?

if Rake::Win32.windows?
def test_directory_win32
desc "WIN32 DESC"
Expand Down

0 comments on commit 5ea79c0

Please sign in to comment.