<commit_before>Certificates generation and mailer [![Build Status](https://snap-ci.com/agile-alliance-brazil/certificates/branch/master/build_image)](https://snap-ci.com/agile-alliance-brazil/certificates/branch/master) [![Dependency Status](https://gemnasium.com/agile-alliance-brazil/certificates.svg)](https://gemnasium.com/agile-alliance-brazil/certificates) [![Code Climate](https://codeclimate.com/github/agile-alliance-brazil/certificates/badges/gpa.svg)](https://codeclimate.com/github/agile-alliance-brazil/certificates) [![Test Coverage](https://codeclimate.com/github/agile-alliance-brazil/certificates/badges/coverage.svg)](https://codeclimate.com/github/agile-alliance-brazil/certificates)
==================================

This is a small helper script to generate and send attendees a certificate PDF based on an SVG, a CSV and an email template.

Prerequisite
============

In order to run this script you need [ruby 2.1.5+](http://www.ruby-lang.org/) installed and [bundler](http://bundler.io/).

How to Use
==========

Ensure you created a .env file at the root of the repo copying .env.example. Add your data in there.

Create a copy of each .example file without the .example extension and fill in your data.

Then run (in the project's root folder):

```
bundle install
```

Copy the example folder into your own (let's say "data"), change the contents and run:

```
bundle exec ruby ./lib/generate_certificates.rb data --dry-run
```

This should generate the certificates for you and just print what action would be taken (not actually sending the emails). It'll cache the generated certificate PDFs in a folder called certificates in your current directory. Check the '--cache' option for details on that.

You can also provide a --prefix option with a prefix text for every PDF's file name if that helps you.

Once you're happy with the results, just run the same thing without the '--dry-run' option.

Development
===========

You can start guard with ``dev.sh`` or just run all tests with ``bundle exec rake``.
<commit_msg>Further updates to the readme.<commit_after>Certificates generation and mailer [![Build Status](https://snap-ci.com/agile-alliance-brazil/certificates/branch/master/build_image)](https://snap-ci.com/agile-alliance-brazil/certificates/branch/master) [![Dependency Status](https://gemnasium.com/agile-alliance-brazil/certificates.svg)](https://gemnasium.com/agile-alliance-brazil/certificates) [![Code Climate](https://codeclimate.com/github/agile-alliance-brazil/certificates/badges/gpa.svg)](https://codeclimate.com/github/agile-alliance-brazil/certificates) [![Test Coverage](https://codeclimate.com/github/agile-alliance-brazil/certificates/badges/coverage.svg)](https://codeclimate.com/github/agile-alliance-brazil/certificates)
==================================

This is a small helper script to generate and send attendees a certificate PDF based on an SVG, a CSV and an email template.

Prerequisite
============

In order to run this script you need [ruby 2.1.5+](http://www.ruby-lang.org/) installed and [bundler](http://bundler.io/).

How to Use
==========

Ensure you created a .env file at the root of the repo copying .env.example. Add your data in there. Copy the example folder into your own (let's say "data"), change the contents to match your attendees, your certificate's svg and an email template.

Then run (in the project's root folder):

```
bundle install
```

And:

```
bundle exec ruby ./lib/generate_certificates.rb data --dry-run
```

This should generate the certificates for you and just print what action would be taken (not actually sending the emails). It'll cache the generated certificate PDFs in a folder called certificates in your current directory. Check the '--cache' option for details on that.

You can also provide a --prefix option with a prefix text for every PDF's file name if that helps you.

Once you're happy with the results, just run the same thing without the '--dry-run' option.

Development
===========

You can start guard with ``dev.sh`` or just run all tests with ``bundle exec rake``.

{'fraction_non_alphanumeric': 0.13894993894993896, 'fraction_numerical': 0.0014652014652014652, 'mean_word_length': 4.843081312410842, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5463234', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1160, 'n_words': 422}