Module: HappyCommit

Includes:
OnCommit
Defined in:
lib/happy-commit.rb,
lib/happy-commit/on_commit.rb

Defined Under Namespace

Modules: OnCommit

Class Method Summary collapse

Methods included from OnCommit

included

Class Method Details

.installObject



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/happy-commit.rb', line 11

def self.install
  if File.exist?(self.hooks_path)
    FileUtils.mkpath(self.sounds_path)
    self.sounds.each_with_index do |sound, i|
      FileUtils.cp(sound, self.sounds_path+"/#{i}.wav")
    end

    File.open(self.post_commit_path, "w") do |f|
      f << File.read(File.expand_path("../happy-commit/hook.rb", __FILE__))
    end
    FileUtils.chmod(0755, self.post_commit_path)
  end
end

.soundsObject



7
8
9
# File 'lib/happy-commit.rb', line 7

def self.sounds
  @sounds ||= Dir.glob(File.dirname(__FILE__)+"/../sounds/*.wav")
end