RubyInline 3.6.6 → 3.6.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/History.txt +109 -28
  2. data/README.txt +15 -13
  3. data/Rakefile +10 -8
  4. data/lib/inline.rb +53 -29
  5. data/test/test_inline.rb +3 -2
  6. metadata +8 -7
@@ -1,21 +1,38 @@
1
- ### 3.6.6 / 2007-12-27
1
+ === 3.6.7 / 2008-03-20
2
+
3
+ * 3 minor enhancements:
4
+
5
+ * Added ability to work entirely without .ruby_inline dir. Thanks Kevin Clark!
6
+ * Updated history, readme, and rakefile for new hoe abilities.
7
+ * Cleaned up some really ugly schlock. Man, compiling sucks!
8
+
9
+ * 2 bug fixes:
10
+
11
+ * Fixes for 1.9.
12
+ * Add -I for platform-specific header dir (for ruby/config.h).
13
+
14
+ === 3.6.6 / 2007-12-27
2
15
 
3
16
  * 1 minor enhancement:
17
+
4
18
  * Enhanced windows support thanks to Luis Lavena.
5
19
 
6
- ### 3.6.5 / 2007-11-08
20
+ === 3.6.5 / 2007-11-08
7
21
 
8
22
  * 1 minor enhancement:
23
+
9
24
  * Quick fix for OSX 10.5 native ruby (should be fixed in 10.5.2).
10
25
 
11
- ### 3.6.4 / 2007-08-20
26
+ === 3.6.4 / 2007-08-20
12
27
 
13
28
  * 1 minor enhancement:
29
+
14
30
  * Added ability to include ruby.h last. Thanks to Luc Heinrich.
15
31
 
16
- ### 3.6.3 / 2007-04-27
32
+ === 3.6.3 / 2007-04-27
17
33
 
18
34
  * 7 minor enhancements:
35
+
19
36
  * Added map_ruby_const and map_c_const to C builder.
20
37
  * Converted example.rb to a real benchmark setup.
21
38
  * Improved error messages.
@@ -23,89 +40,109 @@
23
40
  * Options hash can take optional :method_name param to have ruby name diff from c.
24
41
  * Converted to a more traditional setup. Now I can heckle!
25
42
  * Cleaned up ruby.h search.
43
+
26
44
  * 2 bug fixes:
45
+
27
46
  * Added CCDLFLAGS. _Should_ pick up -fPIC on misconfigured 64 bit machines.
28
47
  * Broke up all warnings so progress report was cleaner.
29
48
 
30
- ### 3.6.2 / 2006-10-12
49
+ === 3.6.2 / 2006-10-12
31
50
 
32
51
  * 2 bug fixes:
52
+
33
53
  * comment stripper much more sane to fix problems on certain linux distros
34
54
  * fixed a nit with older C compilers.
35
55
 
36
- ### 3.6.1 / 2006-10-11
56
+ === 3.6.1 / 2006-10-11
37
57
 
38
58
  * 1 minor enhancement
59
+
39
60
  * Hoe'd the Rakefile. :P
61
+
40
62
  * 2 bug fixes
63
+
41
64
  * Removed VALUE from @types because it is now in @@type_map.
42
65
  * Tweak added for mingw32.
43
66
 
44
- ### 3.6.0 / 2005-11-30 (omg I suck: actual release: 2006-09-15)
67
+ === 3.6.0 / 2005-11-30 (omg I suck: actual release: 2006-09-15)
45
68
 
46
69
  * 6 minor enhancements
70
+
47
71
  * C builder can now be used directly for other foreign language glue.
48
72
  * Pretty much all (c) functions are plain argument style, not argc/argv.
49
73
  * Added Nathaniel and Dan's patches for windows support.
50
74
  * Added VALUE as a default known type.
51
75
  * Improved testing under $DEBUG.
52
76
  * Deprecated $INLINE_FLAGS and $INLINE_LIBS are dead.
77
+
53
78
  * 3 bug fixes
79
+
54
80
  * Fixed a number of issues wrt testing.
55
81
  * Cleaned up and cached certain calculations.
56
82
  * Some windows compiler fixes went in, but MS compiler is a PITA still.
57
83
 
58
- ### 3.5.0 / 2005-10-15
84
+ === 3.5.0 / 2005-10-15
59
85
 
60
86
  * 4 minor enhancements
87
+
61
88
  * Switched to install for Makefile.
62
89
  * Lots of minor cleanup.
63
90
  * Added add_to_init to extend init methods. Great hack!
64
91
  * Added 2 demo files used in the rubyconf 2005 presentation.
92
+
65
93
  * 1 bug fix
94
+
66
95
  * Fixed example in README.txt. OOPS!
67
96
 
68
- ### 3.4.0 / 2005-07-13
97
+ === 3.4.0 / 2005-07-13
69
98
 
70
99
  * 2 minor enhancement
100
+
71
101
  * Changed inline to take the language and a hash of options.
72
102
  * Still backwards compatible, for now, and emits a warning.
73
103
  * Options are available via the builder passed to your block.
104
+
74
105
  * 2 bug fixes
106
+
75
107
  * Modified caller discovery, yet again, due to changes in ruby 1.8.3.
76
108
  * More compatible and clean with non-gems systems.
77
109
 
78
- ### 3.3.2 / 2005-05-19
110
+ === 3.3.2 / 2005-05-19
79
111
 
80
112
  * 4 bug fixes
113
+
81
114
  * Fixed a line number issue when using c_raw w/ multi-line signatures.
82
115
  * Inline can now be invoked multiple times per class.
83
116
  * Filled out rdoc.
84
117
  * Fixed some old tests.
85
118
 
86
- ### 3.3.1 / 2005-05-03
119
+ === 3.3.1 / 2005-05-03
87
120
 
88
121
  * 3 bug fixes
122
+
89
123
  * Fixed a bug w/ unit tests involving caching of rootdir.
90
124
  * Added a minor tweak to the file discovery when called through eval.
91
125
  * Moved the packaging code into inline.rb in order to get rubygems wrapped scripts to work again (wrapper was breaking due to __FILE__ != $0).
92
126
 
93
- ### 3.3.0 / 2005-04-22
127
+ === 3.3.0 / 2005-04-22
94
128
 
95
129
  * 2 minor enhancement
130
+
96
131
  * Added inline_package, which helps you package inlined code into gems.
97
132
  * inline_package also generates a Rakefile for you if you need it.
98
133
  * inline.rb now (only) loads packaged code when present.
99
134
 
100
- ### 3.2.1 / 2005-04-19
135
+ === 3.2.1 / 2005-04-19
101
136
 
102
137
  * 2 bug fixes
138
+
103
139
  * Added double to typemap. Thanks Phil Tomson!
104
140
  * Added a minor hack to get cygwin to work right--lemme know pls.
105
141
 
106
- ### 3.2.0 / 2004-11-27
142
+ === 3.2.0 / 2004-11-27
107
143
 
108
144
  * 8 minor enhancements
145
+
109
146
  * Gemified
110
147
  * Added #line preprocessor directives to make debugging inside your ruby file practical.
111
148
  * Added uninstall rule to Makefile
@@ -115,127 +152,171 @@
115
152
  * Generation of inline'd class methods. (c_singleton and c_raw_singleton)
116
153
  * Fixed problems with nested module/classes.
117
154
  * Inline can now extend the same class multiple times.
155
+
118
156
  * 2 bug fixes
157
+
119
158
  * Smarter require/instantiation to accomodate other languages better.
120
159
  * Fixed a logic error where running good code, then bad, then bad again ran the original good code.
121
160
 
122
- ### 3.1.0 / 2004-09-24
161
+ === 3.1.0 / 2004-09-24
123
162
 
124
163
  * 2 minor enhancement
164
+
125
165
  * Extended API of Inline::C with prefix(code).
126
166
  * Documented all public API.
167
+
127
168
  * 2 bug fixes
169
+
128
170
  * Cleaned a lot of code and tests.
129
171
  * Removed nearly all tags.
130
172
 
131
- ### 3.0.1 / 2004-02-24
173
+ === 3.0.1 / 2004-02-24
132
174
 
133
175
  * 2 bug fixes
176
+
134
177
  * I let references to ZenTestUnit slip through the release. Removed.
135
178
  * Converted History.txt to ZenWeb format.
136
179
 
137
- ### 3.0.0 / 2003-12-23
180
+ === 3.0.0 / 2003-12-23
138
181
 
139
182
  * 3 major enhancements
183
+
140
184
  * Complete rewrite with new design.
141
185
  * Multiple language support, works with C/C++ out of the box.
142
186
  * Multiple functions per compilation unit, now allowing entire classes to be defined and linked in one unit.
187
+
143
188
  * Notes:
189
+
144
190
  * I still need to write much better/complete documentation.
145
191
 
146
- ### 2.2.0 / 2003-01-25
192
+ === 2.2.0 / 2003-01-25
147
193
 
148
194
  * 1 minor enhancements
195
+
149
196
  * Touch all generated files to avoid unnecessary diffs.
197
+
150
198
  * 1 bug fixes
199
+
151
200
  * Added good profiling example in tutorial/*.
152
201
  * Added profiling strategy in README.txt.
202
+
153
203
  * Notes:
204
+
154
205
  * Paired with Doug Beaver <snarly@beaver.net>
155
206
 
156
- ### 2.1.1 / 2002-12-27
207
+ === 2.1.1 / 2002-12-27
157
208
 
158
209
  * 2 bug fixes
210
+
159
211
  * Fixed a bug in inline.rb where it was comparing against inline.rb, not the caller.
160
212
  * Tweaked example.rb to take the number of iterations as an option.
161
213
 
162
- ### 2.1.0 / 2002-12-17
214
+ === 2.1.0 / 2002-12-17
163
215
 
164
216
  * 2 minor enhancements
217
+
165
218
  * Added inline_c_raw to replace Inline.inline.
166
219
  * Removed module Inline as a whole. This gets rid of some
167
220
  * major version incompatibilities, tons of duplicate code, and
168
221
  * just seems to make things happier.
222
+
169
223
  * 4 bug fixes
224
+
170
225
  * Added a fix from Michael Scholz to fix the use of $0 for file test.
171
226
  * Added private and public declarations since we are invading
172
227
  * class Module.
173
228
  * Fixed tests... oops!
174
229
  * Lots of clean up...
230
+
175
231
  * Notes:
232
+
176
233
  * Reviewed by Doug Beaver <snarly@beaver.net>
177
234
 
178
- ### 2.0.0 / 2002-12-12
235
+ === 2.0.0 / 2002-12-12
179
236
 
180
237
  * 2 bug fixes
238
+
181
239
  * Minor fix to get working on MacOS X (.so vs .bundle).
182
240
  * Downgraded typemap to be compatible with 1.6.x.
241
+
183
242
  * Notes:
243
+
184
244
  * Paired w/ Doug Beaver <snarly@beaver.net>
185
245
 
186
- ### 2.0.0 beta / 2002-11-22
246
+ === 2.0.0 beta / 2002-11-22
187
247
 
188
248
  * 1 major enhancements
249
+
189
250
  * Added inline_c, a "compile-time" version of inline. Massively enhanced, this version has a limited form of C function parsing.
251
+
190
252
  * 2 minor enhancements
253
+
191
254
  * Deprecated Inline#inline for Module#inline_c. To be removed by 2.1.0.
192
255
  * Extended example.rb to include a fully written inlined C function.
256
+
193
257
  * 3 bug fixes
258
+
194
259
  * Updated README.txt and improved some of the documentation.
195
260
  * Added test and clean rules to Makefile.
196
261
  * Removed the copious warnings if running ruby < 1.7.2.
262
+
197
263
  * Notes:
264
+
198
265
  * Paired w/ Doug Beaver <snarly@beaver.net>
199
266
 
200
- ### 1.1.0 / 2002-11-01
267
+ === 1.1.0 / 2002-11-01
201
268
 
202
269
  * 2 minor enhancements
270
+
203
271
  * Aliased methods are now inlined as well. 250x faster.
204
272
  * ONLY on ruby 1.7*. Warns on ruby < 1.7.
205
273
  * Added a makefile to automate running of all different benchmarks.
274
+
206
275
  * 1 bug fixes
276
+
207
277
  * Improved example to include an aliased method testcase.
208
278
 
209
- ### 1.0.7 / 2002-09-22
279
+ === 1.0.7 / 2002-09-22
210
280
 
211
281
  * 1 minor enhancements
282
+
212
283
  * Only compiles the generated code if it was different from the previous version.
284
+
213
285
  * 1 bug fixes
286
+
214
287
  * Improved security: Checks group and global write on home directory.
215
288
 
216
- ### 1.0.6 / 2002-09-18
289
+ === 1.0.6 / 2002-09-18
217
290
 
218
291
  * 1 minor enhancements
292
+
219
293
  * Added a prelude argument for header and datatype declarations.
294
+
220
295
  * 3 bug fixes
296
+
221
297
  * Only output stuff if invoked verbose (ie 'ruby -v ./example.rb').
222
298
  * Added some compatibility code for windows.
223
299
  * Declared requirement on POSIX system.
224
300
 
225
- ### 1.0.5 / 2002-09-11
301
+ === 1.0.5 / 2002-09-11
226
302
 
227
303
  * 2 bug fixes
304
+
228
305
  * Improved security model for UNIX. Still not sure about windoze.
229
306
  * Fixed History.txt to be accurate, gave example in README.
230
307
 
231
- ### 1.0.4 / 2002-09-10
308
+ === 1.0.4 / 2002-09-10
232
309
 
233
310
  * 1 major enhancements
311
+
234
312
  * Released to sourceforge!
313
+
235
314
  * 1 bug fixes
315
+
236
316
  * A number of very minor bug fixes from IRC sessions w/ others.
237
317
 
238
- ### 1.0.0 / 2002-09-05
318
+ === 1.0.0 / 2002-09-05
239
319
 
240
320
  * 1 major enhancements
321
+
241
322
  * Birthday!
data/README.txt CHANGED
@@ -1,9 +1,11 @@
1
- ** Ruby Inline
1
+ = Ruby Inline
2
2
 
3
- http://rubyforge.org/projects/rubyinline/
4
- http://www.zenspider.com/ZSS/Products/RubyInline/
3
+ * http://rubyforge.org/projects/rubyinline/
4
+ * http://rubyinline.rubyforge.org/RubyInline/
5
+ * http://www.zenspider.com/ZSS/Products/RubyInline/
6
+ * mailto:ryand-ruby@zenspider.com
5
7
 
6
- ** DESCRIPTION:
8
+ == DESCRIPTION:
7
9
 
8
10
  Ruby Inline is an analog to Perl's Inline::C. Out of the box, it
9
11
  allows you to embed C/++ external module code in your ruby script
@@ -14,7 +16,7 @@ run on the fly when needed.
14
16
  Using the package_inline tool Inline allows you to package up your
15
17
  inlined object code for distribution to systems without a compiler.
16
18
 
17
- ** FEATURES/PROBLEMS:
19
+ == FEATURES/PROBLEMS:
18
20
 
19
21
  + Quick and easy inlining of your C or C++ code embedded in your ruby script.
20
22
  + Extendable to work with other languages.
@@ -26,7 +28,7 @@ inlined object code for distribution to systems without a compiler.
26
28
  + Only requires standard ruby libraries, nothing extra to download.
27
29
  + Can generate a basic Rakefile and package up built extensions for distribution.
28
30
 
29
- ** SYNOPSYS:
31
+ == SYNOPSYS:
30
32
 
31
33
  require "inline"
32
34
  class MyTest
@@ -42,7 +44,7 @@ inlined object code for distribution to systems without a compiler.
42
44
  t = MyTest.new()
43
45
  factorial_5 = t.factorial(5)
44
46
 
45
- ** SYNOPSYS (C++):
47
+ == SYNOPSYS (C++):
46
48
 
47
49
  require 'inline'
48
50
  class MyTest
@@ -60,14 +62,14 @@ inlined object code for distribution to systems without a compiler.
60
62
  t = MyTest.new()
61
63
  t.hello(3)
62
64
 
63
- ** SYNOPSYS (packaging):
65
+ == SYNOPSYS (packaging):
64
66
 
65
67
  rm -rf ~/.ruby_inline
66
68
  make test
67
69
  inline_package packagename 1.0.0
68
70
  ls lib/inline
69
71
 
70
- ** (PSEUDO)BENCHMARKS:
72
+ == (PSEUDO)BENCHMARKS:
71
73
 
72
74
  > make bench
73
75
 
@@ -83,7 +85,7 @@ inlined object code for distribution to systems without a compiler.
83
85
  Type = InlineRaw, Iter = 1000000, T = 7.54097200 sec, 0.00000754 sec / iter
84
86
  Type = Alias , Iter = 1000000, T = 7.53654000 sec, 0.00000754 sec / iter
85
87
 
86
- ** PROFILING STRATEGY:
88
+ == PROFILING STRATEGY:
87
89
 
88
90
  0) Always keep a log of your progress and changes.
89
91
  1) Run code with 'time' and large dataset.
@@ -92,7 +94,7 @@ inlined object code for distribution to systems without a compiler.
92
94
  4) Run new code with 'time' and large dataset. Repeat 2-3 if unsatisfied.
93
95
  5) Run final code with 'time' and compare to the first run.
94
96
 
95
- ** REQUIREMENTS:
97
+ == REQUIREMENTS:
96
98
 
97
99
  + Ruby - 1.8.2 has been used on FreeBSD 4.6+ and MacOSX.
98
100
  + POSIX compliant system (ie pretty much any UNIX, or Cygwin on MS platforms).
@@ -100,12 +102,12 @@ inlined object code for distribution to systems without a compiler.
100
102
  + test::unit for running tests ( http://testunit.talbott.ws/ ).
101
103
  + rubygems & rake if you'd like - these are used by inline_package.
102
104
 
103
- ** INSTALL:
105
+ == INSTALL:
104
106
 
105
107
  + make test (optional)
106
108
  + make install
107
109
 
108
- ** LICENSE:
110
+ == LICENSE:
109
111
 
110
112
  (The MIT License)
111
113
 
data/Rakefile CHANGED
@@ -5,23 +5,25 @@ require 'hoe'
5
5
 
6
6
  require './lib/inline.rb'
7
7
 
8
- Hoe.new("RubyInline", Inline::VERSION) do |p|
9
- p.description = p.paragraphs_of("README.txt", 3).join
10
- p.summary = p.description[/\A([^.]+\.){2}/]
11
- p.url = p.paragraphs_of("README.txt", 1).join
12
- p.changes = p.paragraphs_of("History.txt", 0..1).join
13
- p.clean_globs << File.expand_path("~/.ruby_inline")
8
+ Hoe.new("RubyInline", Inline::VERSION) do |inline|
9
+ inline.developer 'Ryan Davis', 'ryand-ruby@zenspider.com'
14
10
 
15
- p.spec_extras[:requirements] = "A POSIX environment and a compiler for your language."
11
+ inline.clean_globs << File.expand_path("~/.ruby_inline")
12
+ inline.spec_extras[:requirements] =
13
+ "A POSIX environment and a compiler for your language."
16
14
  end
17
15
 
16
+ desc "run all examples"
18
17
  task :examples do
19
- %w(example.rb example2.rb tutorial/example1.rb tutorial/example2.rb).each do |e|
18
+ %w(example.rb example2.rb
19
+ tutorial/example1.rb
20
+ tutorial/example2.rb).each do |e|
20
21
  rm_rf '~/.ruby_inline'
21
22
  ruby "-Ilib -w #{e}"
22
23
  end
23
24
  end
24
25
 
26
+ desc "run simple benchmarks"
25
27
  task :bench do
26
28
  verbose(false) do
27
29
  ruby "-Ilib ./example.rb"
@@ -37,7 +37,6 @@
37
37
 
38
38
  require "rbconfig"
39
39
  require "digest/md5"
40
- require 'ftools'
41
40
  require 'fileutils'
42
41
 
43
42
  $TESTING = false unless defined? $TESTING
@@ -51,14 +50,14 @@ class CompilationError < RuntimeError; end
51
50
  # the current namespace.
52
51
 
53
52
  module Inline
54
- VERSION = '3.6.6'
53
+ VERSION = '3.6.7'
55
54
 
56
55
  WINDOZE = /win(32|64)/ =~ RUBY_PLATFORM
57
56
  DEV_NULL = (WINDOZE ? 'nul' : '/dev/null')
58
57
  RAKE = (WINDOZE ? 'rake.bat' : 'rake')
59
58
  GEM = (WINDOZE ? 'gem.bat' : 'gem')
60
59
 
61
- $stderr.puts "RubyInline v #{VERSION}" if $DEBUG
60
+ warn "RubyInline v #{VERSION}" if $DEBUG
62
61
 
63
62
  protected
64
63
 
@@ -70,7 +69,7 @@ module Inline
70
69
  env = ENV['HOMEDRIVE'] + ENV['HOMEPATH'] if env.nil? and WINDOZE
71
70
 
72
71
  if env.nil? then
73
- $stderr.puts "Define INLINEDIR or HOME in your environment and try again"
72
+ warn "Define INLINEDIR or HOME in your environment and try again"
74
73
  exit 1
75
74
  end
76
75
 
@@ -86,14 +85,10 @@ module Inline
86
85
 
87
86
  def self.directory
88
87
  directory = File.join(rootdir, ".ruby_inline")
89
- unless defined? @@directory and directory == @@directory and test ?d, @@directory then
90
- unless File.directory? directory then
91
- $stderr.puts "NOTE: creating #{directory} for RubyInline" if $DEBUG
92
- Dir.mkdir directory, 0700
93
- end
94
- Dir.assert_secure directory
95
- @@directory = directory
88
+ unless defined? @@directory and directory == @@directory
89
+ @@directory = File.join(self.rootdir, ".ruby_inline")
96
90
  end
91
+ Dir.assert_secure directory
97
92
  @@directory
98
93
  end
99
94
 
@@ -167,7 +162,7 @@ module Inline
167
162
  if /(((#{@types})\s*\*?)+)\s+(\w+)\s*$/ =~ arg then
168
163
  args.push([$4, $1])
169
164
  elsif arg != "void" then
170
- $stderr.puts "WAR\NING: '#{arg}' not understood"
165
+ warn "WAR\NING: '#{arg}' not understood"
171
166
  end
172
167
  end
173
168
 
@@ -265,7 +260,10 @@ module Inline
265
260
  end
266
261
 
267
262
  attr_reader :rb_file, :mod
268
- attr_accessor :mod, :src, :sig, :flags, :libs if $TESTING
263
+ if $TESTING then
264
+ attr_writer :mod
265
+ attr_accessor :src, :sig, :flags, :libs
266
+ end
269
267
 
270
268
  public
271
269
 
@@ -277,8 +275,9 @@ module Inline
277
275
  raise "Couldn't discover caller" if stack.empty?
278
276
  real_caller = stack.first
279
277
  real_caller = stack[3] if real_caller =~ /\(eval\)/
280
- @real_caller = real_caller.split(/:/)[0..-2].join(':')
281
- @rb_file = File.expand_path(@real_caller)
278
+ real_caller = real_caller.split(/:/, 3)[0..1]
279
+ @real_caller = real_caller.join ':'
280
+ @rb_file = File.expand_path real_caller.first
282
281
 
283
282
  @mod = mod
284
283
  @src = []
@@ -319,7 +318,12 @@ module Inline
319
318
  def build
320
319
  so_name = self.so_name
321
320
  so_exists = File.file? so_name
322
- unless so_exists and File.mtime(rb_file) < File.mtime(so_name)
321
+ unless so_exists and File.mtime(rb_file) < File.mtime(so_name) then
322
+
323
+ unless File.directory? Inline.directory then
324
+ warn "NOTE: creating #{Inline.directory} for RubyInline" if $DEBUG
325
+ Dir.mkdir Inline.directory, 0700
326
+ end
323
327
 
324
328
  src_name = "#{Inline.directory}/#{module_name}.c"
325
329
  old_src_name = "#{src_name}.old"
@@ -370,7 +374,7 @@ module Inline
370
374
  # recompile only if the files are different
371
375
  recompile = true
372
376
  if so_exists and should_compare and
373
- File::compare(old_src_name, src_name, $DEBUG) then
377
+ FileUtils.compare_file(old_src_name, src_name) then
374
378
  recompile = false
375
379
 
376
380
  # Updates the timestamps on all the generated/compiled files.
@@ -382,7 +386,7 @@ module Inline
382
386
 
383
387
  if recompile then
384
388
 
385
- hdrdir = %w(srcdir archdir).map { |name|
389
+ hdrdir = %w(srcdir archdir rubyhdrdir).map { |name|
386
390
  dir = Config::CONFIG[name]
387
391
  }.find { |dir|
388
392
  dir and File.exist? File.join(dir, "/ruby.h")
@@ -391,42 +395,60 @@ module Inline
391
395
  flags = @flags.join(' ')
392
396
  libs = @libs.join(' ')
393
397
 
394
- cmd = "#{Config::CONFIG['LDSHARED']} #{flags} #{Config::CONFIG['CCDLFLAGS']} #{Config::CONFIG['CFLAGS']} -I #{hdrdir} -I #{Config::CONFIG['includedir']} -o \"#{so_name}\" \"#{File.expand_path(src_name)}\" #{libs}" + crap_for_windoze
398
+ config_hdrdir = if RUBY_VERSION > '1.9' then
399
+ "-I #{File.join hdrdir, RbConfig::CONFIG['arch']}"
400
+ else
401
+ nil
402
+ end
403
+
404
+ cmd = [ Config::CONFIG['LDSHARED'],
405
+ flags,
406
+ Config::CONFIG['CCDLFLAGS'],
407
+ Config::CONFIG['CFLAGS'],
408
+ '-I', hdrdir,
409
+ config_hdrdir,
410
+ '-I', Config::CONFIG['includedir'],
411
+ "-L#{Config::CONFIG['libdir']}",
412
+ '-o', so_name.inspect,
413
+ File.expand_path(src_name).inspect,
414
+ libs,
415
+ crap_for_windoze ].join(' ')
416
+
395
417
  # TODO: remove after osx 10.5.2
396
418
  cmd += ' -flat_namespace -undefined suppress' if
397
419
  RUBY_PLATFORM =~ /darwin9\.[01]/
398
420
  cmd += " 2> #{DEV_NULL}" if $TESTING and not $DEBUG
399
421
 
400
- $stderr.puts "Building #{so_name} with '#{cmd}'" if $DEBUG
422
+ warn "Building #{so_name} with '#{cmd}'" if $DEBUG
401
423
  result = `#{cmd}`
402
- $stderr.puts "Output:\n#{result}" if $DEBUG
424
+ warn "Output:\n#{result}" if $DEBUG
403
425
  if $? != 0 then
404
426
  bad_src_name = src_name + ".bad"
405
427
  File.rename src_name, bad_src_name
406
428
  raise CompilationError, "error executing #{cmd}: #{$?}\nRenamed #{src_name} to #{bad_src_name}"
407
429
  end
408
430
 
409
- # NOTE: manifest embedding is only required when using VC8 ruby
431
+ # NOTE: manifest embedding is only required when using VC8 ruby
410
432
  # build or compiler.
411
- # Errors from this point should be ignored if Config::CONFIG['arch']
433
+ # Errors from this point should be ignored if Config::CONFIG['arch']
412
434
  # (RUBY_PLATFORM) matches 'i386-mswin32_80'
413
435
  if WINDOZE and RUBY_PLATFORM =~ /_80$/ then
414
436
  Dir.chdir Inline.directory do
415
437
  cmd = "mt /manifest lib.so.manifest /outputresource:so.dll;#2"
416
- $stderr.puts "Embedding manifest with '#{cmd}'" if $DEBUG
438
+ warn "Embedding manifest with '#{cmd}'" if $DEBUG
417
439
  result = `#{cmd}`
418
- $stderr.puts "Output:\n#{result}" if $DEBUG
440
+ warn "Output:\n#{result}" if $DEBUG
419
441
  if $? != 0 then
420
442
  raise CompilationError, "error executing #{cmd}: #{$?}"
421
443
  end
422
444
  end
423
445
  end
424
446
 
425
- $stderr.puts "Built successfully" if $DEBUG
447
+ warn "Built successfully" if $DEBUG
426
448
  end
427
449
 
428
450
  else
429
- $stderr.puts "#{so_name} is up to date" if $DEBUG
451
+ warn "#{so_name} is up to date" if $DEBUG
430
452
  end # unless (file is out of date)
431
453
  end # def build
432
454
 
@@ -475,7 +497,7 @@ module Inline
475
497
  # Registers C type-casts +r2c+ and +c2r+ for +type+.
476
498
 
477
499
  def add_type_converter(type, r2c, c2r)
478
- $stderr.puts "WAR\NING: overridding #{type} on #{caller[0]}" if @@type_map.has_key? type
500
+ warn "WAR\NING: overridding #{type} on #{caller[0]}" if @@type_map.has_key? type
479
501
  @@type_map[type] = [r2c, c2r]
480
502
  end
481
503
 
@@ -717,7 +739,7 @@ end # class File
717
739
  class Dir
718
740
 
719
741
  ##
720
- # +assert_secure+ checks to see that +path+ exists and has minimally
742
+ # +assert_secure+ checks that if a +path+ exists it has minimally
721
743
  # writable permissions. If not, it prints an error and exits. It
722
744
  # only works on +POSIX+ systems. Patches for other systems are
723
745
  # welcome.
@@ -731,5 +753,7 @@ class Dir
731
753
  abort "#{path} is insecure (#{'%o' % mode}). It may not be group or world writable. Exiting."
732
754
  end
733
755
  end
756
+ rescue Errno::ENOENT
757
+ # If it ain't there, it's certainly secure
734
758
  end
735
759
  end
@@ -27,6 +27,7 @@ class InlineTestCase < Test::Unit::TestCase
27
27
  @rootdir = File.join(Dir.tmpdir, "test_inline.#{$$}")
28
28
  Dir.mkdir @rootdir, 0700 unless test ?d, @rootdir
29
29
  ENV['INLINEDIR'] = @rootdir
30
+ Dir.mkdir Inline.directory, 0700
30
31
  end
31
32
 
32
33
  def teardown
@@ -57,7 +58,7 @@ class TestDir < InlineTestCase
57
58
  Dir.assert_secure path
58
59
  end
59
60
  else
60
- assert_raises(perms.nil? ? Errno::ENOENT : SecurityError) do
61
+ assert_raises(SecurityError) do
61
62
  Dir.assert_secure path
62
63
  end
63
64
  end
@@ -71,7 +72,7 @@ class TestDir < InlineTestCase
71
72
  util_assert_secure 0770, false
72
73
  util_assert_secure 0777, false
73
74
  # missing
74
- util_assert_secure nil, false
75
+ util_assert_secure nil, true
75
76
  end
76
77
  end unless Inline::WINDOZE
77
78
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RubyInline
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.6
4
+ version: 3.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2007-12-27 00:00:00 -08:00
12
+ date: 2008-03-20 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -19,10 +19,11 @@ dependencies:
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.4.0
22
+ version: 1.5.1
23
23
  version:
24
- description: Ruby Inline is an analog to Perl's Inline::C. Out of the box, it allows you to embed C/++ external module code in your ruby script directly. By writing simple builder classes, you can teach how to cope with new languages (fortran, perl, whatever). The code is compiled and run on the fly when needed.
25
- email: ryand-ruby@zenspider.com
24
+ description: Ruby Inline is an analog to Perl's Inline::C. Out of the box, it allows you to embed C/++ external module code in your ruby script directly. By writing simple builder classes, you can teach how to cope with new languages (fortran, perl, whatever). The code is compiled and run on the fly when needed. Using the package_inline tool Inline allows you to package up your inlined object code for distribution to systems without a compiler.
25
+ email:
26
+ - ryand-ruby@zenspider.com
26
27
  executables:
27
28
  - inline_package
28
29
  extensions: []
@@ -46,7 +47,7 @@ files:
46
47
  - tutorial/example1.rb
47
48
  - tutorial/example2.rb
48
49
  has_rdoc: true
49
- homepage: " http://rubyforge.org/projects/rubyinline/\n"
50
+ homepage: http://rubyforge.org/projects/rubyinline/
50
51
  post_install_message:
51
52
  rdoc_options:
52
53
  - --main
@@ -71,6 +72,6 @@ rubyforge_project: rubyinline
71
72
  rubygems_version: 1.0.1
72
73
  signing_key:
73
74
  specification_version: 2
74
- summary: Ruby Inline is an analog to Perl's Inline::C. Out of the box, it allows you to embed C/++ external module code in your ruby script directly.
75
+ summary: Ruby Inline is an analog to Perl's Inline::C
75
76
  test_files:
76
77
  - test/test_inline.rb