forked from look/fetcher
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added Rails 3 compatible generators.
- Loading branch information
Amol Hatwár
committed
May 23, 2010
1 parent
7ebbaa8
commit b880c73
Showing
5 changed files
with
44 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
Description: | ||
Create a fetcher daemon | ||
Create a fetcher daemon with a given name | ||
|
||
Example: | ||
./script/generate fetcher_daemon sms | ||
./script/generate fetcher_daemon MailReader | ||
|
||
This will create: | ||
/config/sms_fetcher.yml | ||
/script/sms_fetcher | ||
/config/mail_reader_fetcher.yml | ||
/script/mail_reader_fetcher | ||
/lib/daemon.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
defaults: &defaults | ||
type: imap # pop OR imap | ||
server: imap.example.com # server hostname | ||
port: # 993 for IMAPs | ||
ssl: true # Remove if not using SSL | ||
username: # Username | ||
password: # Password | ||
receiver: # ActionMailer that will receive mail | ||
use_login: true # Required for GMAIL | ||
sleep_time: # Poll Frequency. 60 seconds by default | ||
authentication: # LOGIN, CRAM-MD5, PASSWORD (IMAP Only) | ||
|
||
development: | ||
type: pop | ||
server: localhost | ||
username: username | ||
password: password | ||
<<: *defaults | ||
# Override other values here | ||
|
||
test: | ||
type: pop | ||
server: localhost | ||
username: username | ||
password: password | ||
<<: *defaults | ||
# Override other values here | ||
|
||
production: | ||
type: pop | ||
server: localhost | ||
username: username | ||
password: password | ||
<<: *defaults | ||
# Override other values here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
require 'rails/generators' | ||
|
||
class FetcherDaemonGenerator < Rails::Generators::NamedBase | ||
source_root File.join(File.dirname(__FILE__), '../../../generators/fetcher_daemon', 'templates') | ||
|
||
def create_fetcher_daemon | ||
copy_file('daemon.rb', "lib/daemon.rb") | ||
template('config.yml', File.join('config', "#{file_name}.yml")) | ||
template('daemon', File.join('script', "#{file_name}_fetcher")) | ||
chmod(File.join("script", "#{file_name}_fetcher"), 0755) | ||
end | ||
end |