Class: CommitPhoto
- Inherits:
-
Object
- Object
- CommitPhoto
- Defined in:
- lib/commitphotos.rb,
lib/commitphotos/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
-
.hook(global, video) ⇒ Object
This will setup Commitphotos for the user.
- .image ⇒ Object
- .video ⇒ Object
Class Method Details
.hook(global, video) ⇒ Object
This will setup Commitphotos for the user.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/commitphotos.rb', line 12 def self.hook(global, video) if global destination = File.(`git config --get init.templatedir`.chomp) if destination.empty? destination = '~/.gittemplates' mkdir_p(destination) unless File.exist?(destination) `git config --global init.templatedir #{destination}` end else destination = File.(File.join(Dir.pwd, '.git/hooks')) abort 'Error: not a git repository.' unless File.exist? File.join(Dir.pwd, '.git') end type = video ? 'video' : 'image' local_post_commit = "#{File.(File.dirname(__FILE__))}/commitphotos/hooks/post-commit-#{type}" FileUtils.mkdir_p(destination) FileUtils.copy(local_post_commit, File.join(destination, 'post-commit')) end |