mailit 2009.08

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,18 @@
1
+ desc 'update changelog'
2
+ task :changelog do
3
+ File.open('CHANGELOG', 'w+') do |changelog|
4
+ `git log -z --abbrev-commit`.split("\0").each do |commit|
5
+ next if commit =~ /^Merge: \d*/
6
+ ref, author, time, _, title, _, message = commit.split("\n", 7)
7
+ ref = ref[/commit ([0-9a-f]+)/, 1]
8
+ author = author[/Author: (.*)/, 1].strip
9
+ time = Time.parse(time[/Date: (.*)/, 1]).utc
10
+ title.strip!
11
+
12
+ changelog.puts "[#{ref} | #{time}] #{author}"
13
+ changelog.puts '', " * #{title}"
14
+ changelog.puts '', message.rstrip if message
15
+ changelog.puts
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,38 @@
1
+ # Copyright (c) 2008-2009 The Rubyists, LLC (effortless systems) <rubyists@rubyists.com>
2
+ # Distributed under the terms of the MIT license.
3
+ # See the LICENSE file that accompanied this software for the full MIT License text
4
+ #
5
+ require "pathname"
6
+ task :legal do
7
+ license = Pathname("LICENSE")
8
+ license.open("w+") do |f|
9
+ f.puts PROJECT_COPYRIGHT
10
+ end unless license.file? and license.read == PROJECT_COPYRIGHT
11
+ doc = Pathname("doc/LEGAL")
12
+ doc.open("w+") do |f|
13
+ f.puts "LICENSE"
14
+ end unless doc.file?
15
+ end
16
+
17
+ desc "add copyright summary to all .rb files in the distribution"
18
+ task :copyright => [:legal] do
19
+ doc = Pathname("doc/LEGAL")
20
+ ignore = doc.readlines.
21
+ select { |line| line.strip!; Pathname(line).file? }.
22
+ map { |file| Pathname(file).expand_path }
23
+
24
+ puts "adding copyright summary to files that don't have it currently"
25
+ puts PROJECT_COPYRIGHT_SUMMARY
26
+ puts
27
+
28
+ (Pathname.glob('{controller,model,app,lib,test,spec}/**/*{.rb}') +
29
+ Pathname.glob("tasks/*.rake") +
30
+ Pathname.glob("Rakefile")).each do |file|
31
+ next if ignore.include? file.expand_path
32
+ lines = file.readlines.map{ |l| l.chomp }
33
+ unless lines.first(PROJECT_COPYRIGHT_SUMMARY.size) == PROJECT_COPYRIGHT_SUMMARY
34
+ oldlines = file.readlines
35
+ file.open("w+") { |f| f.puts PROJECT_COPYRIGHT_SUMMARY + oldlines }
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,23 @@
1
+ require 'rake/gempackagetask'
2
+
3
+ desc "make a gemspec"
4
+ task :gemspec => [:manifest, :changelog, :authors] do
5
+ gemspec_file = "#{GEMSPEC.name}.gemspec"
6
+ File.open(gemspec_file, 'w+'){|gs| gs.puts(GEMSPEC.to_ruby) }
7
+ end
8
+
9
+ desc "package and install from gemspec"
10
+ task :install => [:gemspec] do
11
+ sh "gem build #{GEMSPEC.name}.gemspec"
12
+ sh "gem install #{GEMSPEC.name}-#{GEMSPEC.version}.gem"
13
+ end
14
+
15
+ desc "uninstall the gem"
16
+ task :uninstall => [:clean] do
17
+ sh %{gem uninstall -x #{GEMSPEC.name}}
18
+ end
19
+
20
+ Rake::GemPackageTask.new(GEMSPEC) do |p|
21
+ p.need_tar = true
22
+ p.need_zip = true
23
+ end
@@ -0,0 +1,76 @@
1
+ task :gem_installer do
2
+ class GemInstaller
3
+ def initialize(options = {}, &block)
4
+ @gems = []
5
+ @options = options
6
+
7
+ run(&block)
8
+ end
9
+
10
+ def run(&block)
11
+ instance_eval(&block) if block_given?
12
+ end
13
+
14
+ def gem(name, version = nil, options = {})
15
+ if version.respond_to?(:merge!)
16
+ options = version
17
+ else
18
+ options[:version] = version
19
+ end
20
+
21
+ @gems << [name, options]
22
+ end
23
+
24
+ def setup_gemspec(gemspec)
25
+ gemspec.dependencies.each do |dependency|
26
+ dependency.version_requirements.as_list.each do |version|
27
+ gem(dependency.name, version)
28
+ end
29
+ end
30
+
31
+ setup
32
+ end
33
+
34
+ def setup
35
+ require 'rubygems'
36
+ require 'rubygems/dependency_installer'
37
+
38
+ @gems.each do |name, options|
39
+ setup_gem(name, options)
40
+ end
41
+ end
42
+
43
+ def setup_gem(name, options, try_install = true)
44
+ print "activating #{name} ... "
45
+ Gem.activate(name, *[options[:version]].compact)
46
+ require(options[:lib] || name)
47
+ puts "success."
48
+ rescue LoadError => error
49
+ puts error
50
+ install_gem(name, options) if try_install
51
+ setup_gem(name, options, try_install = false)
52
+ end
53
+
54
+ def install_gem(name, options)
55
+ installer = Gem::DependencyInstaller.new(options)
56
+
57
+ temp_argv(options[:extconf]) do
58
+ print "Installing #{name} ... "
59
+ installer.install(name, options[:version])
60
+ puts "done."
61
+ end
62
+ end
63
+
64
+ def temp_argv(extconf)
65
+ if extconf ||= @options[:extconf]
66
+ old_argv = ARGV.clone
67
+ ARGV.replace(extconf.split(' '))
68
+ end
69
+
70
+ yield
71
+
72
+ ensure
73
+ ARGV.replace(old_argv) if extconf
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,6 @@
1
+ desc 'install dependencies'
2
+ task :install_dependencies => [:gem_installer] do
3
+ GemInstaller.new do
4
+ setup_gemspec(GEMSPEC)
5
+ end
6
+ end
@@ -0,0 +1,4 @@
1
+ desc 'update manifest'
2
+ task :manifest do
3
+ File.open('MANIFEST', 'w+'){|io| io.puts(*GEMSPEC.files) }
4
+ end
@@ -0,0 +1,23 @@
1
+ desc 'code coverage'
2
+ task :rcov => :clean do
3
+ specs = PROJECT_SPECS
4
+
5
+ ignore = %w[ gem rack bacon innate hpricot nagoro/lib/nagoro ]
6
+
7
+ if RUBY_VERSION >= '1.8.7'
8
+ ignore << 'begin_with' << 'end_with'
9
+ end
10
+ if RUBY_VERSION < '1.9'
11
+ ignore << 'fiber'
12
+ end
13
+
14
+ ignored = ignore.join(',')
15
+
16
+ cmd = "rcov --aggregate coverage.data --sort coverage -t --%s -x '#{ignored}' %s"
17
+
18
+ while spec = specs.shift
19
+ puts '', "Gather coverage for #{spec} ..."
20
+ html = specs.empty? ? 'html' : 'no-html'
21
+ sh(cmd % [html, spec])
22
+ end
23
+ end
@@ -0,0 +1,52 @@
1
+ namespace :release do
2
+ task :all => [:release_github, :release_rubyforge]
3
+
4
+ desc 'Display instructions to release on github'
5
+ task :github => [:reversion, :gemspec] do
6
+ name, version = GEMSPEC.name, GEMSPEC.version
7
+
8
+ puts <<INSTRUCTIONS
9
+ First add the relevant files:
10
+
11
+ git add AUTHORS MANIFEST CHANGELOG #{name}.gemspec lib/#{name}/version.rb
12
+
13
+ Then commit them, tag the commit, and push:
14
+
15
+ git commit -m 'Version #{version}'
16
+ git tag -a -m '#{version}' '#{version}'
17
+ git push
18
+
19
+ INSTRUCTIONS
20
+
21
+ end
22
+
23
+ # TODO: Not tested
24
+ desc 'Display instructions to release on rubyforge'
25
+ task :rubyforge => [:reversion, :gemspec, :package] do
26
+ name, version = GEMSPEC.name, GEMSPEC.version.to_s
27
+
28
+ puts <<INSTRUCTIONS
29
+ To publish to rubyforge do following:
30
+
31
+ rubyforge login
32
+ rubyforge add_release #{name} #{name} #{version.dump} pkg/#{name}-#{version}.gem
33
+
34
+ After you have done these steps, see:
35
+
36
+ VERSION=#{version.dump} rake release:rubyforge_archives
37
+
38
+ INSTRUCTIONS
39
+ end
40
+
41
+ desc 'Display instructions to add archives after release:rubyforge'
42
+ task :rubyforge_archives do
43
+ name, version = GEMSPEC.name, GEMSPEC.version.to_s
44
+ puts "Adding archives for distro packagers is:", ""
45
+
46
+ Dir["pkg/#{name}-#{version}.{tgz,zip}"].each do |file|
47
+ puts "rubyforge add_file %s %s %p %p" % [name, name, version, file]
48
+ end
49
+
50
+ puts
51
+ end
52
+ end
@@ -0,0 +1,8 @@
1
+ desc "update version.rb"
2
+ task :reversion do
3
+ File.open("lib/#{GEMSPEC.name}/version.rb", 'w+') do |file|
4
+ file.puts("module #{PROJECT_MODULE}")
5
+ file.puts(' VERSION = %p' % GEMSPEC.version.to_s)
6
+ file.puts('end')
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ desc 'install all possible dependencies'
2
+ task :setup => :gem_installer do
3
+ GemInstaller.new do
4
+ # core
5
+
6
+ # spec
7
+ gem 'bacon'
8
+ gem 'rcov'
9
+
10
+ # doc
11
+ gem 'yard'
12
+
13
+ setup
14
+ end
15
+ end
@@ -0,0 +1,4 @@
1
+ desc 'Generate YARD documentation'
2
+ task :yard => :clean do
3
+ sh("yardoc -o ydoc --protected -r #{PROJECT_README} lib/**/*.rb tasks/*.rake")
4
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mailit
3
+ version: !ruby/object:Gem::Version
4
+ version: "2009.08"
5
+ platform: ruby
6
+ authors:
7
+ - Kevin Berry
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-25 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: The Mailit library, by Kevin Berry
17
+ email: kevinberry@nrs.us
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - AUTHORS
26
+ - CHANGELOG
27
+ - MANIFEST
28
+ - README.md
29
+ - Rakefile
30
+ - lib/mailit.rb
31
+ - lib/mailit/mail.rb
32
+ - lib/mailit/mailer.rb
33
+ - lib/mailit/mime.rb
34
+ - lib/mailit/version.rb
35
+ - lib/version.rb
36
+ - mailit.gemspec
37
+ - spec/helper.rb
38
+ - spec/mailit/mail.rb
39
+ - spec/mailit/mailer.rb
40
+ - tasks/authors.rake
41
+ - tasks/bacon.rake
42
+ - tasks/changelog.rake
43
+ - tasks/copyright.rake
44
+ - tasks/gem.rake
45
+ - tasks/gem_installer.rake
46
+ - tasks/install_dependencies.rake
47
+ - tasks/manifest.rake
48
+ - tasks/rcov.rake
49
+ - tasks/release.rake
50
+ - tasks/reversion.rake
51
+ - tasks/setup.rake
52
+ - tasks/yard.rake
53
+ has_rdoc: true
54
+ homepage: http://github.com/manveru/mailit
55
+ licenses: []
56
+
57
+ post_install_message:
58
+ rdoc_options: []
59
+
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ version:
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: "0"
73
+ version:
74
+ requirements: []
75
+
76
+ rubyforge_project:
77
+ rubygems_version: 1.3.4
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: The Mailit library, by Kevin Berry
81
+ test_files: []
82
+