sendln 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ *.swp
2
+ config/smtp.yaml
@@ -0,0 +1,26 @@
1
+ Oneliner
2
+ --------
3
+ A simple ruby based mail sender.
4
+
5
+ Installation
6
+ ------------
7
+ * Create a file in your home directory (i.e. ~ on linux) called .sendln
8
+ * Add in:
9
+ address: <smtp_server>
10
+ domain: <domain>
11
+ user_name: <your user name>
12
+ password: <your password>
13
+ email: <the email address that should be in the from field>
14
+
15
+
16
+ Usage
17
+ -----
18
+ sendln [to] [message]
19
+
20
+ TODO
21
+ ----
22
+ * -gemify-
23
+ * short name conact.yaml
24
+ - name => some@email
25
+ * oneline contacts
26
+ - list all contacts
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if ARGV.length != 2
4
+ puts "Usage: #{__FILE__} [to] <message>"
5
+ Process.exit
6
+ end
7
+
8
+ $LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
9
+ require 'sendln'
10
+
11
+ to = ARGV[0]
12
+ msg = ARGV[1]
13
+
14
+ Sendln.line(to, msg).deliver
15
+ puts "Message: <#{msg}> sent to [#{to}]"
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'action_mailer'
3
+ require 'yaml'
4
+
5
+ def smtp_config
6
+ file = File.expand_path('~/.sendln')
7
+ raise "No configuration file found! Please provide one at #{file}" unless File.exists? file
8
+ @config ||= YAML::load(File.open(file))
9
+ end
10
+
11
+ ActionMailer::Base.delivery_method = :smtp
12
+ ActionMailer::Base.smtp_settings = {
13
+ :address => smtp_config["address"],
14
+ :tls => true,
15
+ :port => 587,
16
+ :domain => smtp_config["domain"],
17
+ :authentication => :login,
18
+ :user_name => smtp_config["user_name"],
19
+ :password => smtp_config["password"]
20
+ }
21
+
22
+ class Sendln < ActionMailer::Base
23
+ def line(t, sub)
24
+ from smtp_config["email"]
25
+ recipients t
26
+ subject "#{sub}<eom>"
27
+ body ""
28
+ end
29
+ end
@@ -0,0 +1,4 @@
1
+ class Sendln
2
+ VERSION = "0.0.2"
3
+ end
4
+
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), 'lib')
4
+ require "version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "sendln"
8
+ s.version = Sendln::VERSION
9
+ s.platform = Gem::Platform::RUBY
10
+ s.authors = ["Kristoffer Roupe"]
11
+ s.email = ["kitofr@gmail.com"]
12
+ s.homepage = "http://github.com/kitofr/sendln"
13
+ s.add_dependency "actionmailer", "= 3.0.7"
14
+
15
+ s.summary = %q{A simple ruby based mail sender}
16
+ s.description = %q{Based on the ideas of having a quick place to dump email/ideas on from Pragmatic Thinking and Learning (http://pragprog.com/titles/ahptl/pragmatic-thinking-and-learning) by Andy Hunt (@PragmaticAndy)}
17
+
18
+ s.rubyforge_project = "sendln"
19
+
20
+ s.files = `git ls-files`.split("\n")
21
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
+ s.require_paths = ["lib"]
24
+ s.required_ruby_version = '>= 1.8.7'
25
+ end
26
+
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sendln
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.2
6
+ platform: ruby
7
+ authors:
8
+ - Kristoffer Roupe
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-05-14 00:00:00 +02:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: actionmailer
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - "="
23
+ - !ruby/object:Gem::Version
24
+ version: 3.0.7
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ description: Based on the ideas of having a quick place to dump email/ideas on from Pragmatic Thinking and Learning (http://pragprog.com/titles/ahptl/pragmatic-thinking-and-learning) by Andy Hunt (@PragmaticAndy)
28
+ email:
29
+ - kitofr@gmail.com
30
+ executables:
31
+ - sendln
32
+ extensions: []
33
+
34
+ extra_rdoc_files: []
35
+
36
+ files:
37
+ - .gitignore
38
+ - README.md
39
+ - bin/sendln
40
+ - lib/sendln.rb
41
+ - lib/version.rb
42
+ - sendln.gemspec
43
+ has_rdoc: true
44
+ homepage: http://github.com/kitofr/sendln
45
+ licenses: []
46
+
47
+ post_install_message:
48
+ rdoc_options: []
49
+
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 1.8.7
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ requirements: []
65
+
66
+ rubyforge_project: sendln
67
+ rubygems_version: 1.6.2
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: A simple ruby based mail sender
71
+ test_files: []
72
+