Class: SVNCampfireNotifier
- Inherits:
-
Object
- Object
- SVNCampfireNotifier
show all
- Defined in:
- lib/svn_campfire_notifier.rb,
lib/svn_campfire_notifier/message.rb,
lib/svn_campfire_notifier/project.rb,
lib/svn_campfire_notifier/google_image.rb
Defined Under Namespace
Classes: ConfigurationError, GoogleImage, Message, Project
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(test_mode, repository_path, revision) ⇒ SVNCampfireNotifier
Returns a new instance of SVNCampfireNotifier.
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/svn_campfire_notifier.rb', line 17
def initialize(test_mode, repository_path, revision)
@test_mode = test_mode
@project = Project.new(repository_path, revision)
@settings = YAML.load_file(configuration_filename)
@room = @settings['room']
Broach.settings = {
'account' => @settings['account'],
'token' => @settings['token'],
'use_ssl' => @settings['use_ssl']
}
end
|
Instance Attribute Details
#project ⇒ Object
Returns the value of attribute project.
15
16
17
|
# File 'lib/svn_campfire_notifier.rb', line 15
def project
@project
end
|
Class Method Details
.run(options, args) ⇒ Object
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/svn_campfire_notifier.rb', line 64
def self.run(options, args)
if args.length == 2
new(
options.keys.include?('t') || options.keys.include?('test'),
*args
).run
else
usage
end
end
|
.usage ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/svn_campfire_notifier.rb', line 56
def self.usage
puts "Usage: #{File.basename($0)} <repository> <revision>"
puts ""
puts "Options:"
puts " -v, --verbose: Print informative messages"
puts " -t, --test: Don't send to Campfire, just print what you would send"
end
|
Instance Method Details
#configuration_filename ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/svn_campfire_notifier.rb', line 30
def configuration_filename
begin
return File.expand_path('~/.svn_campfire_notifier.yml')
rescue ArgumentError
end
'/etc/svn_campfire_notifier.yml'
end
|
#run ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/svn_campfire_notifier.rb', line 42
def run
if test_mode?
Message.new(project).parts.each do |part|
puts part.first
end
elsif room = Broach::Room.find_by_name(@room)
Message.new(project).parts.each do |part|
room.speak(*part)
end
else
raise ConfigurationError, "Can't find a room with the name `#{@room}'"
end
end
|
#test_mode? ⇒ Boolean
38
39
40
|
# File 'lib/svn_campfire_notifier.rb', line 38
def test_mode?
@test_mode
end
|