<commit_before>require File.expand_path(File.join(File.dirname(__FILE__), '..', 'storage'))
require 'fog/storage'

module Fog
  module Storage
    class Local < Fog::Service

      requires :local_root

      model_path 'fog/local/models/storage'
      collection  :directories
      model       :directory
      model       :file
      collection  :files

      class Mock

        def self.data
          @data ||= Hash.new do |hash, key|
            hash[key] = {}
          end
        end

        def self.reset
          @data = nil
        end

        def initialize(options={})
          Fog::Mock.not_implemented

          require 'mime/types'
          @local_root = ::File.expand_path(options[:local_root])
        end

        def data
          self.class.data[@local_root]
        end

        def local_root
          @local_root
        end

        def path_to(partial)
          ::File.join(@local_root, partial)
        end

        def reset_data
          self.class.data.delete(@local_root)
        end

      end

      class Real

        def initialize(options={})
          require 'mime/types'
          @local_root = ::File.expand_path(options[:local_root])
        end

        def local_root
          @local_root
        end

        def path_to(partial)
          ::File.join(@local_root, partial)
        end
      end

    end
  end
end<commit_msg>[local|storage] Add copy_object method to Local::Storage.<commit_after>require File.expand_path(File.join(File.dirname(__FILE__), '..', 'storage'))
require 'fog/storage'

module Fog
  module Storage
    class Local < Fog::Service

      requires :local_root

      model_path 'fog/local/models/storage'
      collection  :directories
      model       :directory
      model       :file
      collection  :files

      class Mock

        def self.data
          @data ||= Hash.new do |hash, key|
            hash[key] = {}
          end
        end

        def self.reset
          @data = nil
        end

        def initialize(options={})
          Fog::Mock.not_implemented

          require 'mime/types'
          @local_root = ::File.expand_path(options[:local_root])
        end

        def data
          self.class.data[@local_root]
        end

        def local_root
          @local_root
        end

        def path_to(partial)
          ::File.join(@local_root, partial)
        end

        def reset_data
          self.class.data.delete(@local_root)
        end

      end

      class Real

        def initialize(options={})
          require 'mime/types'
          @local_root = ::File.expand_path(options[:local_root])
        end

        def local_root
          @local_root
        end

        def path_to(partial)
          ::File.join(@local_root, partial)
        end

        def copy_object(source_directory_name, source_object_name, target_directory_name, target_object_name, options={})
          require 'fileutils'
          source_path = path_to(::File.join(source_directory_name, source_object_name))
          target_path = path_to(::File.join(target_directory_name, target_object_name))
          ::FileUtils.mkdir_p(::File.dirname(source_path))
          ::FileUtils.copy_file(source_path, target_path)
        end
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.09077017114914425, 'fraction_numerical': 0.0, 'mean_word_length': 1.7950469684030743, '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': '6780894', 'n_tokens_mistral': 965, 'n_tokens_neox': 923, 'n_words': 200}