Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create custom rake tasks #152

Merged
merged 3 commits into from
Jul 14, 2020
Merged

Create custom rake tasks #152

merged 3 commits into from
Jul 14, 2020

Conversation

yukihirop
Copy link
Owner

Summary

Resolve #150

You can define rake tasks.

Work

Create a file called oas_docs/tasks/sample.rake`

# frozen_string_literal: true

namespace :custom do
  namespace :your do
    desc 'custom your task'
    task :task do
      # e.g.)
      # I, [2020-07-14T22:53:47.328715 #55113]  INFO -- : [CUSTOM YOUR TASK] start
      # something
      # I, [2020-07-14T22:53:47.328811 #55113]  INFO -- : [CUSTOM YOUR TASK] end
      start '[CUSTOM YOUR TASK]' do
        # something
        puts 'something'
      end
    end
  end
end

Read with Rakefile. If Rails.application.load_tasks is written, write it below it.

[Rakefile]

Rails.application.load_tasks
+ R2OAS.load_tasks

Check if the defined rake task is loaded.

$ bundle exec rake -T
rake custom:your:task                   # custom your task

Test

===== Rspec for All Support Ruby Result =====
ruby-2.3.3: 0
ruby-2.4.2: 0
ruby-2.5.8: 0
ruby-2.6.6: 0
ruby-2.7.1: 0
=============================================

Rubocop

$ be rubocop
Inspecting 179 files
...................................................................................................................................................................................

179 files inspected, no offenses detected

@yukihirop yukihirop added this to the v0.4.0 milestone Jul 14, 2020
@yukihirop yukihirop self-assigned this Jul 14, 2020
@yukihirop
Copy link
Owner Author

LGTM

@yukihirop yukihirop merged commit 59eb820 into master Jul 14, 2020
@yukihirop yukihirop deleted the create_custom_rake_tasks branch July 14, 2020 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create custom rake tasks
1 participant