Sha256: efb14e73e476f5b47df6b99bfa33ca9f9b93c4eac06fe9f5dbd6f83f75ea800b
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
require 'yaml' class RubossYamlScaffoldGenerator < RubiGen::Base include Ruboss4Ruby::Configuration def extract_attrs(line, attrs) attrs.each do |key,value| if value.class == Array line << " #{key}:#{value.join(',')}" else line << " #{key}:#{value}" end end line end def manifest record do |m| models = YAML.load(File.open(File.join(APP_ROOT, 'db/model.yml'), 'r')) models.each do |model| line = "" attrs = model[1] if attrs.class == Array attrs.each do |elm| line = extract_attrs(line, elm) end else line = extract_attrs(line, attrs) end line = model[0].camelcase + " " + line puts 'running: ruboss_scaffold ' + line RubiGen::Scripts::Generate.new.run(["ruboss_scaffold"] + line.split) puts 'done ...' end RubiGen::Scripts::Generate.new.run(["ruboss_main_app"]) end end protected def banner "Usage: #{$0} #{spec.name}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dima-ruboss4ruby-1.1.0 | generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb |