Class: SVNCampfireNotifier::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/svn_campfire_notifier/project.rb

Constant Summary collapse

SUBJECTS =
%w(kitty turtle dog car computer retro)
COLORS =
%w(red orange yellow green teal blue purple pink white grey black brown)
TYPES =
%w(face photo clipart lineart)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository_path, revision) ⇒ Project

Returns a new instance of Project.



9
10
11
12
# File 'lib/svn_campfire_notifier/project.rb', line 9

def initialize(repository_path, revision)
  @repository_path = repository_path
  @revision        = revision.to_i
end

Instance Attribute Details

#repository_pathObject (readonly)

Returns the value of attribute repository_path.



7
8
9
# File 'lib/svn_campfire_notifier/project.rb', line 7

def repository_path
  @repository_path
end

#revisionObject (readonly)

Returns the value of attribute revision.



7
8
9
# File 'lib/svn_campfire_notifier/project.rb', line 7

def revision
  @revision
end

Instance Method Details

#authorObject



18
19
20
# File 'lib/svn_campfire_notifier/project.rb', line 18

def author
  @author ||= `svnlook author -r #{revision} #{repository_path}`.strip
end

#changedObject



22
23
24
# File 'lib/svn_campfire_notifier/project.rb', line 22

def changed
  @changes ||= `svnlook changed -r #{revision} #{repository_path}`.strip
end

#colorObject



38
39
40
# File 'lib/svn_campfire_notifier/project.rb', line 38

def color
  COLORS[index % COLORS.length]
end

#image_typeObject



42
43
44
# File 'lib/svn_campfire_notifier/project.rb', line 42

def image_type
  TYPES[index % TYPES.length]
end

#indexObject



30
31
32
# File 'lib/svn_campfire_notifier/project.rb', line 30

def index
  name[0]
end

#logObject



26
27
28
# File 'lib/svn_campfire_notifier/project.rb', line 26

def log
  @log ||= `svnlook log -r #{revision} #{repository_path}`.strip
end

#nameObject



14
15
16
# File 'lib/svn_campfire_notifier/project.rb', line 14

def name
  @repository_path.split('/').last
end

#subjectObject



34
35
36
# File 'lib/svn_campfire_notifier/project.rb', line 34

def subject
  SUBJECTS[index % SUBJECTS.length]
end