extconf-task 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/lib/extconf_task/mkmf_utils.rb +25 -0
- data/lib/extconf_task/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53e64a0c6474afb09e0b27996e4a9eaa4ed97d65
|
4
|
+
data.tar.gz: 8e40f989d8293af8670f6409dfe0af54858b4ef4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 743eade3664b44dbb43b3e738b131653254d685756d21d1c955046ed9f490b5e5e0c0a36fd19d14c98eef724fb32ab4801282f04e9e4a525577171fab0241c71
|
7
|
+
data.tar.gz: 2a60912145974a56177286e0b9f68d3fe45c88822d6b993bb245af68c0fd0b0ba8b1506e4967ccdf184859b5fdc53e3e19dd085e747cf2664d0ec0bf404d4d6d
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# ExtconfTask
|
2
2
|
|
3
3
|
Tiny rake tasks to manage extconf.rb.
|
4
4
|
|
@@ -27,6 +27,17 @@ Then, we can use some tasks, which are displayed by the following command;
|
|
27
27
|
|
28
28
|
rake -T
|
29
29
|
|
30
|
+
## Utility methods
|
31
|
+
|
32
|
+
extconf-task includes utility methods to be used in extconf.rb.
|
33
|
+
|
34
|
+
The method "find\_header\_in\_gem" provides search direcories of a gem package for a header file.
|
35
|
+
The following code is the example of extconf.rb to find "ruby_mpfr.h" from directories of gem "ruby-mpfr".
|
36
|
+
|
37
|
+
require "extconf_task/mkmf_utils"
|
38
|
+
|
39
|
+
find_header_in_gem("ruby_mpfr.h", "ruby-mpfr")
|
40
|
+
|
30
41
|
## Contributing
|
31
42
|
|
32
43
|
1. Fork it
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require "mkmf"
|
2
|
+
|
3
|
+
# @param [String] header Header name
|
4
|
+
# @param [String] gem_name Name of target gem
|
5
|
+
# @param [Array] paths_from_gem_root Paths from gem root to search header. If paths_from_gem_root is empty, this method automatically search all subdirectories of target gem
|
6
|
+
def find_header_in_gem(header, gem_name, *paths_from_gem_root)
|
7
|
+
header_dirs = nil
|
8
|
+
begin
|
9
|
+
require "rubygems"
|
10
|
+
spec = Gem::Specification.find_by_name(gem_name)
|
11
|
+
if paths_from_gem_root.empty?
|
12
|
+
if header_path = Dir.glob(File.join(spec.full_gem_path, "**", header)).first
|
13
|
+
header_dirs = [File.dirname(header_path)]
|
14
|
+
else
|
15
|
+
return false
|
16
|
+
end
|
17
|
+
else
|
18
|
+
header_dirs = paths_from_gem_root.map do |path|
|
19
|
+
File.join(spec.full_gem_path, path)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
rescue LoadError
|
23
|
+
end
|
24
|
+
find_header(header, *header_dirs)
|
25
|
+
end
|
data/lib/extconf_task/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extconf-task
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takayuki YAMAGUCHI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,7 @@ files:
|
|
52
52
|
- Rakefile
|
53
53
|
- extconf-task.gemspec
|
54
54
|
- lib/extconf_task.rb
|
55
|
+
- lib/extconf_task/mkmf_utils.rb
|
55
56
|
- lib/extconf_task/version.rb
|
56
57
|
homepage: https://github.com/ytaka/extconf-task
|
57
58
|
licenses:
|