class XZGit::XZDevGit
Public Class Methods
new(argv)
click to toggle source
Calls superclass method
XZGit::Command::new
# File lib/mrbin/xzcommand/xzdevgit.rb, line 13 def initialize(argv) @exclude = argv.option('exclude','').split(',') @gitcommands = argv.arguments super end
options()
click to toggle source
Calls superclass method
# File lib/mrbin/xzcommand/xzdevgit.rb, line 7 def self.options [ ['--exclude','exclude pod name'] ].concat(super) end
Public Instance Methods
run()
click to toggle source
# File lib/mrbin/xzcommand/xzdevgit.rb, line 30 def run pods = excutepods() excutecommand(pods) end
validate!()
click to toggle source
# File lib/mrbin/xzcommand/xzdevgit.rb, line 19 def validate! root_path = Dir.pwd() dev_path = "#{root_path}/DevPods" if File.directory?(dev_path) && !Dir.empty?(dev_path) puts "devpods path --> #{dev_path}" else puts "DevPods does not exist or DevPods is empty" exit(1) end end
Private Instance Methods
excutecommand(paths)
click to toggle source
# File lib/mrbin/xzcommand/xzdevgit.rb, line 54 def excutecommand(paths) if @gitcommands.count > 0 && paths.count > 0 paths.each do |path| commandarr = [] commandarr << 'git' commandarr << '-C' commandarr << path commandarr << @gitcommands commandstr = commandarr.join(' ') system(commandstr) end end end
excutepods()
click to toggle source
# File lib/mrbin/xzcommand/xzdevgit.rb, line 36 def excutepods root_path = Dir.pwd() dev_path = "#{root_path}/DevPods" pods = Set.new Find.find(dev_path) do |file| filename = File.basename(file) if filename.end_with?('.podspec') filepath = File.dirname(file) pods << filepath podname = filename.split('.')[0] if @exclude.include?(podname) pods.delete(filepath) end end end pods end