chocolate_rain 0.0.3 → 0.0.4

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.
@@ -9,10 +9,17 @@ require 'logger'
9
9
  ftp_worker
10
10
  ).each{|m| require File.dirname(__FILE__) + '/chocolate_rain/' + m }
11
11
 
12
+
12
13
  module ChocolateRain
13
- puts "Starting MailFetcher"
14
- MailFetcher.start
15
- puts "Starting FtpMachine"
16
- FtpMachine.start
17
- puts "All started"
14
+ class Loader
15
+
16
+ def self.do
17
+ puts "Starting MailFetcher"
18
+ ChocolateRain::MailFetcher.start
19
+ puts "Starting FtpMachine"
20
+ ChocolateRain::FtpMachine.start
21
+ puts "All started"
22
+ end
23
+
24
+ end
18
25
  end
@@ -3,15 +3,10 @@ require 'fileutils'
3
3
  include Daemon
4
4
  include ChocolateRain
5
5
 
6
- class FtpMachine < Daemon::Base
7
- def self.start
8
- loop do
6
+ module ChocolateRain
7
+ class FtpMachine
8
+ def self.start
9
9
  ChocolateRain::FtpWorker.do_work
10
- sleep(30)
11
10
  end
12
11
  end
13
-
14
- def self.stop
15
- put "Stopping FtpMachine"
16
- end
17
- end
12
+ end
@@ -3,7 +3,7 @@ require 'fileutils'
3
3
 
4
4
  module ChocolateRain
5
5
  class FtpWorker < ActionMailer::Base
6
- def do_work
6
+ def self.do_work
7
7
  @@ftp_creds = YAML.load(File.open("config/fms_config.yml"))["#{Rails.env}"]
8
8
 
9
9
  @local_files = []
@@ -1,26 +1,23 @@
1
1
  require 'net/pop'
2
2
  require 'mail'
3
- include Daemon
4
3
  include ChocolateRain
5
4
 
6
- class MailFetcher < Daemon::Base
7
- def self.start
8
- loop do
5
+ module ChocolateRain
6
+ class MailFetcher
7
+ def self.start
8
+ puts "in start"
9
9
  pop = Net::POP3.new('mail.hasflavor.com')
10
10
  pop.start("app@hasflavor.com", "oi890po")
11
11
 
12
12
  if !pop.mails.empty?
13
13
  pop.each_mail do |m|
14
+ puts "new mail"
14
15
  ChocolateRain::MailHandler.receive(m.pop)
15
- # m.delete
16
+ m.delete
16
17
  end
17
18
  end
19
+ puts 'done poppin'
18
20
  pop.finish
19
- sleep(30)
20
21
  end
21
22
  end
22
-
23
- def self.stop
24
- puts "Stopping Mail Fetcher Daemon"
25
- end
26
23
  end
@@ -1,3 +1,3 @@
1
1
  module ChocolateRain
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chocolate_rain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: youtube_it
16
- requirement: &2156678920 !ruby/object:Gem::Requirement
16
+ requirement: &2153952420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156678920
24
+ version_requirements: *2153952420
25
25
  description: Monitor E-Mail and FTP for videos to upload to YouTube
26
26
  email:
27
27
  - kevin@wearefound.com