Class: Hooke::Linker
- Inherits:
-
Object
- Object
- Hooke::Linker
- Defined in:
- lib/hooke/linker.rb
Overview
Link .git_hooks directory to .git/hooks
Instance Attribute Summary collapse
-
#app_dir ⇒ Object
readonly
Returns the value of attribute app_dir.
Instance Method Summary collapse
-
#initialize ⇒ Linker
constructor
A new instance of Linker.
- #symlink ⇒ Object
Constructor Details
#initialize ⇒ Linker
Returns a new instance of Linker.
7 8 9 |
# File 'lib/hooke/linker.rb', line 7 def initialize @app_dir = File.(Bundler.root) end |
Instance Attribute Details
#app_dir ⇒ Object (readonly)
Returns the value of attribute app_dir.
5 6 7 |
# File 'lib/hooke/linker.rb', line 5 def app_dir @app_dir end |
Instance Method Details
#symlink ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/hooke/linker.rb', line 11 def symlink fail_with_link_error unless linkable? install_status = Dir.chdir(app_dir) do backup_directory('./.git/hooks') File.symlink("#{app_dir}/git_hooks", "#{app_dir}/.git/hooks") end install_status end |