summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDuncan Mac-Vicar P <dmacvicar@suse.de>2007-04-22 19:44:49 +0000
committerDuncan Mac-Vicar P <dmacvicar@suse.de>2007-04-22 19:44:49 +0000
commitb58c6b95fa494fe7b41135efc42472dd185e6667 (patch)
tree62a03993cde278e0e089cc2d67530a8624703d62 /examples
downloadlibzypp-bindings-b58c6b95fa494fe7b41135efc42472dd185e6667.tar.gz
libzypp-bindings-b58c6b95fa494fe7b41135efc42472dd185e6667.tar.bz2
libzypp-bindings-b58c6b95fa494fe7b41135efc42472dd185e6667.zip
attempt to create generated bindings for
libzypp. Not restricted to one language.
Diffstat (limited to 'examples')
-rw-r--r--examples/ruby/list_target_resolvables.rb12
-rw-r--r--examples/ruby/mediasetaccess_example.rb13
-rw-r--r--examples/ruby/play_with_pool_and_target.rb21
-rw-r--r--examples/ruby/test.rb24
-rw-r--r--examples/ruby/test2.rb19
5 files changed, 89 insertions, 0 deletions
diff --git a/examples/ruby/list_target_resolvables.rb b/examples/ruby/list_target_resolvables.rb
new file mode 100644
index 0000000..e66d8f0
--- /dev/null
+++ b/examples/ruby/list_target_resolvables.rb
@@ -0,0 +1,12 @@
+
+require 'rzypp'
+include Rzypp
+
+z = ZYppFactory::instance.get_zypp
+
+t = z.initialize_target("/")
+r = z.target.resolvables
+puts r.class
+r.each do | p |
+ puts "#{p.name} #{p.edition}"
+end
diff --git a/examples/ruby/mediasetaccess_example.rb b/examples/ruby/mediasetaccess_example.rb
new file mode 100644
index 0000000..424a387
--- /dev/null
+++ b/examples/ruby/mediasetaccess_example.rb
@@ -0,0 +1,13 @@
+
+require 'rzypp'
+include Rzypp
+
+a = MediaSetAccess.new("http://dist.suse.de/install/stable-x86", "/")
+p = a.provide_file("/content", 1)
+puts p.class
+File.open(p, 'r') do | f |
+ f.each_line do |l|
+ puts l
+ end
+end
+
diff --git a/examples/ruby/play_with_pool_and_target.rb b/examples/ruby/play_with_pool_and_target.rb
new file mode 100644
index 0000000..945424d
--- /dev/null
+++ b/examples/ruby/play_with_pool_and_target.rb
@@ -0,0 +1,21 @@
+
+require 'rzypp'
+include Rzypp
+
+z = ZYppFactory::instance.get_zypp
+
+t = z.initialize_target("/")
+r = z.target.resolvables
+puts r.class
+
+p = z.pool
+puts p.class
+
+z.add_resolvables r
+p.each do | pi |
+ puts "a poolitem: #{pi} status: #{pi.status} res: #{pi.resolvable}"
+ puts pi.methods
+ exit
+end
+
+
diff --git a/examples/ruby/test.rb b/examples/ruby/test.rb
new file mode 100644
index 0000000..1ad8b56
--- /dev/null
+++ b/examples/ruby/test.rb
@@ -0,0 +1,24 @@
+
+require 'rzypp'
+include Rzypp
+
+a = Arch.new("i386")
+puts a.inspect
+#exit
+
+z = ZYppFactory::instance.get_zypp
+
+puts z.inspect
+puts z.architecture.to_s
+
+puts z.home_path
+puts z.home_path.class
+
+t = z.initialize_target("/")
+r = z.target.resolvables
+puts r.class
+r.each do | p |
+ puts "#{p.name} #{p.edition}"
+end
+
+#puts z.methods
diff --git a/examples/ruby/test2.rb b/examples/ruby/test2.rb
new file mode 100644
index 0000000..0056627
--- /dev/null
+++ b/examples/ruby/test2.rb
@@ -0,0 +1,19 @@
+
+require 'rzypp'
+require 'pathname'
+
+include Rzypp
+
+z = ZYppFactory::instance.get_zypp
+
+#puts z.homePath.class
+#z.setHomePath("/home")
+
+z.initialize_target("/")
+t = z.target
+puts z.target.class
+#r = z.target.resolvables
+puts t.class
+#puts t.methods
+
+