alexmchale-gmail-client 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ pkg
2
+ attic
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "gmail-client"
8
+ gem.summary = %Q{A client to use GMail for sending email.}
9
+ gem.email = "alexmchale@gmail.com"
10
+ gem.homepage = "http://github.com/alexmchale/gmail-client"
11
+ gem.authors = ["Alex McHale"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
14
+ rescue LoadError
15
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
16
+ end
17
+
18
+ require 'rake/rdoctask'
19
+ Rake::RDocTask.new do |rdoc|
20
+ rdoc.rdoc_dir = 'rdoc'
21
+ rdoc.title = 'gmail-client'
22
+ rdoc.options << '--line-numbers' << '--inline-source'
23
+ rdoc.rdoc_files.include('README*')
24
+ rdoc.rdoc_files.include('lib/**/*.rb')
25
+ end
26
+
27
+ require 'rake/testtask'
28
+ Rake::TestTask.new(:test) do |test|
29
+ test.libs << 'lib' << 'test'
30
+ test.pattern = 'test/**/*_test.rb'
31
+ test.verbose = false
32
+ end
33
+
34
+ begin
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/*_test.rb'
39
+ test.verbose = true
40
+ end
41
+ rescue LoadError
42
+ task :rcov do
43
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
44
+ end
45
+ end
46
+
47
+ task :verify_committed do
48
+ abort "This project has not been fully committed." unless `git status | grep "nothing to commit"` != ''
49
+ end
50
+
51
+ task :patch => [ :verify_committed, :test, "version:bump:patch", :release, :build, :install ]
52
+ task :minor => [ :verify_committed, :test, "version:bump:minor", :release, :build, :install ]
53
+ task :major => [ :verify_committed, :test, "version:bump:major", :release, :build, :install ]
54
+
55
+ task :default => :test
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 2
3
2
  :major: 0
4
- :patch: 1
3
+ :patch: 0
4
+ :minor: 3
@@ -0,0 +1,38 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{gmail-client}
5
+ s.version = "0.3.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Alex McHale"]
9
+ s.date = %q{2009-07-16}
10
+ s.email = %q{alexmchale@gmail.com}
11
+ s.extra_rdoc_files = [
12
+ "README.markdown"
13
+ ]
14
+ s.files = [
15
+ ".gitignore",
16
+ "README.markdown",
17
+ "Rakefile",
18
+ "VERSION.yml",
19
+ "gmail-client.gemspec",
20
+ "init.rb",
21
+ "lib/gmail.rb"
22
+ ]
23
+ s.homepage = %q{http://github.com/alexmchale/gmail-client}
24
+ s.rdoc_options = ["--charset=UTF-8"]
25
+ s.require_paths = ["lib"]
26
+ s.rubygems_version = %q{1.3.4}
27
+ s.summary = %q{A client to use GMail for sending email.}
28
+
29
+ if s.respond_to? :specification_version then
30
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
31
+ s.specification_version = 3
32
+
33
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
34
+ else
35
+ end
36
+ else
37
+ end
38
+ end
data/init.rb ADDED
@@ -0,0 +1,5 @@
1
+ begin
2
+ require File.join(File.dirname(__FILE__), 'lib', 'gmail') # From here
3
+ rescue LoadError
4
+ require 'gmail' # From gem
5
+ end
@@ -42,7 +42,7 @@ class GMail
42
42
  "Content-Type: #{attachment[:type]}; name=\"#{attachment[:name]}\"\r\n" +
43
43
  "Content-Disposition: attachment; filename=\"#{attachment[:name]}\"\r\n" +
44
44
  "Content-Transfer-Encoding: base64\r\n" +
45
- "Content-ID: <#{attachment[:name]}>\r\n" +
45
+ "Content-ID: <#{attachment[:name]}>\r\n" +
46
46
  "\r\n" +
47
47
  Base64.encode64(attachment[:data])
48
48
  end.compact.join
@@ -69,8 +69,7 @@ class GMail
69
69
  "Subject: #{@subject}\r\n" +
70
70
  "Content-Type: #{@body_type}\r\n" +
71
71
  "\r\n" +
72
- "#{@body}\r\n" +
73
- "\r\n.\r\n"
72
+ @body
74
73
  end
75
74
  end
76
75
 
@@ -80,11 +79,9 @@ class GMail
80
79
  end
81
80
  end
82
81
 
83
- def send(to, subject, body, content_type = 'text/plan')
84
- Net::SMTP.start('smtp.gmail.com', 587, 'gmail.com', @username, @password, :plain) do |smtp|
85
- msg = "From: #{@username}\r\nTo: #{to}\r\nSubject: #{subject}\r\nContent-Type: #{content_type}\r\n\r\n#{body}"
86
- smtp.send_message msg, @username, to
87
- end
82
+ def send(to, subject, body, content_type = 'text/plain')
83
+ start to, subject, body, content_type
84
+ dispatch
88
85
  end
89
86
  end
90
87
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexmchale-gmail-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex McHale
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-11 00:00:00 -07:00
12
+ date: 2009-07-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -22,14 +22,17 @@ extensions: []
22
22
  extra_rdoc_files:
23
23
  - README.markdown
24
24
  files:
25
- - VERSION.yml
25
+ - .gitignore
26
26
  - README.markdown
27
+ - Rakefile
28
+ - VERSION.yml
29
+ - gmail-client.gemspec
30
+ - init.rb
27
31
  - lib/gmail.rb
28
- has_rdoc: true
32
+ has_rdoc: false
29
33
  homepage: http://github.com/alexmchale/gmail-client
30
34
  post_install_message:
31
35
  rdoc_options:
32
- - --inline-source
33
36
  - --charset=UTF-8
34
37
  require_paths:
35
38
  - lib
@@ -50,7 +53,7 @@ requirements: []
50
53
  rubyforge_project:
51
54
  rubygems_version: 1.2.0
52
55
  signing_key:
53
- specification_version: 2
56
+ specification_version: 3
54
57
  summary: A client to use GMail for sending email.
55
58
  test_files: []
56
59