Class: Avm::Git::AutoCommitPath
- Defined in:
- lib/avm/git/auto_commit_path.rb,
lib/avm/git/auto_commit_path/ruby.rb
Defined Under Namespace
Modules: Ruby
Constant Summary collapse
- CLASS_NAME_PATTERNS =
[%r{lib/((?!.*/lib/).+)\.rb\z}, %r{app/[^/]+/(.+)\.rb\z}].freeze
Instance Method Summary collapse
- #banner ⇒ Object
- #class_name ⇒ Object
- #commit ⇒ Object
- #commit_message ⇒ Object
- #relative_path ⇒ Object
- #run ⇒ Object
Instance Method Details
#banner ⇒ Object
21 22 23 24 25 |
# File 'lib/avm/git/auto_commit_path.rb', line 21 def infom "Checking \"#{relative_path}\"" infov ' * Class name', class_name infov ' * Commit message', end |
#class_name ⇒ Object
34 35 36 |
# File 'lib/avm/git/auto_commit_path.rb', line 34 def class_name ruby_class_name || relative_path.to_path end |
#commit ⇒ Object
27 28 29 30 31 32 |
# File 'lib/avm/git/auto_commit_path.rb', line 27 def commit infom ' * Commiting...' git.system!('reset', 'HEAD') git.system!('add', '--', relative_path.to_path) git.system!('commit', '-m', , '--', relative_path.to_path) end |
#commit_message ⇒ Object
38 39 40 41 42 |
# File 'lib/avm/git/auto_commit_path.rb', line 38 def r = class_name r += ': remove' unless path.file? r + '.' end |
#relative_path ⇒ Object
44 45 46 |
# File 'lib/avm/git/auto_commit_path.rb', line 44 def relative_path path.relative_path_from(git.root_path) end |
#run ⇒ Object
16 17 18 19 |
# File 'lib/avm/git/auto_commit_path.rb', line 16 def run commit end |