Sha256: c9988f2ba1288b6f2606ecadace802c8867ed4cc7d71f18c35e508f84ec247de
Contents?: true
Size: 1.79 KB
Versions: 10
Compression:
Stored size: 1.79 KB
Contents
module Padrino module Generators module Actions ## # Tell us if for our orm we need migrations # def skip_migrations skip_migration = case orm when :activerecord then false when :sequel then false else true end end ## # Tell us which orm we are using # def orm fetch_component_choice(:orm).to_sym rescue :datamapper end ## # Tell us for now wich orm we support # def supported_orm [:datamapper, :activerecord] end ## # Add access_control permission in our app.rb # def add_access_control_permission(admin, controller) permission = indent(6, access_control(controller)) inject_into_file destination_root("#{admin}/app.rb"), permission, :after => "access_control.roles_for :admin do |role, account|\n" end ## # Add a simple permission (allow/deny) to our app.rb # def add_permission(admin, permission) inject_into_file destination_root("#{admin}/app.rb"), indent(6, "\n#{permission}\n"), :after => "access_control.roles_for :admin do |role, account|\n" end ## # Indent a content/string for the given spaces # def indent(count, content) indent = ' ' * count content.map { |line| line != "\n" ? indent+line : "\n" }.join end private ## # For access control permissions # def access_control(controller) (<<-RUBY).gsub(/ {12}/,'') role.project_module :#{controller} do |project| project.menu :list, "/admin/#{controller}.js" project.menu :new, "/admin/#{controller}/new" end RUBY end end end end
Version data entries
10 entries across 10 versions & 1 rubygems