kookeeper 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/.github/ISSUE_TEMPLATE.md +20 -0
- data/.gitignore +50 -0
- data/.travis.yml +19 -0
- data/CODE_OF_CONDUCT.md +46 -0
- data/CONTRIBUTING.md +70 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +125 -0
- data/LICENSE +21 -0
- data/README.md +113 -0
- data/Rakefile +2 -0
- data/big_keeper.gemspec +49 -0
- data/bin/big +14 -0
- data/bin/setup +8 -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/client.rb +50 -0
- data/lib/big_keeper/command/feature&hotfix/delete.rb +40 -0
- data/lib/big_keeper/command/feature&hotfix/finish.rb +54 -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 +74 -0
- data/lib/big_keeper/command/feature&hotfix/switch.rb +46 -0
- data/lib/big_keeper/command/feature&hotfix/update.rb +66 -0
- data/lib/big_keeper/command/feature&hotfix.rb +167 -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/init.rb +36 -0
- data/lib/big_keeper/command/pod/podfile.rb +72 -0
- data/lib/big_keeper/command/pod.rb +55 -0
- data/lib/big_keeper/command/release/finish.rb +36 -0
- data/lib/big_keeper/command/release/home.rb +92 -0
- data/lib/big_keeper/command/release/module.rb +65 -0
- data/lib/big_keeper/command/release/publish.rb +4 -0
- data/lib/big_keeper/command/release/start.rb +78 -0
- data/lib/big_keeper/command/release.rb +100 -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 +74 -0
- data/lib/big_keeper/dependency/dep_operator.rb +48 -0
- data/lib/big_keeper/dependency/dep_pod_operator.rb +130 -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 +30 -0
- data/lib/big_keeper/model/podfile_model.rb +33 -0
- data/lib/big_keeper/service/git_service.rb +211 -0
- data/lib/big_keeper/service/module_service.rb +224 -0
- data/lib/big_keeper/service/stash_service.rb +45 -0
- data/lib/big_keeper/util/bigkeeper_parser.rb +260 -0
- data/lib/big_keeper/util/cache_operator.rb +118 -0
- data/lib/big_keeper/util/code_operator.rb +37 -0
- data/lib/big_keeper/util/command_line_util.rb +9 -0
- data/lib/big_keeper/util/file_operator.rb +33 -0
- data/lib/big_keeper/util/git_operator.rb +242 -0
- data/lib/big_keeper/util/gitflow_operator.rb +51 -0
- data/lib/big_keeper/util/gradle_content_generator.rb +26 -0
- data/lib/big_keeper/util/gradle_file_operator.rb +339 -0
- data/lib/big_keeper/util/gradle_module_operator.rb +70 -0
- data/lib/big_keeper/util/info_plist_operator.rb +46 -0
- data/lib/big_keeper/util/leancloud_logger.rb +84 -0
- data/lib/big_keeper/util/list_generator.rb +101 -0
- data/lib/big_keeper/util/lockfile_parser.rb +143 -0
- data/lib/big_keeper/util/logger.rb +47 -0
- data/lib/big_keeper/util/pod_operator.rb +70 -0
- data/lib/big_keeper/util/podfile_detector.rb +102 -0
- data/lib/big_keeper/util/podfile_module.rb +63 -0
- data/lib/big_keeper/util/podfile_operator.rb +125 -0
- data/lib/big_keeper/util/verify_operator.rb +17 -0
- data/lib/big_keeper/util/version_config_operator.rb +29 -0
- data/lib/big_keeper/util/xcode_operator.rb +15 -0
- data/lib/big_keeper/version.rb +3 -0
- data/lib/big_keeper.rb +81 -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
- data/resources/template/Bigkeeper +23 -0
- metadata +354 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'big_keeper/util/podfile_operator'
|
4
|
+
require 'big_keeper/util/logger'
|
5
|
+
require 'big_keeper/util/pod_operator'
|
6
|
+
require 'big_keeper/util/xcode_operator'
|
7
|
+
require 'big_keeper/util/cache_operator'
|
8
|
+
require 'big_keeper/util/bigkeeper_parser'
|
9
|
+
require 'big_keeper/model/operate_type'
|
10
|
+
require 'big_keeper/dependency/dep_service'
|
11
|
+
|
12
|
+
require 'big_keeper/dependency/dep_type'
|
13
|
+
|
14
|
+
|
15
|
+
module BigKeeper
|
16
|
+
|
17
|
+
def self.publish(path, user, type)
|
18
|
+
begin
|
19
|
+
# Parse Bigkeeper file
|
20
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
21
|
+
|
22
|
+
branch_name = GitOperator.new.current_branch(path)
|
23
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
24
|
+
|
25
|
+
path_modules = ModuleCacheOperator.new(path).current_path_modules
|
26
|
+
Logger.error("You have unfinished modules #{path_modules}, Use 'finish' first please.") unless path_modules.empty?
|
27
|
+
|
28
|
+
# Push modules changes to remote then rebase
|
29
|
+
modules = ModuleCacheOperator.new(path).current_git_modules
|
30
|
+
modules.each do |module_name|
|
31
|
+
ModuleService.new.pre_publish(path, user, module_name, branch_name, type)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Install
|
35
|
+
DepService.dep_operator(path, user).install(modules, OperateType::PUBLISH, false)
|
36
|
+
|
37
|
+
# Modify module as git
|
38
|
+
modules.each do |module_name|
|
39
|
+
ModuleService.new.publish(path, user, module_name, branch_name, type)
|
40
|
+
end
|
41
|
+
|
42
|
+
Logger.highlight("Publish branch '#{branch_name}' for 'Home'")
|
43
|
+
|
44
|
+
# Recover home
|
45
|
+
DepService.dep_operator(path, user).recover
|
46
|
+
|
47
|
+
# Push home changes to remote
|
48
|
+
GitService.new.verify_push(path, "publish branch #{branch_name}", branch_name, 'Home')
|
49
|
+
# Rebase Home
|
50
|
+
GitService.new.verify_rebase(path, GitflowType.base_branch(type), 'Home')
|
51
|
+
|
52
|
+
`open #{BigkeeperParser.home_pulls()}`
|
53
|
+
ensure
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'big_keeper/util/logger'
|
2
|
+
require 'big_keeper/util/cache_operator'
|
3
|
+
|
4
|
+
require 'big_keeper/dependency/dep_service'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
def self.pull(path, user, type)
|
8
|
+
begin
|
9
|
+
# Parse Bigkeeper file
|
10
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
11
|
+
branch_name = GitOperator.new.current_branch(path)
|
12
|
+
|
13
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
14
|
+
|
15
|
+
modules = ModuleCacheOperator.new(path).current_path_modules
|
16
|
+
|
17
|
+
modules.each do |module_name|
|
18
|
+
ModuleService.new.pull(path, user, module_name, branch_name, type)
|
19
|
+
end
|
20
|
+
|
21
|
+
Logger.highlight("Pull branch '#{branch_name}' for 'Home'...")
|
22
|
+
GitOperator.new.pull(path)
|
23
|
+
ensure
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'big_keeper/util/logger'
|
2
|
+
require 'big_keeper/util/cache_operator'
|
3
|
+
|
4
|
+
require 'big_keeper/dependency/dep_service'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
|
8
|
+
def self.push(path, user, comment, type)
|
9
|
+
begin
|
10
|
+
# Parse Bigkeeper file
|
11
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
12
|
+
branch_name = GitOperator.new.current_branch(path)
|
13
|
+
|
14
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
15
|
+
|
16
|
+
modules = ModuleCacheOperator.new(path).current_path_modules
|
17
|
+
|
18
|
+
modules.each do |module_name|
|
19
|
+
ModuleService.new.push(path, user, module_name, branch_name, type, comment)
|
20
|
+
end
|
21
|
+
|
22
|
+
Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
|
23
|
+
GitService.new.verify_push(path, comment, branch_name, 'Home')
|
24
|
+
ensure
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'big_keeper/util/logger'
|
2
|
+
require 'big_keeper/util/cache_operator'
|
3
|
+
|
4
|
+
require 'big_keeper/dependency/dep_service'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
def self.rebase(path, user, type)
|
8
|
+
begin
|
9
|
+
# Parse Bigkeeper file
|
10
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
11
|
+
branch_name = GitOperator.new.current_branch(path)
|
12
|
+
|
13
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
14
|
+
|
15
|
+
modules = ModuleCacheOperator.new(path).current_path_modules
|
16
|
+
|
17
|
+
modules.each do |module_name|
|
18
|
+
ModuleService.new.rebase(path, user, module_name, branch_name, type)
|
19
|
+
end
|
20
|
+
|
21
|
+
Logger.highlight("Rebase '#{GitflowType.base_branch(type)}' "\
|
22
|
+
"to branch '#{branch_name}' for 'Home'...")
|
23
|
+
|
24
|
+
# Rebase Home
|
25
|
+
Logger.error("You have some changes in branch '#{branch_name}' "\
|
26
|
+
"for 'Home'. Use 'push' first please") if GitOperator.new.has_changes(path)
|
27
|
+
|
28
|
+
GitService.new.verify_rebase(path, GitflowType.base_branch(type), 'Home')
|
29
|
+
ensure
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'big_keeper/util/podfile_operator'
|
4
|
+
require 'big_keeper/util/gitflow_operator'
|
5
|
+
require 'big_keeper/util/bigkeeper_parser'
|
6
|
+
require 'big_keeper/util/logger'
|
7
|
+
require 'big_keeper/util/pod_operator'
|
8
|
+
require 'big_keeper/util/xcode_operator'
|
9
|
+
require 'big_keeper/util/cache_operator'
|
10
|
+
require 'big_keeper/model/operate_type'
|
11
|
+
require 'big_keeper/dependency/dep_service'
|
12
|
+
|
13
|
+
require 'big_keeper/dependency/dep_type'
|
14
|
+
|
15
|
+
require 'big_keeper/service/stash_service'
|
16
|
+
require 'big_keeper/service/module_service'
|
17
|
+
|
18
|
+
|
19
|
+
module BigKeeper
|
20
|
+
def self.start(path, version, user, name, modules, type)
|
21
|
+
begin
|
22
|
+
# Parse Bigkeeper file
|
23
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
24
|
+
|
25
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
26
|
+
full_name = "#{version}_#{user}_#{name}"
|
27
|
+
branch_name = "#{GitflowType.name(type)}/#{full_name}"
|
28
|
+
|
29
|
+
GitService.new.verify_home_branch(path, branch_name, OperateType::START)
|
30
|
+
|
31
|
+
stash_modules = ModuleCacheOperator.new(path).all_path_modules
|
32
|
+
|
33
|
+
# Stash current branch
|
34
|
+
StashService.new.stash_all(path, branch_name, user, stash_modules)
|
35
|
+
|
36
|
+
# Verify input modules
|
37
|
+
modules = BigkeeperParser.verify_modules(modules)
|
38
|
+
|
39
|
+
Logger.highlight("Add branch '#{branch_name}' for 'Home'...")
|
40
|
+
# Start home feature
|
41
|
+
GitService.new.start(path, full_name, type)
|
42
|
+
|
43
|
+
# Clean module cache
|
44
|
+
ModuleCacheOperator.new(path).clean_modules
|
45
|
+
|
46
|
+
# Cache all path modules
|
47
|
+
ModuleCacheOperator.new(path).cache_path_modules(modules, modules, [])
|
48
|
+
modules = ModuleCacheOperator.new(path).remain_path_modules
|
49
|
+
|
50
|
+
# Backup home
|
51
|
+
DepService.dep_operator(path, user).backup
|
52
|
+
|
53
|
+
# Start modules feature and modify module as path
|
54
|
+
modules.each do |module_name|
|
55
|
+
ModuleService.new.add(path, user, module_name, full_name, type)
|
56
|
+
end
|
57
|
+
|
58
|
+
# install
|
59
|
+
DepService.dep_operator(path, user).install(modules, OperateType::START, true)
|
60
|
+
|
61
|
+
# Open home workspace
|
62
|
+
DepService.dep_operator(path, user).open
|
63
|
+
|
64
|
+
# Push home changes to remote
|
65
|
+
Logger.highlight("Push branch '#{branch_name}' for 'Home'...")
|
66
|
+
GitService.new.verify_push(
|
67
|
+
path,
|
68
|
+
"init #{GitflowType.name(type)} #{full_name}",
|
69
|
+
branch_name,
|
70
|
+
'Home')
|
71
|
+
ensure
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
require 'big_stash/stash_operator'
|
3
|
+
require 'big_keeper/util/logger'
|
4
|
+
require 'big_keeper/util/pod_operator'
|
5
|
+
require 'big_keeper/util/xcode_operator'
|
6
|
+
require 'big_keeper/model/operate_type'
|
7
|
+
require 'big_keeper/dependency/dep_service'
|
8
|
+
|
9
|
+
module BigKeeper
|
10
|
+
def self.switch_to(path, version, user, full_name, type)
|
11
|
+
begin
|
12
|
+
# Parse Bigkeeper file
|
13
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
14
|
+
|
15
|
+
version = BigkeeperParser.version if version == 'Version in Bigkeeper file'
|
16
|
+
branch_name = "#{GitflowType.name(type)}/#{full_name}"
|
17
|
+
|
18
|
+
GitService.new.verify_home_branch(path, branch_name, OperateType::SWITCH)
|
19
|
+
|
20
|
+
stash_modules = ModuleCacheOperator.new(path).all_path_modules
|
21
|
+
|
22
|
+
# Stash current branch
|
23
|
+
StashService.new.stash_all(path, branch_name, user, stash_modules)
|
24
|
+
|
25
|
+
# Switch to new feature
|
26
|
+
GitOperator.new.checkout(path, branch_name)
|
27
|
+
GitOperator.new.pull(path)
|
28
|
+
|
29
|
+
# Apply home stash
|
30
|
+
StashService.new.pop_stash(path, branch_name, 'Home')
|
31
|
+
|
32
|
+
modules = ModuleCacheOperator.new(path).all_path_modules
|
33
|
+
|
34
|
+
modules.each do |module_name|
|
35
|
+
ModuleService.new.switch_to(path, user, module_name, branch_name, type)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Install
|
39
|
+
DepService.dep_operator(path, user).install(modules, OperateType::SWITCH, false)
|
40
|
+
|
41
|
+
# Open home workspace
|
42
|
+
DepService.dep_operator(path, user).open
|
43
|
+
ensure
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'big_keeper/util/podfile_operator'
|
4
|
+
require 'big_keeper/util/gitflow_operator'
|
5
|
+
require 'big_keeper/util/bigkeeper_parser'
|
6
|
+
require 'big_keeper/util/logger'
|
7
|
+
require 'big_keeper/util/pod_operator'
|
8
|
+
require 'big_keeper/util/xcode_operator'
|
9
|
+
require 'big_keeper/util/cache_operator'
|
10
|
+
require 'big_keeper/model/operate_type'
|
11
|
+
require 'big_keeper/dependency/dep_service'
|
12
|
+
|
13
|
+
require 'big_keeper/dependency/dep_type'
|
14
|
+
|
15
|
+
require 'big_keeper/service/stash_service'
|
16
|
+
require 'big_keeper/service/module_service'
|
17
|
+
|
18
|
+
|
19
|
+
module BigKeeper
|
20
|
+
def self.update(path, user, modules, type)
|
21
|
+
begin
|
22
|
+
# Parse Bigkeeper file
|
23
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
24
|
+
branch_name = GitOperator.new.current_branch(path)
|
25
|
+
|
26
|
+
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type)
|
27
|
+
|
28
|
+
full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '')
|
29
|
+
|
30
|
+
current_modules = ModuleCacheOperator.new(path).current_path_modules
|
31
|
+
|
32
|
+
# Verify input modules
|
33
|
+
modules = BigkeeperParser.verify_modules(modules)
|
34
|
+
|
35
|
+
Logger.highlight("Start to update modules for branch '#{branch_name}'...")
|
36
|
+
|
37
|
+
add_modules = modules - current_modules
|
38
|
+
del_modules = current_modules - modules
|
39
|
+
|
40
|
+
# Clean module cache
|
41
|
+
ModuleCacheOperator.new(path).clean_modules
|
42
|
+
ModuleCacheOperator.new(path).cache_path_modules(modules, add_modules, del_modules)
|
43
|
+
remain_path_modules = ModuleCacheOperator.new(path).remain_path_modules
|
44
|
+
|
45
|
+
if add_modules.empty? and del_modules.empty?
|
46
|
+
Logger.default("There is nothing changed with modules #{modules}.")
|
47
|
+
else
|
48
|
+
# Modify podfile as path and Start modules feature
|
49
|
+
remain_path_modules.each do |module_name|
|
50
|
+
ModuleService.new.add(path, user, module_name, full_name, type)
|
51
|
+
end
|
52
|
+
|
53
|
+
del_modules.each do |module_name|
|
54
|
+
ModuleService.new.del(path, user, module_name, full_name, type)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Install
|
59
|
+
DepService.dep_operator(path, user).install(modules, OperateType::UPDATE, false)
|
60
|
+
|
61
|
+
# Open home workspace
|
62
|
+
DepService.dep_operator(path, user).open
|
63
|
+
ensure
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'big_keeper/command/feature&hotfix/start'
|
2
|
+
require 'big_keeper/command/feature&hotfix/finish'
|
3
|
+
require 'big_keeper/command/feature&hotfix/switch'
|
4
|
+
require 'big_keeper/command/feature&hotfix/update'
|
5
|
+
require 'big_keeper/command/feature&hotfix/pull'
|
6
|
+
require 'big_keeper/command/feature&hotfix/push'
|
7
|
+
require 'big_keeper/command/feature&hotfix/rebase'
|
8
|
+
require 'big_keeper/command/feature&hotfix/publish'
|
9
|
+
require 'big_keeper/command/feature&hotfix/delete'
|
10
|
+
require 'big_keeper/command/feature&hotfix/list'
|
11
|
+
require 'big_keeper/util/leancloud_logger'
|
12
|
+
|
13
|
+
module BigKeeper
|
14
|
+
def self.feature_and_hotfix_command(type)
|
15
|
+
desc "Gitflow #{GitflowType.name(type)} operations"
|
16
|
+
command GitflowType.command(type) do |c|
|
17
|
+
c.desc "Start a new #{GitflowType.name(type)} with name for given modules and main project"
|
18
|
+
c.command :start do |start|
|
19
|
+
start.action do |global_options, options, args|
|
20
|
+
path = File.expand_path(global_options[:path])
|
21
|
+
version = global_options[:ver]
|
22
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
23
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/start")
|
24
|
+
|
25
|
+
help_now!('user name is required') if user and user.empty?
|
26
|
+
help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
|
27
|
+
name = args[0]
|
28
|
+
modules = args[(1...args.length)] if args.length > 1
|
29
|
+
start(path, version, user, name, modules, type)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
c.desc "Update modules for the #{GitflowType.name(type)} with name"
|
34
|
+
c.command :update do |update|
|
35
|
+
update.action do |global_options, options, args|
|
36
|
+
path = File.expand_path(global_options[:path])
|
37
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
38
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/update")
|
39
|
+
|
40
|
+
help_now!('user name is required') if user and user.empty?
|
41
|
+
modules = args[(0...args.length)] if args.length > 0
|
42
|
+
update(path, user, modules, type)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
c.desc "Switch to the #{GitflowType.name(type)} with name"
|
47
|
+
c.command :switch do |switch|
|
48
|
+
switch.action do |global_options, options, args|
|
49
|
+
path = File.expand_path(global_options[:path])
|
50
|
+
version = global_options[:ver]
|
51
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
52
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/switch")
|
53
|
+
|
54
|
+
help_now!('user name is required') if user and user.empty?
|
55
|
+
help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
|
56
|
+
name = args[0]
|
57
|
+
switch_to(path, version, user, name, type)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
c.desc "Pull remote changes for current #{GitflowType.name(type)}"
|
62
|
+
c.command :pull do |pull|
|
63
|
+
pull.action do |global_options, options, args|
|
64
|
+
path = File.expand_path(global_options[:path])
|
65
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
66
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/pull")
|
67
|
+
|
68
|
+
help_now!('user name is required') if user and user.empty?
|
69
|
+
pull(path, user, type)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
c.desc "Push local changes to remote for current #{GitflowType.name(type)}"
|
74
|
+
c.command :push do |push|
|
75
|
+
push.action do |global_options, options, args|
|
76
|
+
path = File.expand_path(global_options[:path])
|
77
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
78
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/push")
|
79
|
+
|
80
|
+
help_now!('user name is required') if user and user.empty?
|
81
|
+
help_now!('comment message is required') if args.length < 1
|
82
|
+
help_now!(%Q(comment message should be wrappered with '' or "")) if args.length > 1
|
83
|
+
comment = args[0]
|
84
|
+
push(path, user, comment, type)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
c.desc "Rebase '#{GitflowType.base_branch(type)}' to current #{GitflowType.name(type)}"
|
89
|
+
c.command :rebase do |rebase|
|
90
|
+
rebase.action do |global_options, options, args|
|
91
|
+
path = File.expand_path(global_options[:path])
|
92
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
93
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/rebase")
|
94
|
+
|
95
|
+
help_now!('user name is required') if user and user.empty?
|
96
|
+
rebase(path, user, type)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
c.desc "Finish current #{GitflowType.name(type)}"
|
101
|
+
c.command :finish do |finish|
|
102
|
+
finish.action do |global_options, options, args|
|
103
|
+
path = File.expand_path(global_options[:path])
|
104
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
105
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/finish")
|
106
|
+
|
107
|
+
help_now!('user name is required') if user and user.empty?
|
108
|
+
finish(path, user, type)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
c.desc "Publish current #{GitflowType.name(type)}"
|
113
|
+
c.command :publish do |publish|
|
114
|
+
publish.action do |global_options, options, args|
|
115
|
+
path = File.expand_path(global_options[:path])
|
116
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
117
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/publish")
|
118
|
+
|
119
|
+
help_now!('user name is required') if user and user.empty?
|
120
|
+
publish(path, user, type)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
c.desc "Delete #{GitflowType.name(type)} with name"
|
125
|
+
c.command :delete do |delete|
|
126
|
+
delete.action do |global_options, options, args|
|
127
|
+
path = File.expand_path(global_options[:path])
|
128
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
129
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/delete")
|
130
|
+
|
131
|
+
help_now!('user name is required') if user and user.empty?
|
132
|
+
help_now!("#{GitflowType.name(type)} name is required") if args.length < 1
|
133
|
+
name = args[0]
|
134
|
+
delete(path, user, name, type)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
c.desc "List all the #{GitflowType.name(type)}s"
|
139
|
+
c.command :list do |list|
|
140
|
+
list.flag %i[v version] , default_value: 'all versions'
|
141
|
+
list.desc "Print list of TREE format."
|
142
|
+
list.command :tree do |tree|
|
143
|
+
tree.action do |global_options, options, args|
|
144
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/list/tree")
|
145
|
+
|
146
|
+
Logger.highlight("Generating #{GitflowType.name(type)} tree of all version...") if args.length < 1
|
147
|
+
path = File.expand_path(global_options[:path])
|
148
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
149
|
+
list(path, user, type, options)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
list.desc "Print list of JSON format."
|
154
|
+
list.command :json do |json|
|
155
|
+
json.action do |global_options, options, args|
|
156
|
+
LeanCloudLogger.instance.set_command("#{GitflowType.command(type)}/list/json")
|
157
|
+
|
158
|
+
options[:json] = true
|
159
|
+
path = File.expand_path(global_options[:path])
|
160
|
+
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase
|
161
|
+
list(path, user, type, options)
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
File without changes
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'big_resources/util/image/name_analyze_util'
|
2
|
+
require 'big_keeper/util/leancloud_logger'
|
3
|
+
|
4
|
+
module BigKeeper
|
5
|
+
def self.image_command
|
6
|
+
desc 'Image operations'
|
7
|
+
command :image do | c |
|
8
|
+
c.desc "Detect duplicate name images."
|
9
|
+
c.command :name do | name |
|
10
|
+
name.action do | global_options, options, args |
|
11
|
+
LeanCloudLogger.instance.set_command("image/name")
|
12
|
+
|
13
|
+
path = File.expand_path(global_options[:path])
|
14
|
+
BigResources::ImageAnalyzeUtil.get_duplicate_name_file_with_type(path, BigResources::PNG)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
c.desc "Detect duplicate content images."
|
19
|
+
c.command :content do | content |
|
20
|
+
content.action do | global_options, options, args |
|
21
|
+
LeanCloudLogger.instance.set_command("image/content")
|
22
|
+
path = File.expand_path(global_options[:path])
|
23
|
+
BigResources::ImageAnalyzeUtil.get_duplicate_content_file_with_type(path, BigResources::PNG)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'big_keeper/util/leancloud_logger'
|
2
|
+
require 'big_keeper/util/file_operator'
|
3
|
+
require 'fileutils'
|
4
|
+
require 'big_keeper/util/logger'
|
5
|
+
|
6
|
+
module BigKeeper
|
7
|
+
def self.init_command
|
8
|
+
desc 'BigKeeper file initialize'
|
9
|
+
command :init do | c |
|
10
|
+
c.desc "BigKeeper template file initialize."
|
11
|
+
c.action do | global_options, options, args |
|
12
|
+
LeanCloudLogger.instance.set_command("big/init")
|
13
|
+
|
14
|
+
bin_path = File.dirname(__FILE__)
|
15
|
+
bin_path = File.dirname(bin_path)
|
16
|
+
bin_path = File.dirname(bin_path)
|
17
|
+
bin_path = File.dirname(bin_path)
|
18
|
+
path = global_options['path']
|
19
|
+
Logger.highlight("Initialize BigKeeper File...")
|
20
|
+
#template path
|
21
|
+
source_file = File.join(bin_path, 'resources/template/BigKeeper')
|
22
|
+
#BigKeeper file need exist path
|
23
|
+
target_path = File.join(path, 'BigKeeper')
|
24
|
+
|
25
|
+
if !File.exists?(target_path)
|
26
|
+
FileUtils.cp(source_file, target_path)
|
27
|
+
Logger.highlight("Initialize BigKeeper Complete!")
|
28
|
+
else
|
29
|
+
Logger.highlight("BigKeeper File Has Exist!")
|
30
|
+
end
|
31
|
+
|
32
|
+
LeanCloudLogger.instance.set_command("file/init")
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'big_keeper/util/podfile_detector'
|
2
|
+
require 'big_keeper/util/podfile_operator'
|
3
|
+
require 'big_keeper/util/podfile_module'
|
4
|
+
require 'big_keeper/util/gitflow_operator'
|
5
|
+
require 'big_keeper/util/bigkeeper_parser'
|
6
|
+
require 'big_keeper/dependency/dep_type'
|
7
|
+
require 'big_keeper/util/logger'
|
8
|
+
require 'big_keeper/util/lockfile_parser'
|
9
|
+
|
10
|
+
module BigKeeper
|
11
|
+
|
12
|
+
def self.podfile_detect(path)
|
13
|
+
# Parse Bigkeeper file
|
14
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
15
|
+
# Get modules' name
|
16
|
+
# module_list = BigkeeperParser.module_names
|
17
|
+
# initialize PodfileDetector
|
18
|
+
detector = PodfileParser.instance
|
19
|
+
detactor.parse
|
20
|
+
# Get unlocked third party pods list
|
21
|
+
unlock_pod_list = detector.get_unlock_pod_list
|
22
|
+
# Print out unlock pod list
|
23
|
+
unlock_pod_list.each do |pod_name|
|
24
|
+
Logger.default("#{pod_name} should be locked.")
|
25
|
+
end
|
26
|
+
Logger.separator
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.podfile_lock(path, is_all)
|
31
|
+
# Parse Bigkeeper file
|
32
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
33
|
+
# initialize PodfileDetector
|
34
|
+
pod_parser = PodfileParser.instance
|
35
|
+
#Parser Podfile.lock
|
36
|
+
pod_parser.parse(path)
|
37
|
+
#initialize LockfileParser
|
38
|
+
lock_parser = LockfileParser.instance
|
39
|
+
#Parser Podfile.lock
|
40
|
+
lock_parser.parse(path)
|
41
|
+
# Get unlocked third party pods list
|
42
|
+
unlock_pod_info = lock_parser.get_unlock_pod_list(is_all)
|
43
|
+
# Lock modules in podfile
|
44
|
+
if unlock_pod_info.empty?
|
45
|
+
Logger.warning("There is nothing to be locked.")
|
46
|
+
else
|
47
|
+
PodfileOperator.new.find_and_lock("#{path}/Podfile", unlock_pod_info)
|
48
|
+
Logger.highlight("The Podfile has been changed.")
|
49
|
+
Logger.separator
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.podfile_modules_update(path)
|
55
|
+
# Parse Bigkeeper file
|
56
|
+
BigkeeperParser.parse("#{path}/Bigkeeper")
|
57
|
+
# Get modules' name
|
58
|
+
module_list = BigkeeperParser.module_names
|
59
|
+
# initialize PodfileDetector
|
60
|
+
detector = PodfileModuleDetector.new(path)
|
61
|
+
# Get module latest version
|
62
|
+
module_dictionary = detector.check_version_list
|
63
|
+
# Check if anything should be upgrade
|
64
|
+
if module_dictionary.empty?
|
65
|
+
Logger.warning("There is nothing to be upgrade.")
|
66
|
+
else
|
67
|
+
PodfileOperator.new.find_and_upgrade("#{path}/Podfile", module_dictionary)
|
68
|
+
Logger.highlight("The Podfile has been changed.")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|