Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Contribute a One-Liner to Whenbot (guide included :) #23

Open
M7 opened this issue May 4, 2012 · 3 comments
Open

Contribute a One-Liner to Whenbot (guide included :) #23

M7 opened this issue May 4, 2012 · 3 comments

Comments

@M7
Copy link
Member

M7 commented May 4, 2012

One-Liners exercise

Want to make a contribution to Whenbot? Let's get you started! The main goal of the exercise is to show that it's not all that hard to contribute to an open source project.

We've taken away the hard part of figuring out exactly what to contribute, by providing you with a list of one-liners that need to be added to Whenbot. We've also provided you a step-by-step guide to walk you through the process.

All you need to do is choose a One-Liner from the list below (be sure to reserve your choice), and follow the Contribution Guide here.

Never contributed to Open Source before?

If it's your first time making an Open Source contribution, don't worry, it's not that hard. Be excited, follow the guide below, and very soon you should have made your first Open Source contribution!

How to participate

Follow these steps:

  1. Take a look at the list below and choose a One-Liner to work on.

  2. Make sure that the One-Liner you picked hasn't already been chosen by checking the comments below this post. If your One-Liner has already been reserved, choose another one.

  3. Then, reserve your One-Liner by posting a comment in this thread (below). Just write: "Working on one-liner number one-liner number in file path here, brief description of change". For example:

    Working on one-liner number 8 in app/models/task.rb, to make the :name, :active, :trigger_attributes, and :action_attributes attributes accessible.

    After posting your comment, you're ready to start working on your update. :)

  4. Once you have your one-liner chosen and reserved, follow the Whenbot One-Liner Contribution Guide to learn how to create your own fork of the app, clone the repository, make your changes, push your changes back to your fork, and issue a Pull Request.

The One-Liners

Choose a One-Liner number below, and follow the instructions above. Soon, you'll have contributed to a cool, new Open-Source project. :)

If you need help, you can find the solution for your one-liner in this branch. Just browse to the file you're working on.

lib/whenbot.rb

  1. Line 15: add a call to #mattr_accessor to create a Module Attribute for :channels
  2. Line 50: Fill in the block to take a Channel class (e.g. Whenbot::Channels::Developer), convert it to a string, and extract the Channel's name out of the string. In the previous example, you'd want to get the word" Developer"

    lib/whenbot/trigger.rb

  3. Line 14: In the current_time method, return the current time in the set time zone.

    app/controllers/whenbot_controller.rb

  4. Line 6: Call the Task.handle_callback method (found in app/models/task.rb) with the following parameters in the given order, and set the response variable to the return value of that call:
    • params[:channel], params[:trigger], params, request.headers, request.body.read
  5. Line 7 and Line 20: Rename the #validate_response method to "#parse_response``.

    app/models/task.rb

  6. Line 3: Create a has_many association with the Action model
  7. Line 7: Make the following accessible attributes:
    • :name, :active, :trigger_attributes, :action_attributes
  8. Line 17: Call the Trigger#save_updated_triggers method with returned_triggers, and trigger_ids as parameters.
  9. Line 18: Return response

    app/models/trigger.rb

  10. Line 2: Create a named scope (use scope) called active that returns records where the active field is set to true
  11. Line 4: Allow the parameters field to be serializable as a Hash
  12. Line 5: Allow the match_data field to be serializable as a Hash
  13. Line 6: Allow the extra_data field to be serializable as a Hash
  14. Line 7: Set up a "belongs to" association with the Task model
  15. Line 8: Make the following accessible attributes:
    • channel, trigger, parameters, active
  16. Line 9: Ensure that the model validates the presence of channel, trigger, and ``parameters
@dewolfe
Copy link
Contributor

dewolfe commented Jun 18, 2012

Working on one-liner number 3 in lib/whenbot/trigger.rb line 14 adding return value of local time to current_time method.

@SimbaZ
Copy link

SimbaZ commented Feb 19, 2013

I would like how to build whenbot..

@M7
Copy link
Member Author

M7 commented Feb 26, 2013

Hi SimbaZ,

Thanks a lot for your interest in Whenbot.

This project has been stalled for a while now actually. It's my fault, I've just been so busy and haven't had the time to get the ball rolling again. I've been trying to set aside some time for this, but I have no idea when I can work on it.

But I'd love to get Whenbot up and running. Any chance you'd be up for helping out with this or making some contributions?

For instance, is there anything you'd like to see added to this document (see links at the end too) in order to feel comfortable contributing to Whenbot? This will give me an idea of what needs to be written to get things moving.

The goal is for it to be a group project for Ottawa Ruby. So once a plan is in place, I think people will start contributing.

Sorry again that it's not ready to go. I hope we can get a usable version out there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants