Sha256: b0575b8fda225ddd129a171fe3a0f99b0bf2d34956bfc849b477ba5f5896025f
Contents?: true
Size: 1.65 KB
Versions: 6
Compression:
Stored size: 1.65 KB
Contents
require_relative "generate/generate" Dir.chdir __dir__ version_re = /\d+(\.\d+)*/ version = `command grep 'VERSION =' lib/zscan.rb`[version_re] gem_files = Dir.glob('{rakefile,zscan.gemspec,readme.md,**/*.{rb,h,c,inc},ext/pack/COPYING*}') - Dir.glob('ext/pack/{pack.c,internal.h}') gem_package = "zscan-#{version}.gem" generate_src = [__FILE__, *Dir.glob('generate/*')] desc "generate, build and test, and pack gem" task :default => [:gen, :test, gem_package] desc "build and test" task :test => 'ext/Makefile' do sh "make -C ext" sh "ruby spec/*.rb" end desc "clean" task :clean do if File.exist?('ext/Makefile') sh "cd ext && make clean" end sh "rm -f ext/pack/pack.c ext/pack/internal.h ext/Makefile zscan*.gem" end file 'ext/Makefile' => ['ext/extconf.rb', 'ext/pack/pack-25.c', 'ext/pack/pack-23.c'] do Dir.chdir 'ext' do sh "ruby extconf.rb" end end desc "pack gem" file gem_package => gem_files + Generate.files do sh "rm -f zscan-*.gem" new_version = false lines = File.readlines('zscan.gemspec') lines.each do |line| if line =~ /s\.version =/ and (line.sub! version_re, version) new_version = true break end end if new_version File.open('zscan.gemspec', 'w'){|f| f << lines.join } end puts "packing files:" puts '-' * 40 puts gem_files puts '-' * 40 sh "gem build zscan.gemspec" end desc "generate files" task :gen => Generate.files Generate.files.each do |name| file name => generate_src do puts "generating #{name}" r = Generate.generate(name) File.open name, 'w' do |f| f.puts "#{name.end_with?('rb') ? '#' : '//'} generated by rake gen" f << r end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
zscan-2.0.9 | rakefile |
zscan-2.0.8 | rakefile |
zscan-2.0.7 | rakefile |
zscan-2.0.6 | rakefile |
zscan-2.0.5 | rakefile |
zscan-2.0.4 | rakefile |