forked from jkraemer/mail-gpg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
57 lines (52 loc) · 1.17 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
require "bundler/gem_tasks"
require 'rake/testtask'
require 'gpgme'
def setup_gpghome
gpghome = File.join File.dirname(__FILE__), 'test', 'gpghome'
ENV['GNUPGHOME'] = gpghome
ENV['GPG_AGENT_INFO'] = '' # disable gpg agent
unless File.directory? gpghome
FileUtils.mkdir_p gpghome
GPGME::Ctx.new do |gpg|
gpg.generate_key <<-END
<GnupgKeyParms format="internal">
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: Joe Tester
Name-Comment: with stupid passphrase
Name-Email: joe@foo.bar
Expire-Date: 0
Passphrase: abc
</GnupgKeyParms>
END
gpg.generate_key <<-END
<GnupgKeyParms format="internal">
Key-Type: DSA
Key-Length: 1024
Subkey-Type: ELG-E
Subkey-Length: 1024
Name-Real: Jane Doe
Name-Comment: with stupid passphrase
Name-Email: jane@foo.bar
Expire-Date: 0
Passphrase: abc
</GnupgKeyParms>
END
end
end
end
task :default => ["mail_gpg:tests:setup", :test]
namespace :mail_gpg do
namespace :tests do
task :setup do
setup_gpghome
end
end
end
Rake::TestTask.new(:test) do |test|
test.libs << 'test'
test.test_files = FileList['test/**/*_test.rb']
test.verbose = true
end