shkeeper 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.idea/.gitignore +8 -0
- data/.idea/bigkeeper.iml +68 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/CONTRIBUTING.md +70 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +145 -0
- data/LICENSE +21 -0
- data/README.md +113 -0
- data/big_keeper.gemspec +50 -0
- data/bin/big +14 -0
- data/bin/koo +14 -0
- data/bin/setup +8 -0
- data/bin/sh +14 -0
- data/docs/en-US/FEATURE.md +0 -0
- data/docs/en-US/README.md +54 -0
- data/docs/zh-CN/BIGKEEPER_FILE.md +84 -0
- data/docs/zh-CN/FEATURE&HOTFIX.md +88 -0
- data/docs/zh-CN/IMAGE.md +0 -0
- data/docs/zh-CN/PODFILE.md +43 -0
- data/docs/zh-CN/README.md +113 -0
- data/docs/zh-CN/RECOMMEND.md +22 -0
- data/docs/zh-CN/RELEASE.md +60 -0
- data/docs/zh-CN/SPEC.md +39 -0
- data/lib/big_keeper/command/feature&hotfix/delete.rb +40 -0
- data/lib/big_keeper/command/feature&hotfix/finish.rb +57 -0
- data/lib/big_keeper/command/feature&hotfix/list.rb +63 -0
- data/lib/big_keeper/command/feature&hotfix/publish.rb +56 -0
- data/lib/big_keeper/command/feature&hotfix/pull.rb +26 -0
- data/lib/big_keeper/command/feature&hotfix/push.rb +27 -0
- data/lib/big_keeper/command/feature&hotfix/rebase.rb +32 -0
- data/lib/big_keeper/command/feature&hotfix/start.rb +94 -0
- data/lib/big_keeper/command/feature&hotfix/switch.rb +48 -0
- data/lib/big_keeper/command/feature&hotfix/update.rb +74 -0
- data/lib/big_keeper/command/feature&hotfix.rb +169 -0
- data/lib/big_keeper/command/image/image.rb +0 -0
- data/lib/big_keeper/command/image.rb +28 -0
- data/lib/big_keeper/command/pod/podfile.rb +69 -0
- data/lib/big_keeper/command/pod.rb +42 -0
- data/lib/big_keeper/command/release/home.rb +91 -0
- data/lib/big_keeper/command/release/module.rb +61 -0
- data/lib/big_keeper/command/release.rb +75 -0
- data/lib/big_keeper/command/spec/add.rb +9 -0
- data/lib/big_keeper/command/spec/analyze.rb +88 -0
- data/lib/big_keeper/command/spec/delete.rb +9 -0
- data/lib/big_keeper/command/spec/list.rb +19 -0
- data/lib/big_keeper/command/spec/search.rb +9 -0
- data/lib/big_keeper/command/spec/sync.rb +12 -0
- data/lib/big_keeper/command/spec.rb +78 -0
- data/lib/big_keeper/dependency/dep_gradle_operator.rb +56 -0
- data/lib/big_keeper/dependency/dep_operator.rb +32 -0
- data/lib/big_keeper/dependency/dep_pod_operator.rb +131 -0
- data/lib/big_keeper/dependency/dep_service.rb +14 -0
- data/lib/big_keeper/dependency/dep_type.rb +33 -0
- data/lib/big_keeper/model/gitflow_type.rb +43 -0
- data/lib/big_keeper/model/library_model.rb +116 -0
- data/lib/big_keeper/model/operate_type.rb +27 -0
- data/lib/big_keeper/model/podfile_model.rb +33 -0
- data/lib/big_keeper/service/git_service.rb +261 -0
- data/lib/big_keeper/service/module_service.rb +161 -0
- data/lib/big_keeper/service/stash_service.rb +58 -0
- data/lib/big_keeper/util/bigkeeper_parser.rb +244 -0
- data/lib/big_keeper/util/cache_operator.rb +149 -0
- data/lib/big_keeper/util/code_operator.rb +37 -0
- data/lib/big_keeper/util/file_operator.rb +33 -0
- data/lib/big_keeper/util/git_operator.rb +226 -0
- data/lib/big_keeper/util/gitflow_operator.rb +51 -0
- data/lib/big_keeper/util/gradle_operator.rb +209 -0
- data/lib/big_keeper/util/info_plist_operator.rb +46 -0
- data/lib/big_keeper/util/leancloud_logger.rb +72 -0
- data/lib/big_keeper/util/list_generator.rb +101 -0
- data/lib/big_keeper/util/logger.rb +46 -0
- data/lib/big_keeper/util/pod_operator.rb +71 -0
- data/lib/big_keeper/util/podfile_detector.rb +137 -0
- data/lib/big_keeper/util/podfile_module.rb +63 -0
- data/lib/big_keeper/util/podfile_operator.rb +117 -0
- data/lib/big_keeper/util/verify_operator.rb +17 -0
- data/lib/big_keeper/util/xcode_operator.rb +15 -0
- data/lib/big_keeper/version.rb +3 -0
- data/lib/big_keeper.rb +71 -0
- data/resources/banner.png +0 -0
- data/resources/command.png +0 -0
- data/resources/keynote/big-keeper-readme-analyze.key +0 -0
- data/resources/keynote/big-keeper-readme-example.key +0 -0
- data/resources/keynote/big-keeper-readme-feature.key +0 -0
- data/resources/keynote/big-keeper-readme-release.key +0 -0
- data/resources/readme/big-keeper-readme.001.png +0 -0
- metadata +345 -0
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'colorize'
|
2
|
+
require 'big_keeper/util/leancloud_logger'
|
3
|
+
|
4
|
+
module BigKeeper
|
5
|
+
DEFAULT_LOG = 1
|
6
|
+
HIGHLIGHT_LOG = 2
|
7
|
+
ERROR_LOG = 3
|
8
|
+
WARNING_LOG = 4
|
9
|
+
|
10
|
+
class Logger
|
11
|
+
|
12
|
+
def self.log_with_type(sentence,type)
|
13
|
+
case type
|
14
|
+
when DEFAULT_LOG then puts sentence.to_s.colorize(:default)
|
15
|
+
when HIGHLIGHT_LOG then puts sentence.to_s.colorize(:green)
|
16
|
+
when ERROR_LOG then raise sentence.to_s.colorize(:red)
|
17
|
+
when WARNING_LOG then puts sentence.to_s.colorize(:yellow)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.default(sentence)
|
22
|
+
puts formatter_output(sentence).colorize(:default)
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.highlight(sentence)
|
26
|
+
puts formatter_output(sentence).colorize(:green)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.error(sentence)
|
30
|
+
LeanCloudLogger.instance.end_log(false)
|
31
|
+
raise formatter_output(sentence).colorize(:red)
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.warning(sentence)
|
35
|
+
puts formatter_output(sentence).colorize(:yellow)
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.separator
|
39
|
+
puts "- - - - - - - - - - - - - - - - - - - - - - - - - - -".colorize(:light_blue)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.formatter_output(sentence)
|
43
|
+
"[big] ".concat(sentence.to_s).to_s
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'big_keeper/util/logger'
|
2
|
+
require 'open3'
|
3
|
+
|
4
|
+
module BigKeeper
|
5
|
+
class PodOperator
|
6
|
+
def self.pod_install(path, repo_update)
|
7
|
+
# pod install
|
8
|
+
if repo_update
|
9
|
+
PodOperator.pod_update_private_repos(true)
|
10
|
+
end
|
11
|
+
Logger.highlight('Start pod update, waiting...')
|
12
|
+
cmd = "pod update --project-directory='#{path}'"
|
13
|
+
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
|
14
|
+
while line = stdout.gets
|
15
|
+
p line
|
16
|
+
end
|
17
|
+
end
|
18
|
+
Logger.highlight('Finish pod update.')
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.pod_repo_push(path, module_name, source, version)
|
22
|
+
Logger.highlight(%Q(Start Pod repo push #{module_name}))
|
23
|
+
Dir.chdir(path) do
|
24
|
+
command = ""
|
25
|
+
p BigkeeperParser.source_spec_name(module_name)
|
26
|
+
if source.length > 0
|
27
|
+
command = "pod repo push #{BigkeeperParser.source_spec_name(module_name)} #{module_name}.podspec --allow-warnings --sources=#{source} --verbose --use-libraries"
|
28
|
+
else
|
29
|
+
command = "pod repo push #{BigkeeperParser.source_spec_name(module_name)} #{module_name}.podspec --allow-warnings --verbose --use-libraries"
|
30
|
+
end
|
31
|
+
|
32
|
+
IO.popen(command) do |io|
|
33
|
+
is_success = false
|
34
|
+
error_info = Array.new
|
35
|
+
io.each do |line|
|
36
|
+
error_info.push(line)
|
37
|
+
is_success = true if line.include? "Updating spec repo"
|
38
|
+
end
|
39
|
+
unless is_success
|
40
|
+
puts error_info
|
41
|
+
Logger.error("Fail: '#{module_name}' Pod repo fail")
|
42
|
+
end
|
43
|
+
Logger.highlight(%Q(Success release #{module_name} V#{version}))
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.pod_update_private_repos(update_private)
|
49
|
+
if update_private
|
50
|
+
p "BigkeeperParser.sources = #{BigkeeperParser.sources}"
|
51
|
+
BigkeeperParser.sources.map { |spec|
|
52
|
+
Logger.highlight('Start pod repo update, waiting...')
|
53
|
+
cmd = "pod repo update #{spec}"
|
54
|
+
cmd(cmd)
|
55
|
+
}
|
56
|
+
else
|
57
|
+
cmd = "pod repo update"
|
58
|
+
cmd(cmd)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.cmd(cmd)
|
63
|
+
Open3.popen3(cmd) do |stdin , stdout , stderr, wait_thr|
|
64
|
+
while line = stdout.gets
|
65
|
+
puts line
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require 'big_keeper/util/bigkeeper_parser'
|
2
|
+
require 'big_keeper/model/podfile_model'
|
3
|
+
require 'big_keeper/util/logger'
|
4
|
+
|
5
|
+
module BigKeeper
|
6
|
+
|
7
|
+
class PodfileDetector
|
8
|
+
|
9
|
+
attr_accessor :module_list, :main_path
|
10
|
+
$current_module_list = []
|
11
|
+
$unlock_pod_list = []
|
12
|
+
$modify_pod_list = {}
|
13
|
+
|
14
|
+
def initialize(main_path, module_list)
|
15
|
+
@module_list = module_list
|
16
|
+
@main_path = main_path
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def get_current_module_list
|
21
|
+
$current_module_list = []
|
22
|
+
podfile_lines = File.readlines("#{@main_path}/Podfile")
|
23
|
+
Logger.highlight("Analyzing Podfile...") unless podfile_lines.size.zero?
|
24
|
+
podfile_lines.collect do |sentence|
|
25
|
+
deal_podfile_line_forCurrent(sentence)
|
26
|
+
end
|
27
|
+
$current_module_list
|
28
|
+
end
|
29
|
+
|
30
|
+
def deal_podfile_line_forCurrent(sentence)
|
31
|
+
return unless !sentence.strip.start_with?("#")
|
32
|
+
if sentence.strip.include?('pod ')
|
33
|
+
pod_model = PodfileModel.new(sentence)
|
34
|
+
if !pod_model.name.empty? &&
|
35
|
+
pod_model.path != nil &&
|
36
|
+
pod_model.tag == nil
|
37
|
+
$current_module_list << pod_model.name if @module_list.include?(pod_model.name)
|
38
|
+
end
|
39
|
+
pod_model
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
def get_unlock_pod_list
|
45
|
+
podfile_lines = File.readlines("#{@main_path}/Podfile")
|
46
|
+
Logger.highlight("Analyzing Podfile...") unless podfile_lines.size.zero?
|
47
|
+
podfile_lines.collect do |sentence|
|
48
|
+
deal_podfile_line(sentence) unless sentence =~(/(\d+.){1,2}\d+/)
|
49
|
+
end
|
50
|
+
$unlock_pod_list
|
51
|
+
end
|
52
|
+
|
53
|
+
def deal_podfile_line(sentence)
|
54
|
+
return unless !sentence.strip.start_with?("#")
|
55
|
+
if sentence.strip.include?('pod ')
|
56
|
+
pod_model = PodfileModel.new(sentence)
|
57
|
+
if !pod_model.name.empty? &&
|
58
|
+
pod_model.configurations != '[\'Debug\']' &&
|
59
|
+
pod_model.path == nil &&
|
60
|
+
pod_model.tag == nil
|
61
|
+
$unlock_pod_list << pod_model.name unless @module_list.include?(pod_model.name)
|
62
|
+
end
|
63
|
+
pod_model
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
def deal_lock_file(main_path, deal_list)
|
69
|
+
$result = {}
|
70
|
+
podfile_lock_lines = File.readlines("#{main_path}/Podfile.lock")
|
71
|
+
Logger.highlight("Analyzing Podfile.lock...") unless podfile_lock_lines.size.zero?
|
72
|
+
podfile_lock_lines.select do |sentence|
|
73
|
+
if sentence.include?('DEPENDENCIES') #指定范围解析 Dependencies 之前
|
74
|
+
break
|
75
|
+
end
|
76
|
+
|
77
|
+
temp_sentence = sentence.strip
|
78
|
+
pod_name = get_lock_podname(temp_sentence)
|
79
|
+
if deal_list.include?(pod_name)
|
80
|
+
current_version = $result[pod_name]
|
81
|
+
temp_version = get_lock_version(temp_sentence)
|
82
|
+
if temp_version != nil
|
83
|
+
if current_version != nil
|
84
|
+
$result[pod_name] = chose_version(current_version, temp_version)
|
85
|
+
else
|
86
|
+
$result[pod_name] = temp_version
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
return $result
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.get_pod_model(sentence)
|
95
|
+
if sentence.include?('pod ')
|
96
|
+
pod_model = PodfileModel.new(sentence)
|
97
|
+
return pod_model
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def get_pod_name(sentence)
|
102
|
+
pod_model = deal_podfile_line(sentence)
|
103
|
+
pod_name = pod_model.name if pod_model != nil && pod_model.configurations.nil
|
104
|
+
@unlock_pod_list << pod_name unless @module_list.include pod_name
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
def get_lock_podname(sentence) #获得pod名称
|
110
|
+
match_result = /(\d+.){1,2}\d+/.match(sentence.delete('- :~>='))
|
111
|
+
pod_name = match_result.pre_match unless match_result == nil
|
112
|
+
return pod_name.delete('()') unless pod_name == nil
|
113
|
+
end
|
114
|
+
|
115
|
+
def get_lock_version(sentence)#获得pod版本号
|
116
|
+
match_result = /(\d+.){1,2}\d+/.match(sentence)
|
117
|
+
return match_result[0] unless match_result == nil
|
118
|
+
end
|
119
|
+
|
120
|
+
def chose_version(cur_version,temp_version)
|
121
|
+
# p "cur:#{cur_version},temp:#{temp_version}"
|
122
|
+
cur_list = cur_version.split('.')
|
123
|
+
temp_list = temp_version.split('.')
|
124
|
+
temp_list << 0.to_s if temp_list.size == 2
|
125
|
+
if cur_list[0] >= temp_list[0]
|
126
|
+
if cur_list[1] >= temp_list[1]
|
127
|
+
if cur_list[2] > temp_list[2]
|
128
|
+
return cur_version
|
129
|
+
end
|
130
|
+
return temp_version
|
131
|
+
end
|
132
|
+
return temp_version
|
133
|
+
end
|
134
|
+
return temp_version
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'big_keeper/util/bigkeeper_parser'
|
2
|
+
require 'big_keeper/util/podfile_detector'
|
3
|
+
require 'big_keeper/model/podfile_model'
|
4
|
+
require 'big_keeper/util/logger'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
|
8
|
+
class PodfileModuleDetector
|
9
|
+
@module_list = []
|
10
|
+
|
11
|
+
def initialize(main_path)
|
12
|
+
@module_list = BigkeeperParser.module_names
|
13
|
+
@main_path = main_path
|
14
|
+
@update_modules = {}
|
15
|
+
# check_version_list
|
16
|
+
end
|
17
|
+
|
18
|
+
#检查需要更新业务库列表
|
19
|
+
def check_version_list
|
20
|
+
if @module_list.empty?
|
21
|
+
Logger.highlight('There is not any module should to be check.')
|
22
|
+
return
|
23
|
+
else
|
24
|
+
Logger.highlight('Checking..')
|
25
|
+
@module_list.each do |module_name|
|
26
|
+
get_pod_search_result(module_name)
|
27
|
+
end
|
28
|
+
|
29
|
+
#获得pod信息后
|
30
|
+
deal_module_info
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_pod_search_result(pod_name)
|
35
|
+
#输入pod Search 结果
|
36
|
+
`pod search #{pod_name} --ios --simple >> #{@main_path}/bigKeeperPodInfo.tmp`
|
37
|
+
end
|
38
|
+
|
39
|
+
def deal_module_info
|
40
|
+
podfile_lines = File.readlines("#{@main_path}/bigKeeperPodInfo.tmp")
|
41
|
+
Logger.highlight("Analyzing modules info...") unless podfile_lines.size.zero?
|
42
|
+
podfile_lines.collect do |sentence|
|
43
|
+
if sentence =~(/pod/)
|
44
|
+
sentence = sentence.sub('pod', '')
|
45
|
+
sentence = sentence.delete('\n\'')
|
46
|
+
match_result = sentence.split(',')
|
47
|
+
pod_name = match_result[0].strip
|
48
|
+
latest_version = match_result[1].strip
|
49
|
+
@update_modules[pod_name] = latest_version unless @update_modules.include?(pod_name)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
p @update_modules
|
53
|
+
File.delete("#{@main_path}/bigKeeperPodInfo.tmp")
|
54
|
+
@update_modules
|
55
|
+
end
|
56
|
+
|
57
|
+
def get_module_latest_version(pod_model)
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'big_keeper/dependency/dep_type'
|
4
|
+
require 'big_keeper/util/podfile_detector'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
# Operator for podfile
|
8
|
+
class PodfileOperator
|
9
|
+
def has(podfile, module_name)
|
10
|
+
File.open(podfile, 'r') do |file|
|
11
|
+
file.each_line do |line|
|
12
|
+
if line.include?module_name
|
13
|
+
return true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
false
|
18
|
+
end
|
19
|
+
|
20
|
+
def generate_pod_config(pod_name, version, comment)
|
21
|
+
module_config = ''
|
22
|
+
if comment != nil
|
23
|
+
module_config = " pod '#{pod_name}' , '#{version}' # #{comment}"
|
24
|
+
else
|
25
|
+
module_config = " pod '#{pod_name}' , '#{version}'"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def replace_all_module_release(path, user, module_names, version)
|
30
|
+
module_names.each do |module_name|
|
31
|
+
DepService.dep_operator(path, user).update_module_config(
|
32
|
+
module_name,
|
33
|
+
ModuleOperateType::RELEASE)
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def find_and_lock(podfile, dictionary)
|
39
|
+
temp_file = Tempfile.new('.Podfile.tmp')
|
40
|
+
begin
|
41
|
+
File.open(podfile, 'r') do |file|
|
42
|
+
file.each_line do |line|
|
43
|
+
pod_model = PodfileDetector.get_pod_model(line)
|
44
|
+
if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil
|
45
|
+
# p "#{pod_name},#{dictionary[pod_name]}"
|
46
|
+
temp_file.puts generate_pod_config(pod_model.name, dictionary[pod_model.name], pod_model.comment)
|
47
|
+
else
|
48
|
+
temp_file.puts line
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
temp_file.close
|
53
|
+
FileUtils.mv(temp_file.path, podfile)
|
54
|
+
ensure
|
55
|
+
temp_file.close
|
56
|
+
temp_file.unlink
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def find_and_upgrade(podfile, dictionary)
|
61
|
+
temp_file = Tempfile.new('.Podfile.tmp')
|
62
|
+
begin
|
63
|
+
File.open(podfile, 'r') do |file|
|
64
|
+
file.each_line do |line|
|
65
|
+
pod_model = PodfileDetector.get_pod_model(line)
|
66
|
+
if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil
|
67
|
+
temp_file.puts generate_pod_config(pod_model.name, dictionary[pod_model.name], pod_model.comment)
|
68
|
+
else
|
69
|
+
temp_file.puts line
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
temp_file.close
|
74
|
+
FileUtils.mv(temp_file.path, podfile)
|
75
|
+
ensure
|
76
|
+
temp_file.close
|
77
|
+
temp_file.unlink
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def podspec_change(podspec_file, version, module_name)
|
82
|
+
temp_file = Tempfile.new(".#{module_name}.podspec")
|
83
|
+
has_change = false
|
84
|
+
begin
|
85
|
+
File.open(podspec_file, 'r') do |file|
|
86
|
+
file.each_line do |line|
|
87
|
+
if line.include?("s.version")
|
88
|
+
temp_line = line
|
89
|
+
temp_line_arr = temp_line.split("=")
|
90
|
+
if temp_line_arr[0].delete(" ") == "s.version"
|
91
|
+
unless temp_line_arr[temp_line_arr.length - 1].include? "#{version}"
|
92
|
+
temp_file.puts "s.version = '#{version}'"
|
93
|
+
has_change = true
|
94
|
+
else
|
95
|
+
temp_file.puts line
|
96
|
+
Logger.highlight("The version in PodSpec is equal your input version")
|
97
|
+
end
|
98
|
+
else
|
99
|
+
temp_file.puts line
|
100
|
+
end
|
101
|
+
else
|
102
|
+
temp_file.puts line
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
temp_file.close
|
107
|
+
FileUtils.mv(temp_file.path, podspec_file)
|
108
|
+
ensure
|
109
|
+
temp_file.close
|
110
|
+
temp_file.unlink
|
111
|
+
end
|
112
|
+
has_change
|
113
|
+
end
|
114
|
+
|
115
|
+
private :generate_pod_config
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module BigKeeper
|
2
|
+
# Operator for got
|
3
|
+
class VerifyOperator
|
4
|
+
def self.already_in_process?
|
5
|
+
already_in_process = false
|
6
|
+
Open3.popen3('ps aux | grep \<big\> -c') do |stdin , stdout , stderr, wait_thr|
|
7
|
+
while line = stdout.gets
|
8
|
+
if line.rstrip.to_i > 2
|
9
|
+
already_in_process = true
|
10
|
+
break
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
already_in_process
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/big_keeper.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'big_keeper/version'
|
4
|
+
|
5
|
+
require 'big_keeper/util/bigkeeper_parser'
|
6
|
+
require 'big_keeper/util/git_operator'
|
7
|
+
require 'big_keeper/util/verify_operator'
|
8
|
+
|
9
|
+
require 'big_keeper/model/gitflow_type'
|
10
|
+
|
11
|
+
require 'big_keeper/command/feature&hotfix'
|
12
|
+
require 'big_keeper/command/release'
|
13
|
+
require 'big_keeper/command/pod'
|
14
|
+
require 'big_keeper/command/spec'
|
15
|
+
require 'big_keeper/command/image'
|
16
|
+
|
17
|
+
require 'big_keeper/service/git_service'
|
18
|
+
require 'big_keeper/util/leancloud_logger'
|
19
|
+
|
20
|
+
require 'gli'
|
21
|
+
|
22
|
+
include GLI::App
|
23
|
+
|
24
|
+
module BigKeeper
|
25
|
+
# Your code goes here...
|
26
|
+
program_desc 'Efficiency improvement for iOS&Android module development, iOSer&Android using this tool can make module development easier.'
|
27
|
+
|
28
|
+
flag %i[p path], default_value: './'
|
29
|
+
flag %i[v ver], default_value: 'Version in Bigkeeper file'
|
30
|
+
flag %i[u user], default_value: GitOperator.new.user.gsub(/[^0-9A-Za-z]/, '').downcase
|
31
|
+
|
32
|
+
if VerifyOperator.already_in_process?
|
33
|
+
p %Q(There is another 'big' command in process, please wait)
|
34
|
+
exit
|
35
|
+
end
|
36
|
+
|
37
|
+
if !GitflowOperator.new.verify_git_flow_command
|
38
|
+
p %Q('git-flow' not found, use 'brew install git-flow' to install it)
|
39
|
+
exit
|
40
|
+
end
|
41
|
+
|
42
|
+
pre do |global_options,command,options,args|
|
43
|
+
LeanCloudLogger.instance.start_log(global_options, args)
|
44
|
+
end
|
45
|
+
|
46
|
+
post do |global_options,command,options,args|
|
47
|
+
LeanCloudLogger.instance.end_log(true)
|
48
|
+
end
|
49
|
+
|
50
|
+
feature_and_hotfix_command(GitflowType::FEATURE)
|
51
|
+
|
52
|
+
feature_and_hotfix_command(GitflowType::HOTFIX)
|
53
|
+
|
54
|
+
release_command
|
55
|
+
|
56
|
+
pod_command
|
57
|
+
|
58
|
+
spec_command
|
59
|
+
|
60
|
+
image_command
|
61
|
+
|
62
|
+
desc 'Show version of bigkeeper'
|
63
|
+
command :version do |version|
|
64
|
+
version.action do |global_options, options, args|
|
65
|
+
LeanCloudLogger.instance.set_command("version")
|
66
|
+
p "bigkeeper (#{VERSION})"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
exit run(ARGV)
|
71
|
+
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|