<commit_before>require 'bundler/deployment'
require 'capistrano/recipes/deploy/strategy/copy'

module Capistrano
  module Deploy
    module Strategy

      class CopyBundled < Copy

        def deploy!
          logger.info "running :copy_bundled strategy"

          copy_cache ? run_copy_cache_strategy : run_copy_strategy

          create_revision_file

          configuration.trigger('strategy:before:bundle')
          #Bundle all gems
          Dir.chdir(copy_cache) { bundle! }
          configuration.trigger('strategy:after:bundle')


          logger.info "compressing repository"
          configuration.trigger('strategy:before:compression')
          compress_repository
          configuration.trigger('strategy:after:compression')


          logger.info "distributing packaged repository"

          configuration.trigger('strategy:before:distrubute')
          distribute!
          configuration.trigger('strategy:after:distrubute')
        ensure
          rollback_changes
        end


        private

        def bundle!
          logger.info "packaging gems for bundler in #{destination}..."
          Bundler.with_clean_env { run "#{configuration.fetch(:bundle_cmd, 'bundle')} package --all" }
        end
      end

    end
  end
end<commit_msg>Update bundle to use clean_env and manually go to copy_cache required directory<commit_after>require 'bundler/deployment'
require 'capistrano/recipes/deploy/strategy/copy'

module Capistrano
  module Deploy
    module Strategy

      class CopyBundled < Copy

        def deploy!
          logger.info "running :copy_bundled strategy"

          copy_cache ? run_copy_cache_strategy : run_copy_strategy

          create_revision_file

          configuration.trigger('strategy:before:bundle')
          #Bundle all gems
          bundle!
          configuration.trigger('strategy:after:bundle')


          logger.info "compressing repository"
          configuration.trigger('strategy:before:compression')
          compress_repository
          configuration.trigger('strategy:after:compression')


          logger.info "distributing packaged repository"

          configuration.trigger('strategy:before:distrubute')
          distribute!
          configuration.trigger('strategy:after:distrubute')
        ensure
          rollback_changes
        end


        private

        def bundle!
          logger.info "packaging gems for bundler in #{destination}..."
          Bundler.with_clean_env do
            run "cd #{copy_cache} && #{configuration.fetch(:bundle_cmd, 'bundle')} package --all"
          end
        end
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.07753705815279362, 'fraction_numerical': 0.0, 'mean_word_length': 2.4677206851119893, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2555874', 'n_tokens_mistral': 704, 'n_tokens_neox': 665, 'n_words': 147}