Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
r8 committed Mar 23, 2015
0 parents commit ccbe6f7
Show file tree
Hide file tree
Showing 18 changed files with 412 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.vagrant
Berksfile.lock
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~

# Bundler
Gemfile.lock
bin/*
.bundle/*

.kitchen/
.kitchen.local.yml
16 changes: 16 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
driver:
name: vagrant

provisioner:
name: chef_zero

platforms:
- name: ubuntu-12.04
- name: centos-6.5

suites:
- name: default
run_list:
- recipe[mailhog::default]
attributes:
3 changes: 3 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "https://supermarket.chef.io"

metadata
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0.1.0 (2015-03-23)
------------------

* Initial release
31 changes: 31 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# How to contribute

I appreciate any kind of contributions. Please feel free to submit issue reports, feature suggestions and especially pull requests. But please take a moment to review following guidelines.

## Got a Question?

Please don't use Github Issues for asking questions. This project uses Github Issues for bug tracking and feature management only, not as some kind of support forum.
If you have personal support request or any questions about how to use this project, please feel free to send an email to project maintainer. You may find the email address in maintainer's Github profile.

## Reporting bugs

Please make sure that issue is reproducible on the latest code in `develop` branch in the repository.

Be sure to include enough of information so that your issue can be recreated.

Make sure that no other similar issues already exist.

## Submitting pull requests

### Branches

This repository is using [git flow](http://nvie.com/posts/a-successful-git-branching-model/) branching model. If you're not familiar with it, please take a moment to read the text by the link.

Generally it means that all new branches should be forked from `develop` branch, not from `master`.

### Pull request workflow

1. Fork the repo.
2. Checkout your new branch from `develop` branch.
3. Push your changes to your branch in your fork of repository.
4. Submit a pull request to the upstream repository.
5 changes: 5 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem "berkshelf"
gem "stove", "~> 3.0.0"

19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2015 Sergey Storchay

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# chef-mailhog

[![CK Version](http://img.shields.io/cookbook/v/mailhog.svg)](https://supermarket.getchef.com/cookbooks/mailhog)

This cookbook installs [MailHog](https://github.com/mailhog/MailHog).

Usage
-----

Include the mailhog recipe to install MailHog on your system:
```chef
include_recipe "mailhog"
```

MailHog service is installed and managed via `runit`.

Requirements
------------

### Cookbooks:

* runit

### Platforms:

* Ubuntu
* Debian
* RHEL
* CentOS
* Fedora

License
-------

Copyright (c) 2015 Sergey Storchay, http://r8.com.ua

Licensed under MIT:
http://raw.github.com/r8/chef-mailhog/master/LICENSE
36 changes: 36 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#
# Cookbook Name:: mailhog
# Recipe:: default
#
# Copyright (c) 2015 Sergey Storchay, All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

default['mailhog']['version'] = '0.1.6'
default['mailhog']['install_method'] = 'binary'

default['mailhog']['binary']['url'] = nil # Set it to override automatical generation

default['mailhog']['binary']['mode'] = 0755
default['mailhog']['binary']['path'] = '/usr/local/bin/MailHog'

default['mailhog']['binary']['prefix_url'] = 'http://github.com/mailhog/MailHog/releases/download/v'
default['mailhog']['binary']['checksum']['linux_386'] = 'a72d1016b70964562c8a77a3b57637a77889ee61f3b22973e0a7beb17181d8da'
default['mailhog']['binary']['checksum']['linux_amd64'] = 'e8e9acb4fa4470f4d4c3a4bba312f335bfc28122ea723599531699f099b4c9a5'
95 changes: 95 additions & 0 deletions chefignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Put files/directories that should be ignored in this file when uploading
# or sharing to the community site.
# Lines that start with '# ' are comments.

# OS generated files #
######################
.DS_Store
Icon?
nohup.out
ehthumbs.db
Thumbs.db

# SASS #
########
.sass-cache

# EDITORS #
###########
\#*
.#*
*~
*.sw[a-z]
*.bak
REVISION
TAGS*
tmtags
*_flymake.*
*_flymake
*.tmproj
.project
.settings
mkmf.log

## COMPILED ##
##############
a.out
*.o
*.pyc
*.so
*.com
*.class
*.dll
*.exe
*/rdoc/

# Testing #
###########
.watchr
.rspec
spec/*
spec/fixtures/*
test/*
features/*
Guardfile
Procfile

# SCM #
#######
.git
*/.git
.gitignore
.gitmodules
.gitconfig
.gitattributes
.svn
*/.bzr/*
*/.hg/*
*/.svn/*

# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp

# Cookbooks #
#############
CONTRIBUTING

# Strainer #
############
Colanderfile
Strainerfile
.colander
.strainer

# Vagrant #
###########
.vagrant
Vagrantfile

# Travis #
##########
.travis.yml
12 changes: 12 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name 'mailhog'
maintainer 'Sergey Storchay'
maintainer_email 'r8@r8.com.ua'
license 'MIT'
description 'Installs/Configures mailhog'
version '0.1.0'

depends 'runit', '>= 0.0.0'

%w(debian ubuntu centos redhat smartos).each do |os|
supports os, '>= 0.0.0'
end
49 changes: 49 additions & 0 deletions recipes/binary.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Cookbook Name:: mailhog
# Recipe:: default
#
# Copyright (c) 2015 Sergey Storchay, All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

include_recipe 'runit'

arch = node['kernel']['machine'] =~ /x86_64/ ? 'amd64' : '386'

if node['mailhog']['binary']['url']
binary_url = node['mailhog']['binary']['url']
checksum = node['mailhog']['binary']['checksum']
else
binary_url = "#{node['mailhog']['binary']['prefix_url']}#{node['mailhog']['version']}/MailHog_linux_#{arch}"
checksum = node['mailhog']['binary']['checksum']["linux_#{arch}"]
end

# Download and install binary file
remote_file node['mailhog']['binary']['path'] do
source binary_url
checksum checksum
mode node['mailhog']['binary']['mode']
action :create
end

# Setup runit service
runit_service 'mailhog' do
default_logger true
end
26 changes: 26 additions & 0 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#
# Cookbook Name:: mailhog
# Recipe:: default
#
# Copyright (c) 2015 Sergey Storchay, All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

include_recipe "mailhog::#{node['mailhog']['install_method']}"
2 changes: 2 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'chefspec'
require 'chefspec/berkshelf'
Loading

0 comments on commit ccbe6f7

Please sign in to comment.