Class: Git
- Inherits:
-
Object
- Object
- Git
- Defined in:
- lib/aidir/git.rb
Instance Attribute Summary collapse
-
#changed_files ⇒ Object
Returns the value of attribute changed_files.
-
#errors ⇒ Object
Returns the value of attribute errors.
Instance Method Summary collapse
- #clear_cached_files ⇒ Object
-
#initialize ⇒ Git
constructor
A new instance of Git.
- #is_repository? ⇒ Boolean
- #ruby_files ⇒ Object
Constructor Details
#initialize ⇒ Git
Returns a new instance of Git.
5 6 7 8 |
# File 'lib/aidir/git.rb', line 5 def initialize @errors = [] @changed_files = [] end |
Instance Attribute Details
#changed_files ⇒ Object
Returns the value of attribute changed_files.
3 4 5 |
# File 'lib/aidir/git.rb', line 3 def changed_files @changed_files end |
#errors ⇒ Object
Returns the value of attribute errors.
3 4 5 |
# File 'lib/aidir/git.rb', line 3 def errors @errors end |
Instance Method Details
#clear_cached_files ⇒ Object
25 26 27 28 29 |
# File 'lib/aidir/git.rb', line 25 def clear_cached_files @changed_files.each do |file| File.delete(temp(file)) end end |
#is_repository? ⇒ Boolean
10 11 12 13 14 15 16 |
# File 'lib/aidir/git.rb', line 10 def is_repository? Open3.popen3('git rev-parse') do |_, _, stderr| error = stderr.read @errors << error unless error.empty? end @errors.empty? end |
#ruby_files ⇒ Object
18 19 20 21 22 23 |
# File 'lib/aidir/git.rb', line 18 def ruby_files all_changed_files filter_ruby_files cache_files @changed_files end |