| 1 |
#!/opt/csw/bin/ruby -w |
| 2 |
|
| 3 |
require 'rubygems' |
| 4 |
require 'rubygems/format' |
| 5 |
|
| 6 |
unless File.exists?(ARGV[0]) |
| 7 |
$stderr.puts "Pass path to a valid .gem file as first argument. You gave: #{ARGV[0]}" |
| 8 |
exit 1 |
| 9 |
end |
| 10 |
|
| 11 |
begin |
| 12 |
spec = Gem::Format.from_file_by_path(File.expand_path(ARGV[0])).spec |
| 13 |
|
| 14 |
blurb = spec.description.gsub("\n", ' ').squeeze.lstrip |
| 15 |
|
| 16 |
puts <<"EOF" |
| 17 |
NAME = #{spec.name} |
| 18 |
VERSION = #{spec.version} |
| 19 |
CATEGORIES = rbgems |
| 20 |
|
| 21 |
DESCRIPTION = #{spec.summary} |
| 22 |
|
| 23 |
define BLURB |
| 24 |
#{blurb.gsub(/(.{1,70})( +|$\n?)|(.{1,70})/, "\\1\\3")} |
| 25 |
endef |
| 26 |
|
| 27 |
EOF |
| 28 |
|
| 29 |
unless spec.dependencies.empty? |
| 30 |
spec.dependencies.each do |d| |
| 31 |
puts "RUNTIME_DEP_PKGS += CSWgem-#{d.name}" |
| 32 |
end |
| 33 |
puts |
| 34 |
end |
| 35 |
|
| 36 |
puts "ARCHALL = 1\n\n" if spec.extensions.size.eql?(0) |
| 37 |
|
| 38 |
puts "include gar/category.mk" |
| 39 |
rescue Exception => e |
| 40 |
# we could be more selective, but this catches _everything_ |
| 41 |
$stderr.puts "Rescued exception of type #{e.class}" |
| 42 |
$stderr.puts "Exception text: #{e.message}" |
| 43 |
end |