DEV Community

Aria Diniz
Aria Diniz

Posted on

Introducing MacawFramework 1.1.1: Now with Cron Job Support

Hi There! After our previous posts showcasing MacawFramework and demonstrating how to build an app with it, we're back to share the latest version, 1.1.1. This update introduces several enhancements that improve the framework's flexibility and usability, and we are excited to walk you through these changes.

For those unacquainted with MacawFramework, it's a lightweight web framework built with Ruby that's perfect for developing small to medium-sized web applications. With its diverse set of features, like support for various HTTP methods, caching, session management, and more, it aims to simplify and streamline web application development. Now, let's delve into what's new!

New Features

Cron Job Feature

One of the most significant additions to MacawFramework in this release is the Cron Job feature. Developers can now define tasks to run at set intervals directly in the application code, eliminating the need for external tools for task scheduling. This is particularly helpful for developers who need to perform repetitive tasks such as data cleanup, report generation, or regular updates. Here's a simple example of how to declare a cron job:

m.setup_job(interval: 5, start_delay: 5, job_name: "cron job 1") do
  puts "i'm a cron job that runs every 5 secs!"
end
Enter fullscreen mode Exit fullscreen mode

Each job runs in a separate thread, executing in parallel with the server thread pool without consuming the server's threads. However, please note that defining numerous jobs with low intervals could significantly impact your application's performance.

Enhancements

Common Server Methods Extraction

To enhance code reuse and eliminate duplication, we've separated common server methods, like handle_client, into a separate module. This separation improves code readability and maintainability, allowing developers to write cleaner and more efficient code.

Other Changes and Improvements

While the Cron Job feature and the extraction of common server methods are the highlights of this release, we've also made other improvements and updates:

  1. Documentation Enhancements: Our documentation is more comprehensive and detailed, providing thorough explanations of various aspects of MacawFramework. We've expanded existing examples, usage instructions, and explanations to help developers better understand and utilize the framework's features.

  2. Logo Removal: The Macaw Framework logo has been removed from the repository. This change doesn't impact the functionality or usage of the framework.

  3. Compatibility Assurance: We've ensured compatibility with different Ruby interpreters, including MRI, TruffleRuby, and JRuby, for improved flexibility in choosing a Ruby interpreter.

With these updates, we aim to further improve your experience with MacawFramework, enhancing your productivity as a Ruby developer. We encourage you to explore the updated documentation for more information on how to utilize the new features and improvements introduced in this release. As always, we're eager to hear your feedback, so don't hesitate to share your thoughts and suggestions!

Happy coding!

Top comments (0)