开发者

How to add task With hoe Rakefile

开发者 https://www.devze.com 2022-12-18 16:14 出处:网络
I\'m creating a gem package with hoe library. The package shoud do \"cd ext/lib/ && make \" when \"gem install pkg.gem\"

I'm creating a gem package with hoe library.

The package shoud do "cd ext/lib/ && make " when "gem install pkg.gem"

How to add task when package installing.

# -*- ruby -*-

require 'rubygems'
require 'hoe'
file ["ext/lib/*.c", "ext/lib/*.h"] do
  Dir.chdir "ext/lib" do
    sh "make"
  end
end

Hoe.spec 'mypackag开发者_开发百科e' do |p|
  p.developer('My.Name.IS.FF', 'ff@example.com')
  p.rubyforge_name = 'mypackage'
  p.author = 'My.Name.IS.FF'
  p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
  p.clean_globs = ["ext/lib/*.c", "ext/lib/*.h"]
end


I think you're asking, "how do I make the 'mypackage' task run make before bundling?" If that's what you mean, I think you want this in your Rakefile:

# -*- ruby -*-

require 'rubygems'
require 'hoe'

task 'compile_binary_components' do
  Dir.chdir "ext/lib" do
  sh "make"
end

Hoe.spec 'mypackage' do |p|
  # as you had this...
end

task 'mypackage' => 'compile_binary_components'
0

精彩评论

暂无评论...
验证码 换一张
取 消