svn-campfire-notifier 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/svn_campfire_notifier.rb +12 -1
  2. metadata +3 -3
@@ -5,6 +5,11 @@ require 'json'
5
5
  require 'svn_campfire_notifier/core_ext'
6
6
 
7
7
  class SVNCampfireNotifier
8
+ CONFIGURATION_CANDIDATES = [
9
+ File.expand_path('~/.svn_campfire_notifier.yml'),
10
+ '/etc/svn_campfire_notifier.yml'
11
+ ]
12
+
8
13
  class ConfigurationError < StandardError; end
9
14
 
10
15
  autoload :GoogleImage, 'svn_campfire_notifier/google_image'
@@ -18,7 +23,7 @@ class SVNCampfireNotifier
18
23
  @test_mode = test_mode
19
24
  @project = Project.new(repository_path, revision)
20
25
 
21
- @settings = YAML.load_file(File.expand_path('~/.svn_campfire_notifier.yml'))
26
+ @settings = YAML.load_file(configuration_filename)
22
27
  @room = @settings['room']
23
28
  Broach.settings = {
24
29
  'account' => @settings['account'],
@@ -27,6 +32,12 @@ class SVNCampfireNotifier
27
32
  }
28
33
  end
29
34
 
35
+ def configuration_filename
36
+ CONFIGURATION_CANDIDATES.detect do |candidate|
37
+ File.exist?(candidate)
38
+ end || CONFIGURATION_CANDIDATES.last
39
+ end
40
+
30
41
  def test_mode?
31
42
  @test_mode
32
43
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svn-campfire-notifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Manfred Stienstra