<commit_before>require "fileutils"

module RSpec
  module Mate
    # This is based on Ruy Asan's initial code:
    # http://ruy.ca/posts/6-A-simple-switch-between-source-and-spec-file-command-for-textmate-with-auto-creation-
    class SwitchCommand
      def go_to_twin(project_directory, filepath)
        other = twin(filepath)

        if File.file?(other)
          %x{ "$TM_SUPPORT_PATH/bin/mate" "#{other}" }
        else
          relative  = other[project_directory.length+1..-1]
          file_type = file_type(other)

          if create?(relative, file_type)
            write_and_open(other)
          end
        end
      end

      module Framework
        def merb?
          File.exist?(File.join(self, 'config', 'init.rb'))
        end

        def merb_or_rails?
          merb? || rails?<commit_msg>Fix error in “Alternate File” command.<commit_after>require "fileutils"
require File.dirname(__FILE__) + "/helpers.rb"

module RSpec
  module Mate
    # This is based on Ruy Asan's initial code:
    # http://ruy.ca/posts/6-A-simple-switch-between-source-and-spec-file-command-for-textmate-with-auto-creation-
    class SwitchCommand
      include Helpers
      
      def go_to_twin(project_directory, filepath)
        other = twin(filepath)

        if File.file?(other)
          %x{ "$TM_SUPPORT_PATH/bin/mate" "#{other}" }
        else
          relative  = other[project_directory.length+1..-1]
          file_type = file_type(other)

          if create?(relative, file_type)
            write_and_open(other)
          end
        end
      end

      module Framework
        def merb?
          File.exist?(File.join(self, 'config', 'init.rb'))
        end

        def merb_or_rails?
          merb? || rails?
{'fraction_non_alphanumeric': 0.10983323749281196, 'fraction_numerical': 0.0034502587694077054, 'mean_word_length': 2.135135135135135, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2352510', 'n_tokens_mistral': 561, 'n_tokens_neox': 546, 'n_words': 111}