smashing
smashing copied to clipboard
Build a Job class
Currently, jobs are a ruby file that invoke Rufus scheduler directly and then call send_event. It would be much better for many reasons if there was a superclass which users could subclass. The subclass would be responsible for providing the implementation for a 'run' method which would return a value to the caller.
Benefits:
- Abstracts the use of Rufus, making it easier to update or replace it in the future
- Enhanced testability of Job logic -- simply mock job dependencies and assert the output
- Less confusion for beginners about what is happening when (dashboard start time vs. job runtime)
Good idea. I like specially abstraction. I have a pattern that I use with YAML files and some boilerplate code for encryption (simple base64 by default, but with support to Amazon KMS too). When vacation is over (February hooray! :tada: ) I will file an issue for that. But having a Job class could be useful for that too, so my +1
Maybe try to add loading and passing through settings in a unified way too. This way we might prevent a lot of copy pastes and hardcoded configuration in the jobs, making them less re-useable
@vStone the way I'm configuring my jobs now is with a dashboard.yml file or similar in the top level. e.g. (writing without testing the syntax):
- bitbucket:
- repositories:
- a
- b
- credentials:
- username: abc
- password: abc
- testlink:
- credentials:
- username: abc
I will have access to the working dashboard in one week and will update the ticket with the complete set up. But basically, each job imports an utility class (that could be part of smashing core if others find it useful) and this class has the methods to parse the YAML.
can you use the dashing jobs generator with smashing?
@JoshuaEdwards1991 what do you mean by using the dashing jobs generator with smashing?
At this point, Dashing and Smashing are quite similar so you should be able to generate jobs using Smashing, just as you would in Dashing.