Skip to content

Instantly share code, notes, and snippets.

@bertBruynooghe
Last active December 11, 2015 03:19
Show Gist options
  • Save bertBruynooghe/4537235 to your computer and use it in GitHub Desktop.
Save bertBruynooghe/4537235 to your computer and use it in GitHub Desktop.
# RAILS_VERSION 3.2.11
require 'yaml'
require 'json'
config = ::YAML::load <<EOS
---
tasks:
instances:
tasks:
domain: anthos
project: invoicing
controller:
valid:
proceed:
valid: true
invalid:
proceed:
invalid: true
save:
update: params
dispute:
proceed:
reject: true
dispute: params
approve:
proceed:
approved: true
types:
data_validation:
actions:
valid:
call: valid
caption: Valid
style: success
approve_level1:
actions:
approve:
call: approve
caption: Approve
style: success
EOS
prepend_to_file 'Gemfile', "source Bundler.settings['upnxt_gem_server'] if Bundler.settings['upnxt_gem_server']\n"
gem 'upnxt_frontend_rich_modules', path: '../upnxt/frontend/rich/modules'
run 'bundle install'
generate 'upnxt_frontend_rich_modules:install'
generate 'upnxt_frontend_rich_modules:tasks_install'
tasks = config['tasks']
tasks['instances'].each do |key, i|
run "rails generate upnxt_frontend_rich_modules:tasks_instance #{key} #{i['domain']} #{i['project']} '#{i['controller'].to_json}'"
end
tasks['types'].each {|type, data| run "rails generate upnxt_frontend_rich_modules:task_type #{type} --config '#{data.to_json}'"}
generate 'upnxt_frontend_rich_modules:create_user', '[email protected]', 'can_proceed_data_validation'
generate 'upnxt_frontend_rich_modules:create_user', '[email protected]', 'can_proceed_approve_level1'
# generate 'upnxt_frontend_rich_modules:create_user', '[email protected]', 'can_proceed_approve_level2'
# generate 'upnxt_frontend_rich_modules:create_user', '[email protected]', 'can_proceed_schedule_payment'
generate 'upnxt_frontend_rich_modules:documents_install'
generate 'upnxt_frontend_rich_modules:documents_instance', 'archive', 'anthos', 'admin', 'factuur'
generate 'upnxt_frontend_rich_modules:document_properties', 'archive', 'leverancier_naam', 'leverancier_contactpersoon', 'leverancier_btwnummer', 'leverancier_adres_straat', 'leverancier_adres_gemeente', 'leverancier_adres_postcode', 'leverancier_adres_landcode', 'leverancier_email', 'leverancier_telefoonnummer', 'leverancier_rekeningnummer', 'klant_naam', 'klant_contactpersoon', 'klant_btwnummer', 'klant_adres_straat', 'klant_adres_gemeente', 'klant_adres_postcode', 'klant_adres_landcode', 'klant_email', 'klant_telefoonnummer', 'klant_klantnummer', 'document_type', 'document_nummer', 'document_totaal', 'document_netto', 'document_btw', 'document_po', 'document_vervaldatum', 'document_betaaltermijn', 'document_referentie', 'document_naam', 'document_scandatum', 'document_factuurdatum', 'document_valuta'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment