[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [websites/inqlude] /: Initialize distro only when needed
From: Cornelius Schumacher <schumacher () kde ! org>
Date: 2016-07-23 7:38:22
Message-ID: E1bQrVu-0004Ay-Ql () code ! kde ! org
[Download RAW message or body]
Git commit a84b86874db7b5b2f204bddf97d378fdfd9af6b7 by Cornelius Schumacher.
Committed on 02/07/2016 at 06:45.
Pushed by cschumac into branch 'master'.
Initialize distro only when needed
M +0 -6 bin/inqlude
M +12 -7 lib/cli.rb
http://commits.kde.org/websites/inqlude/a84b86874db7b5b2f204bddf97d378fdfd9af6b7
diff --git a/bin/inqlude b/bin/inqlude
index 3311305..35e4c3e 100755
--- a/bin/inqlude
+++ b/bin/inqlude
@@ -18,13 +18,7 @@
require File.expand_path('../../lib/inqlude',__FILE__)
-distro = Distro.detect
-if !distro
- STDERR.puts "Warning: unable to detect distro."
-end
-
Cli.settings = Settings.new
-Cli.distro = distro
Cli.check_unknown_options!
Cli.start ARGV
diff --git a/lib/cli.rb b/lib/cli.rb
index 84d5e1e..be3d6d1 100644
--- a/lib/cli.rb
+++ b/lib/cli.rb
@@ -26,8 +26,13 @@ class Cli < Thor
@@settings = s
end
- def self.distro= d
- @@distro = d
+ def self.distro
+ @@distro if @@distro
+
+ @@distro = Distro.detect
+ if !@@distro
+ STDERR.puts "Warning: unable to detect distro."
+ end
end
desc "global", "Global options", :hide => true
@@ -39,8 +44,8 @@ class Cli < Thor
qmake_out =~ /Qt version (.*) in/
puts "Qt: #{$1}"
- if @@distro
- puts "OS: #{@@distro.name} #{@@distro.version}"
+ if self.distro
+ puts "OS: #{self.distro.name} #{self.distro.version}"
else
puts "OS: unknown"
end
@@ -63,7 +68,7 @@ class Cli < Thor
puts library.name + " (" + library.versions.join(", ") + ")"
end
else
- manifests = @@distro.installed handler
+ manifests = self.distro.installed handler
manifests.each do |manifest|
puts manifest["name"]
end
@@ -263,7 +268,7 @@ actual domain."
if !manifest
STDERR.puts "Manifest for '#{name}' not found"
else
- @@distro.uninstall manifest
+ self.distro.uninstall manifest
end
end
@@ -276,7 +281,7 @@ actual domain."
if !manifest
STDERR.puts "Manifest for '#{name}' not found"
else
- @@distro.install manifest, :dry_run => options[:dry_run]
+ self.distro.install manifest, :dry_run => options[:dry_run]
end
end
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic