mmailer 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 0.0.7
2
+
3
+ * Correctly handles Array or Proc passed in config.collection, warns if it something else.
4
+
1
5
  ## Version 0.0.6
2
6
 
3
7
  * Markdown template
@@ -40,11 +40,7 @@ class MyCLI < Thor
40
40
  option :mail_interval, :type => :numeric
41
41
  option :sleep_time, :type => :numeric
42
42
  def config
43
- if options.empty?
44
- client(:config)
45
- else
46
43
  client(:config, options)
47
- end
48
44
  end
49
45
 
50
46
  end
@@ -58,8 +58,8 @@ module Mmailer
58
58
  end
59
59
  end
60
60
 
61
- def config(options=nil)
62
- if options.nil?
61
+ def config(options)
62
+ if options.empty?
63
63
  puts "I will send emails every #{Mmailer.configuration.time_interval} seconds. After #{Mmailer.configuration.mail_interval} emails, I will sleep for #{Mmailer.configuration.sleep_time} seconds."
64
64
  else
65
65
  Mmailer.configuration.sleep_time = options.fetch("sleep_time", Mmailer.configuration.sleep_time)
@@ -1,3 +1,3 @@
1
1
  module Mmailer
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -38,13 +38,19 @@ module Mmailer
38
38
  break
39
39
  end
40
40
  end
41
- obj.puts "Exiting worker, stopping server"
42
- DRb::stop_service
43
- Thread.exit
41
+ stop
44
42
  end
45
43
 
46
44
  def load_collection
47
- @collection = Mmailer.configuration.collection.lambda? ? Mmailer.configuration.collection.call : Mmailer.configuration.collection
45
+ @collection = case Mmailer.configuration.collection
46
+ when Array
47
+ Mmailer.configuration.collection
48
+ when Proc
49
+ Mmailer.configuration.collection.call
50
+ else
51
+ obj.puts "Collection needs to be an array or a proc object. It appears to be neither."
52
+ stop
53
+ end
48
54
  collection.shift(from)
49
55
  obj.puts "Loaded #{collection.count} entries"
50
56
  end
@@ -54,5 +60,11 @@ module Mmailer
54
60
  @mail_interval = Mmailer.configuration.mail_interval
55
61
  @sleep_time = Mmailer.configuration.sleep_time
56
62
  end
63
+
64
+ def stop
65
+ obj.puts "Exiting worker, stopping server"
66
+ DRb::stop_service
67
+ Thread.exit
68
+ end
57
69
  end
58
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mmailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-03 00:00:00.000000000 Z
12
+ date: 2013-09-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler