bigkeeper 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/big_keeper.rb +6 -0
- data/lib/big_keeper/command/feature&hotfix.rb +19 -5
- data/lib/big_keeper/command/feature&hotfix/list.rb +44 -23
- data/lib/big_keeper/command/pod.rb +1 -2
- data/lib/big_keeper/command/pod/podfile.rb +5 -5
- data/lib/big_keeper/command/release.rb +4 -2
- data/lib/big_keeper/command/release/home.rb +44 -44
- data/lib/big_keeper/command/release/module.rb +37 -84
- data/lib/big_keeper/dependency/dep_pod_operator.rb +41 -1
- data/lib/big_keeper/model/podfile_model.rb +2 -2
- data/lib/big_keeper/service/git_service.rb +8 -3
- data/lib/big_keeper/service/module_service.rb +13 -6
- data/lib/big_keeper/util/bigkeeper_parser.rb +26 -15
- data/lib/big_keeper/util/file_operator.rb +6 -0
- data/lib/big_keeper/util/git_operator.rb +67 -7
- data/lib/big_keeper/util/list_generator.rb +56 -13
- data/lib/big_keeper/util/pod_operator.rb +51 -8
- data/lib/big_keeper/util/podfile_detector.rb +11 -8
- data/lib/big_keeper/util/podfile_module.rb +1 -2
- data/lib/big_keeper/util/podfile_operator.rb +16 -7
- data/lib/big_keeper/util/verify_operator.rb +17 -0
- data/lib/big_keeper/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67a9534eec7e2adda494fbf338a2d425d8a50880
|
4
|
+
data.tar.gz: cfdf86a415c35767c26378f750293f9ca352f73e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bcd74eca37de2258644c22e37290918cc3e5709a1bab3be4c9d1de36705f17edaf9d82fea873c5c734c8a894ad5c9b647e3d0b5c10ab4bc245600eb8ba347b8
|
7
|
+
data.tar.gz: 07ab4bc44a44426a1706a6a87b62c0148a7cd6dd0f14056bf44773a36f7fc55488d03f83f025e6da980c1f3b883b5ca9c349f7b19b8b13255cb992a4a50ed9e5
|
data/Gemfile.lock
CHANGED
data/lib/big_keeper.rb
CHANGED
@@ -4,6 +4,7 @@ require 'big_keeper/version'
|
|
4
4
|
|
5
5
|
require 'big_keeper/util/bigkeeper_parser'
|
6
6
|
require 'big_keeper/util/git_operator'
|
7
|
+
require 'big_keeper/util/verify_operator'
|
7
8
|
|
8
9
|
require 'big_keeper/model/gitflow_type'
|
9
10
|
|
@@ -25,6 +26,11 @@ module BigKeeper
|
|
25
26
|
flag %i[v ver], default_value: 'Version in Bigkeeper file'
|
26
27
|
flag %i[u user], default_value: GitOperator.new.user.gsub(/[^0-9A-Za-z]/, '').downcase
|
27
28
|
|
29
|
+
if VerifyOperator.already_in_process?
|
30
|
+
p %Q(There is another 'big' command in process, please wait)
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
|
28
34
|
if !GitflowOperator.new.verify_git_flow_command
|
29
35
|
p %Q('git-flow' not found, use 'brew install git-flow' to install it)
|
30
36
|
exit
|
@@ -127,11 +127,25 @@ module BigKeeper
|
|
127
127
|
|
128
128
|
c.desc "List all the #{GitflowType.name(type)}s"
|
129
129
|
c.command :list do |list|
|
130
|
-
list.
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
130
|
+
list.flag %i[v version] , default_value: 'all versions'
|
131
|
+
list.desc "Print list of TREE format."
|
132
|
+
list.command :tree do |tree|
|
133
|
+
tree.action do |global_options, options, args|
|
134
|
+
Logger.highlight("Generating #{GitflowType.name(type)} tree of all version...") if args.length < 1
|
135
|
+
path = File.expand_path(global_options[:path])
|
136
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
137
|
+
list(path, user, type, options)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
list.desc "Print list of JSON format."
|
142
|
+
list.command :json do |json|
|
143
|
+
json.action do |global_options, options, args|
|
144
|
+
options[:json] = true
|
145
|
+
path = File.expand_path(global_options[:path])
|
146
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
147
|
+
list(path, user, type, options)
|
148
|
+
end
|
135
149
|
end
|
136
150
|
end
|
137
151
|
end
|
@@ -5,38 +5,59 @@ require 'big_keeper/service/module_service'
|
|
5
5
|
|
6
6
|
|
7
7
|
module BigKeeper
|
8
|
-
def self.list(path,user,type)
|
8
|
+
def self.list(path, user, type, options)
|
9
9
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
10
|
+
home_path = File.expand_path(path)
|
10
11
|
#get home project branches
|
11
|
-
branches = GitService.new.branchs_with_type(
|
12
|
+
branches = GitService.new.branchs_with_type(home_path, type)
|
12
13
|
#get modules list
|
14
|
+
is_print_log = false if options[:json]
|
15
|
+
#get search version
|
16
|
+
version = options[:version]
|
17
|
+
cache_path = File.expand_path("#{path}/.bigkeeper")
|
18
|
+
json_path = "#{cache_path}/branches.json"
|
13
19
|
begin
|
14
|
-
|
15
|
-
|
20
|
+
#get cache file path
|
21
|
+
FileUtils.mkdir_p(cache_path) unless File.exist?(cache_path)
|
22
|
+
file = File.new(json_path, 'w')
|
16
23
|
begin
|
17
|
-
#
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
#local project verify
|
22
|
-
if !File.exist? module_full_path
|
23
|
-
Logger.default("No local repository for module '#{module_name}', clone it...")
|
24
|
-
module_git = BigkeeperParser.module_git(module_name)
|
25
|
-
git_operator.clone(File.expand_path("#{module_full_path}/../"), module_git)
|
26
|
-
end
|
27
|
-
feature_modules_list = ModuleService.new.list(module_full_path, user, module_name)
|
28
|
-
dic = {}
|
29
|
-
dic[module_name] = feature_modules_list
|
30
|
-
file << dic
|
31
|
-
file << "\n\n"
|
32
|
-
end
|
33
|
-
file.close
|
24
|
+
#get all modules info
|
25
|
+
module_list_dic = get_module_info(path, user, type, version, branches)
|
26
|
+
file << module_list_dic.to_json
|
27
|
+
file.close
|
34
28
|
end
|
35
|
-
|
36
29
|
#print list
|
37
|
-
|
30
|
+
generate_list_with_option(options, json_path, version, branches)
|
38
31
|
ensure
|
39
32
|
file.close
|
40
33
|
end
|
41
34
|
end
|
35
|
+
|
36
|
+
def self.get_module_info(path, user, type, version, home_branches)
|
37
|
+
#get module list
|
38
|
+
modules = BigkeeperParser.module_names
|
39
|
+
git_operator = GitOperator.new
|
40
|
+
module_info_list = []
|
41
|
+
modules.each do |module_name|
|
42
|
+
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
|
43
|
+
#local project verify
|
44
|
+
if !File.exist? module_full_path
|
45
|
+
Logger.default("No local repository for module '#{module_name}', clone it...") if is_print_log
|
46
|
+
module_git = BigkeeperParser.module_git(module_name)
|
47
|
+
git_operator.clone(File.expand_path("#{module_full_path}/../"), module_git)
|
48
|
+
end
|
49
|
+
#每个模块详细信息
|
50
|
+
module_branch_info = ModuleService.new.module_info(module_full_path, home_branches, user, type, module_name, version)
|
51
|
+
module_info_list << module_branch_info
|
52
|
+
end
|
53
|
+
module_info_list
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.generate_list_with_option(options, file_path, version, home_branches)
|
57
|
+
if options[:json]
|
58
|
+
ListGenerator.generate_json(file_path, home_branches, version)
|
59
|
+
else
|
60
|
+
ListGenerator.generate_tree(file_path, home_branches, version)
|
61
|
+
end
|
62
|
+
end
|
42
63
|
end
|
@@ -5,12 +5,11 @@ module BigKeeper
|
|
5
5
|
def self.pod_command
|
6
6
|
desc 'Podfile operation'
|
7
7
|
command :podfile do |podfile|
|
8
|
-
podfile.flag %i[pod podfile]
|
9
8
|
podfile.desc 'Podfile'
|
10
9
|
|
11
10
|
podfile.desc 'Detect podname should be locked.'
|
12
11
|
podfile.command :detect do |detect|
|
13
|
-
detect.action do |global_options,options,args|
|
12
|
+
detect.action do |global_options, options, args|
|
14
13
|
path = File.expand_path(global_options[:path])
|
15
14
|
podfile_detect(path)
|
16
15
|
end
|
@@ -14,7 +14,7 @@ module BigKeeper
|
|
14
14
|
# Get modules' name
|
15
15
|
module_list = BigkeeperParser.module_names
|
16
16
|
# initialize PodfileDetector
|
17
|
-
detector = PodfileDetector.new(path,module_list)
|
17
|
+
detector = PodfileDetector.new(path, module_list)
|
18
18
|
# Get unlocked third party pods list
|
19
19
|
unlock_pod_list = detector.get_unlock_pod_list
|
20
20
|
# Print out unlock pod list
|
@@ -31,15 +31,15 @@ module BigKeeper
|
|
31
31
|
# Get modules' name
|
32
32
|
module_list = BigkeeperParser.module_names
|
33
33
|
# initialize PodfileDetector
|
34
|
-
detector = PodfileDetector.new(path,module_list)
|
34
|
+
detector = PodfileDetector.new(path, module_list)
|
35
35
|
# Get unlocked third party pods list
|
36
36
|
unlock_pod_list = detector.get_unlock_pod_list
|
37
37
|
# Get Version
|
38
|
-
dictionary = detector.deal_lock_file(path,unlock_pod_list)
|
38
|
+
dictionary = detector.deal_lock_file(path, unlock_pod_list)
|
39
39
|
if dictionary.empty?
|
40
40
|
Logger.warning("There is nothing to be locked.")
|
41
41
|
else
|
42
|
-
PodfileOperator.new.find_and_lock("#{path}/Podfile",dictionary)
|
42
|
+
PodfileOperator.new.find_and_lock("#{path}/Podfile", dictionary)
|
43
43
|
Logger.highlight("The Podfile has been changed.")
|
44
44
|
Logger.separator
|
45
45
|
end
|
@@ -61,7 +61,7 @@ module BigKeeper
|
|
61
61
|
if module_dictionary.empty?
|
62
62
|
Logger.warning("There is nothing to be upgrade.")
|
63
63
|
else
|
64
|
-
PodfileOperator.new.find_and_upgrade("#{path}/Podfile",module_dictionary)
|
64
|
+
PodfileOperator.new.find_and_upgrade("#{path}/Podfile", module_dictionary)
|
65
65
|
Logger.highlight("The Podfile has been changed.")
|
66
66
|
end
|
67
67
|
end
|
@@ -34,6 +34,7 @@ module BigKeeper
|
|
34
34
|
end
|
35
35
|
|
36
36
|
c.desc 'release module'
|
37
|
+
c.switch [:i,:ignore]
|
37
38
|
c.command :module do |m|
|
38
39
|
m.desc 'Start release module project'
|
39
40
|
m.command :start do |start|
|
@@ -45,11 +46,12 @@ module BigKeeper
|
|
45
46
|
help_now!('module name is required') if args.length != 1
|
46
47
|
raise Logger.error("release version is required") if version == nil
|
47
48
|
module_name = args[0]
|
48
|
-
release_module_start(path, version, user, module_name)
|
49
|
+
release_module_start(path, version, user, module_name, options[:ignore])
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
53
|
m.desc 'finish release module project'
|
54
|
+
m.switch [:s,:spec]
|
53
55
|
m.command :finish do |finish|
|
54
56
|
finish.action do |global_options, options, args|
|
55
57
|
path = File.expand_path(global_options[:path])
|
@@ -59,7 +61,7 @@ module BigKeeper
|
|
59
61
|
help_now!('module name is required') if args.length != 1
|
60
62
|
raise Logger.error("release version is required") if version == nil
|
61
63
|
module_name = args[0]
|
62
|
-
release_module_finish(path, version, user, module_name)
|
64
|
+
release_module_finish(path, version, user, module_name, options[:spec])
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|
@@ -4,64 +4,64 @@ require 'big_keeper/util/gitflow_operator'
|
|
4
4
|
require 'big_keeper/dependency/dep_type'
|
5
5
|
require 'big_keeper/util/info_plist_operator'
|
6
6
|
require 'big_keeper/util/logger'
|
7
|
+
require 'big_keeper/util/xcode_operator'
|
7
8
|
|
8
9
|
module BigKeeper
|
9
10
|
def self.release_home_start(path, version, user)
|
10
11
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
11
|
-
start_release(path, version, BigkeeperParser::module_names, user)
|
12
|
-
end
|
13
12
|
|
14
|
-
|
15
|
-
|
13
|
+
modules = BigkeeperParser.module_names
|
14
|
+
|
15
|
+
#stash
|
16
|
+
StashService.new.stash_all(path, GitOperator.new.current_branch(path), user, modules)
|
17
|
+
|
18
|
+
# check
|
19
|
+
GitOperator.new.check_merge(path, "feature/#{version}")
|
20
|
+
GitOperator.new.check_diff(path, "develop", "master")
|
21
|
+
|
22
|
+
#checkout release branch
|
23
|
+
Logger.highlight(%Q(Start to checkout Branch release/#{version}))
|
24
|
+
if GitOperator.new.current_branch(path) != "release/#{version}"
|
16
25
|
if GitOperator.new.has_branch(path, "release/#{version}")
|
17
|
-
|
18
|
-
GitOperator.new.commit(path, "release: V #{version}")
|
19
|
-
GitOperator.new.push_to_remote(path, "release/#{version}")
|
20
|
-
GitflowOperator.new.finish_release(path, version)
|
21
|
-
if GitOperator.new.current_branch(path) == "master"
|
22
|
-
GitOperator.new.tag(path, version)
|
23
|
-
else
|
24
|
-
GitOperator.new.checkout(path, "master")
|
25
|
-
GitOperator.new.tag(path, version)
|
26
|
-
end
|
27
|
-
else
|
28
|
-
raise Logger.error("Not in release branch, please check your branches.")
|
29
|
-
end
|
26
|
+
GitOperator.new.checkout(path, "release/#{version}")
|
30
27
|
else
|
31
|
-
|
28
|
+
GitflowOperator.new.start(path, version, GitflowType::RELEASE)
|
29
|
+
GitOperator.new.push_to_remote(path, "release/#{version}")
|
32
30
|
end
|
33
31
|
end
|
34
|
-
end
|
35
32
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
33
|
+
Logger.highlight(%Q(Start to release/#{version}))
|
34
|
+
# step 2 replace_modules
|
35
|
+
PodfileOperator.new.replace_all_module_release(path,
|
36
|
+
user,
|
37
|
+
modules,
|
38
|
+
ModuleOperateType::RELEASE)
|
39
|
+
|
40
|
+
# step 3 change Info.plist value
|
41
|
+
InfoPlistOperator.new.change_version_build(path, version)
|
41
42
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
DepService.dep_operator(path, user).install(true)
|
44
|
+
XcodeOperator.open_workspace(path)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.release_home_finish(path, version)
|
48
|
+
if GitOperator.new.has_branch(path, "release/#{version}")
|
49
|
+
if GitOperator.new.current_branch(path) == "release/#{version}"
|
50
|
+
GitOperator.new.commit(path, "release: V #{version}")
|
51
|
+
GitOperator.new.push_to_remote(path, "release/#{version}")
|
52
|
+
GitflowOperator.new.finish_release(path, version)
|
53
|
+
if GitOperator.new.current_branch(path) == "master"
|
54
|
+
GitOperator.new.tag(path, version)
|
47
55
|
else
|
48
|
-
|
49
|
-
GitOperator.new.
|
56
|
+
GitOperator.new.checkout(path, "master")
|
57
|
+
GitOperator.new.tag(path, version)
|
50
58
|
end
|
59
|
+
else
|
60
|
+
raise Logger.error("Not in release branch, please check your branches.")
|
51
61
|
end
|
52
|
-
|
53
|
-
Logger.
|
54
|
-
# step 2 replace_modules
|
55
|
-
PodfileOperator.new.replace_all_module_release(project_path,
|
56
|
-
user,
|
57
|
-
modules,
|
58
|
-
version)
|
59
|
-
|
60
|
-
# step 3 change Info.plist value
|
61
|
-
InfoPlistOperator.new.change_version_build(project_path, version)
|
62
|
-
|
63
|
-
DepService.dep_operator(project_path, user).install(true)
|
64
|
-
`open #{project_path}/*.xcworkspace`
|
62
|
+
else
|
63
|
+
raise Logger.error("Not has release branch, please use release start first.")
|
65
64
|
end
|
66
65
|
end
|
66
|
+
|
67
67
|
end
|
@@ -5,102 +5,55 @@ require 'big_keeper/dependency/dep_type'
|
|
5
5
|
require 'big_keeper/util/info_plist_operator'
|
6
6
|
require 'big_keeper/util/git_operator'
|
7
7
|
require 'big_keeper/util/logger'
|
8
|
+
require 'big_keeper/util/pod_operator'
|
8
9
|
|
9
10
|
module BigKeeper
|
10
|
-
def self.release_module_start(path, version, user, module_name)
|
11
|
+
def self.release_module_start(path, version, user, module_name, ignore)
|
11
12
|
BigkeeperParser.parse("#{path}/Bigkeeper")
|
13
|
+
module_path = BigkeeperParser.module_full_path(path, user, module_name)
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
module_path = self.get_module_path_default(path, user, module_name)
|
16
|
-
start_module_release(module_path, version, module_name, git_info, user)
|
17
|
-
end
|
18
|
-
end
|
15
|
+
# stash
|
16
|
+
StashService.new.stash(module_path, GitOperator.new.current_branch(module_path), module_name)
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# check out master
|
26
|
-
if GitOperator.new.current_branch(module_path) != "master"
|
27
|
-
current_name = GitOperator.new.current_branch(module_path)
|
28
|
-
GitOperator.new.checkout(module_path, "master")
|
29
|
-
Logger.highlight("Push branch '#{current_name}' for '#{module_name}'...")
|
30
|
-
GitService.new.verify_push(module_path, "finish #{GitflowType.name(GitflowType::RELEASE)} #{current_name}", "master", "#{module_name}")
|
18
|
+
#check
|
19
|
+
if ignore != true
|
20
|
+
GitOperator.new.check_merge(module_path, "feature/#{version}")
|
21
|
+
GitOperator.new.check_diff(module_path, "develop", "master")
|
22
|
+
Logger.highlight(%Q(#{module_name} release check finish))
|
31
23
|
end
|
32
|
-
return
|
33
24
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
#修改 podspec 文件
|
39
|
-
# TO DO: - advanced to use Regular Expression
|
40
|
-
PodfileOperator.new.podspec_change(%Q(#{module_path}/#{module_name}.podspec), version, module_name)
|
41
|
-
|
42
|
-
GitService.new.verify_rebase(module_path, 'develop', "#{module_name}")
|
43
|
-
GitOperator.new.verify_push(module_path, "finish rebase develop to master", "master", "#{module_name}")
|
44
|
-
GitOperator.new.tag(module_path, version)
|
45
|
-
|
46
|
-
Logger.highlight(%Q(Start Pod repo push #{module_name}))
|
47
|
-
IO.popen("pod repo push #{module_name} #{module_name}.podspec --allow-warnings --sources=#{BigkeeperParser::sourcemodule_path}") do |io|
|
48
|
-
io.each do |line|
|
49
|
-
has_error = true if line.include? "ERROR"
|
50
|
-
end
|
51
|
-
end
|
52
|
-
if has_error
|
53
|
-
Logger.error("Pod repo push in '#{module_name}'")
|
54
|
-
return
|
55
|
-
end
|
25
|
+
# checkout to develop branch
|
26
|
+
Logger.highlight(%Q(Start checkout #{module_name} to Branch develop))
|
27
|
+
GitService.new.verify_checkout_pull(module_path, "develop")
|
56
28
|
|
57
|
-
|
58
|
-
end
|
29
|
+
Logger.highlight(%Q(#{module_name} release start finish))
|
59
30
|
end
|
60
31
|
|
61
|
-
|
62
|
-
def self.
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
# step 1 checkout to develop branch
|
68
|
-
Logger.highlight(%Q(Start checkout #{module_name} to Branch develop))
|
69
|
-
if GitOperator.new.current_branch(module_path) != "develop"
|
70
|
-
if GitOperator.new.has_branch(module_path, "develop")
|
71
|
-
GitOperator.new.checkout(module_path, "develop")
|
72
|
-
else
|
73
|
-
Logger.error("Cann't find develop branch, please check.")
|
74
|
-
end
|
75
|
-
end
|
32
|
+
## release finish
|
33
|
+
def self.release_module_finish(path, version, user, module_name, spec)
|
34
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
35
|
+
module_path = BigkeeperParser.module_full_path(path, user, module_name)
|
76
36
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
37
|
+
# check commit
|
38
|
+
Logger.error("current branch has unpush files") if GitOperator.new.has_changes(module_path)
|
39
|
+
# check out master
|
40
|
+
Logger.highlight("'#{module_name}' checkout branch to master...")
|
41
|
+
GitService.new.verify_checkout_pull(module_path, "master")
|
42
|
+
|
43
|
+
Logger.highlight(%Q(Merge develop to master))
|
44
|
+
# merge develop to master
|
45
|
+
GitOperator.new.merge(module_path, "develop")
|
46
|
+
GitOperator.new.push_to_remote(module_path, "master")
|
47
|
+
|
48
|
+
#修改 podspec 文件
|
49
|
+
# TO DO: - advanced to use Regular Expression
|
50
|
+
has_change = PodfileOperator.new.podspec_change(%Q(#{module_path}/#{module_name}.podspec), version, module_name)
|
51
|
+
GitService.new.verify_push(module_path, "Change version number", "master", "#{module_name}") if has_change == true
|
52
|
+
GitOperator.new.tag(module_path, version)
|
53
|
+
# pod repo push
|
54
|
+
if spec == true
|
55
|
+
PodOperator.pod_repo_push(module_path, module_name, BigkeeperParser.source_spec_path(module_name), version)
|
90
56
|
end
|
91
|
-
|
92
|
-
GitOperator.new.commit(module_path, "update podspec")
|
93
|
-
GitOperator.new.first_push(module_path, GitOperator.new.current_branch(module_path))
|
94
|
-
Logger.highlight(%Q(Pod lib lint success))
|
95
57
|
end
|
96
58
|
|
97
|
-
def self.get_module_path_default(path, user, module_name)
|
98
|
-
module_path = BigkeeperParser::module_path(user, module_name)
|
99
|
-
if module_path == "../#{module_name}"
|
100
|
-
path_array = path.split('/')
|
101
|
-
path_array.pop()
|
102
|
-
module_path = path_array.join('/') + "/#{module_name}"
|
103
|
-
end
|
104
|
-
module_path
|
105
|
-
end
|
106
59
|
end
|
@@ -3,6 +3,7 @@ require 'big_keeper/dependency/dep_operator'
|
|
3
3
|
require 'big_keeper/util/pod_operator'
|
4
4
|
require 'big_keeper/util/xcode_operator'
|
5
5
|
require 'big_keeper/util/cache_operator'
|
6
|
+
require 'big_keeper/util/file_operator'
|
6
7
|
|
7
8
|
module BigKeeper
|
8
9
|
# Operator for podfile
|
@@ -64,6 +65,16 @@ module BigKeeper
|
|
64
65
|
branch_name = GitOperator.new.current_branch(@path)
|
65
66
|
base_branch_name = GitflowType.base_branch(GitService.new.current_branch_type(@path))
|
66
67
|
"#{$1}pod '#{module_name}', :git => '#{module_git}', :branch => '#{base_branch_name}'"
|
68
|
+
elsif ModuleOperateType::RELEASE == module_operate_type
|
69
|
+
module_git = BigkeeperParser.module_git(module_name)
|
70
|
+
lastest_tag, is_spec = find_lastest_tag(module_name)
|
71
|
+
if is_spec == true
|
72
|
+
Logger.default("#{module_name} lastest tag is #{lastest_tag}, this tag has published.")
|
73
|
+
"#{$1}pod '#{module_name}', '#{lastest_tag}'"
|
74
|
+
else
|
75
|
+
Logger.default("#{module_name} lastest tag is #{lastest_tag}, this tag not publish.")
|
76
|
+
"#{$1}pod '#{module_name}', :git => '#{module_git}', :tag => '#{lastest_tag}'"
|
77
|
+
end
|
67
78
|
else
|
68
79
|
line
|
69
80
|
end
|
@@ -85,6 +96,35 @@ module BigKeeper
|
|
85
96
|
origin_config.chop
|
86
97
|
end
|
87
98
|
|
88
|
-
|
99
|
+
def find_lastest_tag(module_name)
|
100
|
+
username = FileOperator.new.current_username
|
101
|
+
tags_repos_pwd = Array.new
|
102
|
+
tags_spec_list = Array.new
|
103
|
+
tags_module_list = Array.new
|
104
|
+
|
105
|
+
IO.popen("find /Users/#{username}/.cocoapods/repos -type d -name #{module_name}") do |io|
|
106
|
+
io.each do |line|
|
107
|
+
tags_repos_pwd.push(line) if line.include? "#{module_name}"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
for pwd in tags_repos_pwd do
|
111
|
+
path = pwd.chomp
|
112
|
+
IO.popen("cd #{path}; ls") do |io|
|
113
|
+
io.each do |line|
|
114
|
+
tags_spec_list.push(line)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
tags_module_list = GitOperator.new.tag_list(BigkeeperParser.module_full_path(@path, @user, module_name))
|
120
|
+
last_tag = tags_module_list[tags_module_list.length - 1]
|
121
|
+
if tags_module_list.include?(last_tag) && tags_spec_list.include?(last_tag)
|
122
|
+
return [last_tag.chomp, true]
|
123
|
+
else
|
124
|
+
return [last_tag.chomp, false]
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
private :generate_module_config, :origin_config_of_module, :find_lastest_tag
|
89
129
|
end
|
90
130
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
2
|
module BigKeeper
|
3
3
|
|
4
|
-
class
|
5
|
-
attr_accessor :name
|
4
|
+
class PodfileModel
|
5
|
+
attr_accessor :name, :git, :path, :configurations, :branch,:tag, :comment
|
6
6
|
def initialize(sentence)
|
7
7
|
if sentence.include?('#')
|
8
8
|
list = sentence.split('#')
|
@@ -43,6 +43,11 @@ module BigKeeper
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
def verify_checkout_pull(path, branch_name)
|
47
|
+
GitService.new.verify_checkout(path, branch_name)
|
48
|
+
GitService.new.pull(path, branch_name)
|
49
|
+
end
|
50
|
+
|
46
51
|
def verify_special_branch(path, name)
|
47
52
|
git = GitOperator.new
|
48
53
|
|
@@ -113,9 +118,9 @@ module BigKeeper
|
|
113
118
|
def branchs_with_type(path, type)
|
114
119
|
branchs = []
|
115
120
|
Dir.chdir(path) do
|
116
|
-
IO.popen('git branch -a') do |io|
|
117
|
-
io.each do |line|
|
118
|
-
branchs << line.
|
121
|
+
IO.popen('git branch -a') do | io |
|
122
|
+
io.each do | line |
|
123
|
+
branchs << line.gsub(/\s/, '') if line =~ /[\s\S]*#{GitflowType.name(type)}*/
|
119
124
|
end
|
120
125
|
end
|
121
126
|
end
|
@@ -137,14 +137,21 @@ module BigKeeper
|
|
137
137
|
ModuleCacheOperator.new(path).del_path_module(module_name)
|
138
138
|
end
|
139
139
|
|
140
|
-
def
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
140
|
+
def module_info(module_path, home_branch_name, user, type, module_name, version)
|
141
|
+
result_dic = {}
|
142
|
+
matched_branches = []
|
143
|
+
branches = GitService.new.branchs_with_type(module_path, type)
|
144
|
+
if version == 'all versions'
|
145
|
+
matched_branches = branches
|
146
|
+
else
|
147
|
+
branches.each do | branch |
|
148
|
+
matched_branches << branch if branch.include?(version)
|
145
149
|
end
|
146
150
|
end
|
147
|
-
|
151
|
+
result_dic[:module_name] = module_name
|
152
|
+
result_dic[:current_branch] = GitOperator.new.current_branch(module_path)
|
153
|
+
result_dic[:branches] = matched_branches
|
154
|
+
result_dic
|
148
155
|
end
|
149
156
|
|
150
157
|
private :verify_module
|
@@ -27,6 +27,7 @@ module BigKeeper
|
|
27
27
|
|
28
28
|
def self.source(name)
|
29
29
|
BigkeeperParser.parse_source(name)
|
30
|
+
yield if block_given?
|
30
31
|
end
|
31
32
|
|
32
33
|
# Bigkeeper file parser
|
@@ -43,23 +44,25 @@ module BigKeeper
|
|
43
44
|
content.gsub!(/version\s/, 'BigKeeper::version ')
|
44
45
|
content.gsub!(/user\s/, 'BigKeeper::user ')
|
45
46
|
content.gsub!(/home\s/, 'BigKeeper::home ')
|
47
|
+
content.gsub!(/source\s/, 'BigKeeper::source ')
|
46
48
|
content.gsub!(/mod\s/, 'BigKeeper::mod ')
|
47
49
|
content.gsub!(/modules\s/, 'BigKeeper::modules ')
|
48
|
-
content.gsub!(/source\s/, 'BigKeeper::source ')
|
49
50
|
eval content
|
50
|
-
# p @@config
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
def self.
|
55
|
-
@@config
|
54
|
+
def self.parse_source(name)
|
55
|
+
@@config.delete("tmpSpec")
|
56
|
+
source_split = name.split(",") unless name.split(",").length != 2
|
57
|
+
if source_split != nil
|
58
|
+
sources = Hash["#{source_split[1].lstrip}" => "#{source_split[0]}"]
|
59
|
+
@@config[:source] = sources
|
60
|
+
@@config[:tmpSpec] = source_split[1].lstrip
|
61
|
+
end
|
56
62
|
end
|
57
63
|
|
58
|
-
def self.
|
59
|
-
|
60
|
-
sources << @@config[:source]
|
61
|
-
sources << name
|
62
|
-
@@config[:source] = sources
|
64
|
+
def self.parse_version(name)
|
65
|
+
@@config[:version] = name
|
63
66
|
end
|
64
67
|
|
65
68
|
def self.parse_user(name)
|
@@ -96,6 +99,9 @@ module BigKeeper
|
|
96
99
|
end
|
97
100
|
|
98
101
|
def self.parse_modules_mod(name, params)
|
102
|
+
if @@config[:source] != nil
|
103
|
+
params[:spec] = "#{@@config[:tmpSpec]}"
|
104
|
+
end
|
99
105
|
modules = @@config[:modules]
|
100
106
|
modules[name] = params
|
101
107
|
@@config[:modules] = modules
|
@@ -123,12 +129,17 @@ module BigKeeper
|
|
123
129
|
@@config[:home][:pulls]
|
124
130
|
end
|
125
131
|
|
126
|
-
def self.
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
+
def self.source_spec_path(module_name)
|
133
|
+
spec = @@config[:modules][module_name][:spec]
|
134
|
+
@@config[:source][spec]
|
135
|
+
end
|
136
|
+
|
137
|
+
def self.source_spec_name(module_name)
|
138
|
+
spec = @@config[:modules][module_name][:spec]
|
139
|
+
end
|
140
|
+
|
141
|
+
def self.sources
|
142
|
+
@@config[:source].keys
|
132
143
|
end
|
133
144
|
|
134
145
|
def self.module_full_path(home_path, user_name, module_name)
|
@@ -13,7 +13,7 @@ module BigKeeper
|
|
13
13
|
has_branch = false
|
14
14
|
IO.popen("cd #{path}; git branch -r") do |io|
|
15
15
|
io.each do |line|
|
16
|
-
has_branch = true if line
|
16
|
+
has_branch = true if line.include? branch_name
|
17
17
|
end
|
18
18
|
end
|
19
19
|
has_branch
|
@@ -23,7 +23,7 @@ module BigKeeper
|
|
23
23
|
has_branch = false
|
24
24
|
IO.popen("cd #{path}; git branch") do |io|
|
25
25
|
io.each do |line|
|
26
|
-
has_branch = true if line
|
26
|
+
has_branch = true if line.include? branch_name
|
27
27
|
end
|
28
28
|
end
|
29
29
|
has_branch
|
@@ -33,7 +33,7 @@ module BigKeeper
|
|
33
33
|
has_branch = false
|
34
34
|
IO.popen("cd #{path}; git branch -a") do |io|
|
35
35
|
io.each do |line|
|
36
|
-
has_branch = true if line
|
36
|
+
has_branch = true if line.include? branch_name
|
37
37
|
end
|
38
38
|
end
|
39
39
|
has_branch
|
@@ -88,7 +88,7 @@ module BigKeeper
|
|
88
88
|
|
89
89
|
def has_commits(path, branch_name)
|
90
90
|
has_commits = false
|
91
|
-
IO.popen("cd #{path}; git log
|
91
|
+
IO.popen("cd #{path}; git log --branches --not --remotes") do |io|
|
92
92
|
io.each do |line|
|
93
93
|
has_commits = true if line.include? branch_name
|
94
94
|
end
|
@@ -130,11 +130,71 @@ module BigKeeper
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def tag(path, version)
|
133
|
-
|
134
|
-
|
135
|
-
|
133
|
+
tags = Array.new
|
134
|
+
IO.popen("cd #{path}; git tag") do |io|
|
135
|
+
io.each do |line|
|
136
|
+
tags << line
|
137
|
+
end
|
138
|
+
end
|
139
|
+
unless tags.include? "#{version}\n"
|
140
|
+
Dir.chdir(path) do
|
141
|
+
`git tag -a #{version} -m "release: V #{version}" master;`
|
142
|
+
`git push --tags`
|
143
|
+
end
|
144
|
+
return
|
145
|
+
end
|
146
|
+
Logger.highlight("tag already exists in the remote, skip this step")
|
147
|
+
end
|
148
|
+
|
149
|
+
def tag_list(path)
|
150
|
+
tag_list = Array.new
|
151
|
+
IO.popen("cd #{path}; git tag -l") do |io|
|
152
|
+
io.each do |line|
|
153
|
+
unless line=~(/[a-zA-Z]/)
|
154
|
+
tag_list << line
|
155
|
+
end
|
156
|
+
end
|
136
157
|
end
|
158
|
+
tag_list
|
137
159
|
end
|
160
|
+
|
161
|
+
def check_merge(path, condition)
|
162
|
+
unmerged_branch = Array.new
|
163
|
+
IO.popen("cd #{path}; git branch --no-merged") do |io|
|
164
|
+
io.each do |line|
|
165
|
+
unmerged_branch.push(line) if line.include? "#{condition}"
|
166
|
+
end
|
167
|
+
end
|
168
|
+
if (unmerged_branch.size > 0)
|
169
|
+
unmerged_branch.map { |item|
|
170
|
+
Logger.default(item)
|
171
|
+
}
|
172
|
+
Logger.error("Still has unmerged feature branch, please check")
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def check_diff(path, branch, compare_branch)
|
177
|
+
compare_branch_commits = Array.new
|
178
|
+
IO.popen("cd #{path}; git log --left-right #{branch}...#{compare_branch} --pretty=oneline") do |io|
|
179
|
+
io.each do |line|
|
180
|
+
compare_branch_commits.push(line) if (line.include? '>') && (line.include? "Merge branch #{branch} into #{compare_branch}")
|
181
|
+
end
|
182
|
+
end
|
183
|
+
if compare_branch_commits.size > 0
|
184
|
+
compare_branch_commits.map { |item|
|
185
|
+
Logger.default(item)
|
186
|
+
}
|
187
|
+
Logger.error("#{compare_branch} branch has commit dont committed in #{branch}, please check")
|
188
|
+
return
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def merge(path, branch_name)
|
193
|
+
IO.popen("cd #{path}; git merge #{branch_name}") do |line|
|
194
|
+
Logger.error("Merge conflict in #{branch_name}") if line.include? 'Merge conflict'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
138
198
|
end
|
139
199
|
|
140
200
|
# p GitOperator.new.user
|
@@ -1,24 +1,67 @@
|
|
1
1
|
require 'big_keeper/util/logger'
|
2
|
+
require 'json'
|
2
3
|
|
3
4
|
module BigKeeper
|
4
5
|
class ListGenerator
|
5
|
-
|
6
|
+
#generate tree print throught console
|
7
|
+
def self.generate_tree(file_path, home_branches, version)
|
6
8
|
module_branches_dic = {}
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
json_data = File.read(file_path)
|
10
|
+
module_branches_dic = JSON.parse(json_data)
|
11
|
+
to_tree(module_branches_dic, home_branches, version)
|
12
|
+
end
|
13
|
+
|
14
|
+
#generate json print throught console
|
15
|
+
def self.generate_json(file_path, home_branches, version)
|
16
|
+
module_branches_dic = {}
|
17
|
+
json_data = File.read(file_path)
|
18
|
+
module_branches_dic = JSON.parse(json_data)
|
19
|
+
json = to_json(home_branches, module_branches_dic, version)
|
20
|
+
puts JSON.pretty_generate(json)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.to_json(home_branches, module_info_list, version)
|
24
|
+
json_array = []
|
25
|
+
print_all = version == "all versions"
|
26
|
+
home_branches.each do | home_branch_name |
|
27
|
+
next unless home_branch_name.include?(version) || print_all
|
28
|
+
branch_dic = {}
|
29
|
+
involve_modules = []
|
30
|
+
module_info_list.collect do | module_info_dic |
|
31
|
+
next unless module_info_dic["branches"] != nil
|
32
|
+
module_name = module_info_dic["module_name"]
|
33
|
+
module_info_dic["branches"].each do | module_branch |
|
34
|
+
if module_branch.strip.delete("*") == home_branch_name
|
35
|
+
module_current_info = {}
|
36
|
+
module_current_info["module_name"] = module_name
|
37
|
+
module_current_info["current_branch"] = module_info_dic["current_branch"]
|
38
|
+
involve_modules << module_current_info
|
39
|
+
end
|
40
|
+
end
|
12
41
|
end
|
13
|
-
|
42
|
+
branch_dic["home_branche_name"] = home_branch_name
|
43
|
+
branch_dic["involve_modules"] = involve_modules
|
44
|
+
json_array << branch_dic
|
14
45
|
end
|
46
|
+
json_array
|
47
|
+
end
|
15
48
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
49
|
+
def self.to_tree(module_branches_dic, branches_name, version)
|
50
|
+
home_name = BigkeeperParser.home_name
|
51
|
+
print_all = version == "all versions"
|
52
|
+
branches_name.each do | home_branch_name |
|
53
|
+
next unless home_branch_name.include?(version) || print_all
|
54
|
+
Logger.highlight(home_branch_name.strip)
|
55
|
+
module_branches_dic.each do | module_info_dic |
|
56
|
+
module_name = module_info_dic["module_name"]
|
57
|
+
next if module_info_dic["branches"] == nil
|
58
|
+
module_info_dic["branches"].each do | module_branch |
|
59
|
+
if module_branch.include?(home_branch_name.strip.delete('*'))
|
60
|
+
if !module_branch.include?("*") && home_branch_name.include?("*")
|
61
|
+
Logger.warning(" ├── #{module_name} (current branch :#{module_info_dic["current_branch"]})")
|
62
|
+
else
|
63
|
+
Logger.default(" ├── #{module_name}")
|
64
|
+
end
|
22
65
|
break
|
23
66
|
end
|
24
67
|
end
|
@@ -6,22 +6,65 @@ module BigKeeper
|
|
6
6
|
def self.pod_install(path, repo_update)
|
7
7
|
# pod install
|
8
8
|
if repo_update
|
9
|
-
|
10
|
-
cmd = 'pod repo update'
|
11
|
-
Open3.popen3(cmd) do |stdin , stdout , stderr, wait_thr|
|
12
|
-
while line = stdout.gets
|
13
|
-
puts line
|
14
|
-
end
|
15
|
-
end
|
9
|
+
PodOperator.pod_update_private_repos(true)
|
16
10
|
end
|
17
11
|
Logger.highlight('Start pod install, waiting...')
|
18
12
|
cmd = "pod install --project-directory=#{path}"
|
19
|
-
Open3.popen3(cmd) do |stdin
|
13
|
+
Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
|
20
14
|
while line = stdout.gets
|
21
15
|
puts line
|
22
16
|
end
|
23
17
|
end
|
24
18
|
Logger.highlight('Finish pod install.')
|
25
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
|
+
BigkeeperParser.sources.map { |spec|
|
51
|
+
Logger.highlight('Start pod repo update, waiting...')
|
52
|
+
cmd = "pod repo update #{spec}"
|
53
|
+
cmd(cmd)
|
54
|
+
}
|
55
|
+
else
|
56
|
+
cmd = "pod repo update"
|
57
|
+
cmd(cmd)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.cmd(cmd)
|
62
|
+
Open3.popen3(cmd) do |stdin , stdout , stderr, wait_thr|
|
63
|
+
while line = stdout.gets
|
64
|
+
puts line
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
26
69
|
end
|
27
70
|
end
|
@@ -10,7 +10,7 @@ class PodfileDetector
|
|
10
10
|
$unlock_pod_list = []
|
11
11
|
$modify_pod_list = {}
|
12
12
|
|
13
|
-
def initialize(main_path,module_list)
|
13
|
+
def initialize(main_path, module_list)
|
14
14
|
@module_list = module_list
|
15
15
|
@main_path = main_path
|
16
16
|
end
|
@@ -22,13 +22,16 @@ class PodfileDetector
|
|
22
22
|
deal_podfile_line(sentence) unless sentence =~(/(\d+.){1,2}\d+/)
|
23
23
|
end
|
24
24
|
$unlock_pod_list
|
25
|
-
# p $unlock_pod_list
|
26
25
|
end
|
27
26
|
|
28
27
|
def deal_podfile_line(sentence)
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
return unless !sentence.strip.start_with?("#")
|
29
|
+
if sentence.strip.include?('pod ')
|
30
|
+
pod_model = PodfileModel.new(sentence)
|
31
|
+
if !pod_model.name.empty? &&
|
32
|
+
pod_model.configurations != '[\'Debug\']' &&
|
33
|
+
pod_model.path == nil &&
|
34
|
+
pod_model.tag == nil
|
32
35
|
$unlock_pod_list << pod_model.name unless @module_list.include?(pod_model.name)
|
33
36
|
end
|
34
37
|
pod_model
|
@@ -36,7 +39,7 @@ class PodfileDetector
|
|
36
39
|
end
|
37
40
|
|
38
41
|
|
39
|
-
def deal_lock_file(main_path,deal_list)
|
42
|
+
def deal_lock_file(main_path, deal_list)
|
40
43
|
$result = {}
|
41
44
|
podfile_lock_lines = File.readlines("#{main_path}/Podfile.lock")
|
42
45
|
Logger.highlight("Analyzing Podfile.lock...") unless podfile_lock_lines.size.zero?
|
@@ -52,7 +55,7 @@ class PodfileDetector
|
|
52
55
|
temp_version = get_lock_version(temp_sentence)
|
53
56
|
if temp_version != nil
|
54
57
|
if current_version != nil
|
55
|
-
$result[pod_name] = chose_version(current_version,temp_version)
|
58
|
+
$result[pod_name] = chose_version(current_version, temp_version)
|
56
59
|
else
|
57
60
|
$result[pod_name] = temp_version
|
58
61
|
end
|
@@ -64,7 +67,7 @@ class PodfileDetector
|
|
64
67
|
|
65
68
|
def self.get_pod_model(sentence)
|
66
69
|
if sentence.include?('pod ')
|
67
|
-
pod_model =
|
70
|
+
pod_model = PodfileModel.new(sentence)
|
68
71
|
return pod_model
|
69
72
|
end
|
70
73
|
end
|
@@ -31,7 +31,6 @@ class PodfileModuleDetector
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
34
|
def get_pod_search_result(pod_name)
|
36
35
|
#输入pod Search 结果
|
37
36
|
`pod search #{pod_name} --ios --simple >> #{@main_path}/bigKeeperPodInfo.tmp`
|
@@ -42,7 +41,7 @@ class PodfileModuleDetector
|
|
42
41
|
Logger.highlight("Analyzing modules info...") unless podfile_lines.size.zero?
|
43
42
|
podfile_lines.collect do |sentence|
|
44
43
|
if sentence =~(/pod/)
|
45
|
-
sentence = sentence.sub('pod','')
|
44
|
+
sentence = sentence.sub('pod', '')
|
46
45
|
sentence = sentence.delete('\n\'')
|
47
46
|
match_result = sentence.split(',')
|
48
47
|
pod_name = match_result[0].strip
|
@@ -17,7 +17,7 @@ module BigKeeper
|
|
17
17
|
false
|
18
18
|
end
|
19
19
|
|
20
|
-
def generate_pod_config(pod_name, version,comment)
|
20
|
+
def generate_pod_config(pod_name, version, comment)
|
21
21
|
module_config = ''
|
22
22
|
if comment != nil
|
23
23
|
module_config = " pod '#{pod_name}' , '#{version}' # #{comment}"
|
@@ -30,9 +30,9 @@ module BigKeeper
|
|
30
30
|
module_names.each do |module_name|
|
31
31
|
DepService.dep_operator(path, user).update_module_config(
|
32
32
|
module_name,
|
33
|
-
|
34
|
-
GitInfo.new(BigkeeperParser.module_git(module_name), GitType::TAG, version))
|
33
|
+
ModuleOperateType::RELEASE)
|
35
34
|
end
|
35
|
+
|
36
36
|
end
|
37
37
|
|
38
38
|
def find_and_lock(podfile, dictionary)
|
@@ -43,7 +43,7 @@ module BigKeeper
|
|
43
43
|
pod_model = PodfileDetector.get_pod_model(line)
|
44
44
|
if pod_model != nil && pod_model.name != nil && dictionary[pod_model.name] != nil
|
45
45
|
# p "#{pod_name},#{dictionary[pod_name]}"
|
46
|
-
temp_file.puts generate_pod_config(pod_model.name,dictionary[pod_model.name],pod_model.comment)
|
46
|
+
temp_file.puts generate_pod_config(pod_model.name, dictionary[pod_model.name], pod_model.comment)
|
47
47
|
else
|
48
48
|
temp_file.puts line
|
49
49
|
end
|
@@ -64,7 +64,7 @@ module BigKeeper
|
|
64
64
|
file.each_line do |line|
|
65
65
|
pod_model = PodfileDetector.get_pod_model(line)
|
66
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)
|
67
|
+
temp_file.puts generate_pod_config(pod_model.name, dictionary[pod_model.name], pod_model.comment)
|
68
68
|
else
|
69
69
|
temp_file.puts line
|
70
70
|
end
|
@@ -80,13 +80,21 @@ module BigKeeper
|
|
80
80
|
|
81
81
|
def podspec_change(podspec_file, version, module_name)
|
82
82
|
temp_file = Tempfile.new(".#{module_name}.podspec")
|
83
|
+
has_change = false
|
83
84
|
begin
|
84
85
|
File.open(podspec_file, 'r') do |file|
|
85
86
|
file.each_line do |line|
|
86
87
|
if line.include?("s.version")
|
87
88
|
temp_line = line
|
88
|
-
|
89
|
-
|
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
|
90
98
|
else
|
91
99
|
temp_file.puts line
|
92
100
|
end
|
@@ -101,6 +109,7 @@ module BigKeeper
|
|
101
109
|
temp_file.close
|
102
110
|
temp_file.unlink
|
103
111
|
end
|
112
|
+
has_change
|
104
113
|
end
|
105
114
|
|
106
115
|
private :generate_pod_config
|
@@ -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 -ef|grep big -c') do |stdin , stdout , stderr, wait_thr|
|
7
|
+
while line = stdout.gets
|
8
|
+
if line.rstrip.to_i > 3
|
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/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bigkeeper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mmoaay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gli
|
@@ -264,6 +264,7 @@ files:
|
|
264
264
|
- lib/big_keeper/util/podfile_detector.rb
|
265
265
|
- lib/big_keeper/util/podfile_module.rb
|
266
266
|
- lib/big_keeper/util/podfile_operator.rb
|
267
|
+
- lib/big_keeper/util/verify_operator.rb
|
267
268
|
- lib/big_keeper/util/xcode_operator.rb
|
268
269
|
- lib/big_keeper/version.rb
|
269
270
|
- resources/banner.png
|