Sha256: 2f68157ecaa1039bc47081335e031a2e9bb558250442ed10880db750a17326e9
Contents?: true
Size: 1.01 KB
Versions: 10
Compression:
Stored size: 1.01 KB
Contents
class Git def initialize(path) @working_path = path end def self.clone(from,path,name) `cd #{path} && git clone #{from} #{name}` end def self.init(path) `cd #{path} && git init` end def mv(orig,new,with_commit = true) `cd '#@working_path' && git mv #{orig} #{new}` self.commit("#{clean_name(orig)} Renamed to #{clean_name(new)}") if with_commit end def add(file,with_commit = true) `cd '#@working_path' && git add '#{file}'` self.commit("#{clean_name(file)} Added") if with_commit end def edit(file,with_commit = true) `cd '#@working_path' && git add '#{file}'` self.commit("#{clean_name(file)} Updated") if with_commit end def rm(file,with_commit=true) `cd '#@working_path' && git rm -f '#{file}'` self.commit("#{clean_name(file)} Removed") if with_commit end def commit(msg,*args) `cd '#@working_path' && git commit #{args.to_s} -m '#{msg}'` end def clean_name(f) return f.sub(/^(.*)?\/(main|private)\/(.*)/,'\3').sub(/^@/,'') end end
Version data entries
10 entries across 10 versions & 2 rubygems