Class: Terraspace::CLI::New::GitHook
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Terraspace::CLI::New::GitHook
- Includes:
- Thor::Actions
- Defined in:
- lib/terraspace/cli/new/git_hook.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cli_options ⇒ Object
5 6 7 8 9 10 |
# File 'lib/terraspace/cli/new/git_hook.rb', line 5 def self. [ [:envs, type: :array, default: %w[dev prod], desc: "envs to build"], [:type, aliases: %w[t], default: "pre-push", desc: "git hook type"], ] end |
.source_root ⇒ Object
13 14 15 |
# File 'lib/terraspace/cli/new/git_hook.rb', line 13 def self.source_root File.("../../../templates/base/git_hook", __dir__) end |
Instance Method Details
#create ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/terraspace/cli/new/git_hook.rb', line 17 def create unless File.exist?(".git") puts "No .git folder found. Not creating git hook." return end dest = ".git/hooks/#{[:type]}" template "hook.sh", dest chmod dest, 0755 end |