Sha256: 83e76b33bf42d6391b5cd4ae51f6cfd9fc0cc22a31767f04ddb8a679dff068da

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 Bytes

Contents

require 'linecook/commands/helper'

module Linecook
  module Commands
    
    # ::desc generates all helpers
    #
    # Generates helpers that match the input patterns (by default all,
    # helpers).
    #
    class Helpers < Helper
      def process
        helpers_dir = File.expand_path('helpers', cookbook_dir)

        sources = {}
        Dir.glob("#{helpers_dir}/**/*").each do |source|
          next if File.directory?(source)
          (sources[File.dirname(source)] ||= []) << source
        end

        sources.each_pair do |dir, sources|
          name = dir[(helpers_dir.length+1)..-1]
          super(name, *sources)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
linecook-0.6.2 lib/linecook/commands/helpers.rb