RubyInline 3.3.0 → 3.3.1
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/History.txt +7 -0
- data/Makefile +8 -4
- data/README.txt +15 -3
- data/inline.gemspec +4 -0
- data/inline.rb +91 -9
- data/inline_package +8 -121
- data/test_inline.rb +41 -64
- metadata +5 -4
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
*** 3.3.1 / 2005-05-03
|
2
|
+
|
3
|
+
+ 3 bug fixes
|
4
|
+
+ Fixed a bug w/ unit tests involving caching of rootdir.
|
5
|
+
+ Added a minor tweak to the file discovery when called through eval.
|
6
|
+
+ Moved the packaging code into inline.rb in order to get rubygems wrapped scripts to work again (wrapper was breaking due to __FILE__ != $0).
|
7
|
+
|
1
8
|
*** 3.3.0 / 2005-04-22
|
2
9
|
|
3
10
|
+ 2 minor enhancement
|
data/Makefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
RUBY?=/usr/local/bin/ruby
|
2
2
|
RDOC?=rdoc18
|
3
3
|
RUBYLIB=$(shell $(RUBY) -rrbconfig -e 'include Config; print CONFIG["sitelibdir"]')
|
4
|
+
PREFIX?=/usr/local
|
4
5
|
|
5
6
|
test:
|
6
7
|
$(RUBY) -I. -w ./test_inline.rb
|
@@ -29,13 +30,16 @@ bench:
|
|
29
30
|
@$(RUBY) -I. ./example.rb 2 2> /dev/null
|
30
31
|
|
31
32
|
install:
|
32
|
-
echo "installing inline.rb in $(RUBYLIB)"
|
33
|
-
cp -f inline.rb $(RUBYLIB)
|
33
|
+
echo "installing inline.rb in $(RUBYLIB)"
|
34
|
+
cp -f inline.rb $(RUBYLIB)
|
35
|
+
cp -f inline_package $(PREFIX)/bin
|
36
|
+
chmod 755 $(PREFIX)/bin/inline_package
|
34
37
|
echo Installed
|
35
38
|
|
36
39
|
uninstall:
|
37
|
-
echo "Removing inline.rb from $(RUBYLIB)"
|
38
|
-
rm $(RUBYLIB)/inline.rb
|
40
|
+
echo "Removing inline.rb from $(RUBYLIB)"
|
41
|
+
rm $(RUBYLIB)/inline.rb
|
42
|
+
rm -f $(PREFIX)/bin/inline_package
|
39
43
|
echo Removed
|
40
44
|
|
41
45
|
clean:
|
data/README.txt
CHANGED
@@ -11,6 +11,10 @@ directly. By writing simple builder classes, you can teach how to cope
|
|
11
11
|
with new languages (fortran, perl, whatever). The code is compiled and
|
12
12
|
run on the fly when needed.
|
13
13
|
|
14
|
+
Using the package_inline tool Inline now allows you to package up
|
15
|
+
your inlined object code for distribution to systems without a
|
16
|
+
compiler (read: windows)!
|
17
|
+
|
14
18
|
** FEATURES/PROBLEMS:
|
15
19
|
|
16
20
|
+ Quick and easy inlining of your C or C++ code embedded in your ruby script.
|
@@ -20,7 +24,8 @@ run on the fly when needed.
|
|
20
24
|
+ inline_c_raw exists for when the automatic conversion isn't sufficient.
|
21
25
|
+ Only recompiles if the inlined code has changed.
|
22
26
|
+ Pretends to be secure.
|
23
|
-
+ Only
|
27
|
+
+ Only requires standard ruby libraries, nothing extra to download.
|
28
|
+
+ Can generate a basic Rakefile and package up built extensions for distribution.
|
24
29
|
|
25
30
|
** SYNOPSYS:
|
26
31
|
|
@@ -55,6 +60,13 @@ run on the fly when needed.
|
|
55
60
|
t = MyTest.new()
|
56
61
|
t.hello(3)
|
57
62
|
|
63
|
+
** SYNOPSYS (packaging):
|
64
|
+
|
65
|
+
rm -rf ~/.ruby_inline
|
66
|
+
make test
|
67
|
+
inline_package packagename 1.0.0
|
68
|
+
ls lib/inline
|
69
|
+
|
58
70
|
** (PSEUDO)BENCHMARKS:
|
59
71
|
|
60
72
|
> make bench
|
@@ -86,7 +98,7 @@ run on the fly when needed.
|
|
86
98
|
+ POSIX compliant system (ie pretty much any UNIX, or Cygwin on MS platforms).
|
87
99
|
+ A C/C++ compiler (the same one that compiled your ruby interpreter).
|
88
100
|
+ test::unit for running tests ( http://testunit.talbott.ws/ ).
|
89
|
-
+ rubygems if you'd like.
|
101
|
+
+ rubygems & rake if you'd like - these are used by inline_package.
|
90
102
|
|
91
103
|
** INSTALL:
|
92
104
|
|
@@ -97,7 +109,7 @@ run on the fly when needed.
|
|
97
109
|
|
98
110
|
(The MIT License)
|
99
111
|
|
100
|
-
Copyright (c) 2001-
|
112
|
+
Copyright (c) 2001-2005 Ryan Davis, Zen Spider Software
|
101
113
|
|
102
114
|
Permission is hereby granted, free of charge, to any person obtaining
|
103
115
|
a copy of this software and associated documentation files (the
|
data/inline.gemspec
CHANGED
@@ -16,6 +16,10 @@ spec = Gem::Specification.new do |s|
|
|
16
16
|
s.requirements << "A POSIX environment and a compiler for your language."
|
17
17
|
s.files = IO.readlines("Manifest.txt").map {|f| f.chomp }
|
18
18
|
|
19
|
+
s.bindir = "."
|
20
|
+
s.executables = ['inline_package']
|
21
|
+
puts "Executables = #{s.executables.join(", ")}"
|
22
|
+
|
19
23
|
s.require_path = '.'
|
20
24
|
s.autorequire = 'inline'
|
21
25
|
|
data/inline.rb
CHANGED
@@ -36,8 +36,9 @@
|
|
36
36
|
# at Module#inline for the required API.
|
37
37
|
|
38
38
|
require "rbconfig"
|
39
|
-
require "ftools"
|
40
39
|
require "digest/md5"
|
40
|
+
require 'ftools'
|
41
|
+
require 'fileutils'
|
41
42
|
|
42
43
|
$TESTING = false unless defined? $TESTING
|
43
44
|
|
@@ -50,14 +51,15 @@ class CompilationError < RuntimeError; end
|
|
50
51
|
# the current namespace.
|
51
52
|
|
52
53
|
module Inline
|
53
|
-
VERSION = '3.3.
|
54
|
+
VERSION = '3.3.1'
|
54
55
|
|
55
56
|
$stderr.puts "RubyInline v #{VERSION}" if $DEBUG
|
56
57
|
|
57
58
|
protected
|
58
59
|
|
59
60
|
def self.rootdir
|
60
|
-
|
61
|
+
env = ENV['INLINEDIR'] || ENV['HOME']
|
62
|
+
unless defined? @@rootdir and env == @@rootdir and test ?d, @@rootdir then
|
61
63
|
rootdir = ENV['INLINEDIR'] || ENV['HOME']
|
62
64
|
Dir.mkdir rootdir, 0700 unless test ?d, rootdir
|
63
65
|
Dir.assert_secure rootdir
|
@@ -68,8 +70,8 @@ module Inline
|
|
68
70
|
end
|
69
71
|
|
70
72
|
def self.directory
|
71
|
-
|
72
|
-
|
73
|
+
directory = File.join(rootdir, ".ruby_inline")
|
74
|
+
unless defined? @@directory and directory == @@directory and test ?d, @@directory then
|
73
75
|
unless File.directory? directory then
|
74
76
|
$stderr.puts "NOTE: creating #{directory} for RubyInline" if $DEBUG
|
75
77
|
Dir.mkdir directory, 0700
|
@@ -251,7 +253,10 @@ module Inline
|
|
251
253
|
end
|
252
254
|
|
253
255
|
def build
|
254
|
-
|
256
|
+
real_caller = caller[1]
|
257
|
+
real_caller = caller[4] if real_caller =~ /\(eval\)/
|
258
|
+
real_caller = real_caller.split(/:/).first
|
259
|
+
@rb_file = File.expand_path(real_caller) # [MS]
|
255
260
|
so_exists = File.file? @so_name
|
256
261
|
|
257
262
|
unless so_exists and File.mtime(@rb_file) < File.mtime(@so_name)
|
@@ -334,7 +339,7 @@ module Inline
|
|
334
339
|
cmd += " 2> /dev/null" if $TESTING
|
335
340
|
|
336
341
|
$stderr.puts "Building #{@so_name} with '#{cmd}'" if $DEBUG
|
337
|
-
|
342
|
+
`#{cmd}`
|
338
343
|
if $? != 0 then
|
339
344
|
bad_src_name = src_name + ".bad"
|
340
345
|
File.rename src_name, bad_src_name
|
@@ -353,7 +358,13 @@ module Inline
|
|
353
358
|
@mod = mod
|
354
359
|
if @mod then
|
355
360
|
# Figure out which script file defined the C code
|
356
|
-
|
361
|
+
|
362
|
+
real_caller = caller[2]
|
363
|
+
real_caller = caller[5] if real_caller =~ /\(eval\)/
|
364
|
+
real_caller = real_caller.split(/:/).first
|
365
|
+
|
366
|
+
@rb_file = File.expand_path(real_caller) # [MS]
|
367
|
+
|
357
368
|
# Extract the basename of the script and clean it up to be
|
358
369
|
# a valid C identifier
|
359
370
|
rb_script_name = File.basename(@rb_file).gsub(/[^a-zA-Z0-9_]/,'_')
|
@@ -429,6 +440,78 @@ module Inline
|
|
429
440
|
end
|
430
441
|
|
431
442
|
end # class Inline::C
|
443
|
+
|
444
|
+
class Packager
|
445
|
+
attr_accessor :name, :version, :summary, :libs_copied, :inline_dir
|
446
|
+
|
447
|
+
def initialize(name, version, summary = '')
|
448
|
+
@name = name
|
449
|
+
@version = version
|
450
|
+
@summary = summary
|
451
|
+
@libs_copied = false
|
452
|
+
@ext = Config::CONFIG['DLEXT']
|
453
|
+
|
454
|
+
# TODO (maybe) put libs in platform dir
|
455
|
+
@inline_dir = File.join "lib", "inline"
|
456
|
+
end
|
457
|
+
|
458
|
+
def package
|
459
|
+
copy_libs
|
460
|
+
generate_rakefile
|
461
|
+
build_gem
|
462
|
+
end
|
463
|
+
|
464
|
+
def copy_libs
|
465
|
+
unless @libs_copied then
|
466
|
+
FileUtils.mkdir_p @inline_dir
|
467
|
+
built_libs = Dir.glob File.join(Inline.directory, "*.#{@ext}")
|
468
|
+
FileUtils.cp built_libs, @inline_dir
|
469
|
+
@libs_copied = true
|
470
|
+
end
|
471
|
+
end
|
472
|
+
|
473
|
+
def generate_rakefile
|
474
|
+
if File.exists? 'Rakefile' then
|
475
|
+
unless $TESTING then
|
476
|
+
STDERR.puts "Hrm, you already have a Rakefile, so I didn't touch it."
|
477
|
+
STDERR.puts "You might have to add the following files to your gemspec's files list:"
|
478
|
+
STDERR.puts "\t#{gem_libs.join "\n\t"}"
|
479
|
+
end
|
480
|
+
return
|
481
|
+
end
|
482
|
+
|
483
|
+
rakefile = eval RAKEFILE_TEMPLATE
|
484
|
+
|
485
|
+
STDERR.puts "==> Generating Rakefile" unless $TESTING
|
486
|
+
File.open 'Rakefile', 'w' do |fp|
|
487
|
+
fp.puts rakefile
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
def build_gem
|
492
|
+
STDERR.puts "==> Running rake" unless $TESTING
|
493
|
+
|
494
|
+
cmd = "rake package"
|
495
|
+
cmd += "> /dev/null 2> /dev/null" if $TESTING
|
496
|
+
system cmd
|
497
|
+
|
498
|
+
STDERR.puts unless $TESTING
|
499
|
+
STDERR.puts "Ok, you now have a gem in ./pkg, enjoy!" unless $TESTING
|
500
|
+
end
|
501
|
+
|
502
|
+
def gem_libs
|
503
|
+
unless defined? @gem_libs then
|
504
|
+
@gem_libs = Dir.glob File.join(@inline_dir, "*.#{@ext}")
|
505
|
+
files = Dir.glob(File.join('lib', '*')).select { |f| test ?f, f }
|
506
|
+
|
507
|
+
@gem_libs.push(*files)
|
508
|
+
@gem_libs.sort!
|
509
|
+
end
|
510
|
+
@gem_libs
|
511
|
+
end
|
512
|
+
|
513
|
+
RAKEFILE_TEMPLATE = '%[require "rake"\nrequire "rake/gempackagetask"\n\nsummary = #{summary.inspect}\n\nif summary.empty? then\n STDERR.puts "*************************************"\n STDERR.puts "*** Summary not filled in, SHAME! ***"\n STDERR.puts "*************************************"\nend\n\nspec = Gem::Specification.new do |s|\n s.name = #{name.inspect}\n s.version = #{version.inspect}\n s.summary = summary\n\n s.has_rdoc = false\n s.files = #{gem_libs.inspect}\n s.add_dependency "RubyInline", ">= 3.3.0"\n s.require_path = "lib"\nend\n\ndesc "Builds a gem with #{name} in it"\nRake::GemPackageTask.new spec do |pkg|\n pkg.need_zip = false\n pkg.need_tar = false\nend\n]'
|
514
|
+
end # class Packager
|
432
515
|
end # module Inline
|
433
516
|
|
434
517
|
class Module
|
@@ -479,7 +562,6 @@ class File
|
|
479
562
|
|
480
563
|
return renamed
|
481
564
|
end
|
482
|
-
|
483
565
|
end # class File
|
484
566
|
|
485
567
|
class Dir
|
data/inline_package
CHANGED
@@ -1,128 +1,15 @@
|
|
1
1
|
#!/usr/local/bin/ruby -w
|
2
2
|
|
3
|
-
require 'rbconfig'
|
4
|
-
require 'fileutils'
|
5
3
|
require 'inline'
|
6
4
|
|
7
|
-
|
5
|
+
name = ARGV.shift
|
6
|
+
version = ARGV.shift
|
7
|
+
summary = ARGV.shift || ""
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
%[require 'rake'
|
13
|
-
require 'rake/gempackagetask'
|
14
|
-
|
15
|
-
summary = #{summary.inspect}
|
16
|
-
|
17
|
-
if summary.empty? then
|
18
|
-
STDERR.puts "*************************************"
|
19
|
-
STDERR.puts "*** Summary not filled in, SHAME! ***"
|
20
|
-
STDERR.puts "*************************************"
|
21
|
-
end
|
22
|
-
|
23
|
-
spec = Gem::Specification.new do |s|
|
24
|
-
s.name = #{name.inspect}
|
25
|
-
s.version = #{version.inspect}
|
26
|
-
s.summary = summary
|
27
|
-
|
28
|
-
s.has_rdoc = false
|
29
|
-
s.files = #{gem_libs.inspect}
|
30
|
-
s.add_dependency 'RubyInline', '>= 3.3.0'
|
31
|
-
s.require_path = 'lib'
|
32
|
-
end
|
33
|
-
|
34
|
-
desc "Builds a gem with #{name} in it"
|
35
|
-
Rake::GemPackageTask.new spec do |pkg|
|
36
|
-
pkg.need_zip = false
|
37
|
-
pkg.need_tar = false
|
38
|
-
end
|
39
|
-
]
|
40
|
-
EOF
|
41
|
-
|
42
|
-
attr_accessor :name, :version, :summary
|
43
|
-
|
44
|
-
def initialize(name, version, summary = '')
|
45
|
-
@name = name
|
46
|
-
@version = version
|
47
|
-
@summary = summary
|
48
|
-
|
49
|
-
@libs_copied = false
|
50
|
-
end
|
51
|
-
|
52
|
-
def package
|
53
|
-
copy_libs
|
54
|
-
generate_rakefile
|
55
|
-
build_gem
|
56
|
-
end
|
57
|
-
|
58
|
-
def copy_libs
|
59
|
-
FileUtils.mkdir_p inline_dir
|
60
|
-
FileUtils.cp built_libs, inline_dir
|
61
|
-
@libs_copied = true
|
62
|
-
end
|
63
|
-
|
64
|
-
def generate_rakefile
|
65
|
-
if File.exists? 'Rakefile' then
|
66
|
-
unless $TESTING then
|
67
|
-
STDERR.puts "Hrm, you already have a Rakefile, so I didn't touch it."
|
68
|
-
STDERR.puts "You might have to add the following files to your gemspec's files list:"
|
69
|
-
STDERR.puts "\t#{gem_libs.join "\n\t"}"
|
70
|
-
end
|
71
|
-
return
|
72
|
-
end
|
73
|
-
|
74
|
-
rakefile = eval RAKEFILE_TEMPLATE
|
75
|
-
|
76
|
-
STDERR.puts "==> Generating Rakefile" unless $TESTING
|
77
|
-
File.open 'Rakefile', 'w' do |fp|
|
78
|
-
fp.puts rakefile
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def build_gem
|
83
|
-
STDERR.puts "==> Running rake" unless $TESTING
|
84
|
-
|
85
|
-
cmd = "rake package"
|
86
|
-
cmd += "> /dev/null 2> /dev/null" if $TESTING
|
87
|
-
system cmd
|
88
|
-
|
89
|
-
STDERR.puts unless $TESTING
|
90
|
-
STDERR.puts "Ok, you now have a gem in ./pkg, enjoy!" unless $TESTING
|
91
|
-
end
|
92
|
-
|
93
|
-
def inline_dir
|
94
|
-
@inline_dir ||= File.join "lib", "inline" # TODO put libs in platform dir
|
95
|
-
end
|
96
|
-
|
97
|
-
def built_libs
|
98
|
-
Dir.glob File.join(Inline.directory, "*.#{Config::CONFIG['DLEXT']}")
|
99
|
-
end
|
100
|
-
|
101
|
-
def gem_libs
|
102
|
-
copy_libs unless @libs_copied
|
103
|
-
unless defined? @gem_libs then
|
104
|
-
@gem_libs = Dir.glob File.join(inline_dir, "*.#{Config::CONFIG['DLEXT']}")
|
105
|
-
files = Dir.glob(File.join('lib', '*')).select { |f| test ?f, f }
|
106
|
-
|
107
|
-
@gem_libs.push(*files)
|
108
|
-
@gem_libs.sort!
|
109
|
-
end
|
110
|
-
@gem_libs
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
if __FILE__ == $0 then
|
116
|
-
name = ARGV.shift
|
117
|
-
version = ARGV.shift
|
118
|
-
summary = ARGV.shift || ""
|
119
|
-
|
120
|
-
if version.nil? then # TODO better usage
|
121
|
-
STDERR.puts "Usage: packager NAME VERSION SUMMARY"
|
122
|
-
exit 1
|
123
|
-
end
|
124
|
-
|
125
|
-
packager = Packager.new name, version, summary
|
126
|
-
packager.package
|
9
|
+
if version.nil? then # TODO better usage
|
10
|
+
STDERR.puts "Usage: #{$0} NAME VERSION [SUMMARY]"
|
11
|
+
exit 1
|
127
12
|
end
|
128
13
|
|
14
|
+
packager = Inline::Packager.new name, version, summary
|
15
|
+
packager.package
|
data/test_inline.rb
CHANGED
@@ -3,26 +3,40 @@
|
|
3
3
|
$TESTING = true
|
4
4
|
|
5
5
|
require 'inline'
|
6
|
-
load 'inline_package'
|
7
6
|
require 'tempfile'
|
8
7
|
require 'test/unit'
|
9
8
|
|
10
9
|
File.umask(0)
|
11
10
|
|
12
|
-
class
|
11
|
+
class InlineTestCase < Test::Unit::TestCase
|
13
12
|
|
14
13
|
def setup
|
15
|
-
|
16
|
-
@
|
17
|
-
Dir.mkdir @
|
14
|
+
super
|
15
|
+
@rootdir = "/tmp/#{$$}"
|
16
|
+
Dir.mkdir @rootdir, 0700
|
17
|
+
ENV['INLINEDIR'] = @rootdir
|
18
18
|
end
|
19
19
|
|
20
20
|
def teardown
|
21
|
-
|
21
|
+
FileUtils.rm_rf @rootdir unless $DEBUG
|
22
|
+
ENV.delete 'INLINEDIR'
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_stupid
|
26
|
+
#shuts test unit up
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
class TestDir < InlineTestCase
|
32
|
+
|
33
|
+
def setup
|
34
|
+
super
|
35
|
+
@count = 1
|
22
36
|
end
|
23
37
|
|
24
38
|
def util_assert_secure(perms, should_pass)
|
25
|
-
path = File.join(@
|
39
|
+
path = File.join(@rootdir, @count.to_s)
|
26
40
|
@count += 1
|
27
41
|
Dir.mkdir path, perms unless perms.nil?
|
28
42
|
if should_pass then
|
@@ -48,17 +62,7 @@ class TestDir < Test::Unit::TestCase
|
|
48
62
|
end
|
49
63
|
end
|
50
64
|
|
51
|
-
class TestInline <
|
52
|
-
|
53
|
-
def setup
|
54
|
-
@rootdir = "/tmp/#{$$}"
|
55
|
-
Dir.mkdir @rootdir, 0700
|
56
|
-
ENV['INLINEDIR'] = @rootdir
|
57
|
-
end
|
58
|
-
|
59
|
-
def teardown
|
60
|
-
`rm -rf #{@rootdir}` unless $DEBUG
|
61
|
-
end
|
65
|
+
class TestInline < InlineTestCase
|
62
66
|
|
63
67
|
def test_rootdir
|
64
68
|
assert_equal(@rootdir, Inline.rootdir)
|
@@ -72,7 +76,7 @@ class TestInline < Test::Unit::TestCase
|
|
72
76
|
end
|
73
77
|
|
74
78
|
class TestInline
|
75
|
-
class TestC <
|
79
|
+
class TestC < InlineTestCase
|
76
80
|
|
77
81
|
# quick hack to make tests more readable,
|
78
82
|
# does nothing I wouldn't otherwise do...
|
@@ -540,16 +544,7 @@ module Foo
|
|
540
544
|
end
|
541
545
|
EOR
|
542
546
|
|
543
|
-
class TestModule <
|
544
|
-
|
545
|
-
def setup
|
546
|
-
@rootdir = "/tmp/#{$$}"
|
547
|
-
ENV['INLINEDIR'] = @rootdir
|
548
|
-
end
|
549
|
-
|
550
|
-
def teardown
|
551
|
-
`rm -rf #{@rootdir}` unless $DEBUG
|
552
|
-
end
|
547
|
+
class TestModule < InlineTestCase
|
553
548
|
|
554
549
|
def test_nested
|
555
550
|
Object.class_eval $test_module_code
|
@@ -584,21 +579,17 @@ class TestModule < Test::Unit::TestCase
|
|
584
579
|
|
585
580
|
end
|
586
581
|
|
587
|
-
class
|
582
|
+
class TestInlinePackager < InlineTestCase
|
588
583
|
|
589
584
|
def setup
|
585
|
+
super
|
590
586
|
@name = "Packager Test"
|
591
587
|
@version = "1.0.0"
|
592
588
|
@summary = "This is a Packager test gem"
|
593
|
-
@packager = Packager.new @name, @version, @summary
|
589
|
+
@packager = Inline::Packager.new @name, @version, @summary
|
594
590
|
|
595
|
-
@
|
596
|
-
@package_dir
|
597
|
-
|
598
|
-
ENV['INLINEDIR'] = @inline_dir
|
599
|
-
|
600
|
-
Dir.mkdir @inline_dir, 0700
|
601
|
-
Dir.mkdir @package_dir, 0700
|
591
|
+
@package_dir = @rootdir + "_package"
|
592
|
+
Dir.mkdir @package_dir, 0700 # unless test ?d, @package_dir
|
602
593
|
@orig_dir = Dir.pwd
|
603
594
|
Dir.chdir @package_dir
|
604
595
|
|
@@ -606,10 +597,9 @@ class TestPackager < Test::Unit::TestCase
|
|
606
597
|
end
|
607
598
|
|
608
599
|
def teardown
|
600
|
+
super
|
609
601
|
Dir.chdir @orig_dir
|
610
|
-
|
611
|
-
`rm -rf #{@inline_dir}`
|
612
|
-
`rm -rf #{@package_dir}`
|
602
|
+
FileUtils.rm_rf @package_dir unless $DEBUG
|
613
603
|
end
|
614
604
|
|
615
605
|
def util_generate_rakefile
|
@@ -618,7 +608,12 @@ class TestPackager < Test::Unit::TestCase
|
|
618
608
|
version = @version
|
619
609
|
gem_libs = []
|
620
610
|
|
621
|
-
eval Packager::RAKEFILE_TEMPLATE
|
611
|
+
eval Inline::Packager::RAKEFILE_TEMPLATE
|
612
|
+
end
|
613
|
+
|
614
|
+
def test_initialize
|
615
|
+
assert_equal "lib/inline", @packager.inline_dir
|
616
|
+
assert_equal false, @packager.libs_copied
|
622
617
|
end
|
623
618
|
|
624
619
|
def test_package
|
@@ -628,10 +623,10 @@ class TestPackager < Test::Unit::TestCase
|
|
628
623
|
end
|
629
624
|
|
630
625
|
def test_copy_libs
|
631
|
-
assert_equal false, @packager.
|
626
|
+
assert_equal false, @packager.libs_copied
|
632
627
|
|
633
628
|
built_lib = "Inline_Test.#{@ext}"
|
634
|
-
dir = "#{@
|
629
|
+
dir = "#{@rootdir}/.ruby_inline"
|
635
630
|
|
636
631
|
Dir.mkdir dir, 0700
|
637
632
|
Dir.chdir dir do
|
@@ -643,7 +638,7 @@ class TestPackager < Test::Unit::TestCase
|
|
643
638
|
assert_equal true, File.directory?("#{@package_dir}/lib/inline")
|
644
639
|
assert_equal true, File.exists?("#{@package_dir}/lib/inline/#{built_lib}")
|
645
640
|
|
646
|
-
assert_equal true, @packager.
|
641
|
+
assert_equal true, @packager.libs_copied
|
647
642
|
end
|
648
643
|
|
649
644
|
def test_generate_rakefile_has_rakefile
|
@@ -671,24 +666,8 @@ class TestPackager < Test::Unit::TestCase
|
|
671
666
|
assert_equal true, system("gem check #{package_name}")
|
672
667
|
end
|
673
668
|
|
674
|
-
def test_inline_dir
|
675
|
-
assert_equal "lib/inline", @packager.inline_dir
|
676
|
-
end
|
677
|
-
|
678
|
-
def test_built_libs
|
679
|
-
expected = ["Inline_Test.#{@ext}"]
|
680
|
-
|
681
|
-
dir = "#{@inline_dir}/.ruby_inline"
|
682
|
-
Dir.mkdir dir, 0700
|
683
|
-
Dir.chdir dir
|
684
|
-
|
685
|
-
FileUtils.touch(expected)
|
686
|
-
|
687
|
-
assert_equal expected.map { |f| "#{dir}/#{f}"}, @packager.built_libs
|
688
|
-
end
|
689
|
-
|
690
669
|
def test_gem_libs
|
691
|
-
@packager.
|
670
|
+
@packager.libs_copied = true
|
692
671
|
expected = ["lib/blah.rb", "lib/inline/Inline_Test.#{@ext}"]
|
693
672
|
|
694
673
|
FileUtils.mkdir_p "lib/inline"
|
@@ -696,6 +675,4 @@ class TestPackager < Test::Unit::TestCase
|
|
696
675
|
|
697
676
|
assert_equal expected, @packager.gem_libs
|
698
677
|
end
|
699
|
-
|
700
678
|
end
|
701
|
-
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.10
|
|
3
3
|
specification_version: 1
|
4
4
|
name: RubyInline
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 3.3.
|
7
|
-
date: 2005-
|
6
|
+
version: 3.3.1
|
7
|
+
date: 2005-05-03
|
8
8
|
summary: Multi-language extension coding within ruby.
|
9
9
|
require_paths:
|
10
10
|
- "."
|
@@ -17,7 +17,7 @@ description: "Ruby Inline is an analog to Perl's Inline::C. Out of the box, it a
|
|
17
17
|
whatever). The code is compiled and run on the fly when needed."
|
18
18
|
autorequire: inline
|
19
19
|
default_executable:
|
20
|
-
bindir:
|
20
|
+
bindir: "."
|
21
21
|
has_rdoc: false
|
22
22
|
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
23
23
|
requirements:
|
@@ -46,7 +46,8 @@ test_files:
|
|
46
46
|
- test_inline.rb
|
47
47
|
rdoc_options: []
|
48
48
|
extra_rdoc_files: []
|
49
|
-
executables:
|
49
|
+
executables:
|
50
|
+
- inline_package
|
50
51
|
extensions: []
|
51
52
|
requirements:
|
52
53
|
- A POSIX environment and a compiler for your language.
|