Sha256: 6228277d8bbc2376f7283ab9cbe0514f6f7613d2297279ecb6433ffdc3fc7663

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

module Ratch

   class Manager

     # Return master toolset directory. If toolset if given then
     # return that toolsets directory.

     def toolset_directory(toolset=nil)
       if toolset
         File.join(File.dirname(__FILE__), 'toolset', toolset)
       else
         File.join(File.dirname(__FILE__), 'toolset')
       end
     end

     # List toolsets.

     def toolsets
       files = []
       Dir.chdir(toolset_directory) do
         files = Dir.glob('*/').map{ |d| d.chomp('/') }
       end
       files
     end

     # List tools for a give toolset.

     def tools(toolset=nil)
       files = []
       direc = toolset ? File.join(toolset_directory, toolset) : toolset_directory
       Dir.chdir(direc) do
         files = Dir.glob('**/*') - Dir.glob('**/*/').map{ |d| d.chomp('/') }
       end
       files
     end

     # Verify a toolset exists?

     def toolset?(toolset)
       path = File.join(toolset_directory, toolset)
       File.exist?(path) ? path : false
     end

     # Verify a tool exists for a given toolset.

     def tool?(toolset, batchfile)
       path = File.join(toolset_directory, toolset, batchfile)
       File.exist?(path) ? path : false
     end

   end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ratch-0.4.1 lib/ratch/manager.rb