aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Richard Brown <rbrown@exherbo.org> 2007-02-27 19:22:34 +0000
committerAvatar Richard Brown <rbrown@exherbo.org> 2007-02-27 19:22:34 +0000
commitcd142ee33cbb62666c820d07d67b0de9413b4804 (patch)
tree3a314696a460e8aa5812ddee24da9950e32612f3
parent28c55bddf6933c7698daf209c8435aab17cbf781 (diff)
downloadpaludis-cd142ee33cbb62666c820d07d67b0de9413b4804.tar.gz
paludis-cd142ee33cbb62666c820d07d67b0de9413b4804.tar.xz
Update ruby demos.
-rw-r--r--ruby/demos/check_linkage.rb3
-rw-r--r--ruby/demos/find_unmanaged_files.rb4
-rw-r--r--ruby/demos/latest_stable.rb14
-rw-r--r--ruby/demos/version_spec_distributions.rb19
4 files changed, 26 insertions, 14 deletions
diff --git a/ruby/demos/check_linkage.rb b/ruby/demos/check_linkage.rb
index e2515b3..6f17e36 100644
--- a/ruby/demos/check_linkage.rb
+++ b/ruby/demos/check_linkage.rb
@@ -101,8 +101,7 @@ def check_file file
end
end
-Paludis::DefaultConfig::config_suffix = config_suffix
-env = Paludis::DefaultEnvironment.instance
+env = Paludis::EnvironmentMaker.instance.make_from_spec config_suffix
status "Checking linkage for package-manager installed files"
diff --git a/ruby/demos/find_unmanaged_files.rb b/ruby/demos/find_unmanaged_files.rb
index 3b39758..86666d4 100644
--- a/ruby/demos/find_unmanaged_files.rb
+++ b/ruby/demos/find_unmanaged_files.rb
@@ -92,8 +92,8 @@ end
in_fs = []
Find.find(*files) {|file| in_fs << file}
-Paludis::DefaultConfig::config_suffix = config_suffix
-db = DefaultEnvironment.instance.package_database
+env = Paludis::EnvironmentMaker.instance.make_from_spec config_suffix
+db = env.package_database
db.repositories do |repo|
next unless repo.format == 'vdb'
diff --git a/ruby/demos/latest_stable.rb b/ruby/demos/latest_stable.rb
index 862f335..cf89837 100644
--- a/ruby/demos/latest_stable.rb
+++ b/ruby/demos/latest_stable.rb
@@ -10,12 +10,14 @@ Log.instance.log_level = Paludis::LogLevel::Warning
Log.instance.program_name = $0
opts = GetoptLong.new(
- [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
- [ '--version', '-V', GetoptLong::NO_ARGUMENT ],
+ [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
+ [ '--version', '-V', GetoptLong::NO_ARGUMENT ],
[ '--log-level', GetoptLong::REQUIRED_ARGUMENT ],
- [ '--repository-dir','-r', GetoptLong::REQUIRED_ARGUMENT ])
+ [ '--repository-dir', '-D', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--write-cache-dir', GetoptLong::REQUIRED_ARGUMENT ])
repository_dir = Dir.pwd
+write_cache_dir = '/var/empty'
opts.each do | opt, arg |
case opt
@@ -28,6 +30,7 @@ opts.each do | opt, arg |
puts
puts " --log-level level Set log level (debug, qa, warning, silent)"
puts " --repository-dir dir Repository directory to use (defaults to .)"
+ puts " --write-cache-dir dir Use a subdirectory named for the repository name under the specified directory for repository write cache"
exit 0
when '--version'
@@ -52,6 +55,9 @@ opts.each do | opt, arg |
when '--repository-dir'
repository_dir = arg
+ when '--write-cache-dir'
+ write_cache_dir = arg
+
end
end
@@ -61,7 +67,7 @@ if ARGV.empty?
end
keywords = ARGV;
-env = NoConfigEnvironment.new(repository_dir)
+env = NoConfigEnvironment.new(repository_dir, write_cache_dir)
def check_one_package(env, search_keywords, repo, pkg)
results = {}
diff --git a/ruby/demos/version_spec_distributions.rb b/ruby/demos/version_spec_distributions.rb
index cb23257..1e62660 100644
--- a/ruby/demos/version_spec_distributions.rb
+++ b/ruby/demos/version_spec_distributions.rb
@@ -66,14 +66,17 @@ class Distribution
end
opts = GetoptLong.new(
- [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
- [ '--version', '-V', GetoptLong::NO_ARGUMENT ],
- [ '--log-level', GetoptLong::REQUIRED_ARGUMENT ],
- [ '--repository-dir', GetoptLong::REQUIRED_ARGUMENT ],
- [ '--image', GetoptLong::REQUIRED_ARGUMENT ])
+ [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
+ [ '--version', '-V', GetoptLong::NO_ARGUMENT ],
+ [ '--log-level', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--repository-dir', '-D', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--image', GetoptLong::REQUIRED_ARGUMENT ],
+ [ '--write-cache-dir', GetoptLong::REQUIRED_ARGUMENT ])
output_image = nil
repository_dir = Dir.getwd
+write_cache_dir = '/var/empty'
+
opts.each do | opt, arg |
case opt
when '--help'
@@ -85,6 +88,7 @@ opts.each do | opt, arg |
puts
puts " --log-level level Set log level (debug, qa, warning, silent)"
puts " --repository-dir dir Set repository directory (default: cwd)"
+ puts " --write-cache-dir dir Use a subdirectory named for the repository name under the specified directory for repository write cache"
puts
puts " --image foo.png Output as the specified image rather than as text"
exit 0
@@ -111,6 +115,9 @@ opts.each do | opt, arg |
when '--repository-dir'
repository_dir = arg
+ when '--write-cache-dir'
+ write_cache_dir = arg
+
when '--image'
output_image = arg
@@ -118,7 +125,7 @@ opts.each do | opt, arg |
end
distribution = Distribution.new
-env = Paludis::NoConfigEnvironment.new repository_dir
+env = Paludis::NoConfigEnvironment.new repository_dir, write_cache_dir
env.package_database.repositories.each do | repo |
distribution.add_repository repo
end