commit f0f5ce42ea561559356f4807998788dd825576c2
parent 8f5c45866e94178fd1a8dad83ca0b68eba292946
Author: William Morgan <wmorgan-sup@masanjin.net>
Date: Mon, 18 Jan 2010 12:02:57 -0500
Merge branch 'master' into next
Diffstat:
9 files changed, 42 insertions(+), 23 deletions(-)
diff --git a/bin/sup b/bin/sup
@@ -12,21 +12,7 @@ end
require 'fileutils'
require 'trollop'
-require "sup"
-
-BIN_VERSION = "git"
-
-unless Redwood::VERSION == BIN_VERSION
- $stderr.puts <<EOS
-
-Error: version mismatch!
-The sup executable is at version #{BIN_VERSION.inspect}.
-The sup libraries are at version #{Redwood::VERSION.inspect}.
-
-Is your development environment conflicting with rubygems?
-EOS
- exit(-1)
-end
+require "sup"; Redwood::check_library_version_against "git"
if no_ncursesw
debug "No 'ncursesw' gem detected. Install it for wide character support."
diff --git a/bin/sup-convert-ferret-index b/bin/sup-convert-ferret-index
@@ -2,7 +2,7 @@
require 'rubygems'
require 'trollop'
-require 'sup'
+require "sup"; Redwood::check_library_version_against "git"
STATE_BACKUP_FN = "/tmp/sup-state.txt"
SOURCE_BACKUP_FN = "sources.yaml-before-xapian-upgrade"
@@ -25,6 +25,7 @@ Options:
EOS
opt :verbose, "Be verbose", :short => "-v"
opt :dry_run, "Don't actually do anything, just print out what would happen.", :short => "-n"
+ opt :force, "Force overwrite of an old Xapian index"
opt :version, "Show version information", :short => :none
end
@@ -50,7 +51,7 @@ end
Redwood::start
index = Redwood::Index.init
-Trollop::die "you appear to already have a Xapian index--delete #{File.join(Redwood::BASE_DIR, "xapian")} if you really want to do this" unless Redwood::Index.is_a_deprecated_ferret_index?
+Trollop::die "you appear to already have a Xapian index--delete #{File.join(Redwood::BASE_DIR, "xapian")} or use --force if you really want to do this" unless Redwood::Index.is_a_deprecated_ferret_index? || $opts[:force]
puts "## Step one: back up all message state to #{STATE_BACKUP_FN}"
run "#{build_cmd 'sup-dump'} --index ferret > #{STATE_BACKUP_FN}"
diff --git a/bin/sup-dump b/bin/sup-dump
@@ -2,7 +2,7 @@
require 'rubygems'
require 'trollop'
-require "sup"
+require "sup"; Redwood::check_library_version_against "git"
$opts = Trollop::options do
version "sup-dump (sup #{Redwood::VERSION})"
diff --git a/bin/sup-sync b/bin/sup-sync
@@ -3,7 +3,7 @@
require 'uri'
require 'rubygems'
require 'trollop'
-require "sup"
+require "sup"; Redwood::check_library_version_against "git"
PROGRESS_UPDATE_INTERVAL = 15 # seconds
diff --git a/bin/sup-sync-back b/bin/sup-sync-back
@@ -5,7 +5,7 @@ require 'uri'
require 'tempfile'
require 'trollop'
require 'enumerator'
-require "sup"
+require "sup"; Redwood::check_library_version_against "git"
## save a message 'm' to an open file pointer 'fp'
def save m, fp
diff --git a/bin/sup-tweak-labels b/bin/sup-tweak-labels
@@ -3,7 +3,7 @@
require 'rubygems'
require 'trollop'
require 'enumerator'
-require "sup"
+require "sup"; Redwood::check_library_version_against "git"
class Float
def to_s; sprintf '%.2f', self; end
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -188,8 +188,38 @@ EOM
end
end
+ ## to be called by entry points in bin/, to ensure that
+ ## their versions match up against the library versions.
+ ##
+ ## this is a perennial source of bug reports from people
+ ## who both use git and have a gem version installed.
+ def check_library_version_against v
+ unless Redwood::VERSION == v
+ $stderr.puts <<EOS
+Error: version mismatch!
+The sup executable is at version #{v.inspect}.
+The sup libraries are at version #{Redwood::VERSION.inspect}.
+
+Your development environment may be picking up code from a
+rubygems installation of sup.
+
+If you're running from git with a commandline like
+
+ ruby -Ilib #{$0}
+
+try this instead:
+
+ RUBY_INVOCATION="ruby -Ilib" ruby -Ilib #{$0}
+
+You can also try `gem uninstall sup` and removing all Sup rubygems.
+
+EOS
+ abort
+ end
+ end
+
module_function :save_yaml_obj, :load_yaml_obj, :start, :finish,
- :report_broken_sources
+ :report_broken_sources, :check_library_version_against
end
## set up default configuration file
diff --git a/lib/sup/xapian_index.rb b/lib/sup/xapian_index.rb
@@ -1,3 +1,5 @@
+ENV["XAPIAN_FLUSH_THRESHOLD"] = "1000"
+
require 'xapian'
require 'set'
diff --git a/release-script.txt b/release-script.txt
@@ -8,7 +8,7 @@ vi CONTRIBUTORS # and merge
vi www/index.html # and include CONTRIBUTORS
# ... git add, commit, etc
git checkout -b release-<releasename>
-vi lib/sup.rb bin/sup # and bump BOTH version numbers
+vi lib/sup.rb bin/* # and bump version numbers in all files
# ... git add, commit, etc
rake gem
rake tarball