<commit_before>require 'fog/credentials'

module Fog
  class << self

    def providers
      [
        ::AWS,
        ::Bluebox,
        ::GoGrid,
        ::Linode,
        ::Local,
        ::NewServers,
        ::Rackspace,
        ::Slicehost,
        ::Terremark
      ].select {|provider| provider.available?}
    end

    def modules
      [
        ::Vcloud
      ].select {|_module_| _module_.initialized?}
    end

  end

  class Bin
    class << self

      def available?
        availability = true
        for service in services
          begin
            service = eval(self[service].class.to_s.split('::')[0...-1].join('::'))
            availability &&= service.requirements.all? {|requirement| Fog.credentials.include?(requirement)}
          rescue
            availability = false
          end
        end

        if availability
          for service in services
            for collection in self[service].collections
              self.class_eval <<-EOS, __FILE__, __LINE__
                def #{collection}
                  self[:#{service}].#{collection}
                end
              EOS
            end
          end
        end

        availability
      end

      def collections
        services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s}
      end

    end
  end

end<commit_msg>fix adding collection helpers to bins<commit_after>require 'fog/credentials'

module Fog
  class << self

    def providers
      [
        ::AWS,
        ::Bluebox,
        ::GoGrid,
        ::Linode,
        ::Local,
        ::NewServers,
        ::Rackspace,
        ::Slicehost,
        ::Terremark
      ].select {|provider| provider.available?}
    end

    def modules
      [
        ::Vcloud
      ].select {|_module_| _module_.initialized?}
    end

  end

  class Bin
    class << self

      def available?
        availability = true
        for service in services
          begin
            service = eval(self[service].class.to_s.split('::')[0...-1].join('::'))
            availability &&= service.requirements.all? {|requirement| Fog.credentials.include?(requirement)}
          rescue
            availability = false
          end
        end

        if availability
          for service in services
            for collection in self[service].collections
              unless self.respond_to?(collection)
                self.class_eval <<-EOS, __FILE__, __LINE__
                  def self.#{collection}
                    self[:#{service}].#{collection}
                  end
                EOS
              end
            end
          end
        end

        availability
      end

      def collections
        services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s}
      end

    end
  end

end
{'fraction_non_alphanumeric': 0.09939865581888928, 'fraction_numerical': 0.0014149274849663955, 'mean_word_length': 1.5227475468331846, 'pattern_counts': {'":': 0, '<': 15, '<?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': '6460247', 'n_tokens_mistral': 778, 'n_tokens_neox': 758, 'n_words': 183}