Class: PreCommitHook
Instance Attribute Summary collapse
-
#dot_env_dot_example ⇒ Object
readonly
Returns the value of attribute dot_env_dot_example.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(dot_env_dot_example = nil) ⇒ PreCommitHook
constructor
A new instance of PreCommitHook.
-
#steps ⇒ Object
TODO: Make it possible to put .env and .env.example files somewhere else? Maybe later if people actually want this feature.
Methods inherited from Hook
#contains_steps?, #contents, #create_file, #create_file_if_does_not_exist, #filepath, #find_or_create, #print_new_hook_message, #print_new_steps_message, #write!
Constructor Details
#initialize(dot_env_dot_example = nil) ⇒ PreCommitHook
Returns a new instance of PreCommitHook.
2 3 4 5 6 |
# File 'lib/dot_example/pre_commit_hook.rb', line 2 def initialize(dot_env_dot_example = nil) @dot_env_dot_example = dot_env_dot_example || DotEnvDotExample.new @type = "pre-commit" create_file_if_does_not_exist end |
Instance Attribute Details
#dot_env_dot_example ⇒ Object (readonly)
Returns the value of attribute dot_env_dot_example.
8 9 10 |
# File 'lib/dot_example/pre_commit_hook.rb', line 8 def dot_env_dot_example @dot_env_dot_example end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/dot_example/pre_commit_hook.rb', line 8 def type @type end |
Instance Method Details
#steps ⇒ Object
TODO: Make it possible to put .env and .env.example files somewhere else? Maybe later if people actually want this feature
12 13 14 15 16 17 |
# File 'lib/dot_example/pre_commit_hook.rb', line 12 def steps [ "dot_example sync", "git add .env.example" ].join("\n") end |