README.md in rails_execution-0.1.1 vs README.md in rails_execution-0.1.2

- old
+ new

@@ -1,35 +1,121 @@ -# RailsExecution +# Rails Execution +Rails Execution is an Engine to manage the Rails scripts for migration, cleanup, and fixing the bad data without deployment. +- Supported the Syntax checker +- Supported the Execution logs +- Supported the Reviewing process +- Supported the Attachment files +- Supported the Comments communication +- Supported the Activities tracking -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_execution`. To experiment with that code, run `bin/console` for an interactive prompt. -TODO: Delete this and the text above, and describe your gem +![image](https://user-images.githubusercontent.com/6081795/193129359-fc1e8858-c3e7-4376-be1e-ca453890a98d.png) +![image](https://user-images.githubusercontent.com/6081795/193129792-39176d6e-97fa-4a47-8541-30e7169841cd.png) ## Installation -Install the gem and add to the application's Gemfile by executing: +Add the following line to your **Gemfile**: - $ bundle add rails_execution +```ruby +gem 'rails_execution' +``` +Then run `bundle install` -If bundler is not being used to manage dependencies, install the gem by executing: - $ gem install rails_execution +## Getting started -## Usage - ### How to setup +You need to run the generator: +```bash $ rails g rails_execution:install - $ rails g rails_execution:file_upload +``` +And you can change the config in `config/initializers/rails_execution.rb` -## Development +Default is `Solo Mode`, without the Reviewing process. -After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +#### Enable the Reviewing process +The first step is to disable the `Solo Mode` +```ruby + config.solo_mode = false +``` +And then uncomment the configures of the `owner` and `reviewers` +```ruby + config.owner_model = 'User' + config.owner_method = :current_user + config.owner_name_method = :name + config.owner_avatar = ->(owner) { owner.avatar.url } + + config.reviewers = -> do + User.where(is_admin: true).map do |user| + { + name: user.name, + id: user.id, + type: 'User', + avatar_url: user.avatar.url, + } + end + end +``` -To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). +#### Enable the Attachment files +Run the generator to add the **FileUploader** and **FileReader** +```bash + $ rails g rails_execution:file_upload +``` +And then uncomment the file upload +```ruby + config.file_upload = true + config.file_uploader = ::RailsExecution::FileUploader + config.file_reader = ::RailsExecution::FileReader +``` +To limit the File types. Default: `.png`, `.gif`, `.jpg`, `.jpeg`, `.pdf`, `.csv` +You can modify the limitation like this +```ruby + config.acceptable_file_types = { + '.jpeg': 'image/jpeg', + '.pdf': 'application/pdf', + '.csv': ['text/csv', 'text/plain'], + } +``` -## Contributing +#### Control the Permissions +For example with *[Pundit](https://github.com/varvet/pundit)* authorization. +```ruby + config.task_creatable = lambda do |user| + YourPolicy.new(user).creatable? + end + config.task_editable = lambda do |task, user| + YourPolicy.new(user, task).editable? + end + config.task_closable = lambda do |task, user| + YourPolicy.new(user, task).closable? + end + config.task_approvable = lambda do |task, user| + YourPolicy.new(user, task).approvable? + end + config.task_executable = lambda do |task, user| + YourPolicy.new(user, task).executable? + end +``` -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails_execution. +#### Setup the Logger +To storage the logfile +```ruby + config.logging = lambda do |file, task| + LoggerModel.create!(task: task, file: file) + end +``` +And list the logfiles on Task page +```ruby + config.logging_files = lambda do |task| + LoggerModel.where(task: task).map do |log| + log.file.expiring_url(30.minutes.to_i) + end + end +``` -## License - -The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). +#### Others +To change the Per page of the tasks list. +Default value: `20` +```ruby + config.per_page = 10 +```