Sha256: 6f215179ecf9801b5f3e99c42e28262423cacdb2fb140806c6b44c649193828f

Contents?: true

Size: 1.67 KB

Versions: 170

Compression:

Stored size: 1.67 KB

Contents

# frozen_string_literal: true

require 'avm/eac_ruby_base1/sources/base'

module Avm
  module EacRubyBase1
    module Sources
      class Update
        class SubUpdate
          enable_simple_cache
          enable_speaker
          common_constructor :source_update, :sub do
            perform
          end
          delegate :source, to: :source_update

          protected

          def on_scm_updated(commit)
            if commit.no_scm_changed_files.any?
              commit = commit.reword(no_scm_update_commit_message)
              source.scm.commit_if_change { source_update.bundle_update }
                .if_present { |v| v.merge_with(commit) }
            else
              commit.reword(scm_update_commit_message)
            end
          end

          def perform
            update_scm.if_present { |commit| on_scm_updated(commit) }
          end

          # @return [Avm::EacRubyBase1::Sources::Base]
          def ruby_gem_uncached
            ::Avm::EacRubyBase1::Sources::Base.new(sub.path)
          end

          def no_scm_update_commit_message
            source_update.i18n_translate(__method__, __locale: source.locale,
                                                     name: ruby_gem.gem_name,
                                                     version: ruby_gem.version)
          end

          def scm_update_commit_message
            source_update.i18n_translate(__method__, __locale: source.locale)
          end

          # @return [Avm::Scms::Commit]
          def update_scm
            infom "Updating \"#{sub}\"..."
            source.scm.commit_if_change do
              sub.scm.update
            end
          end
        end
      end
    end
  end
end

Version data entries

170 entries across 170 versions & 2 rubygems

Version Path
avm-eac_ruby_base1-0.35.1 lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.96.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
avm-eac_ruby_base1-0.35.0 lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.95.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
avm-eac_ruby_base1-0.34.1 lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.91.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
avm-eac_ruby_base1-0.34.0 lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.91.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
avm-eac_ruby_base1-0.33.1 lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.83.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.82.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.81.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
avm-eac_ruby_base1-0.33.0 lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.80.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.79.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
avm-eac_ruby_base1-0.32.1 lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.78.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
avm-eac_ruby_base1-0.32.0 lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.77.1 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb
eac_tools-0.77.0 sub/avm-eac_ruby_base1/lib/avm/eac_ruby_base1/sources/update/sub_update.rb