Sha256: c2de1b22f6a2f70463edfae017c96d0f4549e833d1b2468c1f8a58b954549752
Contents?: true
Size: 1.93 KB
Versions: 2
Compression:
Stored size: 1.93 KB
Contents
require 'fileutils' puts CUTIE_ARGV cutie_ui_config = CUTIE_ARGV.inject({}) do |conf, arg| config_key, config_vals = arg.split('=') if config_key # { :extras => ['mysql', 'sqlite3'] } config_value = config_vals.blank? ? true : config_vals.split(',') conf[config_key.gsub('--','').to_sym] = config_value conf else conf end end # dm-cutie-ui has a bunch of views, but views may also come from dm-cutie-extras and eventually add'l plugins # since we need a path to all the views, we create a temp folder and copy the views their # as well as any other views from additional gems/reqs # Configure DmCutieUI FileUtils.mkdir_p DmCutieUI.view_root FileUtils.cp_r( File.join(DmCutieUI.root, "server", "views"), DmCutieUI.view_root ) DmCutieUI.logger.info "View temp directory: #{DmCutieUI.view_root}" # If extras were requested, get them. if cutie_ui_config[:extras] begin require 'dm-cutie-extras' rescue LoadError => ex DmCutieUI.logger.error "dm-cutie-extras were requested, but the gem was not found: gem install dm-cutie-extras" exit(1) end cutie_ui_config[:extras].each do |extra| begin # Load the extra DataMapper::Cutie::Extras.load extra.to_sym # move the hook's view into the DmCutieUI.view_root/cutie_models directory #/tmp/dm-cutie-ui/view/1258150564/views/cutie_models/#{extra}.erb # render a extras views by doing # render :'cutie_models/#{extra}' FileUtils.cp DataMapper::Cutie::Extras.view_path[extra.to_sym], DmCutieUI.view_root / 'views' / 'cutie_models' rescue LoadError => ex DmCutieUI.logger.error "dm-cutie-extra '#{extra}' does not exist." exit(2) end end end # Thanks to dkubb: this make sure that the PropertySet always contains remote keys descendants = DataMapper::Model.descendants.to_a while model = descendants.shift descendants.concat(model.descendants.to_a - [ model ]) model.send(:assert_valid) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dm-cutie-ui-0.4.0 | lib/dm-cutie-ui/config.rb |
dm-cutie-ui-0.0.2 | lib/dm-cutie-ui/config.rb |