forked from eleme/bigkeeper
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from BigKeeper/develop
merge develop to master
- Loading branch information
Showing
32 changed files
with
830 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
require 'big_keeper/util/leancloud_logger' | ||
require 'big_keeper/command/pod/podfile' | ||
require 'big_keeper/command/spec/list' | ||
require 'big_keeper/util/list_generator' | ||
|
||
module BigKeeper | ||
|
||
def self.client_command | ||
desc 'API for bigkeeper-client.' | ||
command :client do | c | | ||
c.desc 'Commands about operate modules.' | ||
c.command :modules do |modules| | ||
modules.desc 'Get modules list from Bigkeeper file.' | ||
modules.command :list do |list| | ||
list.action do |global_options, options, args| | ||
LeanCloudLogger.instance.set_command("spec/list") | ||
path = File.expand_path(global_options[:path]) | ||
version = global_options[:ver] | ||
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase | ||
spec_list(path, user, options) | ||
end | ||
end | ||
modules.desc 'Update modules.' | ||
modules.command :update do |update| | ||
update.action do |global_options, options, args| | ||
LeanCloudLogger.instance.set_command("spec/list") | ||
path = File.expand_path(global_options[:path]) | ||
version = global_options[:ver] | ||
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase | ||
spec_list(path, user, options) | ||
end | ||
end | ||
end | ||
c.desc 'Commands about features.' | ||
c.command :feature do |feature| | ||
feature.desc "List all the features including origin." | ||
feature.command :list do | list | | ||
list.flag %i[v version] , default_value: 'all versions' | ||
list.action do |global_options, options, args| | ||
LeanCloudLogger.instance.set_command("feature/list/json") | ||
options[:json] = true | ||
path = File.expand_path(global_options[:path]) | ||
user = global_options[:user].gsub(/[^0-9A-Za-z]/, '').downcase | ||
list(path, user, GitflowType::FEATURE, options) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/usr/bin/ruby | ||
|
||
require 'big_keeper/util/podfile_operator' | ||
require 'big_keeper/util/gitflow_operator' | ||
require 'big_keeper/util/bigkeeper_parser' | ||
require 'big_keeper/util/logger' | ||
require 'big_keeper/util/pod_operator' | ||
require 'big_keeper/util/xcode_operator' | ||
require 'big_keeper/util/cache_operator' | ||
require 'big_keeper/model/operate_type' | ||
require 'big_keeper/dependency/dep_service' | ||
|
||
require 'big_keeper/dependency/dep_type' | ||
|
||
require 'big_keeper/service/stash_service' | ||
require 'big_keeper/service/module_service' | ||
|
||
|
||
module BigKeeper | ||
def self.module_add(path, user, modules, type) | ||
BigkeeperParser.parse("#{path}/Bigkeeper") | ||
branch_name = GitOperator.new.current_branch(path) | ||
|
||
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type) | ||
|
||
full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '') | ||
|
||
# Verify input modules | ||
modules = BigkeeperParser.verify_modules(modules) | ||
|
||
current_modules = ModuleCacheOperator.new(path).current_path_modules | ||
|
||
ModuleCacheOperator.new(path).clean_modules | ||
ModuleCacheOperator.new(path).cache_path_modules(current_modules + modules, modules, []) | ||
|
||
Logger.highlight("Start to add modules for branch '#{branch_name}'...") | ||
|
||
if modules.empty? | ||
Logger.default("There is nothing changed with modules #{modules}.") | ||
else | ||
# Modify podfile as path and Start modules feature | ||
modules.each do |module_name| | ||
ModuleCacheOperator.new(path).add_path_module(module_name) | ||
ModuleService.new.add(path, user, module_name, full_name, type) | ||
end | ||
end | ||
|
||
# Install | ||
DepService.dep_operator(path, user).install(modules, OperateType::UPDATE, false) | ||
|
||
# Open home workspace | ||
DepService.dep_operator(path, user).open | ||
end | ||
|
||
def self.module_del(path, user, modules, type) | ||
BigkeeperParser.parse("#{path}/Bigkeeper") | ||
branch_name = GitOperator.new.current_branch(path) | ||
|
||
Logger.error("Not a #{GitflowType.name(type)} branch, exit.") unless branch_name.include? GitflowType.name(type) | ||
|
||
full_name = branch_name.gsub(/#{GitflowType.name(type)}\//, '') | ||
|
||
current_modules = ModuleCacheOperator.new(path).current_path_modules | ||
|
||
# Verify input modules | ||
modules = BigkeeperParser.verify_modules(modules) | ||
|
||
ModuleCacheOperator.new(path).clean_modules | ||
ModuleCacheOperator.new(path).cache_path_modules(current_module + modules, [], modules) | ||
|
||
Logger.highlight("Start to delete modules for branch '#{branch_name}'...") | ||
|
||
if modules.empty? | ||
Logger.default("There is nothing changed with modules #{modules}.") | ||
else | ||
# Modify podfile as path and Start modules feature | ||
modules.each do |module_name| | ||
ModuleCacheOperator.new(path).del_path_module(module_name) | ||
ModuleService.new.del(path, user, module_name, full_name, type) | ||
end | ||
end | ||
|
||
# Install | ||
DepService.dep_operator(path, user).install(modules, OperateType::UPDATE, false) | ||
|
||
# Open home workspace | ||
DepService.dep_operator(path, user).open | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.