["\n\n \n \n\n\n File: README\n \n — Documentation for ThanhKhoaIT/rails_execution (master)\n \n\n\n \n\n \n\n \n\n\n\n\n \n\n \n\n \n\n \n\n\n \n \n
\n \n
\n
\n\n
\n
\n
\n \n
\n\n\n
\n \n Libraries »\n ThanhKhoaIT/rails_execution (master)\n \n \n » \n Index » \n File: README\n \n
\n\n \n
\n
\n\n

Rails Execution

\n\n

Rails Execution is an Engine to manage the Rails scripts for migration, cleanup, and fixing the bad data without deployment.

\n\n
    \n
  • Supported the Syntax checker
  • \n
  • Supported the Execution logs
  • \n
  • Supported the Reviewing process
  • \n
  • Supported the Attachment files
  • \n
  • Supported the Comments communication
  • \n
  • Supported the Activities tracking
  • \n
\n\n

\"image\"\n\"image\"

\n\n

Installation

\n\n

Add the following line to your Gemfile:

\n\n
gem 'rails_execution'\n
\n\n

Then run bundle install

\n\n

Getting started

\n\n

How to setup

\n\n

You need to run the generator:

\n\n
    $ rails g rails_execution:install\n
\n\n

And you can change the config in config/initializers/rails_execution.rb

\n\n

Default is Solo Mode, without the Reviewing process.

\n\n

Enable the Reviewing process

\n\n

The first step is to disable the Solo Mode

\n\n
    config.solo_mode = false\n
\n\n

And then uncomment the configures of the owner and reviewers

\n\n
    config.owner_model = 'User'\n    config.owner_method = :current_user\n    config.owner_name_method = :name\n    config.owner_avatar = ->(owner) { owner.avatar.url }\n\n    config.reviewers = -> do\n      User.where(is_admin: true).map do |user|\n        {\n          name: user.name,\n          id: user.id,\n          type: 'User',\n          avatar_url: user.avatar.url,\n        }\n      end\n    end\n
\n\n

Enable the Attachment files

\n\n

Run the generator to add the FileUploader and FileReader

\n\n
    $ rails g rails_execution:file_upload\n
\n\n

And then uncomment the file upload

\n\n
  config.file_upload = true\n  config.file_uploader = ::RailsExecution::FileUploader\n  config.file_reader = ::RailsExecution::FileReader\n
\n\n

To limit the File types. Default: .png, .gif, .jpg, .jpeg, .pdf, .csv\nYou can modify the limitation like this

\n\n
  config.acceptable_file_types = {\n    '.jpeg': 'image/jpeg',\n    '.pdf': 'application/pdf',\n    '.csv': ['text/csv', 'text/plain'],\n  }\n
\n\n

Control the Permissions

\n\n

For example with Pundit authorization.

\n\n
  config.task_creatable = lambda do |user|\n    YourPolicy.new(user).creatable?\n  end\n  config.task_editable = lambda do |task, user|\n    YourPolicy.new(user, task).editable?\n  end\n  config.task_closable = lambda do |task, user|\n    YourPolicy.new(user, task).closable?\n  end\n  config.task_approvable = lambda do |task, user|\n    YourPolicy.new(user, task).approvable?\n  end\n  config.task_executable = lambda do |task, user|\n    YourPolicy.new(user, task).executable?\n  end\n
\n\n

Setup the Logger

\n\n

To storage the logfile

\n\n
  config.logging = lambda do |file, task|\n    LoggerModel.create!(task: task, file: file)\n  end\n
\n\n

And list the logfiles on Task page

\n\n
  config.logging_files = lambda do |task|\n    LoggerModel.where(task: task).map do |log|\n      log.file.expiring_url(30.minutes.to_i)\n    end\n  end\n
\n\n

Others

\n\n

To change the Per page of the tasks list.\nDefault value: 20

\n\n
  config.per_page = 10\n
\n
\n\n
\n Generated on Wed Jun 7 18:11:54 2023 by\n yard\n 0.9.32 (ruby-3.2.2).\n
\n\n\n\n\n\n\n \n\n\n
\n \n"]