Sha256: 829c4c7021d40b780df73e084b3b65754afc7a1f59324897565dec3a6be9b917

Contents?: true

Size: 1.17 KB

Versions: 11

Compression:

Stored size: 1.17 KB

Contents

module TmpRails
  class << self    
    attr_accessor :root
    
    def root_dir path, options = {}
      @root = options == :custom ? custom_root_dir(path) : default_root_dir(path)      
    end

    protected

    def default_root_dir path
      File.expand_path(File.join(File.dirname(path), '..', 'tmp'))      
    end

    def custom_root_dir path
      File.expand_path(path)
    end
  end
end  
  
module Rails
  def self.root
    @root ||= File.join(Rails.application.config.root_dir, 'rails_app')
  end
end

class TestApp < Rails::Application
end

Rails.application = TestApp 
                
module Rails
  def self.logger
    logger_type = RSpec::Generator.logger
    case logger_type
    when Hash
      file = logger_type[:file]      
    when :stdout
      return Logger.new(STDOUT)     
    when :file               
      file = File.expand_path "#{Rails.application.config.root_dir}/../rails_generator.log"
    else
      return Logger.new(STDOUT)
    end                 
    if file != @logger_file
      @logger_file = file
      RSpec::Generator.logfile = file 
      @logger = Logger.new(file) if file
    else
      @logger ||= Logger.new(file) if file
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
generator-spec-0.7.8 lib/generator-spec/rails/configure.rb
generator-spec-0.7.6 lib/generator-spec/rails/configure.rb
generator-spec-0.7.5 lib/generator-spec/rails/configure.rb
generator-spec-0.7.4 lib/generator-spec/rails/configure.rb
generator-spec-0.7.2 lib/generator-spec/rails/configure.rb
generator-spec-0.7.1 lib/generator-spec/rails/configure.rb
generator-spec-0.7.0 lib/generator-spec/rails/configure.rb
generator-spec-0.6.6 lib/generator-spec/rails/configure.rb
generator-spec-0.6.5 lib/generator-spec/rails/configure.rb
generator-spec-0.6.4 lib/generator-spec/rails/configure.rb
generator-spec-0.6.3 lib/generator-spec/rails/configure.rb