Sha256: 4a93eda9e37c446dc45b8d92e00366d9c862b84914772d8693597ce77d75faa5

Contents?: true

Size: 640 Bytes

Versions: 3

Compression:

Stored size: 640 Bytes

Contents

require 'grit'

module Shelly
  class StructureValidator
    attr_reader :gemfile_path, :gemfile_lock_path

    def initialize(options = {})
      @gemfile_path = options[:gemfile] || "Gemfile"
      @gemfile_lock_path = options[:gemfile_lock] || "Gemfile.lock"
    end

    def gemfile_exists?
      File.exists?(@gemfile_path)
    end

    def config_ru_exists?
      repo = Grit::Repo.new(".")
      repo.status.map(&:path).include?("config.ru")
    end

    def gems
      return [] unless gemfile_exists?
      @d = Bundler::Definition.build(@gemfile_path, @gemfile_lock_path, nil)
      @gems = @d.specs.map(&:name)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shelly-0.1.9 lib/shelly/structure_validator.rb
shelly-0.1.8 lib/shelly/structure_validator.rb
shelly-0.1.7 lib/shelly/structure_validator.rb