mailcvt 0.0.1 → 0.0.2

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/mailcvt CHANGED
@@ -1,13 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'gli'
3
- begin # XXX: Remove this begin/rescue before distributing your app
4
3
  require 'mailcvt'
5
- rescue LoadError
6
- STDERR.puts "In development, you need to use `bundle exec bin/mailcvt` to run your app"
7
- STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
8
- STDERR.puts "Feel free to remove this message from bin/mailcvt now"
9
- exit 64
10
- end
11
4
 
12
5
  include GLI::App
13
6
 
@@ -33,13 +26,17 @@ command :write do |c|
33
26
  c.default_value 'default'
34
27
  c.flag :f
35
28
  c.action do |global_options,options,args|
29
+ err = "write command need 3 arguments: [input dir] [output dir] [output file number]"
30
+ raise err if args.length != 3
31
+
32
+ raise "Cannot find #{args[0]}" unless Dir.exists?(args[0])
36
33
 
37
- # Your command logic here
38
-
39
- # If you have any errors, just raise them
40
- # raise "that command made no sense"
34
+ output = args[1]
35
+ FileUtils.rm_r(output) if Dir.exists?(output)
36
+ Dir.mkdir(output)
41
37
 
42
- puts "write command ran"
38
+ bmg = BigMailGenerator.new(args[0], args[1], args[2].to_i)
39
+ bmg.generate
43
40
  end
44
41
  end
45
42
 
@@ -47,7 +44,13 @@ desc 'Describe read here'
47
44
  arg_name 'Describe arguments to read here'
48
45
  command :read do |c|
49
46
  c.action do |global_options,options,args|
50
- puts "read command ran"
47
+ err = "read command need 2 arguments: [input dir] [output dir]"
48
+ raise err if args.length != 2
49
+
50
+ raise "Cannot find #{args[0]}" unless Dir.exists?(args[0])
51
+ Dir.mkdir(args[1]) unless Dir.exists?(args[1])
52
+ mp = MailParser.new(args[0], args[1])
53
+ mp.parse
51
54
  end
52
55
  end
53
56
 
data/lib/mailcvt.rb CHANGED
@@ -2,3 +2,6 @@ require 'mailcvt/version.rb'
2
2
 
3
3
  # Add requires for other files you add to your project here, so
4
4
  # you just need to require this one file in your bin file
5
+ require 'fileutils'
6
+ require 'big_mail_generator'
7
+ require 'mail_parser'
@@ -1,3 +1,3 @@
1
1
  module Mailcvt
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  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.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: -1803101067780984176
112
+ hash: -432718095918672412
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: -1803101067780984176
121
+ hash: -432718095918672412
122
122
  requirements: []
123
123
  rubyforge_project:
124
124
  rubygems_version: 1.8.25