Sha256: 943c094a6bd2336dc0ef255c159db4775b5b39c387ef9c0efab149e54c31c1fe

Contents?: true

Size: 474 Bytes

Versions: 3

Compression:

Stored size: 474 Bytes

Contents

module RailsFinder
  class EnvironmentFile
    attr_reader :path

    def initialize(path)
      @path = path
    end

    def exists?
      File.exists?(path)
    end

    def rails_version
      return @rails_version if @rails_version

      version_line = File.readlines(path).find { |l| l =~ /RAILS_GEM_VERSION/ }
      if version_line
        @rails_version = version_line[/\d+\.\d+(\.\d+)?/].strip
      else
        @rails_version = "n/a"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_finder-0.0.3 lib/rails_finder/environment_file.rb
rails_finder-0.0.2 lib/rails_finder/environment_file.rb
rails_finder-0.0.1 lib/rails_finder/environment_file.rb