gitorious-munin-plugins 0.9.22 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,10 +10,6 @@ require "gitorious-munin-plugins/memory_gauge"
10
10
  require "term/ansicolor"
11
11
  require "trollop"
12
12
 
13
-
14
-
15
-
16
-
17
13
  all_plugins = GitoriousMuninPlugins::Plugin.all
18
14
  called_as = Pathname($0).basename.to_s
19
15
  cli = GitoriousMuninPlugins::Cli.new(all_plugins, called_as)
@@ -8,17 +8,15 @@ module GitoriousMuninPlugins
8
8
  end
9
9
 
10
10
  def run
11
- if plugins.any? {|plugin| plugin.named?(called_as)}
11
+ if plugins.any? {|plugin| plugin.named?(called_as) }
12
12
  load_plugin(called_as)
13
13
  else
14
14
  UsagePlugin.new(plugins).run
15
15
  end
16
16
  end
17
17
 
18
-
19
18
  def load_plugin(name)
20
19
  load Plugin.root.realpath + "#{name}.rb"
21
20
  end
22
21
  end
23
-
24
22
  end
@@ -25,11 +25,15 @@ module GitoriousMuninPlugins
25
25
 
26
26
  # Fetch line matching #{key}= in /etc/gitorious.conf
27
27
  def fetch(key, default_value=nil)
28
+ return ENV[key] if ENV[key]
28
29
 
29
30
  begin
30
31
  config_file = File.read(GITORIOUS_CONF_PATH)
31
32
  rescue Errno::ENOENT
32
- abort "Gitorious configuration file #{GITORIOUS_CONF_PATH} was not found, exiting"
33
+ abort <<-MSG
34
+ Gitorious configuration file #{GITORIOUS_CONF_PATH} was not found, and
35
+ environment variable #{key} was not set, exiting.
36
+ MSG
33
37
  end
34
38
 
35
39
  result = config_file.scan(/^#{key}=(.*)$/).flatten.first
@@ -27,7 +27,7 @@ EOS
27
27
  elsif global_options[:uninstall_given]
28
28
  uninstall_plugins(ARGV)
29
29
  elsif global_options[:try_given]
30
- try_running(ARGV)
30
+ (ARGV[0] || "").split(",").each { |name| try_running(name) }
31
31
  end
32
32
  end
33
33
 
@@ -54,7 +54,9 @@ EOS
54
54
  end
55
55
 
56
56
  def try_running(name)
57
- load Plugin.root.realpath + "#{name}.rb"
57
+ plugin = Plugin.root.realpath + "#{name}.rb"
58
+ abort("Unknown plugin #{name}, exiting. List valid plugins with -l.") if !plugin.exist?
59
+ load(plugin)
58
60
  end
59
61
 
60
62
  def extract_plugins_from_spec(spec)
@@ -1,3 +1,3 @@
1
1
  module GitoriousMuninPlugins
2
- VERSION = "0.9.22"
2
+ VERSION = "0.10.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitorious-munin-plugins
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 55
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 9
9
- - 22
10
- version: 0.9.22
8
+ - 10
9
+ - 0
10
+ version: 0.10.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marius Mathiesen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-11-06 00:00:00 +01:00
18
+ date: 2013-06-13 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency