howlr 0.1.0 → 0.1.0.34

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.
@@ -1,3 +1 @@
1
- === 0.1.0 :: 2008-03-10
2
-
3
- * First public release.
1
+ See History.txt
@@ -0,0 +1,9 @@
1
+ == 0.2.0 In Progress...
2
+
3
+ * Can now force all outgoing messages to be sent to some given recipient,
4
+ overriding the message's actual recipient using the --override-recipient
5
+ command-line option. This is useful for testing and debugging.
6
+
7
+ == 0.1.0 2008-03-10
8
+
9
+ * First public release.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 FIXME full name
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,10 +1,15 @@
1
1
  CHANGELOG.txt
2
+ History.txt
3
+ License.txt
2
4
  Manifest.txt
5
+ PostInstall.txt
3
6
  README.txt
4
7
  Rakefile
5
8
  bin/howlr
6
9
  bin/howlr-ctl
7
10
  config.example.yml
11
+ config/hoe.rb
12
+ config/requirements.rb
8
13
  examples/active_resource_client_example.rb
9
14
  examples/php_client_example.php
10
15
  lib/howlr.rb
@@ -15,6 +20,19 @@ lib/howlr/environment.rb
15
20
  lib/howlr/message.rb
16
21
  lib/howlr/version.rb
17
22
  lib/howlr/views.rb
23
+ script/console
24
+ script/destroy
25
+ script/generate
26
+ script/txt2html
18
27
  setup.rb
28
+ tasks/deployment.rake
29
+ tasks/environment.rake
30
+ tasks/website.rake
19
31
  test/howlr_test.rb
20
32
  test/test_helper.rb
33
+ test/test_howlr.rb
34
+ website/index.html
35
+ website/index.txt
36
+ website/javascripts/rounded_corners_lite.inc.js
37
+ website/stylesheets/screen.css
38
+ website/template.html.erb
@@ -0,0 +1,4 @@
1
+
2
+ For more information on howlr, see http://howlr.rubyforge.org
3
+
4
+
data/README.txt CHANGED
@@ -1,11 +1,48 @@
1
- = Howlr
1
+ = howlr
2
2
 
3
- The Howlr daemon provides RESTful interface for sending outgoing messages.
4
- Messages are submitted via HTTP and dispatched to other protocols. Currently
5
- only email (SMTP and Sendmail) is supported, but other delivery methods
6
- (SMS, IM, etc.) are possible.
3
+ * FIX (url)
7
4
 
5
+ == DESCRIPTION:
8
6
 
9
- Please see Howlr's Google Code site for further information:
7
+ FIX (describe your package)
10
8
 
11
- http://code.google.com/p/howlr/
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * FIX (list of features or problems)
12
+
13
+ == SYNOPSIS:
14
+
15
+ FIX (code sample of usage)
16
+
17
+ == REQUIREMENTS:
18
+
19
+ * FIX (list of requirements)
20
+
21
+ == INSTALL:
22
+
23
+ * FIX (sudo gem install, anything else)
24
+
25
+ == LICENSE:
26
+
27
+ (The MIT License)
28
+
29
+ Copyright (c) 2008 FIXME full name
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining
32
+ a copy of this software and associated documentation files (the
33
+ 'Software'), to deal in the Software without restriction, including
34
+ without limitation the rights to use, copy, modify, merge, publish,
35
+ distribute, sublicense, and/or sell copies of the Software, and to
36
+ permit persons to whom the Software is furnished to do so, subject to
37
+ the following conditions:
38
+
39
+ The above copyright notice and this permission notice shall be
40
+ included in all copies or substantial portions of the Software.
41
+
42
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
43
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
45
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
46
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
47
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
48
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,62 +1,4 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/clean'
4
- require 'rake/testtask'
5
- require 'rake/packagetask'
6
- require 'rake/gempackagetask'
7
- require 'rake/rdoctask'
8
- require 'rake/contrib/rubyforgepublisher'
9
- require 'fileutils'
10
- require 'hoe'
11
- include FileUtils
12
- require File.join(File.dirname(__FILE__), 'lib', 'howlr', 'version')
13
-
14
- AUTHOR = "Matt Zukowski"
15
- EMAIL = "matt@roughest.net"
16
- DESCRIPTION = "Sends out emails/messages using a REST API."
17
- GEM_NAME = "howlr"
18
- RUBYFORGE_PROJECT = "howlr"
19
- HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
20
-
21
- ENV['nodot'] = '1'
22
-
23
- NAME = "howlr"
24
- REV = nil
25
- #REV = `svn info`[/Revision: (\d+)/, 1] rescue nil
26
- VERS = ENV['VERSION'] || (Howlr::VERSION::STRING + (REV ? ".#{REV}" : ""))
27
- CLEAN.include ['**/.*.sw?', '*.gem', '.config']
28
- RDOC_OPTS = ['--quiet', '--title', "howlr #{VERS} documentation",
29
- "--opname", "index.html",
30
- "--line-numbers",
31
- "--main", "README",
32
- "--inline-source"]
33
-
34
- class Hoe
35
- def extra_deps
36
- @extra_deps.reject { |x| Array(x).first == 'hoe' }
37
- end
38
- end
39
-
40
- # Generate all the Rake tasks
41
- # Run 'rake -T' to see list of generated tasks (from gem root directory)
42
- hoe = Hoe.new(GEM_NAME, VERS) do |p|
43
- p.author = AUTHOR
44
- p.description = DESCRIPTION
45
- p.email = EMAIL
46
- p.summary = DESCRIPTION
47
- p.url = HOMEPATH
48
- p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
49
- p.test_globs = ["test/**/*_test.rb"]
50
- p.clean_globs = CLEAN #An array of file patterns to delete on clean.
51
-
52
- # == Optional
53
- #p.changes - A description of the release's latest changes.
54
- #p.extra_deps - An array of rubygem dependencies.
55
- #p.spec_extras - A hash of extra values to set in the gemspec.
56
-
57
- p.extra_deps = [
58
- ['picnic', '~>0.6.2'],
59
- ['reststop', '~>0.2.0']
60
- ]
61
- p.spec_extras = {:executables => ['howlr', 'howlr-ctl']}
62
- end
1
+ require 'config/requirements'
2
+ require 'config/hoe' # setup Hoe + all gem configuration
3
+
4
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
data/bin/howlr CHANGED
@@ -27,9 +27,17 @@ end
27
27
 
28
28
  require 'picnic/cli'
29
29
 
30
+ extra_cli_options = Proc.new do |opts|
31
+ opts.on("--override-recipient EMAIL", String,
32
+ "Send all outgoing messages to this address instead of the actual recipient (for testing purposes).") do |email|
33
+ $OVERRIDE_RECIPIENT = email
34
+ end
35
+ end
36
+
30
37
  cli = Picnic::Cli.new(
31
38
  'howlr',
32
- :app_path => File.expand_path(File.dirname(File.expand_path(__FILE__)))
39
+ :app_path => File.expand_path(File.dirname(File.expand_path(__FILE__))),
40
+ :extra_cli_options => extra_cli_options
33
41
  )
34
42
 
35
- cli.handle_cli_input
43
+ cli.handle_cli_input
File without changes
@@ -0,0 +1,75 @@
1
+ require 'howlr/version'
2
+
3
+ AUTHOR = 'Matt Zukowski' # can also be an array of Authors
4
+ EMAIL = "matt at roughest dot net"
5
+ DESCRIPTION = "Daemon for sending out messages/emails via a RESTful API."
6
+ GEM_NAME = 'howlr' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'howlr' # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
+ EXTRA_DEPENDENCIES = [
11
+ 'picnic',
12
+ 'actionmailer'
13
+ # ['activesupport', '>= 1.3.1']
14
+ ] # An array of rubygem dependencies [name, version]
15
+
16
+ @config_file = "~/.rubyforge/user-config.yml"
17
+ @config = nil
18
+ RUBYFORGE_USERNAME = "unknown"
19
+ def rubyforge_username
20
+ unless @config
21
+ begin
22
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
23
+ rescue
24
+ puts <<-EOS
25
+ ERROR: No rubyforge config file found: #{@config_file}
26
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
27
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
28
+ EOS
29
+ exit
30
+ end
31
+ end
32
+ RUBYFORGE_USERNAME.replace @config["username"]
33
+ end
34
+
35
+
36
+ #REV = nil
37
+ # UNCOMMENT IF REQUIRED:
38
+ REV = YAML.load(`svn info`)['Revision']
39
+ VERS = Howlr::VERSION::STRING + (REV ? ".#{REV}" : "")
40
+ RDOC_OPTS = ['--quiet', '--title', 'howlr documentation',
41
+ "--opname", "index.html",
42
+ "--line-numbers",
43
+ "--main", "README",
44
+ "--inline-source"]
45
+
46
+ class Hoe
47
+ def extra_deps
48
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
49
+ @extra_deps
50
+ end
51
+ end
52
+
53
+ # Generate all the Rake tasks
54
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
55
+ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
56
+ p.developer(AUTHOR, EMAIL)
57
+ p.description = DESCRIPTION
58
+ p.summary = DESCRIPTION
59
+ p.url = HOMEPATH
60
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
61
+ p.test_globs = ["test/**/test_*.rb"]
62
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
63
+
64
+ # == Optional
65
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
66
+ #p.extra_deps = EXTRA_DEPENDENCIES
67
+
68
+ #p.spec_extras = {} # A hash of extra values to set in the gemspec.
69
+ end
70
+
71
+ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
72
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
73
+ $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
74
+ $hoe.rsync_args = '-av --delete --ignore-errors'
75
+ $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -0,0 +1,15 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe newgem rubigen].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
@@ -31,7 +31,6 @@ module Howlr::Controllers
31
31
 
32
32
  # Show the message with the given id created by this server.
33
33
  def read(id)
34
- puts "Looking for #{id}"
35
34
  @message = @@messages.find{|m| m.id == id}
36
35
  puts @format
37
36
  if @message
@@ -72,6 +71,12 @@ module Howlr::Controllers
72
71
 
73
72
  render :message
74
73
  end
74
+
75
+ # Show some information about messages sent out since last reboot.
76
+ def list
77
+ @messages = @@messages
78
+ render :message_list
79
+ end
75
80
  end
76
81
 
77
82
  # Can be used as a callback target for messages. This makes it possible
@@ -115,7 +120,7 @@ module Howlr::Controllers
115
120
  :subject => subject,
116
121
  :from => @input[:recipient_address]
117
122
  }
118
- puts data.inspect
123
+
119
124
  Restr.post("http://localhost:#{Conf.port}#{Conf.uri_path}messages",
120
125
  data, auth)
121
126
 
@@ -126,4 +131,4 @@ module Howlr::Controllers
126
131
  end
127
132
  end
128
133
  end
129
- end
134
+ end
@@ -26,7 +26,7 @@ module Howlr::Deliverers
26
26
  def self.deliver(message, options = {})
27
27
  recipients = []
28
28
  message.recipients.each do |r|
29
- recipients << (r.respond_to?(:address) ? r.address : r)
29
+ recipients << $OVERRIDE_RECIPIENT || (r.respond_to?(:address) ? r.address : r)
30
30
  end
31
31
 
32
32
  Mailer.raise_delivery_errors = true
@@ -70,4 +70,4 @@ module Howlr::Deliverers
70
70
  def self.deliver(message, options = {})
71
71
  end
72
72
  end
73
- end
73
+ end
@@ -1,19 +1,4 @@
1
- # This file is part of Howlr.
2
- #
3
- # Howlr is free software: you can redistribute it and/or modify
4
- # it under the terms of the GNU General Public License as published by
5
- # the Free Software Foundation, either version 3 of the License, or
6
- # (at your option) any later version.
7
- #
8
- # Howlr is distributed in the hope that it will be useful,
9
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- # GNU General Public License for more details.
12
- #
13
- # You should have received a copy of the GNU General Public License
14
- # along with Howlr. If not, see <http://www.gnu.org/licenses/>.
15
-
16
- module Howlr #:nodoc:
1
+ module Howlr
17
2
  module VERSION #:nodoc:
18
3
  MAJOR = 0
19
4
  MINOR = 1
@@ -56,6 +56,34 @@ module Howlr::Views
56
56
  end
57
57
  end
58
58
 
59
+ def message_list
60
+ html do
61
+ h1 "Messages Sent"
62
+ dl do
63
+ dt 'Number of messages sent out since last server reboot:'
64
+ dd @messages.size
65
+ end
66
+ table do
67
+ thead do
68
+ th 'id'
69
+ th 'subject'
70
+ th 'to'
71
+ th 'from'
72
+ th 'sent successfully?'
73
+ end
74
+ @messages.each do |m|
75
+ tr(:id => "message-#{m.id}") do
76
+ td {a(:href => R(Howlr::Controllers::Messages, m.id)){m.id}}
77
+ td m.subject
78
+ td m.recipients.collect{|r| r.to_s}.join(", ")
79
+ td m.from
80
+ td m.sent
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+
59
87
  def new_message
60
88
  html do
61
89
  form :method => 'post', :action => '/messages' do
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ # File: script/console
3
+ irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
4
+
5
+ libs = " -r irb/completion"
6
+ # Perhaps use a console_lib to store any extra methods I may want available in the cosole
7
+ # libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
8
+ libs << " -r #{File.dirname(__FILE__) + '/../lib/howlr.rb'}"
9
+ puts "Loading howlr gem"
10
+ exec "#{irb} #{libs} --simple-prompt"
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)