Sha256: a7d2daf9e9193dc7630d5bd9e4affef4b07091c6142a8f0247c97030c8da6438

Contents?: true

Size: 808 Bytes

Versions: 2

Compression:

Stored size: 808 Bytes

Contents

require "rails_finder/gemfile"
require "rails_finder/environment_file"
require "rails_finder/isolate_file"

module RailsFinder
  class App
    attr_reader :root

    def initialize(root)
      @root = root
    end

    def basename
      File.basename(root)
    end

    def rails_version
      if gemfile.exists?
        gemfile.rails_version
      elsif isofile.exists?
        isofile.rails_version
      elsif envfile.exists?
        envfile.rails_version
      else
        "n/a"
      end
    end

    private

    def gemfile
      @gemfile ||= Gemfile.new(File.join(root, "Gemfile"))
    end

    def envfile
      @envfile ||= EnvironmentFile.new(File.join(root, "config", "environment.rb"))
    end

    def isofile
      @isofile ||= IsolateFile.new(File.join(root, "Isolate"))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_finder-0.0.3 lib/rails_finder/app.rb
rails_finder-0.0.2 lib/rails_finder/app.rb