Module: BigKeeper
- Defined in:
- lib/big_keeper/util/bigkeeper_parser.rb,
lib/big_keeper.rb,
lib/big_keeper/version.rb,
lib/big_keeper/util/logger.rb,
lib/big_keeper/util/git_operator.rb,
lib/big_keeper/util/pod_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/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/service/module_service.rb,
lib/big_keeper/command/pod/podfile_lock.rb,
lib/big_keeper/util/info_plist_operator.rb,
lib/big_keeper/command/release/release_home.rb,
lib/big_keeper/command/release/release_module.rb,
lib/big_keeper/command/feature&hotfix/feature_pull.rb,
lib/big_keeper/command/feature&hotfix/feature_push.rb,
lib/big_keeper/command/feature&hotfix/feature_start.rb,
lib/big_keeper/command/feature&hotfix/feature_finish.rb,
lib/big_keeper/command/feature&hotfix/feature_switch.rb,
lib/big_keeper/command/feature&hotfix/feature_update.rb
Overview
Defined Under Namespace
Modules: GitType, GitflowType, ModuleType, OperateType
Classes: BigkeeperParser, GitInfo, GitOperator, GitService, GitflowOperator, InfoPlistOperator, Logger, ModuleService, PodOperator, PodfileDetector, PodfileOperator, Podfile_Modle, StashService
Constant Summary
collapse
- VERSION =
"0.7.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
-
.source(name) ⇒ Object
-
.start_module_release(path, version, user, module_name) ⇒ Object
-
.user(name) ⇒ Object
-
.version(name) ⇒ Object
Class Method Details
.feature_finish(path, user) ⇒ Object
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
47
48
49
50
|
# File 'lib/big_keeper/command/feature&hotfix/feature_finish.rb', line 13
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)
Logger.error("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
PodOperator.pod_install(path)
Logger.highlight("Finish branch '#{branch_name}' for 'Home'")
GitService.new.verify_push(path, "finish #{GitflowType.name(GitflowType::FEATURE)} #{branch_name}", branch_name, 'Home')
GitService.new.verify_rebase(path, 'develop', 'Home')
`open #{BigkeeperParser.home_pulls()}`
ensure
end
end
|
.feature_pull(path, user) ⇒ Object
.feature_push(path, user, comment) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/big_keeper/command/feature&hotfix/feature_push.rb', line 5
def self.feature_push(path, user, )
begin
BigkeeperParser.parse("#{path}/Bigkeeper")
branch_name = GitOperator.new.current_branch(path)
Logger.error("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)
Logger.highlight("Push branch '#{branch_name}' for module '#{module_name}'...")
GitService.new.verify_push(path, , module_branch_name, module_name)
end
Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
GitService.new.verify_push(path, , branch_name, 'Home')
ensure
end
end
|
.feature_start(path, version, user, name, modules) ⇒ Object
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
60
61
|
# File 'lib/big_keeper/command/feature&hotfix/feature_start.rb', line 16
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_all(path, branch_name, user, stash_modules)
if modules
BigkeeperParser.verify_modules(modules)
else
modules = BigkeeperParser.module_names
end
Logger.highlight("Add branch '#{branch_name}' for 'Home'...")
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
PodOperator.pod_install(path)
GitService.new.verify_push(path, "init #{GitflowType.name(GitflowType::FEATURE)} #{feature_name}", branch_name, 'Home')
`open #{path}/*.xcworkspace`
ensure
end
end
|
.feature_switch(path, version, user, name) ⇒ Object
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
43
44
45
|
# File 'lib/big_keeper/command/feature&hotfix/feature_switch.rb', line 7
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)
stash_modules = PodfileOperator.new.modules_with_type("#{path}/Podfile",
BigkeeperParser.module_names, ModuleType::PATH)
StashService.new.stash_all(path, branch_name, user, stash_modules)
GitOperator.new.git_checkout(path, branch_name)
GitOperator.new.pull(path)
StashService.new.pop_stash(path, branch_name, 'Home')
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
PodOperator.pod_install(path)
`open #{path}/*.xcworkspace`
ensure
end
end
|
.feature_update(path, user, modules) ⇒ Object
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
60
61
62
63
|
# File 'lib/big_keeper/command/feature&hotfix/feature_update.rb', line 16
def self.feature_update(path, user, modules)
begin
BigkeeperParser.parse("#{path}/Bigkeeper")
branch_name = GitOperator.new.current_branch(path)
Logger.error("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
Logger.highlight("Start to update modules for branch '#{branch_name}'...")
add_modules = modules - current_modules
del_modules = current_modules - modules
if add_modules.empty? and del_modules.empty?
Logger.info("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
PodOperator.pod_install(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
.podfile_lock(path) ⇒ Object
.release_home_finish(path, version) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/big_keeper/command/release/release_home.rb', line 14
def self.release_home_finish(path, version)
Dir.chdir(path) do
if GitOperator.new.has_branch(path, "release/#{version}")
if GitOperator.new.current_branch(path) == "release/#{version}"
GitOperator.new.commit(path, "release: V #{version}")
GitOperator.new.first_push(path, "release/#{version}")
GitflowOperator.new.finish_release(path, version)
if GitOperator.new.current_branch(path) == "master"
GitOperator.new.tag(path, version)
else
GitOperator.new.git_checkout(path, "master")
GitOperator.new.tag(path, version)
end
else
raise Logger.error("Not in release branch, please check your branches.")
end
else
raise Logger.error("Not has release branch, please use release start first.")
end
end
end
|
.release_home_start(path, version, user) ⇒ Object
9
10
11
12
|
# File 'lib/big_keeper/command/release/release_home.rb', line 9
def self.release_home_start(path, version, user)
BigkeeperParser.parse("#{path}/Bigkeeper")
start_release(path, version, BigkeeperParser::module_names, user)
end
|
.start_module_release(path, version, user, module_name) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/big_keeper/command/release/release_module.rb', line 10
def self.start_module_release(path, version, user, module_name)
BigkeeperParser.parse("#{path}/Bigkeeper")
Dir.chdir(path) do
module_release(BigkeeperParser::module_path(user, module_name),
version,
module_name,
GitInfo.new(BigkeeperParser::home_git, GitType::TAG, version),
user)
end
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
|