Class: XsdMappers::Mappers

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/thor/xsd_mappers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



35
36
37
# File 'lib/thor/xsd_mappers.rb', line 35

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#create_lib_fileObject



43
44
45
46
# File 'lib/thor/xsd_mappers.rb', line 43

def create_lib_file
  filename = "#{name.underscore}_mapper.rb"
  template('templates/mapper_class.erb', File.join('app/mappers/', module_path, filename))
end

#create_test_fileObject



48
49
50
51
52
53
54
# File 'lib/thor/xsd_mappers.rb', line 48

def create_test_file
  test     = options[:test_framework] == "test" ? :test : :spec
  filename = "#{name.underscore}_mapper_#{test}.rb"
  with_padding do
    template 'templates/mapper_spec.erb', File.join("#{test}/mappers/", module_path, filename)
  end
end

#module_pathObject



39
40
41
# File 'lib/thor/xsd_mappers.rb', line 39

def module_path
  options[:module_name] ? options[:module_name].underscore : ""
end