aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-06-11 19:22:10 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2008-06-14 12:37:54 +0000
commitea0c1040b5fe3cd72354bc248d5a96c6aa521c82 (patch)
tree8b86ad7e540596d7bfad03282c6c4fce6aea4d17
parentd7aa5b62d3fd45664426bf99c1e8f2523de919c3 (diff)
downloadpaludis-ea0c1040b5fe3cd72354bc248d5a96c6aa521c82.tar.gz
paludis-ea0c1040b5fe3cd72354bc248d5a96c6aa521c82.tar.xz
(ruby) Add Environment::distribution.
-rw-r--r--ruby/environment.cc8
-rw-r--r--ruby/environment_TEST.rb11
2 files changed, 19 insertions, 0 deletions
diff --git a/ruby/environment.cc b/ruby/environment.cc
index 9a16a0c..b2a0300 100644
--- a/ruby/environment.cc
+++ b/ruby/environment.cc
@@ -248,6 +248,13 @@ namespace
}
+ VALUE
+ environment_distribution(VALUE self)
+ {
+ return rb_str_new2(value_to_environment(self)->distribution().c_str());
+
+ }
+
std::tr1::shared_ptr<PaludisEnvironment>
value_to_paludis_environment(VALUE v)
{
@@ -545,6 +552,7 @@ namespace
rb_define_method(c_environment, "set", RUBY_FUNC_CAST(&environment_set), 1);
rb_define_method(c_environment, "root", RUBY_FUNC_CAST(&environment_root), 0);
rb_define_method(c_environment, "default_destinations", RUBY_FUNC_CAST(&environment_default_destinations), 0);
+ rb_define_method(c_environment, "distribution", RUBY_FUNC_CAST(&environment_distribution), 0);
rb_define_method(c_environment, "accept_license", RUBY_FUNC_CAST(&environment_accept_license), 2);
rb_define_method(c_environment, "accept_keywords", RUBY_FUNC_CAST(&environment_accept_keywords), 2);
rb_define_method(c_environment, "mirrors", RUBY_FUNC_CAST(&environment_mirrors), 1);
diff --git a/ruby/environment_TEST.rb b/ruby/environment_TEST.rb
index 6d53074..e54e4a4 100644
--- a/ruby/environment_TEST.rb
+++ b/ruby/environment_TEST.rb
@@ -353,6 +353,17 @@ module Paludis
end
end
+ class TestCase_EnvironmentDistribution < Test::Unit::TestCase
+ def env
+ NoConfigEnvironment.new(Dir.getwd().to_s + "/environment_TEST_dir/testrepo")
+ end
+
+ def test_distribution
+ assert_kind_of String, env.distribution
+ assert_equal "gentoo", env.distribution
+ end
+ end
+
class TestCase_EnvironmentDefaultDestinations < Test::Unit::TestCase
def env
NoConfigEnvironment.new(Dir.getwd().to_s + "/environment_TEST_dir/testrepo")