Skip to content

Commit 94567de

Browse files
committed
Fixed linting errors.
Added new mailcatcher part parameter since mailcatcher isn't always installed in /usr/local/bin. Fixed up exec command, there puppet 3.1.1 outputs the entire array to the upstart erb while 3.2.1 doesn't. Excluded pkg directory. Bumped version.
1 parent a309b83 commit 94567de

File tree

6 files changed

+24
-17
lines changed

6 files changed

+24
-17
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea
22
.tmp
33
.swp
4+
pkg/

Diff for: Modulefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name 'actionjack-mailcatcher'
2-
version '0.1.4'
2+
version '0.1.5'
33
source 'https://github.com/actionjack/puppet-mailcatcher'
44
author 'actionjack'
55
license 'Apache License, Version 2.0'

Diff for: manifests/init.pp

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# == Class: mailcatcher
22
#
33
# Install and configure Mailcatcher.
4-
# MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface.
4+
# MailCatcher runs a super simple SMTP server which catches any message sent to
5+
# it to display in a web interface.
56
# http://mailcatcher.me/
67
#
78
# === Parameters
@@ -24,6 +25,9 @@
2425
# What TCP Port the mailcatcher web mail client service should listen on.
2526
# The default is 1080
2627
#
28+
# [*mailcatcher_path*]
29+
# Path to the mailcatcher program.
30+
# The default is '/usr/local/bin'
2731
#
2832
# === Examples
2933
#
@@ -46,13 +50,15 @@
4650
# Copyright 2013 Martin Jackson, unless otherwise noted.
4751
#
4852
# Todo
49-
# - Only supports debian based distros need support for other distros e.g. redhat, centos, or Amazon.
53+
# - Only supports debian based distros need support for other distros
54+
# e.g. redhat, centos, or Amazon.
5055
#
5156
class mailcatcher (
52-
$smtp_ip = $mailcatcher::params::smtp_ip,
53-
$smtp_port = $mailcatcher::params::smtp_port,
54-
$http_ip = $mailcatcher::params::http_ip,
55-
$http_port = $mailcatcher::params::http_port
57+
$smtp_ip = $mailcatcher::params::smtp_ip,
58+
$smtp_port = $mailcatcher::params::smtp_port,
59+
$http_ip = $mailcatcher::params::http_ip,
60+
$http_port = $mailcatcher::params::http_port,
61+
$mailcatcher_path = $mailcatcher::params::mailcatcher_path
5662
) inherits mailcatcher::params {
5763

5864
class {'mailcatcher::package': } ->

Diff for: manifests/params.pp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# class mailcatcher::params
22
#
33
class mailcatcher::params {
4-
$smtp_ip = '0.0.0.0'
5-
$smtp_port = '1025'
6-
$http_ip = '0.0.0.0'
7-
$http_port = '1080'
4+
$smtp_ip = '0.0.0.0'
5+
$smtp_port = '1025'
6+
$http_ip = '0.0.0.0'
7+
$http_port = '1080'
8+
$mailcatcher_path = '/usr/local/bin'
89

910
case $::osfamily {
1011

Diff for: spec/classes/mailcatcher_spec.rb

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
it { should contain_package('libsqlite3-dev') }
1616
it { should contain_package('rubygems') }
1717
it { should contain_package('mailcatcher').with({ 'provider' => 'gem'}) }
18-
it { should contain_user('mailcatcher')}
19-
it { should contain_file('/etc/init/mailcatcher.conf').with_content(/--http-ip\s0.0.0.0/)}
20-
it { should contain_file('/etc/init/mailcatcher.conf').with_content(/--http-port\s1080/)}
21-
it { should contain_file('/etc/init/mailcatcher.conf').with_content(/--smtp-ip 0.0.0.0/)}
22-
it { should contain_file('/etc/init/mailcatcher.conf').with_content(/--smtp-port\s1025/)}
18+
it { should contain_user('mailcatcher') }
19+
it 'should contain a properly formatted start up configuration for upstart' do
20+
should contain_file('/etc/init/mailcatcher.conf').with_content(/exec\s+nohup\s+\/usr\/local\/bin\/mailcatcher\s+--http-ip\s+0\.0\.0\.0\s+--http-port\s+1080\s+--smtp-ip\s+0\.0\.0\.0\s+--smtp-port\s+1025\s+-f/)
21+
end
2322
it { should contain_file('/etc/init/mailcatcher.conf').with({ :notify => 'Class[Mailcatcher::Service]'})}
2423
it { should contain_file('/var/log/mailcatcher').with({
2524
:ensure => 'directory',

Diff for: templates/etc/init/mailcatcher.conf.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ setuid mailcatcher
1212
setgid mailcatcher
1313

1414
script
15-
exec nohup /usr/local/bin/mailcatcher<%= @options.to_s %> -f >> /var/log/mailcatcher/mailcatcher.log 2>&1
15+
exec nohup <%= @mailcatcher_path %>/mailcatcher<%= @options.join(' ') %> -f >> /var/log/mailcatcher/mailcatcher.log 2>&1
1616
end script

0 commit comments

Comments
 (0)