-
Notifications
You must be signed in to change notification settings - Fork 72
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
Task generator for generating new maintenance tasks #115
Conversation
0b1fdc9
to
1e8773f
Compare
1e8773f
to
50b8d8d
Compare
e7b6b38
to
570108e
Compare
570108e
to
40a7da3
Compare
require 'test_helper' | ||
module Maintenance | ||
<% module_namespacing do -%> | ||
class <%= class_name %>TaskTest < ActiveSupport::TestCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could check which testing framework they're using and generate the correct template (ie. test vs spec), but I think this is sufficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a concept of hooks where our generator could call a different other generator, I think it could work where this could call a different testing framework, or even none if the rails app was generated without tests.
https://api.rubyonrails.org/classes/Rails/Generators/Base.html#method-c-hook_for
But I also think this is enough for this PR, we could look into later maybe.
require 'test_helper' | ||
module Maintenance | ||
<% module_namespacing do -%> | ||
class <%= class_name %>TaskTest < ActiveSupport::TestCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a concept of hooks where our generator could call a different other generator, I think it could work where this could call a different testing framework, or even none if the rails app was generated without tests.
https://api.rubyonrails.org/classes/Rails/Generators/Base.html#method-c-hook_for
But I also think this is enough for this PR, we could look into later maybe.
767c99c
to
5a5af74
Compare
5a5af74
to
d87d4c1
Compare
Closes: #105
Creates a
MaintenanceTaskGenerator
that can be invoked usingrails generate maintenance_tasks foo
, which will createfoo_task.rb
inapp/tasks/maintenance
, as well astest/tasks/maintenance/foo_task_test.rb
.Generated tasks have a template that follows the API we've outlined in the README.