bigkeeper 0.7.6 → 0.7.7
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 +1 -1
- data/big_keeper.gemspec +3 -3
- data/docs/en-US/README.md +2 -2
- data/docs/zh-CN/BIGKEEPER_FILE.md +2 -2
- data/docs/zh-CN/FEATURE&HOTFIX.md +18 -11
- data/lib/big_keeper.rb +9 -289
- data/lib/big_keeper/command/feature&hotfix.rb +140 -0
- data/lib/big_keeper/command/feature&hotfix/finish.rb +7 -4
- data/lib/big_keeper/command/feature&hotfix/publish.rb +7 -6
- data/lib/big_keeper/command/feature&hotfix/pull.rb +2 -2
- data/lib/big_keeper/command/feature&hotfix/push.rb +2 -2
- data/lib/big_keeper/command/feature&hotfix/rebase.rb +2 -2
- data/lib/big_keeper/command/feature&hotfix/start.rb +16 -6
- data/lib/big_keeper/command/feature&hotfix/switch.rb +4 -6
- data/lib/big_keeper/command/feature&hotfix/update.rb +6 -4
- data/lib/big_keeper/command/pod.rb +36 -0
- data/lib/big_keeper/command/release.rb +68 -0
- data/lib/big_keeper/command/release/home.rb +2 -1
- data/lib/big_keeper/dependency/dep_gradle_operator.rb +26 -130
- data/lib/big_keeper/dependency/dep_operator.rb +4 -10
- data/lib/big_keeper/dependency/dep_pod_operator.rb +9 -53
- data/lib/big_keeper/dependency/dep_service.rb +2 -2
- data/lib/big_keeper/dependency/dep_type.rb +4 -4
- data/lib/big_keeper/model/gitflow_type.rb +12 -0
- data/lib/big_keeper/service/git_service.rb +2 -2
- data/lib/big_keeper/service/module_service.rb +15 -6
- data/lib/big_keeper/util/cache_operator.rb +69 -0
- data/lib/big_keeper/util/gradle_operator.rb +151 -0
- data/lib/big_keeper/util/podfile_operator.rb +4 -4
- data/lib/big_keeper/version.rb +1 -1
- data/resources/keynote/big-keeper-readme-feature.key +0 -0
- metadata +10 -6
@@ -53,13 +53,14 @@ module BigKeeper
|
|
53
53
|
Logger.highlight(%Q(Start to release/#{version}))
|
54
54
|
# step 2 replace_modules
|
55
55
|
PodfileOperator.new.replace_all_module_release(project_path,
|
56
|
+
user,
|
56
57
|
modules,
|
57
58
|
version)
|
58
59
|
|
59
60
|
# step 3 change Info.plist value
|
60
61
|
InfoPlistOperator.new.change_version_build(project_path, version)
|
61
62
|
|
62
|
-
DepService.dep_operator(project_path).install(true
|
63
|
+
DepService.dep_operator(project_path, user).install(true)
|
63
64
|
`open #{project_path}/*.xcworkspace`
|
64
65
|
end
|
65
66
|
end
|
@@ -1,160 +1,56 @@
|
|
1
1
|
require 'big_keeper/dependency/dep_operator'
|
2
|
+
require 'big_keeper/util/gradle_operator'
|
2
3
|
|
3
4
|
module BigKeeper
|
4
5
|
# Operator for podfile
|
5
6
|
class DepGradleOperator < DepOperator
|
6
7
|
|
7
8
|
def backup
|
8
|
-
|
9
|
-
cache_operator.save('settings.gradle')
|
10
|
-
Dir.glob("#{@path}/*/build.gradle").each do |build_gradle_file_path|
|
11
|
-
build_gradle_file = build_gradle_file_path.gsub!(/#{@path}/, '')
|
12
|
-
cache_operator.save(build_gradle_file)
|
13
|
-
end
|
9
|
+
GradleOperator.new(@path).backup
|
14
10
|
end
|
15
11
|
|
16
12
|
def recover
|
17
|
-
|
18
|
-
|
19
|
-
cache_operator.load('settings.gradle')
|
20
|
-
Dir.glob("#{@path}/*/build.gradle").each do |build_gradle_file_path|
|
21
|
-
build_gradle_file = build_gradle_file_path.gsub!(/#{@path}/, '')
|
22
|
-
cache_operator.load(build_gradle_file)
|
23
|
-
end
|
24
|
-
|
25
|
-
cache_operator.clean
|
26
|
-
end
|
27
|
-
|
28
|
-
def modules_with_branch(modules, branch_name)
|
29
|
-
full_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
|
30
|
-
file = "#{@path}/app/build.gradle"
|
31
|
-
|
32
|
-
matched_modules = []
|
33
|
-
File.open(file, 'r') do |file|
|
34
|
-
file.each_line do |line|
|
35
|
-
modules.each do |module_name|
|
36
|
-
if line =~ /compile\s*'\S*#{module_name.downcase}:#{full_name}'\S*/
|
37
|
-
matched_modules << module_name
|
38
|
-
break
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
matched_modules
|
13
|
+
GradleOperator.new(@path).recover
|
44
14
|
end
|
45
15
|
|
46
|
-
def
|
47
|
-
|
16
|
+
def update_module_config(module_name, module_type, source)
|
17
|
+
GradleOperator.new(@path).update_module_config(module_name, module_type, source)
|
48
18
|
|
49
|
-
|
50
|
-
File.open(file, 'r') do |file|
|
51
|
-
file.each_line do |line|
|
52
|
-
modules.each do |module_name|
|
53
|
-
if line =~ regex(module_type, module_name)
|
54
|
-
matched_modules << module_name
|
55
|
-
break
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
matched_modules
|
61
|
-
end
|
19
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
62
20
|
|
63
|
-
def regex(module_type, module_name)
|
64
21
|
if ModuleType::PATH == module_type
|
65
|
-
|
66
|
-
elsif ModuleType::GIT == module_type
|
67
|
-
/compile\s*'\S*#{module_name.downcase}\S*'\S*/
|
68
|
-
elsif ModuleType::SPEC == module_type
|
69
|
-
/compile\s*'\S*#{module_name.downcase}\S*'\S*/
|
70
|
-
else
|
71
|
-
//
|
72
|
-
end
|
73
|
-
end
|
22
|
+
GradleOperator.new(module_full_path).backup
|
74
23
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
file.each_line do |line|
|
81
|
-
temp_file.puts generate_build_config(line, module_name, module_type, source)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
temp_file.close
|
85
|
-
FileUtils.mv(temp_file.path, file)
|
86
|
-
ensure
|
87
|
-
temp_file.close
|
88
|
-
temp_file.unlink
|
24
|
+
all_path_modules = ModuleCacheOperator.new(@path).all_path_modules
|
25
|
+
all_path_modules.each do |path_module_name|
|
26
|
+
next if path_module_name == module_name
|
27
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, path_module_name)
|
28
|
+
GradleOperator.new(module_full_path).update_module_config(module_name, module_type, source)
|
89
29
|
end
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
def install(should_update, user)
|
94
|
-
modules = modules_with_type(BigkeeperParser.module_names, ModuleType::PATH)
|
95
|
-
|
96
|
-
CacheOperator.new(@path).load('settings.gradle')
|
30
|
+
elsif ModuleType::GIT == module_type
|
31
|
+
GradleOperator.new(module_full_path).recover
|
97
32
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
"projectDir = new File(rootProject.projectDir," \
|
104
|
-
"'#{BigkeeperParser.module_path(user, module_name)}/#{module_name.downcase}-lib')\r\n"
|
105
|
-
end
|
33
|
+
all_path_modules = ModuleCacheOperator.new(@path).all_path_modules
|
34
|
+
all_path_modules.each do |path_module_name|
|
35
|
+
next if path_module_name == module_name
|
36
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, path_module_name)
|
37
|
+
GradleOperator.new(module_full_path).update_module_config(module_name, module_type, source)
|
106
38
|
end
|
107
|
-
|
39
|
+
else
|
108
40
|
end
|
109
41
|
end
|
110
42
|
|
111
|
-
def
|
112
|
-
|
113
|
-
|
43
|
+
def install(should_update)
|
44
|
+
modules = ModuleCacheOperator.new(@path).all_path_modules
|
45
|
+
GradleOperator.new(@path).update_setting_config('', @user, modules)
|
114
46
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
prefix = line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
|
119
|
-
$3
|
120
|
-
}
|
121
|
-
end
|
122
|
-
end
|
47
|
+
modules.each do |module_name|
|
48
|
+
module_full_path = BigkeeperParser.module_full_path(@path, @user, module_name)
|
49
|
+
GradleOperator.new(module_full_path).update_setting_config(module_name, @user, modules)
|
123
50
|
end
|
124
|
-
|
125
|
-
prefix.chop
|
126
51
|
end
|
127
52
|
|
128
53
|
def open
|
129
54
|
end
|
130
|
-
|
131
|
-
def generate_build_config(line, module_name, module_type, source)
|
132
|
-
if ModuleType::PATH == module_type
|
133
|
-
line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
|
134
|
-
"#{$1}compile project(':#{module_name.downcase}')"
|
135
|
-
}
|
136
|
-
elsif ModuleType::GIT == module_type
|
137
|
-
branch_name = GitOperator.new.current_branch(@path)
|
138
|
-
full_name = ''
|
139
|
-
|
140
|
-
# Get version part of source.addition
|
141
|
-
if 'develop' == source.addition || 'master' == source.addition
|
142
|
-
full_name = branch_name.sub(/([\s\S]*)\/(\d+.\d+.\d+)_([\s\S]*)/){ $2 }
|
143
|
-
else
|
144
|
-
full_name = branch_name.sub(/([\s\S]*)\/([\s\S]*)/){ $2 }
|
145
|
-
end
|
146
|
-
line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
|
147
|
-
"#{$1}compile '#{prefix_of_module(module_name)}#{module_name.downcase}:#{full_name}'"
|
148
|
-
}
|
149
|
-
elsif ModuleType::SPEC == module_type
|
150
|
-
line.sub(/(\s*)([\s\S]*)'(\S*)#{module_name.downcase}(\S*)'(\S*)/){
|
151
|
-
"#{$1}compile '#{prefix_of_module(module_name)}#{module_name.downcase}:#{source}'"
|
152
|
-
}
|
153
|
-
else
|
154
|
-
line
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
private :generate_build_config, :regex, :prefix_of_module
|
159
55
|
end
|
160
56
|
end
|
@@ -2,9 +2,11 @@ module BigKeeper
|
|
2
2
|
# Operator for podfile
|
3
3
|
class DepOperator
|
4
4
|
@path
|
5
|
+
@user
|
5
6
|
|
6
|
-
def initialize(path)
|
7
|
+
def initialize(path, user)
|
7
8
|
@path = path
|
9
|
+
@user = user
|
8
10
|
end
|
9
11
|
|
10
12
|
def backup
|
@@ -15,19 +17,11 @@ module BigKeeper
|
|
15
17
|
raise "You should override this method in subclass."
|
16
18
|
end
|
17
19
|
|
18
|
-
def modules_with_branch(modules, branch_name)
|
19
|
-
raise "You should override this method in subclass."
|
20
|
-
end
|
21
|
-
|
22
|
-
def modules_with_type(modules, module_type)
|
23
|
-
raise "You should override this method in subclass."
|
24
|
-
end
|
25
|
-
|
26
20
|
def update_module_config(module_name, module_type, source)
|
27
21
|
raise "You should override this method in subclass."
|
28
22
|
end
|
29
23
|
|
30
|
-
def install(should_update
|
24
|
+
def install(should_update)
|
31
25
|
raise "You should override this method in subclass."
|
32
26
|
end
|
33
27
|
|
@@ -17,50 +17,6 @@ module BigKeeper
|
|
17
17
|
cache_operator.clean
|
18
18
|
end
|
19
19
|
|
20
|
-
def modules_with_branch(modules, branch_name)
|
21
|
-
file = "#{@path}/Podfile"
|
22
|
-
matched_modules = []
|
23
|
-
File.open(file, 'r') do |file|
|
24
|
-
file.each_line do |line|
|
25
|
-
modules.each do |module_name|
|
26
|
-
if line =~ /pod\s*'#{module_name}'\s*,\s*:git\s*=>\s*\S*\s*,\s*:branch\s*=>\s*'#{branch_name}'\s*/
|
27
|
-
matched_modules << module_name
|
28
|
-
break
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
matched_modules
|
34
|
-
end
|
35
|
-
|
36
|
-
def modules_with_type(modules, module_type)
|
37
|
-
file = "#{@path}/Podfile"
|
38
|
-
matched_modules = []
|
39
|
-
File.open(file, 'r') do |file|
|
40
|
-
file.each_line do |line|
|
41
|
-
modules.each do |module_name|
|
42
|
-
if line =~ /pod\s*'#{module_name}'\s*,#{regex(module_type)}/
|
43
|
-
matched_modules << module_name
|
44
|
-
break
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
matched_modules
|
50
|
-
end
|
51
|
-
|
52
|
-
def regex(module_type)
|
53
|
-
if ModuleType::PATH == module_type
|
54
|
-
"\s*:path\s*=>\s*"
|
55
|
-
elsif ModuleType::GIT == module_type
|
56
|
-
"\s*:git\s*=>\s*"
|
57
|
-
elsif ModuleType::SPEC == module_type
|
58
|
-
"\s*'"
|
59
|
-
else
|
60
|
-
""
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
20
|
def update_module_config(module_name, module_type, source)
|
65
21
|
file = "#{@path}/Podfile"
|
66
22
|
temp_file = Tempfile.new('.Podfile.tmp')
|
@@ -79,7 +35,7 @@ module BigKeeper
|
|
79
35
|
end
|
80
36
|
end
|
81
37
|
|
82
|
-
def install(should_update
|
38
|
+
def install(should_update)
|
83
39
|
PodOperator.pod_install(@path, should_update)
|
84
40
|
end
|
85
41
|
|
@@ -88,29 +44,29 @@ module BigKeeper
|
|
88
44
|
end
|
89
45
|
|
90
46
|
def generate_module_config(line, module_name, module_type, source)
|
91
|
-
line.sub(/(\s*)pod(\s*)'
|
47
|
+
line.sub(/(\s*)pod(\s*)('|")#{module_name}('|")([\s\S]*)/){
|
92
48
|
if ModuleType::PATH == module_type
|
93
|
-
"#{$1}pod '#{module_name}', :path => '#{source}'
|
49
|
+
"#{$1}pod '#{module_name}', :path => '#{source}'"
|
94
50
|
elsif ModuleType::GIT == module_type
|
95
51
|
# puts source.base
|
96
52
|
# puts source.addition
|
97
53
|
if GitType::BRANCH == source.type
|
98
|
-
"#{$1}pod '#{module_name}', :git => '#{source.base}', :branch => '#{source.addition}'
|
54
|
+
"#{$1}pod '#{module_name}', :git => '#{source.base}', :branch => '#{source.addition}'"
|
99
55
|
elsif GitType::TAG == source.type
|
100
|
-
"#{$1}pod '#{module_name}', :git => '#{source.base}', :tag => '#{source.addition}'
|
56
|
+
"#{$1}pod '#{module_name}', :git => '#{source.base}', :tag => '#{source.addition}'"
|
101
57
|
elsif GitType::COMMIT == source.type
|
102
|
-
"#{$1}pod '#{module_name}', :git => '#{source.base}', :commit => '#{source.addition}'
|
58
|
+
"#{$1}pod '#{module_name}', :git => '#{source.base}', :commit => '#{source.addition}'"
|
103
59
|
else
|
104
|
-
"#{$1}pod '#{module_name}', :git => '#{source.base}'
|
60
|
+
"#{$1}pod '#{module_name}', :git => '#{source.base}'"
|
105
61
|
end
|
106
62
|
elsif ModuleType::SPEC == module_type
|
107
|
-
"#{$1}pod '#{module_name}', '#{source}'
|
63
|
+
"#{$1}pod '#{module_name}', '#{source}'"
|
108
64
|
else
|
109
65
|
line
|
110
66
|
end
|
111
67
|
}
|
112
68
|
end
|
113
69
|
|
114
|
-
private :generate_module_config
|
70
|
+
private :generate_module_config
|
115
71
|
end
|
116
72
|
end
|
@@ -19,14 +19,14 @@ module BigKeeper
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.operator(path)
|
22
|
+
def self.operator(path, user)
|
23
23
|
operator_type = type(path)
|
24
24
|
if COCOAPODS == operator_type
|
25
|
-
DepPodOperator.new(path)
|
25
|
+
DepPodOperator.new(path, user)
|
26
26
|
elsif GRADLE == operator_type
|
27
|
-
DepGradleOperator.new(path)
|
27
|
+
DepGradleOperator.new(path, user)
|
28
28
|
else
|
29
|
-
DepOperator.new(path)
|
29
|
+
DepOperator.new(path, user)
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -16,6 +16,18 @@ module BigKeeper
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.command(type)
|
20
|
+
if FEATURE == type
|
21
|
+
:feature
|
22
|
+
elsif HOTFIX == type
|
23
|
+
:hotfix
|
24
|
+
elsif RELEASE == type
|
25
|
+
:release
|
26
|
+
else
|
27
|
+
:feature
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
19
31
|
def self.base_branch(type)
|
20
32
|
if FEATURE == type
|
21
33
|
"develop"
|
@@ -13,11 +13,11 @@ module BigKeeper
|
|
13
13
|
branch_name = "#{GitflowType.name(type)}/#{name}"
|
14
14
|
if !git.has_remote_branch(path, branch_name) && !git.has_local_branch(path, branch_name)
|
15
15
|
|
16
|
-
GitflowOperator.new.verify_git_flow(path)
|
17
|
-
|
18
16
|
verify_special_branch(path, 'master')
|
19
17
|
verify_special_branch(path, 'develop')
|
20
18
|
|
19
|
+
GitflowOperator.new.verify_git_flow(path)
|
20
|
+
|
21
21
|
GitflowOperator.new.start(path, name, type)
|
22
22
|
git.push_to_remote(path, branch_name)
|
23
23
|
else
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'big_keeper/service/git_service'
|
2
|
+
|
2
3
|
require 'big_keeper/util/logger'
|
4
|
+
require 'big_keeper/util/cache_operator'
|
3
5
|
|
4
6
|
module BigKeeper
|
5
7
|
# Operator for got
|
@@ -72,12 +74,13 @@ module BigKeeper
|
|
72
74
|
|
73
75
|
verify_module(path, user, module_name, home_branch_name, type)
|
74
76
|
|
75
|
-
GitService.new.verify_push(module_full_path, "publish branch #{home_branch_name}", home_branch_name, module_name)
|
76
|
-
|
77
77
|
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
|
78
|
+
GitService.new.verify_push(module_full_path, "publish branch #{home_branch_name}", home_branch_name, module_name)
|
78
79
|
GitService.new.verify_rebase(module_full_path, GitflowType.base_branch(type), module_name)
|
79
80
|
|
80
81
|
`open #{BigkeeperParser.module_pulls(module_name)}`
|
82
|
+
|
83
|
+
ModuleCacheOperator.new(path).del_branch_module(module_name)
|
81
84
|
end
|
82
85
|
|
83
86
|
def finish(path, user, module_name, home_branch_name, type)
|
@@ -89,10 +92,13 @@ module BigKeeper
|
|
89
92
|
GitService.new.verify_push(module_full_path, "finish branch #{home_branch_name}", home_branch_name, module_name)
|
90
93
|
|
91
94
|
module_git = BigkeeperParser.module_git(module_name)
|
92
|
-
|
95
|
+
|
96
|
+
DepService.dep_operator(path, user).update_module_config(
|
93
97
|
module_name,
|
94
98
|
ModuleType::GIT,
|
95
99
|
GitInfo.new(module_git, GitType::BRANCH, home_branch_name))
|
100
|
+
|
101
|
+
ModuleCacheOperator.new(path).add_branch_module(module_name)
|
96
102
|
end
|
97
103
|
|
98
104
|
def add(path, user, module_name, name, type)
|
@@ -103,10 +109,12 @@ module BigKeeper
|
|
103
109
|
verify_module(path, user, module_name, home_branch_name, type)
|
104
110
|
|
105
111
|
module_path = BigkeeperParser.module_path(user, module_name)
|
106
|
-
DepService.dep_operator(path).update_module_config(
|
112
|
+
DepService.dep_operator(path, user).update_module_config(
|
107
113
|
module_name,
|
108
114
|
ModuleType::PATH,
|
109
115
|
module_path)
|
116
|
+
|
117
|
+
ModuleCacheOperator.new(path).add_path_module(module_name)
|
110
118
|
end
|
111
119
|
|
112
120
|
def del(path, user, module_name, name, type)
|
@@ -122,11 +130,12 @@ module BigKeeper
|
|
122
130
|
# GitOperator.new.del(module_full_path, home_branch_name)
|
123
131
|
|
124
132
|
module_git = BigkeeperParser.module_git(module_name)
|
125
|
-
|
126
|
-
DepService.dep_operator(path).update_module_config(
|
133
|
+
DepService.dep_operator(path, user).update_module_config(
|
127
134
|
module_name,
|
128
135
|
ModuleType::GIT,
|
129
136
|
GitInfo.new(module_git, GitType::BRANCH, GitflowType.base_branch(type)))
|
137
|
+
|
138
|
+
ModuleCacheOperator.new(path).del_path_module(module_name)
|
130
139
|
end
|
131
140
|
end
|
132
141
|
end
|