Sha256: 5cf9bade5d212c0c8e037ed571fe28e5b14a6f1247c9ab9f6f382b4689fa352a

Contents?: true

Size: 742 Bytes

Versions: 7

Compression:

Stored size: 742 Bytes

Contents

require 'fileutils'
require_relative '../../generators/base_generator'

module Howitzer
  module GeneratorHelper
    def file_tree_info(root)
      Dir["#{root}/**/.*", "#{root}/**/*"].sort_by { |name| name.sub(root, '') }.map do |name|
        hash = { name: name.sub(root, ''), is_directory: File.directory?(name) }
        hash[:size] = File.stat(name).size unless hash[:is_directory]
        hash
      end
    end

    def template_file_size(root_directory, file)
      File.size(File.join(generators_path, root_directory, 'templates', file))
    end
  end
end
Howitzer::BaseGenerator.logger = StringIO.new
Howitzer::BaseGenerator.destination = Dir.mktmpdir
Dir[File.join(generators_path, '**', '*_generator.rb')].each { |f| require f }

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
howitzer-2.2.0 spec/support/generator_helper.rb
howitzer-2.1.1 spec/support/generator_helper.rb
howitzer-2.1.0 spec/support/generator_helper.rb
howitzer-2.0.3 spec/support/generator_helper.rb
howitzer-2.0.2 spec/support/generator_helper.rb
howitzer-2.0.1 spec/support/generator_helper.rb
howitzer-2.0.0 spec/support/generator_helper.rb