晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
| DIR:/opt/alt/ruby18/lib64/ruby/site_ruby/1.8/rubygems/commands/ |
| Current File : //opt/alt/ruby18/lib64/ruby/site_ruby/1.8/rubygems/commands/install_command.rb |
require 'rubygems/command'
require 'rubygems/doc_manager'
require 'rubygems/install_update_options'
require 'rubygems/dependency_installer'
require 'rubygems/local_remote_options'
require 'rubygems/validator'
require 'rubygems/version_option'
##
# Gem installer command line tool
#
# See `gem help install`
class Gem::Commands::InstallCommand < Gem::Command
include Gem::VersionOption
include Gem::LocalRemoteOptions
include Gem::InstallUpdateOptions
def initialize
defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
:generate_rdoc => true,
:generate_ri => true,
:format_executable => false,
:version => Gem::Requirement.default,
})
super 'install', 'Install a gem into the local repository', defaults
add_install_update_options
add_local_remote_options
add_platform_option
add_version_option
add_prerelease_option "to be installed. (Only for listed gems)"
end
def arguments # :nodoc:
"GEMNAME name of gem to install"
end
def defaults_str # :nodoc:
"--both --version '#{Gem::Requirement.default}' --rdoc --ri --no-force\n" \
"--install-dir #{Gem.dir}"
end
def description # :nodoc:
<<-EOF
The install command installs local or remote gem into a gem repository.
For gems with executables ruby installs a wrapper file into the executable
directory by default. This can be overridden with the --no-wrappers option.
The wrapper allows you to choose among alternate gem versions using _version_.
For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer
version is also installed.
If an extension fails to compile during gem installation the gem
specification is not written out, but the gem remains unpacked in the
repository. You may need to specify the path to the library's headers and
libraries to continue. You can do this by adding a -- between RubyGems'
options and the extension's build options:
$ gem install some_extension_gem
[build fails]
Gem files will remain installed in \\
/path/to/gems/some_extension_gem-1.0 for inspection.
Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
$ gem install some_extension_gem -- --with-extension-lib=/path/to/lib
[build succeeds]
$ gem list some_extension_gem
*** LOCAL GEMS ***
some_extension_gem (1.0)
$
If you correct the compilation errors by editing the gem files you will need
to write the specification by hand. For example:
$ gem install some_extension_gem
[build fails]
Gem files will remain installed in \\
/path/to/gems/some_extension_gem-1.0 for inspection.
Results logged to /path/to/gems/some_extension_gem-1.0/gem_make.out
$ [cd /path/to/gems/some_extension_gem-1.0]
$ [edit files or what-have-you and run make]
$ gem spec ../../cache/some_extension_gem-1.0.gem --ruby > \\
../../specifications/some_extension_gem-1.0.gemspec
$ gem list some_extension_gem
*** LOCAL GEMS ***
some_extension_gem (1.0)
$
EOF
end
def usage # :nodoc:
"#{program_name} GEMNAME [GEMNAME ...] [options] -- --build-flags"
end
def execute
if options[:include_dependencies] then
alert "`gem install -y` is now default and will be removed"
alert "use --ignore-dependencies to install only the gems you list"
end
installed_gems = []
ENV.delete 'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION > '1.9'
exit_code = 0
get_all_gem_names.each do |gem_name|
begin
next if options[:conservative] and
not Gem::Dependency.new(gem_name, options[:version]).matching_specs.empty?
inst = Gem::DependencyInstaller.new options
inst.install gem_name, options[:version]
inst.installed_gems.each do |spec|
say "Successfully installed #{spec.full_name}"
end
installed_gems.push(*inst.installed_gems)
rescue Gem::InstallError => e
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
exit_code |= 1
rescue Gem::GemNotFoundException => e
show_lookup_failure e.name, e.version, e.errors, options[:domain]
exit_code |= 2
end
end
unless installed_gems.empty? then
gems = installed_gems.length == 1 ? 'gem' : 'gems'
say "#{installed_gems.length} #{gems} installed"
# NOTE: *All* of the RI documents must be generated first. For some
# reason, RI docs cannot be generated after any RDoc documents are
# generated.
if options[:generate_ri] then
installed_gems.each do |gem|
Gem::DocManager.new(gem, options[:rdoc_args]).generate_ri
end
Gem::DocManager.update_ri_cache
end
if options[:generate_rdoc] then
installed_gems.each do |gem|
Gem::DocManager.new(gem, options[:rdoc_args]).generate_rdoc
end
end
end
raise Gem::SystemExitException, exit_code
end
end
|