Sha256: a237f8ef304fcb2c5126074ae2698d96635886afbd13a0836e6854ce9ae3d4c6
Contents?: true
Size: 1.17 KB
Versions: 11
Compression:
Stored size: 1.17 KB
Contents
module DMGen class Adapter < Templater::Generator first_argument :name, :required => true desc <<-eos Generates a DataMapper Adapter skeleton. Use like dm-gen adapter data_source This generates the full plugin structure with skeleton code and specs, as well as a Rakefile. All it needs is a README and some real functionality. eos def self.source_root File.join(File.dirname(__FILE__), '..', 'templates', 'adapter') end def gem_name "dm-#{adapter_name}" end def adapter_name "#{snake_name}-adapter" end def adapter_file "#{snake_name}_adapter" end def snake_name name.snake_case end def class_name "#{name.camel_case}Adapter" end def destination_root File.join(@destination_root, gem_name) end # glob the template dir for all templates. # since we want text files processed, we have to replace the default # extension list. glob!('', %w[rb txt Rakefile LICENSE TODO]) def manifest_files self.all_actions.map {|t| t.destination.gsub(/#{destination_root}\//,'') }.sort end end add :adapter, Adapter end
Version data entries
11 entries across 11 versions & 2 rubygems