Sha256: 382d98b1c0bc018d8de6eb72115db8daf153a0edc17d61a0ebd196610486658b
Contents?: true
Size: 1.27 KB
Versions: 15
Compression:
Stored size: 1.27 KB
Contents
require 'yaml' class RxYamlScaffoldGenerator < RubiGen::Base include RestfulX::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: rx_scaffold ' + line RubiGen::Scripts::Generate.new.run(line.split, :generator => 'rx_scaffold', :gae => options[:gae]) puts 'done ...' end RubiGen::Scripts::Generate.new.run([], :generator => 'rx_main_app', :gae => options[:gae]) end end protected def add_options!(opt) opt.separator '' opt.separator 'Options:' opt.on("--gae", "Generate Google App Engine Python classes in addition to RestfulX Flex resources.", "Default: false") { |v| options[:gae] = v } end end
Version data entries
15 entries across 15 versions & 4 rubygems