Sha256: 9b06af5f29b7ccc592a0633d2d8cc1e10f335e99f71bb85a96667bd4eccd39ce
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'yaml' require 'ruboss4ruby/configuration' class RubossYamlScaffoldGenerator < Merb::GeneratorBase include Ruboss::Configuration def initialize(runtime_args, runtime_options = {}) runtime_args.push "" super end 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, 'schema/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 line = '--flex-only ' + line if ARGV.include?('flexonly') puts 'running: ruboss_scaffold ' + line Merb::ComponentGenerator.run "ruboss_scaffold", line.split(" "), "ruboss_scaffold", "generate" puts 'done ...' sleep 1 end config_args = ['--main-only'] config_args << '--skip-framework' if ARGV.include?('skipframework') Merb::ComponentGenerator.run "ruboss_config", config_args, "ruboss_config", "generate" end end protected def banner "Usage: #{$0} #{spec.name}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruboss4ruby-1.0.2 | merb_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb |
ruboss4ruby-1.0.1 | merb_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb |