OSDN Git Service

ruby-1.9.1-rc1
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / lib / rubygems / install_update_options.rb
1 #--
2 # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
3 # All rights reserved.
4 # See LICENSE.txt for permissions.
5 #++
6
7 require 'rubygems'
8 require 'rubygems/security'
9
10 ##
11 # Mixin methods for install and update options for Gem::Commands
12 module Gem::InstallUpdateOptions
13
14   # Add the install/update options to the option parser.
15   def add_install_update_options
16     OptionParser.accept Gem::Security::Policy do |value|
17       value = Gem::Security::Policies[value]
18       raise OptionParser::InvalidArgument, value if value.nil?
19       value
20     end
21
22     add_option(:"Install/Update", '-i', '--install-dir DIR',
23                'Gem repository directory to get installed',
24                'gems') do |value, options|
25       options[:install_dir] = File.expand_path(value)
26     end
27
28     add_option(:"Install/Update", '-n', '--bindir DIR',
29                'Directory where binary files are',
30                'located') do |value, options|
31       options[:bin_dir] = File.expand_path(value)
32     end
33
34     add_option(:"Install/Update", '-d', '--[no-]rdoc',
35                'Generate RDoc documentation for the gem on',
36                'install') do |value, options|
37       options[:generate_rdoc] = value
38     end
39
40     add_option(:"Install/Update", '--[no-]ri',
41                'Generate RI documentation for the gem on',
42                'install') do |value, options|
43       options[:generate_ri] = value
44     end
45
46     add_option(:"Install/Update", '-E', '--[no-]env-shebang',
47                "Rewrite the shebang line on installed",
48                "scripts to use /usr/bin/env") do |value, options|
49       options[:env_shebang] = value
50     end
51
52     add_option(:"Install/Update", '-f', '--[no-]force',
53                'Force gem to install, bypassing dependency',
54                'checks') do |value, options|
55       options[:force] = value
56     end
57
58     add_option(:"Install/Update", '-t', '--[no-]test',
59                'Run unit tests prior to installation') do |value, options|
60       options[:test] = value
61     end
62
63     add_option(:"Install/Update", '-w', '--[no-]wrappers',
64                'Use bin wrappers for executables',
65                'Not available on dosish platforms') do |value, options|
66       options[:wrappers] = value
67     end
68
69     add_option(:"Install/Update", '-P', '--trust-policy POLICY',
70                Gem::Security::Policy,
71                'Specify gem trust policy') do |value, options|
72       options[:security_policy] = value
73     end
74
75     add_option(:"Install/Update", '--ignore-dependencies',
76                'Do not install any required dependent gems') do |value, options|
77       options[:ignore_dependencies] = value
78     end
79
80     add_option(:"Install/Update", '-y', '--include-dependencies',
81                'Unconditionally install the required',
82                'dependent gems') do |value, options|
83       options[:include_dependencies] = value
84     end
85
86     add_option(:"Install/Update",       '--[no-]format-executable',
87                'Make installed executable names match ruby.',
88                'If ruby is ruby18, foo_exec will be',
89                'foo_exec18') do |value, options|
90       options[:format_executable] = value
91     end
92
93     add_option(:"Install/Update",       '--[no-]user-install',
94                'Install in user\'s home directory instead',
95                'of GEM_HOME. Defaults to using home directory',
96                'only if GEM_HOME is not writable.') do |value, options|
97       options[:user_install] = value
98     end
99
100     add_option(:"Install/Update", "--development",
101                 "Install any additional development",
102                 "dependencies") do |value, options|
103       options[:development] = true
104     end
105   end
106
107   # Default options for the gem install command.
108   def install_update_defaults_str
109     '--rdoc --no-force --no-test --wrappers'
110   end
111
112 end
113