mailcvt 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/lock-runmailcvt CHANGED
@@ -1,12 +1,16 @@
1
1
  #!/bin/bash
2
2
 
3
- log=hourly-runmailcvt.log
4
- lock="runmailcvt.lock"
3
+ bindir=$(cd $(dirname $0) && pwd)
4
+ outputdir=$(cd $(dirname $2) && pwd)
5
+
6
+ log=$outputdir/hourly-runmailcvt.log
7
+ lock=$outputdir/runmailcvt.lock
8
+
5
9
  if mkdir $lock &> /dev/null; then
6
10
  if [ ! -z $3 ] && [ $3 == "-D" ]; then
7
11
  ./bin/runmailcvt $1 $2 $3 >> $log 2>&1
8
12
  else
9
- runmailcvt $1 $2 >> $log 2>&1
13
+ $bindir/runmailcvt $1 $2 >> $log 2>&1
10
14
  fi
11
15
  rmdir $lock
12
16
  else
@@ -1,3 +1,3 @@
1
1
  module Mailcvt
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
data/lib/mailcvt_setup.rb CHANGED
@@ -1,10 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  class MailcvtSetup
4
- def initialize
4
+ def setup
5
+ create_output_dir
6
+ create_cron_job
5
7
  end
6
8
 
7
- def setup
8
- puts "DEBUG> file = #{__FILE__}"
9
+ def create_output_dir
10
+ @output = File.join(Dir.home, 'mailcvt-output')
11
+ Dir.mkdir(@output) unless Dir.exist?(@output)
12
+ end
13
+
14
+ def create_cron_job
15
+ setupdir = Dir.mkdir(File.join(@output, 'setup'))
16
+ jobfile = File.join(setupdir, 'cronjobs')
17
+ newmaildir = File.join(Dir.home, 'Maildir/new')
18
+ File.open(jobfile, 'w') { |f| f.puts "* * * * * #{get_run_path} #{newmaildir} #{@output}" }
19
+ `crontab #{jobfile}`
20
+ File.delete jobfile
21
+ end
22
+
23
+ def get_run_path
24
+ libdir = File.basename(__FILE__)
25
+ bindir = File.join(File.basename(libdir), 'bin')
26
+ path = File.join(bindir, 'lock-runmailcvt')
27
+ raise "Cannot find #{path}." if File.exist?(path)
28
+ path
9
29
  end
10
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailcvt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: -3197550101028164313
121
+ hash: 753049201069822628
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  none: false
124
124
  requirements:
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  segments:
129
129
  - 0
130
- hash: -3197550101028164313
130
+ hash: 753049201069822628
131
131
  requirements: []
132
132
  rubyforge_project:
133
133
  rubygems_version: 1.8.25