|
1 #!/usr/ruby/1.8/bin/ruby |
|
2 # |
|
3 # CDDL HEADER START |
|
4 # |
|
5 # The contents of this file are subject to the terms of the |
|
6 # Common Development and Distribution License (the "License"). |
|
7 # You may not use this file except in compliance with the License. |
|
8 # |
|
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
10 # or http://www.opensolaris.org/os/licensing. |
|
11 # See the License for the specific language governing permissions |
|
12 # and limitations under the License. |
|
13 # |
|
14 # When distributing Covered Code, include this CDDL HEADER in each |
|
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
16 # If applicable, add the following below this CDDL HEADER, with the |
|
17 # fields enclosed by brackets "[]" replaced with your own identifying |
|
18 # information: Portions Copyright [yyyy] [name of copyright owner] |
|
19 # |
|
20 # CDDL HEADER END |
|
21 # |
|
22 |
|
23 # |
|
24 # Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
|
25 # |
|
26 |
|
27 require 'optparse' |
|
28 |
|
29 $pass_on_opts = ["generate_index"] |
|
30 suppress = false |
|
31 deprecation_msg = "WARNING: index_gem_repository.rb has been deprecated and will be removed in a future release of Solaris, use 'gem generate_index' instead. (use '-s' to suppress these warnings)\n\n" |
|
32 |
|
33 options = OptionParser.new do |opts| |
|
34 opts.on('-d', '--dir=DIRNAME', '--directory=DIRNAME', |
|
35 "repository base dir containing gems subdir", |
|
36 String) do |value| |
|
37 $pass_on_opts << '-d' |
|
38 $pass_on_opts << value |
|
39 end |
|
40 |
|
41 opts.on( '--[no-]quick', |
|
42 "include quick index" |
|
43 ) do |value| |
|
44 print "WARNING: Quick index always generated with RubyGems 1.3.1\n" |
|
45 end |
|
46 |
|
47 opts.on('-v', '--verbose', |
|
48 "show verbose output" |
|
49 ) do |
|
50 $pass_on_opts << '-V' |
|
51 end |
|
52 |
|
53 opts.on('-V', '--version', |
|
54 "show version" |
|
55 ) do |
|
56 print deprecation_msg |
|
57 system("gem", "env", "version") |
|
58 exit |
|
59 end |
|
60 |
|
61 opts.on_tail('-s', '--suppress-warnings', |
|
62 "Suppress deprecation warning" |
|
63 ) do |
|
64 suppress = true |
|
65 end |
|
66 |
|
67 opts.on_tail('-h', '--help', "Display this help message" |
|
68 ) do |
|
69 puts deprecation_msg |
|
70 puts opts |
|
71 exit |
|
72 end |
|
73 |
|
74 |
|
75 end |
|
76 |
|
77 begin |
|
78 options.parse!(ARGV) |
|
79 rescue OptionParser::InvalidArgument => err |
|
80 puts options |
|
81 puts |
|
82 puts err.message |
|
83 exit(-1) |
|
84 end |
|
85 |
|
86 ARGV.each do |arg| |
|
87 $pass_on_opts << arg |
|
88 end |
|
89 |
|
90 print deprecation_msg unless suppress |
|
91 |
|
92 system("gem", *$pass_on_opts) |