Skip to content

Commit

Permalink
Revamped how files are required.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacius committed Oct 18, 2009
1 parent 2b81402 commit 3da0eb8
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 32 deletions.
9 changes: 7 additions & 2 deletions lib/nice-ffi.rb
Expand Up @@ -28,21 +28,26 @@
#++


require 'need'
require 'ffi'


module NiceFFI
end


this_dir = File.expand_path( File.dirname(__FILE__) )

%w{

typedpointer
pathset
nicelibrary
autorelease
nicestruct
opaquestruct

}.each do |f|

need { File.join( 'nice-ffi', f ) }
require File.join( this_dir, 'nice-ffi', f )

end
1 change: 0 additions & 1 deletion lib/nice-ffi/autorelease.rb
Expand Up @@ -28,7 +28,6 @@
#++


require 'ffi'

#--
# Don't scan this module for RDoc/RI.
Expand Down
6 changes: 0 additions & 6 deletions lib/nice-ffi/nicelibrary.rb
Expand Up @@ -28,12 +28,6 @@
#++


require 'ffi'

need{ 'typedpointer' }
need{ 'pathset' }


# A module to be used in place of FFI::Library. It acts mostly
# like FFI::Library, but with some nice extra features and
# conveniences to make life easier:
Expand Down
6 changes: 0 additions & 6 deletions lib/nice-ffi/nicestruct.rb
Expand Up @@ -28,12 +28,6 @@
#++


require 'ffi'

need{ 'typedpointer' }
need{ 'autorelease' }


# A class to be used as a baseclass where you would use FFI::Struct.
# It acts mostly like FFI::Struct, but with nice extra features and
# conveniences to make life easier:
Expand Down
6 changes: 0 additions & 6 deletions lib/nice-ffi/opaquestruct.rb
Expand Up @@ -28,11 +28,6 @@
#++



require 'ffi'
need{ 'autorelease' }


# OpaqueStruct represents a Struct with an unknown layout.
# This is meant to be used when the C library designer has
# intentionally hidden the layout (e.g. to prevent user access).
Expand Down Expand Up @@ -88,7 +83,6 @@ def initialize( val, options={} )
when FFI::Pointer
if( val.instance_of? FFI::Pointer ) # not MemoryPointer or Buffer
@pointer = _make_autopointer( val, options[:autorelease] )

else
raise TypeError, "unsupported pointer type #{val.class.name}"
end
Expand Down
3 changes: 0 additions & 3 deletions lib/nice-ffi/typedpointer.rb
Expand Up @@ -28,9 +28,6 @@
#++


require 'ffi'


# TypedPointer represents a :pointer (FFI type) that is a specific
# struct type. You can use TypedPointer( SomeStructClass ) instead
# of :pointer in these situations:
Expand Down
4 changes: 1 addition & 3 deletions spec/autorelease_spec.rb
@@ -1,6 +1,4 @@
require 'need'
need { File.join("..", "lib", "nice-ffi") }

require 'spec_helper.rb'

# NOTE: When using $open_pointers, always use different pointer
# addresses than any other specs have used! Otherwise, a pointer from
Expand Down
3 changes: 1 addition & 2 deletions spec/opaquestruct_spec.rb
@@ -1,5 +1,4 @@
require 'need'
need { File.join("..", "lib", "nice-ffi") }
require 'spec_helper.rb'


class OpaqueThing < NiceFFI::OpaqueStruct
Expand Down
4 changes: 1 addition & 3 deletions spec/pathset_spec.rb
@@ -1,6 +1,4 @@
require 'need'
need { File.join("..", "lib", "nice-ffi") }

require 'spec_helper.rb'


describe NiceFFI::PathSet do
Expand Down
3 changes: 3 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,3 @@

require File.join( File.expand_path( File.dirname(__FILE__) ),
"..","lib","nice-ffi" )

0 comments on commit 3da0eb8

Please sign in to comment.