Sha256: 407e76380de8fba39ecd6a5dd7f76a10b6b1c17edf620abb91850d1e2cf414d5

Contents?: true

Size: 588 Bytes

Versions: 28

Compression:

Stored size: 588 Bytes

Contents

require 'find'
require "rails_generator"

class Hobo::Generator < Rails::Generator::Base

  def with_source_in(path)
    root = source_path(path)
    Find.find(root) do |f|
      Find.prune if File.basename(f) == ".svn"
      full_path = f[(source_root.length)..-1]
      rel_path = f[(root.length)..-1]
      yield full_path, rel_path
    end
  end

  def create_all(m, src, dest)
    with_source_in(src) do |full, rel|
      if File.directory?(source_path(full))
        m.directory File.join(dest, rel)
      else
        m.file full, File.join(dest, rel)
      end
    end
  end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
hobo-0.8.2 lib/hobo/generator.rb
hobo-0.8.4 lib/hobo/generator.rb
hobo-0.8.3 lib/hobo/generator.rb
hobo-0.8.1 lib/hobo/generator.rb
hobo-0.8.5 lib/hobo/generator.rb
hobo-0.8.7 lib/hobo/generator.rb
hobo-0.8.6 lib/hobo/generator.rb
hobo-0.8 lib/hobo/generator.rb