Class: BigKeeper::ModuleService
- Inherits:
-
Object
- Object
- BigKeeper::ModuleService
- Defined in:
- lib/big_keeper/service/module_service.rb
Overview
Operator for got
Instance Method Summary collapse
- #add(path, user, module_name, name, type) ⇒ Object
- #del(path, user, module_name, name, type) ⇒ Object
- #finish(path, user, module_name) ⇒ Object
- #pull(path, user, module_name, branch_name) ⇒ Object
- #switch(path, user, module_name, branch_name) ⇒ Object
Instance Method Details
#add(path, user, module_name, name, type) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/big_keeper/service/module_service.rb', line 57 def add(path, user, module_name, name, type) branch_name = "#{GitflowType.name(type)}/#{name}" module_full_path = BigkeeperParser.module_full_path(path, user, module_name) GitflowOperator.new.start(module_full_path, name, type) GitOperator.new.push(module_full_path, branch_name) BigStash::StashOperator.new(module_full_path).apply_stash(branch_name) module_path = BigkeeperParser.module_path(user, module_name) PodfileOperator.new.find_and_replace("#{path}/Podfile", %('#{module_name}'), ModuleType::PATH, module_path) end |
#del(path, user, module_name, name, type) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/big_keeper/service/module_service.rb', line 73 def del(path, user, module_name, name, type) branch_name = "#{GitflowType.name(type)}/#{name}" module_full_path = BigkeeperParser.module_full_path(path, user, module_name) BigStash::StashOperator.new(module_full_path).stash(branch_name) GitOperator.new.git_checkout(module_full_path, 'develop') GitOperator.new.del(module_full_path, branch_name) module_git = BigkeeperParser.module_git(module_name) PodfileOperator.new.find_and_replace("#{path}/Podfile", %Q('#{module_name}'), ModuleType::GIT, GitInfo.new(module_git, GitType::BRANCH, 'develop')) end |
#finish(path, user, module_name) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/big_keeper/service/module_service.rb', line 42 def finish(path, user, module_name) module_git = BigkeeperParser.module_git(module_name) module_full_path = BigkeeperParser.module_full_path(path, user, module_name) branch_name = GitOperator.new.current_branch(module_full_path) PodfileOperator.new.find_and_replace("#{path}/Podfile", %Q('#{module_name}'), ModuleType::GIT, GitInfo.new(module_git, GitType::BRANCH, branch_name)) GitService.new.verify_rebase(module_full_path, 'develop', module_name) `open #{BigkeeperParser.module_pulls(module_name)}` end |
#pull(path, user, module_name, branch_name) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/big_keeper/service/module_service.rb', line 6 def pull(path, user, module_name, branch_name) module_full_path = BigkeeperParser.module_full_path(path, user, module_name) if !File.exist? module_full_path module_git = BigkeeperParser.module_git(module_name) GitOperator.new.clone(File.("#{module_full_path}/../"), module_git) GitOperator.new.git_checkout(module_full_path, branch_name) else module_branch_name = GitOperator.new.current_branch(module_full_path) if module_branch_name != branch_name p "Current branch of #{module_name} is #{module_branch_name},\ stash it and checkout #{branch_name}..." BigStash::StashOperator.new(module_full_path).stash(module_branch_name) GitOperator.new.git_checkout(module_full_path, branch_name) end p "Start pulling #{module_name}..." GitOperator.new.pull(module_full_path, branch_name) p "Finish pulling #{module_name}..." end end |
#switch(path, user, module_name, branch_name) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/big_keeper/service/module_service.rb', line 27 def switch(path, user, module_name, branch_name) module_full_path = BigkeeperParser.module_full_path(path, user, module_name) p "Start switching #{module_name}..." if !File.exist? module_full_path module_git = BigkeeperParser.module_git(module_name) GitOperator.new.clone(File.("#{module_full_path}/../"), module_git) GitOperator.new.git_checkout(module_full_path, branch_name) else GitOperator.new.git_checkout(module_full_path, branch_name) GitOperator.new.pull(module_full_path, branch_name) end p "Finish switching #{module_name}..." end |