Sha256: e214d181c6f9705b342bd68e4b135182f079821616556a29c9a2053e3f45dd3b

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

def template_rakefile
<<-EOF
# add rake-compiler lib dir to the LOAD_PATH
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '../..', 'lib'))

require 'rubygems'
require 'rake'

# load rakefile extensions (tasks)
Dir['tasks/*.rake'].each { |f| import f }
EOF
end

def template_rake_gemspec(gem_name)
<<-EOF
require 'rake/gempackagetask'
SPEC = Gem::Specification.new do |s|
  s.name = "#{gem_name}"
  s.version = "0.1.0"
  s.summary = "#{gem_name} test gem for rake-compiler"

  s.has_rdoc = true

  s.homepage = 'http://github.com/luislavena/rake-compiler'
  s.rubyforge_project = 'TODO'

  s.authors = ["Luis Lavena"]
  s.email = ["luislavena@gmail.com"]
end

gem_package = Rake::GemPackageTask.new(SPEC) do |pkg|
  pkg.need_zip = false
  pkg.need_tar = false
end
EOF
end

def template_rake_extension(extension_name, gem_spec = nil)
<<-EOF
require 'rake/extensiontask'
Rake::ExtensionTask.new("#{extension_name}"#{', SPEC' if gem_spec})
EOF
end

def template_rake_extension_with_platform(extension_name, platform)
<<-EOF
require 'rake/extensiontask'
Rake::ExtensionTask.new("#{extension_name}", SPEC) do |ext|
  ext.platform = "#{platform}"
end
EOF
end

def template_extconf(extension_name)
<<-EOF
require 'mkmf'
create_makefile("#{extension_name}")
EOF
end

def template_source_c(extension_name)
<<-EOF
#include "source.h"
void Init_#{extension_name}()
{
  printf("source.c of extension #{extension_name}\\n");
}
EOF
end

def template_source_h
<<-EOF
#include "ruby.h"
EOF
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
luislavena-rake-compiler-0.1.1 features/support/file_templates.rb