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/
|
/site/
|
||||||
/spec/reports/
|
/spec/reports/
|
||||||
/tmp/
|
/tmp/
|
||||||
ext/Makefile
|
ext/**/Makefile
|
||||||
ext/*.o
|
ext/**/*.o
|
||||||
ext/*.bundle
|
ext/**/*.bundle
|
||||||
|
*.gem
|
||||||
|
|
|
||||||
12
Rakefile
12
Rakefile
|
|
@ -1,12 +1,18 @@
|
||||||
require 'bundler/gem_tasks'
|
require 'bundler/gem_tasks'
|
||||||
|
require 'English'
|
||||||
|
require 'open3'
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
require 'rubocop/rake_task'
|
require 'rubocop/rake_task'
|
||||||
|
|
||||||
task :compile do
|
task :compile do
|
||||||
puts 'Compiling C extension'
|
puts 'Compiling C extension'
|
||||||
`cd ext && make clean`
|
# ignore clean failure because the Makefile may not exist yet
|
||||||
`cd ext && ruby extconf.rb`
|
cmd = 'cd ext/wordexp_ext && (make clean || true) && ruby extconf.rb && make'
|
||||||
`cd ext && make`
|
out, status = Open3.capture2e(cmd)
|
||||||
|
unless status.success?
|
||||||
|
warn out
|
||||||
|
raise 'Failed to compile native extension'
|
||||||
|
end
|
||||||
puts 'Done'
|
puts 'Done'
|
||||||
end
|
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 <string.h>
|
||||||
#include <wordexp.h>
|
#include <wordexp.h>
|
||||||
|
|
||||||
#include "ruby.h"
|
|
||||||
#include "ruby/encoding.h"
|
|
||||||
|
|
||||||
static VALUE ext_wordexp(VALUE self, VALUE rstring) {
|
static VALUE ext_wordexp(VALUE self, VALUE rstring) {
|
||||||
Check_Type(rstring, T_STRING);
|
Check_Type(rstring, T_STRING);
|
||||||
char *string = RSTRING_PTR(rstring);
|
char *string = RSTRING_PTR(rstring);
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
require 'wordexp_ext'
|
require 'wordexp_ext/wordexp_ext'
|
||||||
|
|
||||||
module Wordexp
|
module Wordexp
|
||||||
autoload :CLI, 'wordexp/cli'
|
autoload :CLI, 'wordexp/cli'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue