Signature Generator
The goal of this Ruby Gem is to provide a simple script to manage company email staff signatures consistently by providing a simple ERB-based templating mechanism to generate actual employee signature.
This gem provides the sg
executable to generate signature file from template.
Any undefined variable used in the ERB template has to be provided at run-time either by:
- Providing values on command line
- Providing values in config file
- Interactively
Installation
Add this line to your application's Gemfile:
gem 'signature_generator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install signature_generator
Usage
By default, the template is taken from STDIN and the result is produced on STDOUT. Of course both template and
result files can be specified on command line (see sg --help
to see all options).
### Template
The template is actually an ERB template.
Resulting file
By default the result is minified using the kangax minifier. You can disable
this behaviour by specifying --no-minify
on the command line.
Substituting variables
You can specify variables on the command line using the following syntax: --var varname1=value1 --var varname2=value2 ...
Here is a real-life usage example:
$ sg -f ./my_template.html.erb -o my_signature_file.html --force --var varname1=value1 --var varname2=value2
As this gem is using [easy_app_helper], it means that anything you can provide on the command line can be actually provided by a config file. Read [easy_app_helper] documentation for further info.
Any variable value not provided by the command line or a config file will actually be requested interactively at run time.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests.
You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
To release a new version, update the version number in version.rb
, and then run bundle exec rake release
,
which will create a git tag for the version, push git commits and tags, and push the .gem
file
to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/lbriais/signature_generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.
[easy_app_helper]: https://github.com/lbriais/easy_app_helper "easy_app_helper Gem'