Module: BigKeeper
- Defined in:
- lib/big_keeper/util/bigkeeper_parser.rb,
lib/big_keeper.rb,
lib/big_keeper/version.rb,
lib/big_keeper/util/log_util.rb,
lib/big_keeper/util/git_operator.rb,
lib/big_keeper/model/gitflow_type.rb,
lib/big_keeper/model/operate_type.rb,
lib/big_keeper/model/podfile_type.rb,
lib/big_keeper/model/podfile_model.rb,
lib/big_keeper/service/git_service.rb,
lib/big_keeper/command/feature_pull.rb,
lib/big_keeper/command/feature_push.rb,
lib/big_keeper/command/podfile_lock.rb,
lib/big_keeper/command/release_home.rb,
lib/big_keeper/command/feature_start.rb,
lib/big_keeper/service/stash_service.rb,
lib/big_keeper/util/gitflow_operator.rb,
lib/big_keeper/util/podfile_detector.rb,
lib/big_keeper/util/podfile_operator.rb,
lib/big_keeper/command/feature_finish.rb,
lib/big_keeper/command/feature_switch.rb,
lib/big_keeper/command/feature_update.rb,
lib/big_keeper/command/release_module.rb,
lib/big_keeper/service/module_service.rb,
lib/big_keeper/util/info_plist_operator.rb
Overview
Defined Under Namespace
Modules: GitType, GitflowType, ModuleType, OperateType
Classes: BigKeeperLog, BigkeeperParser, GitInfo, GitOperator, GitService, GitflowOperator, InfoPlistOperator, ModuleService, PodfileDetector, PodfileOperator, Podfile_Modle, StashService
Constant Summary
collapse
- VERSION =
"0.5.0"
- DEFAULT_LOG =
1
- HIGHLIGHT_LOG =
2
- ERROR_LOG =
3
- WARNING_LOG =
4
Class Method Summary
collapse
-
.feature_finish(path, user) ⇒ Object
-
.feature_pull(path, user) ⇒ Object
-
.feature_push(path, user, comment) ⇒ Object
-
.feature_start(path, version, user, name, modules) ⇒ Object
-
.feature_switch(path, version, user, name) ⇒ Object
-
.feature_update(path, user, modules) ⇒ Object
-
.home(name, params) ⇒ Object
-
.modules ⇒ Object
-
.pod(name, params) ⇒ Object
-
.podfile_detect(path) ⇒ Object
-
.podfile_lock(path) ⇒ Object
-
.release_home_finish(path, version) ⇒ Object
-
.release_home_start(path, version, user) ⇒ Object
-
.start_module_release(path, version, user, module_name) ⇒ Object
-
.user(name) ⇒ Object
-
.version(name) ⇒ Object
Class Method Details
.feature_finish(path, user) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/big_keeper/command/feature_finish.rb', line 10
def self.feature_finish(path, user)
begin
BigkeeperParser.parse("#{path}/Bigkeeper")
modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
BigkeeperParser.module_names, ModuleType::PATH)
branch_name = GitOperator.new.current_branch(path)
raise "Not a feature branch, exit." unless branch_name.include? 'feature'
modules.each do |module_name|
ModuleService.new.finish(path, user, module_name)
end
BigkeeperParser.module_names.each do |module_name|
module_git = BigkeeperParser.module_git(module_name)
PodfileOperator.new.find_and_replace("#{path}/Podfile",
module_name,
ModuleType::GIT,
GitInfo.new(module_git, GitType::BRANCH, 'develop'))
end
p `pod install --project-directory=#{path}`
GitOperator.new.commit(path, "finish #{GitflowType.name(GitflowType::FEATURE)} #{branch_name}")
GitOperator.new.push(path, branch_name)
GitService.new.verify_rebase(path, 'develop', 'Home')
`open #{BigkeeperParser.home_pulls()}`
ensure
end
end
|
.feature_pull(path, user) ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/big_keeper/command/feature_pull.rb', line 2
def self.feature_pull(path, user)
begin
BigkeeperParser.parse("#{path}/Bigkeeper")
branch_name = GitOperator.new.current_branch(path)
raise 'Not a feature branch, exit.' unless branch_name.include? 'feature'
modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
BigkeeperParser.module_names, ModuleType::PATH)
modules.each do |module_name|
ModuleService.new.pull(path, user, module_name, branch_name)
end
p "Pull branch #{branch_name} for home..."
GitOperator.new.pull(path)
ensure
end
end
|
.feature_push(path, user, comment) ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/big_keeper/command/feature_push.rb', line 3
def self.feature_push(path, user, )
begin
BigkeeperParser.parse("#{path}/Bigkeeper")
branch_name = GitOperator.new.current_branch(path)
raise "Not a feature branch, exit." unless branch_name.include? 'feature'
modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
BigkeeperParser.module_names, ModuleType::PATH)
modules.each do |module_name|
module_full_path = BigkeeperParser.module_full_path(path, user, module_name)
module_branch_name = GitOperator.new.current_branch(module_full_path)
if GitOperator.new.has_changes(module_full_path)
p "Push branch #{branch_name} for module #{module_name}..."
GitOperator.new.commit(module_full_path, )
GitOperator.new.push(module_full_path, module_branch_name)
else
p "Nothing to push for #{module_name}."
end
end
if GitOperator.new.has_changes(path)
p "Push branch #{branch_name} for home..."
GitOperator.new.commit(path, )
GitOperator.new.push(path, branch_name)
else
p "Nothing to push for home."
end
ensure
end
end
|
.feature_start(path, version, user, name, modules) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/big_keeper/command/feature_start.rb', line 14
def self.feature_start(path, version, user, name, modules)
begin
BigkeeperParser.parse("#{path}/Bigkeeper")
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
feature_name = "#{version}_#{user}_#{name}"
branch_name = "#{GitflowType.name(GitflowType::FEATURE)}/#{feature_name}"
GitService.new.verify_branch(path, branch_name, OperateType::START)
stash_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
BigkeeperParser.module_names, ModuleType::PATH)
StashService.new.stash(path, branch_name, user, stash_modules)
if modules
BigkeeperParser.verify_modules(modules)
else
modules = BigkeeperParser.module_names
end
GitService.new.start(path, feature_name, GitflowType::FEATURE)
modules.each do |module_name|
ModuleService.new.add(path, user, module_name, feature_name, GitflowType::FEATURE)
end
p `pod install --project-directory=#{path}`
GitOperator.new.commit(path, "init #{GitflowType.name(GitflowType::FEATURE)} #{feature_name}")
GitOperator.new.push(path, branch_name)
`open #{path}/*.xcworkspace`
ensure
end
end
|
.feature_switch(path, version, user, name) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/big_keeper/command/feature_switch.rb', line 4
def self.feature_switch(path, version, user, name)
begin
BigkeeperParser.parse("#{path}/Bigkeeper")
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
feature_name = "#{version}_#{user}_#{name}"
branch_name = "#{GitflowType.name(GitflowType::FEATURE)}/#{feature_name}"
GitService.new.verify_branch(path, branch_name, OperateType::SWITCH)
stath_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
BigkeeperParser.module_names, ModuleType::PATH)
StashService.new.stash(path, branch_name, user, stath_modules)
GitOperator.new.git_checkout(path, branch_name)
GitOperator.new.pull(path)
modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
BigkeeperParser.module_names, ModuleType::PATH)
modules.each do |module_name|
ModuleService.new.switch(path, user, module_name, branch_name)
end
StashService.new.apply_stash(path, branch_name, user, modules)
p `pod install --project-directory=#{path}`
`open #{path}/*.xcworkspace`
ensure
end
end
|
.feature_update(path, user, modules) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/big_keeper/command/feature_update.rb', line 14
def self.feature_update(path, user, modules)
begin
BigkeeperParser.parse("#{path}/Bigkeeper")
branch_name = GitOperator.new.current_branch(path)
raise "Not a feature branch, exit." unless branch_name.include? 'feature'
feature_name = branch_name.gsub(/feature\//, '')
current_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
BigkeeperParser.module_names, ModuleType::PATH)
if modules
BigkeeperParser.verify_modules(modules)
else
modules = BigkeeperParser.module_names
end
add_modules = modules - current_modules
del_modules = current_modules - modules
if add_modules.empty? and del_modules.empty?
p "There is nothing changed with modules #{modules}."
else
add_modules.each do |module_name|
ModuleService.new.add(path, user, module_name, feature_name, GitflowType::FEATURE)
end
del_modules.each do |module_name|
ModuleService.new.del(path, user, module_name, feature_name, GitflowType::FEATURE)
end
p `pod install --project-directory=#{path}`
`open #{path}/*.xcworkspace`
end
ensure
end
end
|
.home(name, params) ⇒ Object
12
13
14
|
# File 'lib/big_keeper/util/bigkeeper_parser.rb', line 12
def self.home(name, params)
BigkeeperParser.parse_home(name, params)
end
|
.modules ⇒ Object
20
21
22
23
|
# File 'lib/big_keeper/util/bigkeeper_parser.rb', line 20
def self.modules
BigkeeperParser.parse_modules
yield if block_given?
end
|
.pod(name, params) ⇒ Object
16
17
18
|
# File 'lib/big_keeper/util/bigkeeper_parser.rb', line 16
def self.pod(name, params)
BigkeeperParser.parse_pod(name, params)
end
|
.podfile_detect(path) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/big_keeper/command/podfile_lock.rb', line 11
def self.podfile_detect(path)
BigkeeperParser.parse("#{path}/Bigkeeper")
modular_list = BigkeeperParser.module_names
detector = PodfileDetector.new(path,modular_list)
unlock_pod_list = detector.get_unlock_pod_list
unlock_pod_list.each do |pod_name|
BigKeeperLog.default("#{pod_name} should be locked.")
end
BigKeeperLog.separator
end
|
.podfile_lock(path) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/big_keeper/command/podfile_lock.rb', line 28
def self.podfile_lock(path)
BigkeeperParser.parse("#{path}/Bigkeeper")
modular_list = BigkeeperParser.module_names
detector = PodfileDetector.new(path,modular_list)
unlock_pod_list = detector.get_unlock_pod_list
dictionary = detector.deal_lock_file(path,unlock_pod_list)
if dictionary.empty?
BigKeeperLog.warning("There is nothing to be locked.")
else
PodfileOperator.new.find_and_lock("#{path}/Podfile",dictionary)
BigKeeperLog.highlight("The Podfile has been changed.")
BigKeeperLog.separator
end
end
|
.release_home_finish(path, version) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/big_keeper/command/release_home.rb', line 13
def self.release_home_finish(path, version)
Dir.chdir(path) do
if GitOperator.new.has_branch(project_path, "release/#{version}")
if GitOperator.new.current_branch(project_path) != "release/#{version}"
GitOperator.new.commit(path, "release: V #{version}")
GitOperator.new.push(path, "release/#{version}")
GitflowOperator.new.finish_release(path, version)
if GitOperator.new.current_branch(project_path) == "master"
GitOperator.new.tag(path, version)
else
GitOperator.new.git_checkout(project_path, "master")
GitOperator.new.tag(path, version)
end
else
raise "Not in release branch, please check your branches."
end
else
raise "Not has release branch, use release start first."
end
end
end
|
.release_home_start(path, version, user) ⇒ Object
8
9
10
11
|
# File 'lib/big_keeper/command/release_home.rb', line 8
def self.release_home_start(path, version, user)
BigkeeperParser.parse("#{path}/Bigkeeper")
start_release(path, version, BigkeeperParser::module_names, GitInfo.new(BigkeeperParser::home_git, GitType::TAG, version), user)
end
|
.start_module_release(path, version, user, module_name) ⇒ Object
8
9
10
11
12
13
14
|
# File 'lib/big_keeper/command/release_module.rb', line 8
def self.start_module_release(path, version, user, module_name)
main_path = File.expand_path("#{path}/Example")
module_release(main_path,
version,
BigkeeperParser::module_names,
GitInfo.new(BigkeeperParser::home_git, GitType::TAG, version), user)
end
|
.user(name) ⇒ Object
7
8
9
10
|
# File 'lib/big_keeper/util/bigkeeper_parser.rb', line 7
def self.user(name)
BigkeeperParser.parse_user(name)
yield if block_given?
end
|
.version(name) ⇒ Object
3
4
5
|
# File 'lib/big_keeper/util/bigkeeper_parser.rb', line 3
def self.version(name)
BigkeeperParser.parse_version(name)
end
|