<commit_before>module EY
  module Serverside
    module DependencyManager
      class Composer < Base
        def detected?
           composer_lock? || composer_json?
        end

        def install
          if composer_available?
            shell.status "Checking for composer updates..."
            composer_selfupdate
            shell.status "Installing composer packages (composer.#{lock_or_json} detected)"
            composer_install
          else
            raise EY::Serverside::RemoteFailure.new("Composer not available!")
          end
        end

        def lock_or_json
          composer_lock? ? 'lock' : 'json'
        end

        def composer_lock?
          paths.composer_lock.exist?
        end

        def composer_json?
          paths.composer_json.exist?
        end

        def composer_install
            run "composer install --no-interaction --working-dir #{paths.active_release}"
        end

        def composer_selfupdate
            run "composer self-update"
        end

        def composer_available?
          begin
            run "command -v composer > /dev/null"
            return true
          rescue EY::Serverside::RemoteFailure
            return false
          end
        end
      end
    end
  end
end
<commit_msg>Slightly more verbose error message.<commit_after>module EY
  module Serverside
    module DependencyManager
      class Composer < Base
        def detected?
           composer_lock? || composer_json?
        end

        def install
          if composer_available?
            shell.status "Checking for composer updates..."
            composer_selfupdate
            shell.status "Installing composer packages (composer.#{lock_or_json} detected)"
            composer_install
          else
            raise EY::Serverside::RemoteFailure.new("composer.#{lock_or_json} detected but composer not available!")
          end
        end

        def lock_or_json
          composer_lock? ? 'lock' : 'json'
        end

        def composer_lock?
          paths.composer_lock.exist?
        end

        def composer_json?
          paths.composer_json.exist?
        end

        def composer_install
            run "composer install --no-interaction --working-dir #{paths.active_release}"
        end

        def composer_selfupdate
            run "composer self-update"
        end

        def composer_available?
          begin
            run "command -v composer > /dev/null"
            return true
          rescue EY::Serverside::RemoteFailure
            return false
          end
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.05994654448262696, 'fraction_numerical': 0.0, 'mean_word_length': 1.625250501002004, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1214166', 'n_tokens_mistral': 669, 'n_tokens_neox': 663, 'n_words': 181}