Class: Gct::Command
- Inherits:
-
CLAide::Command
- Object
- CLAide::Command
- Gct::Command
show all
- Defined in:
- lib/gct/command.rb,
lib/gct/command/op.rb,
lib/gct/command/init.rb,
lib/gct/command/repo.rb,
lib/gct/command/skip.rb,
lib/gct/command/spec.rb,
lib/gct/command/build.rb,
lib/gct/command/clean.rb,
lib/gct/command/robot.rb,
lib/gct/command/setup.rb,
lib/gct/command/config.rb,
lib/gct/command/create.rb,
lib/gct/command/unskip.rb,
lib/gct/command/update.rb,
lib/gct/command/autotag.rb,
lib/gct/command/build/r.rb,
lib/gct/command/init/ci.rb,
lib/gct/command/op/gems.rb,
lib/gct/command/op/lint.rb,
lib/gct/command/op/root.rb,
lib/gct/command/clean/ci.rb,
lib/gct/command/repo/add.rb,
lib/gct/command/skip/tag.rb,
lib/gct/command/create/oc.rb,
lib/gct/command/init/unit.rb,
lib/gct/command/op/xcache.rb,
lib/gct/command/repo/push.rb,
lib/gct/command/spec/lint.rb,
lib/gct/command/clean/lint.rb,
lib/gct/command/config/get.rb,
lib/gct/command/config/set.rb,
lib/gct/command/op/gitconf.rb,
lib/gct/command/unskip/tag.rb,
lib/gct/command/update/tag.rb,
lib/gct/command/clean/cache.rb,
lib/gct/command/repo/update.rb,
lib/gct/command/robot/start.rb,
lib/gct/command/update/next.rb,
lib/gct/command/create/swift.rb,
lib/gct/command/create/third.rb,
lib/gct/command/robot/finish.rb,
lib/gct/command/skip/modular.rb,
lib/gct/command/robot/podfile.rb,
lib/gct/command/unskip/modular.rb,
lib/gct/command/update/analyze.rb,
lib/gct/command/update/podfile.rb,
lib/gct/command/update/version.rb,
lib/gct/command/update/dependency.rb
Direct Known Subclasses
Autotag, Build, Clean, Config, Create, Init, Op, Repo, Robot, Setup, Skip, Spec, Unskip, Update
Defined Under Namespace
Classes: Autotag, Build, Clean, Config, Create, Init, Op, Repo, Robot, Setup, Skip, Spec, Unskip, Update
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(argv) ⇒ Command
Returns a new instance of Command.
50
51
52
53
54
55
56
57
|
# File 'lib/gct/command.rb', line 50
def initialize(argv)
super
unless self.ansi_output?
Colored2.disable!
String.send(:define_method, :colorize) { |string, _| string }
end
end
|
Class Method Details
.options ⇒ Object
40
41
42
43
44
|
# File 'lib/gct/command.rb', line 40
def self.options
[
['--silent', 'Show nothing'],
].concat(super)
end
|
.run(argv) ⇒ Object
46
47
48
|
# File 'lib/gct/command.rb', line 46
def self.run(argv)
super(argv)
end
|
Instance Method Details
#auto_add_tag(tag) ⇒ Object
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/gct/command.rb', line 96
def auto_add_tag(tag)
tag_points = tag.to_s.split('.')
raise "tag is nil" if tag_points.length <= 0
index = tag_points.length - 1
need_add_point = tag_points[index].to_i + 1
tag_points[index] = need_add_point == 10 ? 0 : need_add_point
while need_add_point == 10 && index > 0
index = index - 1
need_add_point = tag_points[index].to_i + 1
tag_points[index] = need_add_point == 10 && index != 0 ? 0 : need_add_point
end
tag_points.join('.')
end
|
#check_branch_can_be_update(branch) ⇒ Object
116
117
118
119
120
121
122
|
# File 'lib/gct/command.rb', line 116
def check_branch_can_be_update(branch)
can_be_update = current_branch.include?(branch)
puts "当前不是#{branch}分支".red if !can_be_update
can_be_update
end
|
#config_gitlab ⇒ Object
65
66
67
68
69
70
71
72
|
# File 'lib/gct/command.rb', line 65
def config_gitlab
if FileBase.exist_root and token
Gitlab.configure do |config|
config.endpoint = 'https://gi-dev.ccrgt.com/api/v4'
config.private_token = token
end
end
end
|
#current_branch ⇒ Object
110
111
112
113
114
|
# File 'lib/gct/command.rb', line 110
def current_branch
branch = "#{`git branch | awk '$1 == "*" {print $2}'`}".rstrip
raise "该文件夹不是一个git仓库".red if branch.empty?
branch
end
|
#file_contents(project_id, file, branch) ⇒ Object
59
60
61
62
63
|
# File 'lib/gct/command.rb', line 59
def file_contents(project_id, file, branch)
file_contents ||= Gitlab.file_contents(project_id, file, branch)
rescue Gitlab::Error::NotFound => error
raise error.message
end
|
#get_project ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# File 'lib/gct/command.rb', line 79
def get_project
proj = nil
Dir.entries(Dir.pwd).each do |subfile|
if subfile.include? '.xcodeproj'
proj = subfile
end
end
if proj.nil?
puts '没有找到.xcodeproj文件'.red if proj.nil?
nil
else
project_path = File.join(Dir.pwd, "./" + proj)
project = Xcodeproj::Project.open(project_path)
project
end
end
|
#gitlab_error ⇒ Object
74
75
76
77
|
# File 'lib/gct/command.rb', line 74
def gitlab_error
FileBase.root_err
token_err
end
|