| 1 |
#!/usr/bin/ruby -EUTF-8 |
| 2 |
# |
| 3 |
# Copyright © 2011, Lucas Nussbaum <[email protected]> |
| 4 |
# |
| 5 |
# This program is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
|
| 18 |
require 'gem2deb' |
| 19 |
require 'gem2deb/dh_make_ruby' |
| 20 |
require 'optparse' |
| 21 |
|
| 22 |
options = {} |
| 23 |
|
| 24 |
optparse = OptionParser.new do |opts| |
| 25 |
opts.banner = "Usage: dh-make-ruby [OPTIONS] [TARBALL|DIRECTORY]" |
| 26 |
opts.separator 'Options:' |
| 27 |
|
| 28 |
opts.on('-h', '--help', 'show help') do |
| 29 |
puts opts |
| 30 |
exit |
| 31 |
end |
| 32 |
|
| 33 |
opts.on('-v', '--version', 'show version') do |
| 34 |
puts "dh-make-ruby version #{Gem2Deb::VERSION}" |
| 35 |
exit |
| 36 |
end |
| 37 |
|
| 38 |
opts.on('-p', '--package PACKAGE', 'specify package name (default: ruby-*)') do |package_name| |
| 39 |
options[:source_package_name] = package_name |
| 40 |
end |
| 41 |
|
| 42 |
opts.on('-w', '--overwrite', 'overwrite existing files (default: don\'t)') do |
| 43 |
options[:overwrite] = true |
| 44 |
end |
| 45 |
|
| 46 |
options[:do_wnpp_check] = true |
| 47 |
opts.on('', '--no-wnpp-check', 'prevent dh-make-ruby from checking wnpp reports') do |
| 48 |
options[:do_wnpp_check] = false |
| 49 |
end |
| 50 |
|
| 51 |
options[:dependencies] = true |
| 52 |
opts.on('', '--no-dependencies', 'skip collecting dependencies from the archive') do |
| 53 |
options[:dependencies] = false |
| 54 |
end |
| 55 |
|
| 56 |
opts.on('-o', '--offline', 'Do not access the internet for anything') do |
| 57 |
options[:do_wnpp_check] = false |
| 58 |
end |
| 59 |
end |
| 60 |
optparse.parse! |
| 61 |
|
| 62 |
if ARGV.length == 0 |
| 63 |
input = '.' |
| 64 |
elsif ARGV.length == 1 |
| 65 |
input = ARGV[0] |
| 66 |
else |
| 67 |
puts optparse |
| 68 |
exit(1) |
| 69 |
end |
| 70 |
|
| 71 |
dmr = Gem2Deb::DhMakeRuby::new(input, options) |
| 72 |
dmr.build |
| 73 |
|
| 74 |
__END__ |
| 75 |
=head1 NAME |
| 76 |
|
| 77 |
dh-make-ruby - build Debian source package from Ruby library |
| 78 |
|
| 79 |
=head1 USAGE |
| 80 |
|
| 81 |
B<dh-make-ruby> [I<OPTIONS>] [I<TARBALL>|I<DIRECTORY>] |
| 82 |
|
| 83 |
=head1 DESCRIPTION |
| 84 |
|
| 85 |
B<dh-make-ruby> will create a basic Debian source package from a tarball named |
| 86 |
I<TARBALL> generated with B<gem2tgz>, or from a I<DIRECTORY> containing Ruby |
| 87 |
code and metadata in a .gemspec file. If no argument is specified, B<dh-make-ruby> |
| 88 |
will build a Debian source package from the current directory. |
| 89 |
|
| 90 |
=head1 OPTIONS |
| 91 |
|
| 92 |
=over |
| 93 |
|
| 94 |
=item B<-p PACKAGE>, B<--package PACKAGE> |
| 95 |
|
| 96 |
Uses PACKAGE as package name. By default, new packages will be named as |
| 97 |
ruby-$gem, where $gem is the upstream name. If the package is mainly used as a |
| 98 |
library, then it should use the default. On the other hand, if the packages is |
| 99 |
mainly used as an application, then you should drop the ruby- prefix by using |
| 100 |
this option an explicit package u. |
| 101 |
|
| 102 |
=item B<-w>, B<--overwrite> |
| 103 |
|
| 104 |
Overwrites packaging files that already exists but would be created by |
| 105 |
dh-make-ruby if they didn't. Exception: I<debian/copyright> is never touched. |
| 106 |
|
| 107 |
=item B<-h>, B<--help> |
| 108 |
|
| 109 |
Displays the help |
| 110 |
|
| 111 |
=item B<-v>, B<--version> |
| 112 |
|
| 113 |
Displays version information and exits. |
| 114 |
|
| 115 |
=item B<--no-wnpp-check> |
| 116 |
|
| 117 |
Prevents B<dh-make-ruby> to check wnpp reports to get the number of a possible |
| 118 |
ITP (intend to package) bug report. By default, B<dh-make-ruby> does check these |
| 119 |
reports, which requires an Internet access. |
| 120 |
|
| 121 |
=item B<--no-dependencies> |
| 122 |
|
| 123 |
Skips the dependency detection based on Rubygems and APT metadata. You should |
| 124 |
usually not do this, unless you know what you are doing. |
| 125 |
|
| 126 |
=item B<-o>, B<--offline> |
| 127 |
|
| 128 |
Prevents B<dh-make-ruby> from accessing the internet at all. |
| 129 |
|
| 130 |
=back |
| 131 |
|
| 132 |
=head1 SEE ALSO |
| 133 |
|
| 134 |
L<B<gem2deb>>(1), L<B<dh_ruby>>(1) |
| 135 |
|
| 136 |
=head1 COPYRIGHT AND AUTHORS |
| 137 |
|
| 138 |
Copyright (c) 2011, Lucas Nussbaum <[email protected]> |
| 139 |
|
| 140 |
This program is free software: you can redistribute it and/or modify |
| 141 |
it under the terms of the GNU General Public License as published by |
| 142 |
the Free Software Foundation, either version 3 of the License, or |
| 143 |
(at your option) any later version. |
| 144 |
|
| 145 |
This program is distributed in the hope that it will be useful, |
| 146 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 147 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 148 |
GNU General Public License for more details. |
| 149 |
|
| 150 |
You should have received a copy of the GNU General Public License |
| 151 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 152 |
|