clamav 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +8 -0
- data/README +35 -0
- data/ext/clamav/clamav.c +146 -0
- data/ext/clamav/extconf.rb +9 -0
- data/rakefile +67 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/unit/clamav_spec.rb +41 -0
- data/tools/rakehelp.rb +117 -0
- metadata +60 -0
data/ChangeLog
ADDED
data/README
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
ClamAV Ruby binding gem. Based on project clamavr-0.2.0
|
2
|
+
http://raa.ruby-lang.org/project/clamavr/
|
3
|
+
Thanks to MoonWoolf <moonwolf@moonwolf.com>
|
4
|
+
|
5
|
+
== INSTALL
|
6
|
+
|
7
|
+
$ sudo gem install clamav
|
8
|
+
or
|
9
|
+
$ rake package && cd pkg && sudo gem install *.gem
|
10
|
+
|
11
|
+
== REQUIREMENTS
|
12
|
+
|
13
|
+
clamav >= 0.94
|
14
|
+
libclamav5, libclamav-dev
|
15
|
+
|
16
|
+
== USAGE
|
17
|
+
ClamAV.new()
|
18
|
+
return:
|
19
|
+
ClamAV instance
|
20
|
+
|
21
|
+
ClamAV#scanfile(filename, options)
|
22
|
+
filename => filename
|
23
|
+
options => CL_SCAN_STDOPT
|
24
|
+
|
25
|
+
return:
|
26
|
+
virusname or ClamAV returncode(Fixnum)
|
27
|
+
|
28
|
+
== LICENSE
|
29
|
+
GPL
|
30
|
+
|
31
|
+
= Clamav as gem
|
32
|
+
Copyright(c) 2008 Alexander Oryol <eagle.alex@gmail.com>
|
33
|
+
|
34
|
+
= ClamAV/R
|
35
|
+
Copyright(c) 2003-2007 MoonWolf <moonwolf@moonwolf.com>
|
data/ext/clamav/clamav.c
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
#include <clamav.h>
|
2
|
+
#include <ruby.h>
|
3
|
+
|
4
|
+
static VALUE cClamAV;
|
5
|
+
|
6
|
+
struct ClamAV_R {
|
7
|
+
struct cl_engine *root;
|
8
|
+
struct cl_limits limits;
|
9
|
+
unsigned int signo;
|
10
|
+
};
|
11
|
+
|
12
|
+
static void clamavr_free(struct ClamAV_R *ptr) {
|
13
|
+
cl_free(ptr->root);
|
14
|
+
xfree(ptr);
|
15
|
+
}
|
16
|
+
|
17
|
+
static VALUE clamavr_s_allocate(VALUE klass) {
|
18
|
+
struct ClamAV_R *ptr = ALLOC(struct ClamAV_R);
|
19
|
+
int ret;
|
20
|
+
|
21
|
+
ptr->root = NULL;
|
22
|
+
ptr->signo = 0;
|
23
|
+
ret = cl_load(cl_retdbdir(), &ptr->root, &ptr->signo, CL_DB_STDOPT);
|
24
|
+
if(ret) {
|
25
|
+
rb_raise(rb_eRuntimeError, "cl_loaddbdir() error: %s\n", cl_strerror(ret));
|
26
|
+
}
|
27
|
+
cl_build(ptr->root);
|
28
|
+
|
29
|
+
ptr->limits.maxscansize = 10 * 1024 * 1024;
|
30
|
+
ptr->limits.maxfilesize = 10 * 1024 * 1024;
|
31
|
+
ptr->limits.maxreclevel = 100;
|
32
|
+
ptr->limits.maxfiles = 1024;
|
33
|
+
ptr->limits.archivememlim = 1;
|
34
|
+
|
35
|
+
return Data_Wrap_Struct(klass, 0, clamavr_free, ptr);
|
36
|
+
}
|
37
|
+
|
38
|
+
static VALUE clamavr_initialize(VALUE self) {
|
39
|
+
return self;
|
40
|
+
}
|
41
|
+
|
42
|
+
static VALUE clamavr_signo(VALUE self) {
|
43
|
+
struct ClamAV_R *ptr;
|
44
|
+
Data_Get_Struct(self, struct ClamAV_R, ptr);
|
45
|
+
return UINT2NUM(ptr->signo);
|
46
|
+
}
|
47
|
+
|
48
|
+
static VALUE clamavr_scanfile(VALUE self, VALUE v_fname, VALUE v_options) {
|
49
|
+
int ret;
|
50
|
+
const char *virname;
|
51
|
+
struct ClamAV_R *ptr;
|
52
|
+
|
53
|
+
Check_Type(v_fname, T_STRING);
|
54
|
+
Check_Type(v_options, T_FIXNUM);
|
55
|
+
|
56
|
+
Data_Get_Struct(self, struct ClamAV_R, ptr);
|
57
|
+
|
58
|
+
ret = cl_scanfile(RSTRING(v_fname)->ptr, &virname, NULL, ptr->root, &ptr->limits, FIX2INT(v_options));
|
59
|
+
if (ret == CL_VIRUS) {
|
60
|
+
return rb_str_new2(virname);
|
61
|
+
} else {
|
62
|
+
return INT2FIX(ret);
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
void Init_clamav() {
|
67
|
+
cClamAV = rb_define_class("ClamAV", rb_cObject);
|
68
|
+
rb_define_alloc_func(cClamAV, clamavr_s_allocate);
|
69
|
+
rb_define_method(cClamAV, "initialize", clamavr_initialize, 0);
|
70
|
+
|
71
|
+
rb_define_method(cClamAV, "scanfile", clamavr_scanfile, 2);
|
72
|
+
rb_define_method(cClamAV, "signo", clamavr_signo, 0);
|
73
|
+
|
74
|
+
/* return codes */
|
75
|
+
rb_define_const(cClamAV, "CL_CLEAN", INT2FIX(CL_CLEAN)); /* no virus found */
|
76
|
+
rb_define_const(cClamAV, "CL_VIRUS", INT2FIX(CL_VIRUS)); /* virus(es) found */
|
77
|
+
rb_define_const(cClamAV, "CL_SUCCESS", INT2FIX(CL_SUCCESS));
|
78
|
+
rb_define_const(cClamAV, "CL_BREAK", INT2FIX(CL_BREAK));
|
79
|
+
|
80
|
+
rb_define_const(cClamAV, "CL_EMAXREC", INT2FIX(CL_EMAXREC)); /* (internal) recursion limit exceeded */
|
81
|
+
rb_define_const(cClamAV, "CL_EMAXSIZE", INT2FIX(CL_EMAXSIZE)); /* (internal) size limit exceeded */
|
82
|
+
rb_define_const(cClamAV, "CL_EMAXFILES", INT2FIX(CL_EMAXFILES)); /* (internal) files limit exceeded */
|
83
|
+
rb_define_const(cClamAV, "CL_ERAR", INT2FIX(CL_ERAR)); /* rar handler error */
|
84
|
+
rb_define_const(cClamAV, "CL_EZIP", INT2FIX(CL_EZIP)); /* zip handler error */
|
85
|
+
rb_define_const(cClamAV, "CL_EGZIP", INT2FIX(CL_EGZIP)); /* gzip handler error */
|
86
|
+
rb_define_const(cClamAV, "CL_EBZIP", INT2FIX(CL_EBZIP)); /* bzip2 handler error */
|
87
|
+
rb_define_const(cClamAV, "CL_EOLE2", INT2FIX(CL_EOLE2)); /* OLE2 handler error */
|
88
|
+
rb_define_const(cClamAV, "CL_EMSCOMP", INT2FIX(CL_EMSCOMP)); /* MS Expand handler error */
|
89
|
+
rb_define_const(cClamAV, "CL_EMSCAB", INT2FIX(CL_EMSCAB)); /* MS CAB module error */
|
90
|
+
rb_define_const(cClamAV, "CL_EACCES", INT2FIX(CL_EACCES)); /* access denied */
|
91
|
+
rb_define_const(cClamAV, "CL_ENULLARG", INT2FIX(CL_ENULLARG)); /* null argument */
|
92
|
+
rb_define_const(cClamAV, "CL_ETMPFILE", INT2FIX(CL_ETMPFILE)); /* tmpfile() failed */
|
93
|
+
rb_define_const(cClamAV, "CL_EMEM", INT2FIX(CL_EMEM)); /* memory allocation error */
|
94
|
+
rb_define_const(cClamAV, "CL_EOPEN", INT2FIX(CL_EOPEN)); /* file open error */
|
95
|
+
rb_define_const(cClamAV, "CL_EMALFDB", INT2FIX(CL_EMALFDB)); /* malformed database */
|
96
|
+
rb_define_const(cClamAV, "CL_EPATSHORT", INT2FIX(CL_EPATSHORT)); /* pattern too short */
|
97
|
+
rb_define_const(cClamAV, "CL_ETMPDIR", INT2FIX(CL_ETMPDIR)); /* mkdir() failed */
|
98
|
+
rb_define_const(cClamAV, "CL_ECVD", INT2FIX(CL_ECVD)); /* not a CVD file (or broken) */
|
99
|
+
rb_define_const(cClamAV, "CL_ECVDEXTR", INT2FIX(CL_ECVDEXTR)); /* CVD extraction failure */
|
100
|
+
rb_define_const(cClamAV, "CL_EMD5", INT2FIX(CL_EMD5)); /* MD5 verification error */
|
101
|
+
rb_define_const(cClamAV, "CL_EDSIG", INT2FIX(CL_EDSIG)); /* digital signature verification error */
|
102
|
+
rb_define_const(cClamAV, "CL_EIO", INT2FIX(CL_EIO)); /* general I/O error */
|
103
|
+
rb_define_const(cClamAV, "CL_EFORMAT", INT2FIX(CL_EFORMAT)); /* (internal) bad format or broken file */
|
104
|
+
rb_define_const(cClamAV, "CL_ESUPPORT", INT2FIX(CL_ESUPPORT)); /* not supported data format */
|
105
|
+
rb_define_const(cClamAV, "CL_EARJ", INT2FIX(CL_EARJ)); /* ARJ handler error */
|
106
|
+
|
107
|
+
/* db options */
|
108
|
+
rb_define_const(cClamAV, "CL_DB_PHISHING", INT2FIX(CL_DB_PHISHING));
|
109
|
+
rb_define_const(cClamAV, "CL_DB_ACONLY", INT2FIX(CL_DB_ACONLY)); /* WARNING: only for developers */
|
110
|
+
rb_define_const(cClamAV, "CL_DB_PHISHING_URLS", INT2FIX(CL_DB_PHISHING_URLS));
|
111
|
+
rb_define_const(cClamAV, "CL_DB_PUA", INT2FIX(CL_DB_PUA));
|
112
|
+
rb_define_const(cClamAV, "CL_DB_CVDNOTMP", INT2FIX(CL_DB_CVDNOTMP));
|
113
|
+
rb_define_const(cClamAV, "CL_DB_OFFICIAL", INT2FIX(CL_DB_OFFICIAL));
|
114
|
+
rb_define_const(cClamAV, "CL_DB_PUA_MODE", INT2FIX(CL_DB_PUA_MODE));
|
115
|
+
rb_define_const(cClamAV, "CL_DB_PUA_INCLUDE", INT2FIX(CL_DB_PUA_INCLUDE));
|
116
|
+
rb_define_const(cClamAV, "CL_DB_PUA_EXCLUDE", INT2FIX(CL_DB_PUA_EXCLUDE));
|
117
|
+
|
118
|
+
/* recommended db settings */
|
119
|
+
rb_define_const(cClamAV, "CL_DB_STDOPT", INT2FIX(CL_DB_STDOPT));
|
120
|
+
|
121
|
+
/* scan options */
|
122
|
+
rb_define_const(cClamAV, "CL_SCAN_RAW", INT2FIX(CL_SCAN_RAW));
|
123
|
+
rb_define_const(cClamAV, "CL_SCAN_ARCHIVE", INT2FIX(CL_SCAN_ARCHIVE));
|
124
|
+
rb_define_const(cClamAV, "CL_SCAN_MAIL", INT2FIX(CL_SCAN_MAIL));
|
125
|
+
rb_define_const(cClamAV, "CL_SCAN_OLE2", INT2FIX(CL_SCAN_OLE2));
|
126
|
+
rb_define_const(cClamAV, "CL_SCAN_BLOCKENCRYPTED", INT2FIX(CL_SCAN_BLOCKENCRYPTED));
|
127
|
+
rb_define_const(cClamAV, "CL_SCAN_HTML", INT2FIX(CL_SCAN_HTML));
|
128
|
+
rb_define_const(cClamAV, "CL_SCAN_PE", INT2FIX(CL_SCAN_PE));
|
129
|
+
rb_define_const(cClamAV, "CL_SCAN_BLOCKBROKEN", INT2FIX(CL_SCAN_BLOCKBROKEN));
|
130
|
+
rb_define_const(cClamAV, "CL_SCAN_MAILURL", INT2FIX(CL_SCAN_MAILURL));
|
131
|
+
rb_define_const(cClamAV, "CL_SCAN_BLOCKMAX", INT2FIX(CL_SCAN_BLOCKMAX)); /* ignored */
|
132
|
+
rb_define_const(cClamAV, "CL_SCAN_ALGORITHMIC", INT2FIX(CL_SCAN_ALGORITHMIC));
|
133
|
+
rb_define_const(cClamAV, "CL_SCAN_PHISHING_BLOCKSSL", INT2FIX(CL_SCAN_PHISHING_BLOCKSSL)); /* ssl mismatches, not ssl by itself */
|
134
|
+
rb_define_const(cClamAV, "CL_SCAN_PHISHING_BLOCKCLOAK", INT2FIX(CL_SCAN_PHISHING_BLOCKCLOAK));
|
135
|
+
rb_define_const(cClamAV, "CL_SCAN_ELF", INT2FIX(CL_SCAN_ELF));
|
136
|
+
rb_define_const(cClamAV, "CL_SCAN_PDF", INT2FIX(CL_SCAN_PDF));
|
137
|
+
rb_define_const(cClamAV, "CL_SCAN_STRUCTURED", INT2FIX(CL_SCAN_STRUCTURED));
|
138
|
+
rb_define_const(cClamAV, "CL_SCAN_STRUCTURED_SSN_NORMAL", INT2FIX(CL_SCAN_STRUCTURED_SSN_NORMAL));
|
139
|
+
rb_define_const(cClamAV, "CL_SCAN_STRUCTURED_SSN_STRIPPED", INT2FIX(CL_SCAN_STRUCTURED_SSN_STRIPPED));
|
140
|
+
rb_define_const(cClamAV, "CL_SCAN_PARTIAL_MESSAGE", INT2FIX(CL_SCAN_PARTIAL_MESSAGE));
|
141
|
+
rb_define_const(cClamAV, "CL_SCAN_HEURISTIC_PRECEDENCE", INT2FIX(CL_SCAN_HEURISTIC_PRECEDENCE));
|
142
|
+
|
143
|
+
/* recommended scan settings */
|
144
|
+
rb_define_const(cClamAV, "CL_SCAN_STDOPT", INT2FIX(CL_SCAN_STDOPT));
|
145
|
+
|
146
|
+
}
|
data/rakefile
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/clean'
|
4
|
+
require 'rake/gempackagetask'
|
5
|
+
require 'tools/rakehelp'
|
6
|
+
require 'spec/rake/spectask'
|
7
|
+
|
8
|
+
GEM_VERSION="0.2.2"
|
9
|
+
|
10
|
+
setup_extension('clamav', 'clamav')
|
11
|
+
|
12
|
+
desc "Compile native extension"
|
13
|
+
task :compile => [:clamav]
|
14
|
+
|
15
|
+
task :default => [:compile, :spec]
|
16
|
+
|
17
|
+
Spec::Rake::SpecTask.new do |task|
|
18
|
+
task.libs << 'spec'
|
19
|
+
task.spec_files = Dir.glob( 'spec/**/*_spec.rb' )
|
20
|
+
task.verbose = true
|
21
|
+
end
|
22
|
+
|
23
|
+
gemspec = Gem::Specification.new do |gemspec|
|
24
|
+
gemspec.name = "clamav"
|
25
|
+
gemspec.version = GEM_VERSION
|
26
|
+
gemspec.author = "Alexander Oryol"
|
27
|
+
gemspec.email = "eagle.alex@gmail.com"
|
28
|
+
gemspec.summary = "ClamAV Ruby binding"
|
29
|
+
gemspec.description = <<-EOF
|
30
|
+
ClamAV Ruby binding. Based on project clamavr-0.2.0
|
31
|
+
http://raa.ruby-lang.org/project/clamavr/
|
32
|
+
Thanks to MoonWoolf <moonwolf@moonwolf.com>
|
33
|
+
EOF
|
34
|
+
gemspec.files = %w( rakefile README ChangeLog ) +
|
35
|
+
Dir.glob( 'lib/*.rb' ) +
|
36
|
+
Dir.glob( 'spec/*.rb' ) +
|
37
|
+
Dir.glob( 'spec/unit/*.rb' ) +
|
38
|
+
Dir.glob( 'ext/**/*.{c,rb}' ) +
|
39
|
+
Dir.glob( 'tools/*.rb' )
|
40
|
+
gemspec.autorequire = 'clamav'
|
41
|
+
gemspec.require_path = 'lib'
|
42
|
+
# gemspec.add_dependency('builder')
|
43
|
+
|
44
|
+
if RUBY_PLATFORM.match("win32")
|
45
|
+
gemspec.platform = Gem::Platform::WIN32
|
46
|
+
gemspec.files += []
|
47
|
+
else
|
48
|
+
gemspec.platform = Gem::Platform::RUBY
|
49
|
+
gemspec.extensions = Dir.glob( 'ext/**/extconf.rb' )
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
task :package => [:clean, :compile, :spec]
|
54
|
+
Rake::GemPackageTask.new( gemspec ) do |task|
|
55
|
+
task.gem_spec = gemspec
|
56
|
+
task.need_tar = true
|
57
|
+
end
|
58
|
+
|
59
|
+
setup_clean ["ext/clamav/*.{so,o}", "ext/clamav/Makefile", "lib/clamav.so", "pkg", "*.gem"]
|
60
|
+
|
61
|
+
task :install => [:default, :package] do
|
62
|
+
sh %{ sudo gem install pkg/clamav-#{GEM_VERSION}.gem }
|
63
|
+
end
|
64
|
+
|
65
|
+
task :uninstall do
|
66
|
+
sh %{ sudo gem uninstall clamav }
|
67
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
class ClamAV
|
4
|
+
|
5
|
+
describe "class" do
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
@clam = ClamAV.new()
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be instance of Clamav" do
|
12
|
+
@clam.should be_instance_of(ClamAV)
|
13
|
+
end
|
14
|
+
|
15
|
+
FILES = {
|
16
|
+
'robots.txt' => CL_CLEAN,
|
17
|
+
'eicar.com' => 'Eicar-Test-Signature', # EICAR
|
18
|
+
'test.txt' => 'Eicar-Test-Signature', # EICAR in text/plain
|
19
|
+
'clam.cab' => 'ClamAV-Test-File',
|
20
|
+
'clam.exe' => 'ClamAV-Test-File',
|
21
|
+
'clam.exe.bz2' => 'ClamAV-Test-File',
|
22
|
+
'clam.zip' => 'ClamAV-Test-File',
|
23
|
+
'clam-v2.rar' => 'ClamAV-Test-File',
|
24
|
+
'clam-v3.rar' => 'ClamAV-Test-File',
|
25
|
+
'clam-p.rar' => 'Encrypted.RAR', # encripted RAR
|
26
|
+
# Bug in ClamAV https://wwws.clamav.net/bugzilla/show_bug.cgi?id=1134
|
27
|
+
# Fixed in 0.94
|
28
|
+
'clam-ph.rar' => 'Encrypted.RAR', # encripted RAR with encrypted both file data and headers
|
29
|
+
'program.doc' => 'W97M.Class.EB',
|
30
|
+
'Программа.doc' => 'W97M.Class.EB', # filename in UTF-8
|
31
|
+
}
|
32
|
+
|
33
|
+
FILES.each do |file, result|
|
34
|
+
it "should scan #{file} with result #{result.to_s}" do
|
35
|
+
@clam.scanfile(File.join(File.dirname(__FILE__), "../clamav-testfiles/", file),
|
36
|
+
CL_SCAN_STDOPT | CL_SCAN_BLOCKENCRYPTED).should == result
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
data/tools/rakehelp.rb
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
def make(makedir)
|
2
|
+
Dir.chdir(makedir) do
|
3
|
+
sh(PLATFORM =~ /win32/ ? 'nmake' : 'make')
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
|
8
|
+
def extconf(dir)
|
9
|
+
Dir.chdir(dir) do ruby "extconf.rb" end
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def setup_tests
|
14
|
+
Rake::TestTask.new do |t|
|
15
|
+
t.libs << "test"
|
16
|
+
t.test_files = FileList['test/test*.rb']
|
17
|
+
t.verbose = true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def setup_clean otherfiles
|
23
|
+
files = ['build/*', '**/*.o', '**/*.so', '**/*.a', 'lib/*-*', '**/*.log'] + otherfiles
|
24
|
+
CLEAN.include(files)
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def setup_rdoc files
|
29
|
+
Rake::RDocTask.new do |rdoc|
|
30
|
+
rdoc.rdoc_dir = 'doc/rdoc'
|
31
|
+
rdoc.options << '--line-numbers'
|
32
|
+
rdoc.rdoc_files.add(files)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def setup_extension(dir, extension)
|
38
|
+
ext = "ext/#{dir}"
|
39
|
+
ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
|
40
|
+
ext_files = FileList[
|
41
|
+
"#{ext}/*.cpp",
|
42
|
+
"#{ext}/*.h",
|
43
|
+
"#{ext}/extconf.rb",
|
44
|
+
"#{ext}/Makefile",
|
45
|
+
"lib"
|
46
|
+
]
|
47
|
+
|
48
|
+
task "lib" do
|
49
|
+
directory "lib"
|
50
|
+
end
|
51
|
+
|
52
|
+
desc "Builds just the #{extension} extension"
|
53
|
+
task extension.to_sym => ["#{ext}/Makefile", ext_so ]
|
54
|
+
|
55
|
+
file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
|
56
|
+
extconf "#{ext}"
|
57
|
+
end
|
58
|
+
|
59
|
+
file ext_so => ext_files do
|
60
|
+
make "#{ext}"
|
61
|
+
cp ext_so, "lib"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
def base_gem_spec(pkg_name, pkg_version)
|
67
|
+
rm_rf "test/coverage"
|
68
|
+
pkg_version = pkg_version
|
69
|
+
pkg_name = pkg_name
|
70
|
+
pkg_file_name = "#{pkg_name}-#{pkg_version}"
|
71
|
+
Gem::Specification.new do |s|
|
72
|
+
s.name = pkg_name
|
73
|
+
s.version = pkg_version
|
74
|
+
s.platform = Gem::Platform::RUBY
|
75
|
+
s.has_rdoc = true
|
76
|
+
s.extra_rdoc_files = [ "README" ]
|
77
|
+
|
78
|
+
s.files = %w(COPYING LICENSE README Rakefile) +
|
79
|
+
Dir.glob("{bin,doc/rdoc,test}/**/*") +
|
80
|
+
Dir.glob("ext/**/*.{h,cpp,rb,rl}") +
|
81
|
+
Dir.glob("{examples,tools,lib}/**/*.rb")
|
82
|
+
|
83
|
+
s.require_path = "lib"
|
84
|
+
s.extensions = FileList["ext/**/extconf.rb"].to_a
|
85
|
+
s.bindir = "bin"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def setup_gem(pkg_name, pkg_version)
|
90
|
+
spec = base_gem_spec(pkg_name, pkg_version)
|
91
|
+
yield spec if block_given?
|
92
|
+
|
93
|
+
Rake::GemPackageTask.new(spec) do |p|
|
94
|
+
p.gem_spec = spec
|
95
|
+
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def sub_project(project, *targets)
|
100
|
+
targets.each do |target|
|
101
|
+
Dir.chdir "projects/#{project}" do
|
102
|
+
sh %{rake --trace #{target.to_s} }
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# Conditional require rcov/rcovtask if present
|
108
|
+
begin
|
109
|
+
require 'rcov/rcovtask'
|
110
|
+
|
111
|
+
Rcov::RcovTask.new do |t|
|
112
|
+
t.test_files = FileList['test/test*.rb']
|
113
|
+
t.rcov_opts << "-x /usr"
|
114
|
+
t.output_dir = "test/coverage"
|
115
|
+
end
|
116
|
+
rescue Object
|
117
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: clamav
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alexander Oryol
|
8
|
+
autorequire: clamav
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-09-08 00:00:00 +04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: ClamAV Ruby binding. Based on project clamavr-0.2.0 http://raa.ruby-lang.org/project/clamavr/ Thanks to MoonWoolf <moonwolf@moonwolf.com>
|
17
|
+
email: eagle.alex@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions:
|
21
|
+
- ext/clamav/extconf.rb
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
24
|
+
files:
|
25
|
+
- rakefile
|
26
|
+
- README
|
27
|
+
- ChangeLog
|
28
|
+
- spec/spec_helper.rb
|
29
|
+
- spec/unit/clamav_spec.rb
|
30
|
+
- ext/clamav/clamav.c
|
31
|
+
- ext/clamav/extconf.rb
|
32
|
+
- tools/rakehelp.rb
|
33
|
+
has_rdoc: false
|
34
|
+
homepage:
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
version:
|
46
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
version:
|
52
|
+
requirements: []
|
53
|
+
|
54
|
+
rubyforge_project:
|
55
|
+
rubygems_version: 1.2.0
|
56
|
+
signing_key:
|
57
|
+
specification_version: 2
|
58
|
+
summary: ClamAV Ruby binding
|
59
|
+
test_files: []
|
60
|
+
|