Class: XZGit::XZInteCommit

Inherits:
Command
  • Object
show all
Defined in:
lib/mrbin/xzcommand/xzintegratecommit.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Command

read_private_token, read_remote_project, run, verify_git_repo

Constructor Details

#initialize(argv) ⇒ XZInteCommit

Returns a new instance of XZInteCommit.



12
13
14
15
# File 'lib/mrbin/xzcommand/xzintegratecommit.rb', line 12

def initialize(argv)
    @std = argv.flag?('std',false)
    super
end

Class Method Details

.optionsObject



6
7
8
9
10
# File 'lib/mrbin/xzcommand/xzintegratecommit.rb', line 6

def self.options 
    [
        ['--std','target branch name'],
    ].concat(super)
end

Instance Method Details

#runObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/mrbin/xzcommand/xzintegratecommit.rb', line 27

def run
    pwdpath = Dir.pwd.strip
    podfilepath = "#{pwdpath}/Podfile"
    if @std
        res = `cat #{podfilepath} | grep commit | grep -v MJRefresh | grep -v XZMonitor`
        puts res
    else
        `cat #{podfilepath} | grep commit | grep -v MJRefresh | grep -v XZMonitor > commit.txt`
    end
    
end

#validate!Object



17
18
19
20
21
22
23
24
25
# File 'lib/mrbin/xzcommand/xzintegratecommit.rb', line 17

def validate!
    super
    pwdpath = Dir.pwd.strip
    podfilepath = "#{pwdpath}/Podfile"
    if !File.exist?(podfilepath)
        puts "can not found Podfile, please inspect your project path"
        exit(1)
    end
end