Permalink
Browse files

bin/fri, pre-install.rb: default to -L if called as "qri" (created at…

… install time).

darcs-hash:20070129110121-0786a-816a536b65cf6a751f040bb5d75eedb69281554d.gz
  • Loading branch information...
1 parent c5b72f7 commit b31a133320631315811489bd4877df23a166ce3d @mfp mfp committed Jan 29, 2007
Showing with 15 additions and 6 deletions.
  1. +1 −0 CHANGES
  2. +9 −4 bin/fri
  3. +5 −2 pre-install.rb
View
@@ -10,6 +10,7 @@ Features
namespace and method name (-Of), and case-indep. variants.
* --local (-L) and --remote (-L) (default) options. --local makes fri operate
in standalone mode, without requiring fastri-server.
+* new executable: qri, equivalent to fri -L (local, standalone mode)
* try to second-guess the correct method type if all search methods fail
and the type was explicitly given
View
@@ -7,6 +7,8 @@ require 'optparse'
require 'fastri/util'
require 'fastri/full_text_index'
+default_local_mode = File.basename($0)[/^qri/] ? true : false
+
# we bind to 127.0.0.1 by default, because otherwise Ruby will try with
# 0.0.0.0, which results in a DNS request, adding way too much latency
options = {
@@ -36,21 +38,24 @@ options = {
:list_methods => nil,
:extended => false,
:index_file => File.join(FastRI::Util.find_home, ".fastri-index"),
- :local_mode => false,
+ :local_mode => default_local_mode,
}
+
override_addr_env = false
+
optparser = OptionParser.new do |opts|
- opts.banner = "Usage: fri [options] <query>"
+ opts.banner = "Usage: #{File.basename($0)} [options] <query>"
- opts.on("-L", "--local", "Try to use local index instead of DRb service.") do
+ opts.on("-L", "--local", "Try to use local index instead of DRb service.",
+ *[("(default)" if default_local_mode)].compact) do
options[:local_mode] = true
end
opts.on("--index-file=FILE", "Use index file (forces --local mode).",
"(default: #{options[:index_file]})") do |file|
options[:index_file] = file
options[:local_mode] = true
end
- opts.on("-R", "--remote", "Use DRb service. (default)") do
+ opts.on("-R", "--remote", "Use DRb service. #{'(default)' unless default_local_mode}") do
options[:local_mode] = false
end
opts.on("-s", "--bind ADDR", "Bind to ADDR for incoming DRb connections.",
View
@@ -1,8 +1,11 @@
#!/usr/bin/env ruby
+require 'fileutils'
+
+FileUtils.cp "bin/fri", "bin/qri"
if /win/ =~ RUBY_PLATFORM and /darwin|cygwin/ !~ RUBY_PLATFORM
- require 'fileutils'
- %w[fri fastri-server ri-emacs].each do |fname|
+ %w[fri qri fastri-server ri-emacs].each do |fname|
FileUtils.mv "bin/#{fname}", "bin/#{fname}.rb", :force => true
end
end
+

0 comments on commit b31a133

Please sign in to comment.