ffi-libc 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gemtest ADDED
File without changes
data/ChangeLog.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 0.0.5 / 2011-05-11
2
+
3
+ * Skip `clearenv`, `memrchr`, `stdin`, `stdout` and `stderr` if they cannot
4
+ be loaded (thanks FreneticEntropy and mephux).
5
+ * The `libc` installed on OSX lacks these functions/global-variables.
6
+ * Opt into [test.rubygems.org](http://test.rubygems.org/).
7
+
1
8
  ### 0.0.4 / 2011-02-03
2
9
 
3
10
  * Require ffi >= 0.6.0, <= 1.1.0:
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
 
4
4
  begin
5
- gem 'ore-tasks', '~> 0.3.0'
5
+ gem 'ore-tasks', '~> 0.4'
6
6
  require 'ore/tasks'
7
7
 
8
8
  Ore::Tasks.new
@@ -12,7 +12,7 @@ rescue LoadError => e
12
12
  end
13
13
 
14
14
  begin
15
- gem 'rspec', '~> 2.4.0'
15
+ gem 'rspec', '~> 2.4'
16
16
  require 'rspec/core/rake_task'
17
17
 
18
18
  RSpec::Core::RakeTask.new
@@ -21,6 +21,7 @@ rescue LoadError => e
21
21
  abort "Please run `gem install rspec` to install RSpec."
22
22
  end
23
23
  end
24
+ task :test => :spec
24
25
  task :default => :spec
25
26
 
26
27
  begin
data/gemspec.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: ffi-libc
2
- version: 0.0.4
2
+ version: 0.0.5
3
3
  summary: Useful FFI bindings for libc
4
4
  description: Useful Ruby FFI bindings for libc.
5
5
  license: MIT
@@ -12,6 +12,6 @@ dependencies:
12
12
  ffi: >= 0.6.0, <= 1.1.0
13
13
 
14
14
  development_dependencies:
15
- ore-tasks: ~> 0.3.0
16
- rspec: ~> 2.4.0
15
+ ore-tasks: ~> 0.4
16
+ rspec: ~> 2.4
17
17
  yard: ~> 0.6.0
data/lib/ffi/libc/libc.rb CHANGED
@@ -33,7 +33,12 @@ module FFI
33
33
  attach_function :getenv, [:string], :string
34
34
  attach_function :putenv, [:string], :int
35
35
  attach_function :unsetenv, [:string], :int
36
- attach_function :clearenv, [], :int
36
+
37
+ begin
38
+ attach_function :clearenv, [], :int
39
+ rescue FFI::NotFoundError
40
+ # clearenv is not available on OSX
41
+ end
37
42
 
38
43
  # time.h
39
44
  attach_function :time, [:pointer], :time_t
@@ -52,7 +57,13 @@ module FFI
52
57
  attach_function :memcpy, [:pointer, :pointer, :size_t], :pointer
53
58
  attach_function :memcmp, [:pointer, :pointer, :size_t], :int
54
59
  attach_function :memchr, [:pointer, :int, :size_t], :pointer
55
- attach_function :memrchr, [:pointer, :int, :size_t], :pointer
60
+
61
+ begin
62
+ attach_function :memrchr, [:pointer, :int, :size_t], :pointer
63
+ rescue FFI::NotFoundError
64
+ # memrchr is not available on OSX
65
+ end
66
+
56
67
  attach_function :strcpy, [:string, :string], :pointer
57
68
  attach_function :strncpy, [:string, :string, :size_t], :pointer
58
69
  attach_function :strlen, [:string], :size_t
@@ -62,12 +73,15 @@ module FFI
62
73
  attach_function :strrchr, [:string, :int], :string
63
74
  attach_function :strstr, [:string, :string], :string
64
75
  attach_function :strerror, [:int], :string
65
-
66
- # stdio.h
67
- attach_variable :stdin, :pointer
68
- attach_variable :stdout, :pointer
69
- attach_variable :stderr, :pointer
70
-
76
+
77
+ begin
78
+ attach_variable :stdin, :pointer
79
+ attach_variable :stdout, :pointer
80
+ attach_variable :stderr, :pointer
81
+ rescue FFI::NotFoundError
82
+ # stdin, stdout, stderr are not available on OSX
83
+ end
84
+
71
85
  attach_function :fopen, [:string, :string], :FILE
72
86
  attach_function :fdopen, [:int, :string], :FILE
73
87
  attach_function :freopen, [:string, :string, :FILE], :FILE
data/spec/libc_spec.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe "FFI::LibC" do
4
+ it "should attach all functions" do
5
+ lambda {
6
+ require 'ffi/libc/libc'
7
+ }.should_not raise_error(FFI::NotFoundError)
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ gem 'rspec', '~> 2.4'
2
+ require 'rspec'
3
+
4
+ require 'ffi'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ffi-libc
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Postmodern
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-03 00:00:00 -08:00
14
- default_executable:
13
+ date: 2011-05-11 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: ffi
@@ -19,12 +18,12 @@ dependencies:
19
18
  requirement: &id001 !ruby/object:Gem::Requirement
20
19
  none: false
21
20
  requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: 0.6.0
25
21
  - - <=
26
22
  - !ruby/object:Gem::Version
27
23
  version: 1.1.0
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.6.0
28
27
  type: :runtime
29
28
  version_requirements: *id001
30
29
  - !ruby/object:Gem::Dependency
@@ -35,7 +34,7 @@ dependencies:
35
34
  requirements:
36
35
  - - ~>
37
36
  - !ruby/object:Gem::Version
38
- version: 0.3.0
37
+ version: "0.4"
39
38
  type: :development
40
39
  version_requirements: *id002
41
40
  - !ruby/object:Gem::Dependency
@@ -46,7 +45,7 @@ dependencies:
46
45
  requirements:
47
46
  - - ~>
48
47
  - !ruby/object:Gem::Version
49
- version: 2.4.0
48
+ version: "2.4"
50
49
  type: :development
51
50
  version_requirements: *id003
52
51
  - !ruby/object:Gem::Dependency
@@ -61,7 +60,8 @@ dependencies:
61
60
  type: :development
62
61
  version_requirements: *id004
63
62
  description: Useful Ruby FFI bindings for libc.
64
- email: postmodern.mod3@gmail.com
63
+ email:
64
+ - postmodern.mod3@gmail.com
65
65
  executables: []
66
66
 
67
67
  extensions: []
@@ -69,6 +69,7 @@ extensions: []
69
69
  extra_rdoc_files:
70
70
  - README.md
71
71
  files:
72
+ - .gemtest
72
73
  - .rspec
73
74
  - .yardopts
74
75
  - ChangeLog.md
@@ -90,7 +91,8 @@ files:
90
91
  - lib/ffi/libc/timeval.rb
91
92
  - lib/ffi/libc/timezone.rb
92
93
  - lib/ffi/libc/types.rb
93
- has_rdoc: true
94
+ - spec/libc_spec.rb
95
+ - spec/spec_helper.rb
94
96
  homepage: http://github.com/postmodern/ffi-libc
95
97
  licenses:
96
98
  - MIT
@@ -114,9 +116,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
116
  requirements: []
115
117
 
116
118
  rubyforge_project: ffi-libc
117
- rubygems_version: 1.5.0
119
+ rubygems_version: 1.8.1
118
120
  signing_key:
119
121
  specification_version: 3
120
122
  summary: Useful FFI bindings for libc
121
- test_files: []
122
-
123
+ test_files:
124
+ - spec/libc_spec.rb