File: Rakefile

package info (click to toggle)
ruby-mail-gpg 0.4.0-1~bpo9+1
  • links: PTS, VCS
  • area: main
  • in suites: stretch-backports
  • size: 320 kB
  • sloc: ruby: 2,133; makefile: 5
file content (58 lines) | stat: -rw-r--r-- 1,223 bytes parent folder | download | duplicates (2)
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
57
58
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
  test.warning = false
end