Method: Git#add_files
- Defined in:
- lib/version_control/git.rb
#add_files(exclude_regex = "") ⇒ Object
Adds any new files in the local repo to the git commit list
note: you need to commit after adding files
Attributes
-
exclude_regex- regex to filter add files (file !=~ filter)
Returns
-
command output
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/version_control/git.rb', line 148 def add_files(exclude_regex = "") result = status lines = result.split("\n") ipos = lines.index("Untracked files:") unless ipos.nil? files = lines[(ipos + 2)..-3] files.each do |item| unless File.basename.start_with?(".") cmd = "#{@git} add #{item}" if exclude == "" result += process_cmd(cmd) else result += process_cmd(cmd) unless file =~ /#{exclude}/ end end end end result += status result end |