Class: CocoapodsGitHooks::GitHooksManager
- Inherits:
-
Object
- Object
- CocoapodsGitHooks::GitHooksManager
- Defined in:
- lib/cocoapods-hbh/command/custom/sync_githooks.rb
Class Method Summary collapse
- .dependencies_in_target(abstract_target) ⇒ Array<Dependency>
- .sync ⇒ Object
- .validate_git_directory? ⇒ Boolean
Class Method Details
.dependencies_in_target(abstract_target) ⇒ Array<Dependency>
10 11 12 |
# File 'lib/cocoapods-hbh/command/custom/sync_githooks.rb', line 10 def dependencies_in_target(abstract_target) abstract_target.dependencies end |
.sync ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/cocoapods-hbh/command/custom/sync_githooks.rb', line 22 def sync return unless validate_git_directory? scr_path = "./Script/pre-commit" return unless File::exist?(scr_path) pre_path = ".git/hooks/pre-commit" FileUtils.mkdir '.git/hooks' unless File.directory?('.git/hooks') if File::exist?(pre_path) FileUtils.cp(scr_path, ".git/hooks/") FileUtils.chmod('+x', pre_path) end end |
.validate_git_directory? ⇒ Boolean
14 15 16 17 18 19 20 |
# File 'lib/cocoapods-hbh/command/custom/sync_githooks.rb', line 14 def validate_git_directory? unless File.directory?(".git") Pod::UI.puts 'Can not find .git directory.' return false end true end |