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 fox rabbit tractor calculator bear shark happy cute)
COLORS =
%w(red orange yellow green teal blue purple pink white grey black brown)
TYPES =

EXCLUDE: face

%w(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



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

def color
  COLORS[name[1] % COLORS.length]
end

#image_typeObject



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

def image_type
  TYPES[name[2] % TYPES.length]
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



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

def subject
  SUBJECTS[name[0] % SUBJECTS.length]
end