Sha256: 0919dd4bb13eded4aca6aa1e9fde6666b28dbb8d52bed3012936c98169ef73cd

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

require_relative '../../git'
module KCommercial
  module Resources
    # 自动同步到仓库
    class ResourcesUpdate
      def initialize
      end
      def self.can_auto_push?
        change_files = KCommercial::KCPipeline::KCGit.git.status.changed()
        change_files.delete('Gemfile.lock')
        change_files.empty?
      end

      def self.push
        if !should_push
          KCommercial::KCPipeline::KCGit.git.add('.')
          KCommercial::KCPipeline::KCGit.git.commit("chore(matrix,resource): 自动更新资源组件")
          branch_name = KCommercial::KCPipeline::KCGit.git.current_branch || ''
          KCommercial::KCPipeline::KCGit.git.push('origin',branch_name) unless branch_name.empty?
        else
          KCommercial::UI.info("资源未更新")
          exit!(0)
        end
      end

      def self.should_push
        change_files = KCommercial::KCPipeline::KCGit.git.status.changed()
        change_files.delete('Gemfile.lock')
        change_files.empty?
      end
    end


  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
KCommercialPipeline-0.2.5.1 lib/KCommercialPipeline/core/resource/auto_publish_resource/update_resource_component.rb