Sha256: 356cf667ce1516ab43921c0f1435acba4ca6d3a557a037d96befce38664fdd80

Contents?: true

Size: 1.99 KB

Versions: 9

Compression:

Stored size: 1.99 KB

Contents

#!/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/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.update(path, user, modules, type)
    begin
      # Parse Bigkeeper file
      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)

      Logger.highlight("Start to update modules for branch '#{branch_name}'...")

      add_modules = modules - current_modules
      del_modules = current_modules - modules

      ModuleCacheOperator.new(path).cache_path_modules(modules, add_modules, del_modules)
      remain_path_modules = ModuleCacheOperator.new(path).remain_path_modules

      if add_modules.empty? and del_modules.empty?
        Logger.default("There is nothing changed with modules #{modules}.")
      else
        # Modify podfile as path and Start modules feature
        remain_path_modules.each do |module_name|
          ModuleService.new.add(path, user, module_name, full_name, type)
        end

        del_modules.each do |module_name|
          ModuleService.new.del(path, user, module_name, full_name, type)
        end
      end

      # Install
      DepService.dep_operator(path, user).install(false)

      # Open home workspace
      DepService.dep_operator(path, user).open
    ensure
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bigkeeper-0.8.8 lib/big_keeper/command/feature&hotfix/update.rb
bigkeeper-0.8.7 lib/big_keeper/command/feature&hotfix/update.rb
bigkeeper-0.8.6 lib/big_keeper/command/feature&hotfix/update.rb
bigkeeper-0.8.5 lib/big_keeper/command/feature&hotfix/update.rb
bigkeeper-0.8.4 lib/big_keeper/command/feature&hotfix/update.rb
bigkeeper-0.8.3 lib/big_keeper/command/feature&hotfix/update.rb
bigkeeper-0.8.2 lib/big_keeper/command/feature&hotfix/update.rb
bigkeeper-0.8.1 lib/big_keeper/command/feature&hotfix/update.rb
bigkeeper-0.8.0 lib/big_keeper/command/feature&hotfix/update.rb