I am creating a new gem that uses FFI to create a ruby binding to webview
C library
The gem structure is as follows:
.
├── ...
├── Rakefile
├── ext
│ └── webview
│ ├── extconf.rb
│ ├── webview.cc
│ └── webview.h
├── lib
│ ├── webview
│ │ └── version.rb
│ ├── webview.rb
│ └── webview.so
├── ...
└── webview.gemspec
The Rakefile is as follows:
require "bundler/gem_tasks"
require "rubocop/rake_task"
require "rake/extensiontask"
RuboCop::RakeTask.new
task default: :rubocop
Rake::ExtensionTask.new "webview"
The Gemspec is as follows:
# frozen_string_literal: true
require_relative "lib/webview/version"
Gem::Specification.new do |spec|
...
# Specify which files should be added to the gem when it is released.
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
spec.files = Dir.chdir(File.expand_path(__dir__)) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
end
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.extensions = ["ext/webview/extconf.rb"]
# Uncomment to register a new dependency of your gem
spec.add_dependency "ffi"
spec.add_dependency "rake-compiler"
end
When I run rake compile
it compiles the library and adds webview.so
to the lib/
dir.
But when I run rake install:local
the webview.so
is not in place!
What's wrong?