[SCM] ci-tooling packaging branch, master, updated. 68d1aefa6a4c05a6097849802fb0ebde2a193daf

Harald Sitter apachelogger-guest at moszumanska.debian.org
Fri Feb 6 14:53:43 UTC 2015


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=68d1aef

The following commit has been merged in the master branch:
commit 68d1aefa6a4c05a6097849802fb0ebde2a193daf
Author: Harald Sitter <sitter at kde.org>
Date:   Fri Feb 6 15:53:40 2015 +0100

    import require_or_install
    
    this is a meta helper that is partially used on kci to allow requires
    that would automatically install gems if not found.
    
    eventually getting replaced by bundler in the not too distant future
---
 lib/require_or_install.rb | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/lib/require_or_install.rb b/lib/require_or_install.rb
new file mode 100644
index 0000000..02f8b6f
--- /dev/null
+++ b/lib/require_or_install.rb
@@ -0,0 +1,30 @@
+# When a require fails it will attempt to install the gem for it.
+
+module RubyManager
+  @__got_ruby_dev = false
+
+  def self._install_ruby_dev
+    return if @__got_ruby_dev
+    `echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup`
+    `echo "Acquire::Languages "none";" > /etc/apt/apt.conf.d/99no-languages`
+    exit 1 unless system('apt-get install -y ruby ruby-dev')
+    @__got_ruby_dev = true
+  end
+end
+
+module Kernel
+  def install_and_require(name)
+    puts "doing require_or_install on '#{name}'"
+    begin
+      require(name)
+    rescue LoadError => e
+      raise e unless Process.uid == 0
+      RubyManager._install_ruby_dev
+      gem = name.gsub('/', '-')
+      puts "			running :: gem install #{gem} --no-document"
+      exit 1 unless system("gem install #{gem} --no-document")
+      Gem.clear_paths
+      require(name)
+    end
+  end
+end

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list