module GitCli::Ignore
Public Instance Methods
ignore(val)
click to toggle source
# File lib/git_cli/ignore.rb, line 22 def ignore(val) with_ignore_file do |f| f.puts val end log_debug ".gitignore file updated with line '#{val}'" [true,".gitignore file updated"] end
ignore_rules()
click to toggle source
# File lib/git_cli/ignore.rb, line 30 def ignore_rules st, root = workspace_root root.strip! if st rulesFile = File.join(root,".gitignore") if File.exist?(rulesFile) File.open(rulesFile,"r") do |f| @cont = f.read end @cont else "" end else "" end end
update_ignore_rules(rules)
click to toggle source
# File lib/git_cli/ignore.rb, line 48 def update_ignore_rules(rules) st, root = workspace_root root.strip! if st rulesFile = File.join(root,".gitignore") File.open(rulesFile,"w") do |f| f.write rules end end log_debug ".gitignore files is updated!" [true,".gitignore file is updated"] end
Private Instance Methods
with_ignore_file(&block)
click to toggle source
# File lib/git_cli/ignore.rb, line 62 def with_ignore_file(&block) if block st, root = workspace_root root.strip! if st igPath = File.join(root,".gitignore") FileUtils.touch(igPath) if not File.exist?(igPath) File.open(igPath,"a") do |f| block.call(f) end else raise GitCliException, "Cannot get workspace root. Probably not a GIT workspace?" end end end