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

Task generator for generating new maintenance tasks #115

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

adrianna-chang-shopify
Copy link
Contributor

@adrianna-chang-shopify adrianna-chang-shopify commented Oct 30, 2020

Closes: #105

Creates a MaintenanceTaskGenerator that can be invoked using rails generate maintenance_tasks foo, which will create foo_task.rb in app/tasks/maintenance, as well as test/tasks/maintenance/foo_task_test.rb.

Generated tasks have a template that follows the API we've outlined in the README.

@adrianna-chang-shopify adrianna-chang-shopify force-pushed the generator-for-new-tasks branch 4 times, most recently from 0b1fdc9 to 1e8773f Compare October 30, 2020 16:33
README.md Outdated Show resolved Hide resolved
lib/generators/maintenance_tasks/templates/task.rb.tt Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
require 'test_helper'
module Maintenance
<% module_namespacing do -%>
class <%= class_name %>TaskTest < ActiveSupport::TestCase
Copy link
Contributor Author

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.

Copy link
Member

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
Copy link
Member

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.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
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.

Generator for new tasks
3 participants