Search code examples
rubyrakerakefile

Rake get directory name in file glob


If a Rake File exists with the following code:

file 'assets/*/map.a' => ['map.b', 'map.c'] do
    # Code goes here...
end

I want to know what the name of the directory in the glob is (instead of the file). Any suggestions?


Solution

  • file 'assets/*/map.a' => ['map.b', 'map.c'] do |path|
        File.basename(File.dirname(path))
    end