Skip to content

Commit fac368c

Browse files
committed
Various packaging cleanups.
* Add license file (MIT). * Pull gemspec out into dedicated file. * Move version constant into separate file for use in gemspec. * Update Rakefile, to use RDoc::Task, Gem::PackageTask etc as they were removed from rake. Switch to using SimpleCov for coverage.
1 parent c8f8491 commit fac368c

File tree

5 files changed

+88
-56
lines changed

5 files changed

+88
-56
lines changed

COPYING

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2007-2014 Charles Lowe
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.
20+

Rakefile

Lines changed: 29 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,52 @@
1-
require 'rake/rdoctask'
1+
require 'rubygems'
22
require 'rake/testtask'
3-
require 'rake/packagetask'
4-
require 'rake/gempackagetask'
53

64
require 'rbconfig'
75
require 'fileutils'
86

9-
$:.unshift 'lib'
10-
11-
require 'mapi/msg'
12-
13-
PKG_NAME = 'ruby-msg'
14-
PKG_VERSION = Mapi::VERSION
7+
spec = eval File.read('ruby-msg.gemspec')
158

169
task :default => [:test]
1710

18-
Rake::TestTask.new(:test) do |t|
11+
Rake::TestTask.new do |t|
1912
t.test_files = FileList["test/test_*.rb"] - ['test/test_pst.rb']
2013
t.warning = false
2114
t.verbose = true
2215
end
2316

2417
begin
25-
require 'rcov/rcovtask'
26-
# NOTE: this will not do anything until you add some tests
27-
desc "Create a cross-referenced code coverage report"
28-
Rcov::RcovTask.new do |t|
29-
t.test_files = FileList['test/test*.rb']
30-
t.ruby_opts << "-Ilib" # in order to use this rcov
31-
t.rcov_opts << "--xrefs" # comment to disable cross-references
32-
t.rcov_opts << "--exclude /usr/local/lib/site_ruby"
18+
Rake::TestTask.new(:coverage) do |t|
19+
t.test_files = FileList["test/test_*.rb"] - ['test/test_pst.rb']
20+
t.warning = false
3321
t.verbose = true
22+
t.ruby_opts = ['-rsimplecov -e "SimpleCov.start; load(ARGV.shift)"']
3423
end
3524
rescue LoadError
36-
# Rcov not available
37-
end
38-
39-
Rake::RDocTask.new do |t|
40-
t.rdoc_dir = 'doc'
41-
t.title = "#{PKG_NAME} documentation"
42-
t.options += %w[--main README --line-numbers --inline-source --tab-width 2]
43-
t.rdoc_files.include 'lib/**/*.rb'
44-
t.rdoc_files.include 'README'
25+
# SimpleCov not available
4526
end
4627

47-
spec = Gem::Specification.new do |s|
48-
s.name = PKG_NAME
49-
s.version = PKG_VERSION
50-
s.summary = %q{Ruby Msg library.}
51-
s.description = %q{A library for reading and converting Outlook msg and pst files (mapi message stores).}
52-
s.authors = ["Charles Lowe"]
53-
s.email = %q{aquasync@gmail.com}
54-
s.homepage = %q{http://code.google.com/p/ruby-msg}
55-
s.rubyforge_project = %q{ruby-msg}
56-
57-
s.executables = ['mapitool']
58-
s.files = FileList['data/*.yaml', 'Rakefile', 'README', 'FIXES']
59-
s.files += FileList['lib/**/*.rb', 'test/test_*.rb', 'bin/*']
60-
61-
s.has_rdoc = true
62-
s.extra_rdoc_files = ['README']
63-
s.rdoc_options += ['--main', 'README',
64-
'--title', "#{PKG_NAME} documentation",
65-
'--tab-width', '2']
66-
67-
s.add_dependency 'ruby-ole', '>=1.2.8'
68-
s.add_dependency 'vpim', '>=0.360'
28+
begin
29+
require 'rdoc/task'
30+
RDoc::Task.new do |t|
31+
t.rdoc_dir = 'doc'
32+
t.rdoc_files.include 'lib/**/*.rb'
33+
t.rdoc_files.include 'README', 'ChangeLog'
34+
t.title = "#{PKG_NAME} documentation"
35+
t.options += %w[--line-numbers --inline-source --tab-width 2]
36+
t.main = 'README'
37+
end
38+
rescue LoadError
39+
# RDoc not available or too old (<2.4.2)
6940
end
7041

71-
Rake::GemPackageTask.new(spec) do |p|
72-
p.gem_spec = spec
73-
p.need_tar = false #true
74-
p.need_zip = false
75-
p.package_dir = 'build'
42+
begin
43+
require 'rubygems/package_task'
44+
Gem::PackageTask.new(spec) do |t|
45+
t.need_tar = true
46+
t.need_zip = false
47+
t.package_dir = 'build'
48+
end
49+
rescue LoadError
50+
# RubyGems too old (<1.3.2)
7651
end
7752

lib/mapi.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1+
require 'mapi/version'
12
require 'mapi/types'
23
require 'mapi/property_set'
34

45
module Mapi
5-
VERSION = '1.5.1'
6-
76
#
87
# Mapi::Item is the base class used for all mapi objects, and is purely a
98
# property set container

lib/mapi/version.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Mapi
2+
VERSION = '1.5.1'
3+
end

ruby-msg.gemspec

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
$:.unshift File.dirname(__FILE__) + '/lib'
2+
require 'mapi/version'
3+
4+
PKG_NAME = 'ruby-msg'
5+
PKG_VERSION = Mapi::VERSION
6+
7+
Gem::Specification.new do |s|
8+
s.name = PKG_NAME
9+
s.version = PKG_VERSION
10+
s.summary = %q{Ruby Msg library.}
11+
s.description = %q{A library for reading and converting Outlook msg and pst files (mapi message stores).}
12+
s.authors = ['Charles Lowe']
13+
s.email = %q{aquasync@gmail.com}
14+
s.homepage = %q{http://code.google.com/p/ruby-msg}
15+
s.rubyforge_project = %q{ruby-msg}
16+
17+
s.executables = ['mapitool']
18+
s.files = ['README', 'COPYING', 'Rakefile', 'ChangeLog', 'ruby-msg.gemspec']
19+
s.files += Dir.glob('data/*.yaml')
20+
s.files += Dir.glob('lib/**/*.rb')
21+
s.files += Dir.glob('test/test_*.rb')
22+
s.files += Dir.glob('bin/*')
23+
24+
s.has_rdoc = true
25+
s.extra_rdoc_files = ['README', 'ChangeLog']
26+
s.rdoc_options += [
27+
'--main', 'README',
28+
'--title', "#{PKG_NAME} documentation",
29+
'--tab-width', '2'
30+
]
31+
32+
s.add_dependency 'ruby-ole', '>=1.2.8'
33+
s.add_dependency 'vpim', '>=0.360'
34+
end
35+

0 commit comments

Comments
 (0)