Class: Pixab::Package
- Inherits:
-
Object
- Object
- Pixab::Package
- Defined in:
- lib/Package.rb
Instance Attribute Summary collapse
-
#repo_manager ⇒ Object
readonly
Returns the value of attribute repo_manager.
Instance Method Summary collapse
-
#initialize(repo_manager = RepoManager.new) ⇒ Package
constructor
A new instance of Package.
- #run ⇒ Object
Constructor Details
#initialize(repo_manager = RepoManager.new) ⇒ Package
Returns a new instance of Package.
14 15 16 |
# File 'lib/Package.rb', line 14 def initialize(repo_manager = RepoManager.new) @repo_manager = repo_manager end |
Instance Attribute Details
#repo_manager ⇒ Object (readonly)
Returns the value of attribute repo_manager.
12 13 14 |
# File 'lib/Package.rb', line 12 def repo_manager @repo_manager end |
Instance Method Details
#run ⇒ Object
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/Package.rb', line 18 def run main_repo = repo_manager.main_repo package_branch = 'develop' origin_package_branch = "origin/#{package_branch}" target_branch = main_repo["target_branch"] origin_target_branch = "origin/#{target_branch}" main_repo_path = "#{repo_manager.root_path}/#{main_repo['name']}" FileUtils.cd(main_repo_path) GitUtils.check_git_repo(main_repo_path) puts "\n》》》》》正在更新远程仓库信息》》》》》\n".green GitUtils.fetch_origin if !GitUtils.is_branch_synced(origin_package_branch, package_branch) puts "\n》》》》》正在将#{origin_package_branch}代码拉取到#{package_branch}》》》》》\n".green GitUtils.check_is_code_conflicts(origin_package_branch, package_branch) GitUtils.fetch_origin(package_branch, package_branch) end if !GitUtils.is_branch_synced(origin_target_branch, package_branch) puts "\n》》》》》正在将#{origin_target_branch}代码合并到#{package_branch}》》》》》\n".green GitUtils.check_is_code_conflicts(origin_target_branch, package_branch) GitUtils.fetch_origin(target_branch, package_branch) end if GitUtils.is_branch_synced(package_branch, origin_package_branch) puts "Error: #{package_branch} branch has no code update and cannot be packaged.".red exit(1) end GitUtils.push(package_branch) puts "\n》》》》》已完成#{package_branch}代码推送,正在打包》》》》》".green puts "打包平台地址:http://ios.meitu-int.com/ipa/airbrush/queue\n".green end |