Giter Club home page Giter Club logo

gifts's Introduction

Rust

Gifts

Gifts is a tool to organize "Secret Santa" gifts exchange events.

According to a configuration file, it randomly generates "giver/receiver" pairs, and send e-mails to the giver with the name of the person to whom they offer something.

People are organized in groups (e.g. families, couples, ...). Gifts are not exchanged within a group. If everybody can be the Secret Santa of anybody, even within a family or couple, groups of 1 person can be used.

Hints can be given to Secret Santas: if Alice and Bob are in the same group, Alice and Bob will not give a gift to one another. If Janet is drawn to be the Secret Santa of Alice, and John to be Bob's one, Janet will receive a hint that John is the Secret Santa of Bob and John will be informed that Janet is Alice's one. So they can possibly synchronize and offer a shared gift for both.

Build

cargo build

Test

cargo test

Configuration

The configuration is a yaml file. A scaffold can be generated with:

cargo run -- --scaffold config.yml

Which results in something like:

groups:
  - people:
      - email: [email protected]
        name: Alice
      - email: [email protected]
        name: Bob
  - people:
      - email: [email protected]
        name: Jules
      - email: [email protected]
        name: Janet
  - people:
      - email: [email protected]
        name: John
  - people:
      - email: [email protected]
        name: Foo
      - email: [email protected]
        name: Bar
config:
  smtp:
    address: stmp.gmail.com
    port: 587
    user: [email protected]
    password: password
  email:
    from: [email protected]
    subject: Gift for our Lackadaisical party
    body:  |-
      Hey {giver},
      
      The magical thingy decided that you'll offer a gift to... {receiver}.
      
      {{- if has_secrets }}
      I can tell you something...
      {{ for secret in secrets }}
      { secret.0.name } is the secret santa of { secret.1.name }... 🤫
      {{- endfor }}
      {{- endif }}

The SMTP configuration is used to send the emails.

In the email configuration, the body has optional 2 placeholders (at least the receiver is mandatory if you want the giver to know who receives their gift): {giver} and {receiver}.

Hints can be used in a section as following:

      {{- if has_secrets }}
      I can tell you something...
      {{ for secret in secrets }}
      { secret.0.name } is the secret santa of { secret.1.name }... 🤫
      {{- endfor }}
      {{- endif }}

If you don't want hints, leave it out of the email body.

Run

Before sending actual emails, you can test with:

cargo run -- --config config.yml --debug

When you are ready, run the final command, the emails will be sent.

cargo run -- --config config.yml

License

Gifts is distributed under the terms of both the MIT license and the Apache License (Version 2.0)

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

gifts's People

Contributors

cbaconnier avatar guewen avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

cbaconnier

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.