mirror of
https://github.com/samsonjs/wordexp.git
synced 2026-03-25 08:45:54 +00:00
Move extension to a subdirectory
This commit is contained in:
parent
8f6e90d0a6
commit
0795eb3f91
6 changed files with 18 additions and 13 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -7,6 +7,7 @@
|
|||
/site/
|
||||
/spec/reports/
|
||||
/tmp/
|
||||
ext/Makefile
|
||||
ext/*.o
|
||||
ext/*.bundle
|
||||
ext/**/Makefile
|
||||
ext/**/*.o
|
||||
ext/**/*.bundle
|
||||
*.gem
|
||||
|
|
|
|||
12
Rakefile
12
Rakefile
|
|
@ -1,12 +1,18 @@
|
|||
require 'bundler/gem_tasks'
|
||||
require 'English'
|
||||
require 'open3'
|
||||
require 'rake/testtask'
|
||||
require 'rubocop/rake_task'
|
||||
|
||||
task :compile do
|
||||
puts 'Compiling C extension'
|
||||
`cd ext && make clean`
|
||||
`cd ext && ruby extconf.rb`
|
||||
`cd ext && make`
|
||||
# ignore clean failure because the Makefile may not exist yet
|
||||
cmd = 'cd ext/wordexp_ext && (make clean || true) && ruby extconf.rb && make'
|
||||
out, status = Open3.capture2e(cmd)
|
||||
unless status.success?
|
||||
warn out
|
||||
raise 'Failed to compile native extension'
|
||||
end
|
||||
puts 'Done'
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
require 'mkmf'
|
||||
|
||||
create_makefile 'wordexp_ext'
|
||||
3
ext/wordexp_ext/extconf.rb
Normal file
3
ext/wordexp_ext/extconf.rb
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
require 'mkmf'
|
||||
|
||||
create_makefile 'wordexp_ext/wordexp_ext'
|
||||
|
|
@ -11,12 +11,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <ruby.h>
|
||||
#include <string.h>
|
||||
#include <wordexp.h>
|
||||
|
||||
#include "ruby.h"
|
||||
#include "ruby/encoding.h"
|
||||
|
||||
static VALUE ext_wordexp(VALUE self, VALUE rstring) {
|
||||
Check_Type(rstring, T_STRING);
|
||||
char *string = RSTRING_PTR(rstring);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
require 'wordexp_ext'
|
||||
require 'wordexp_ext/wordexp_ext'
|
||||
|
||||
module Wordexp
|
||||
autoload :CLI, 'wordexp/cli'
|
||||
|
|
|
|||
Loading…
Reference in a new issue