Sha256: 64f199e2574f00be3b1ecb838be91933fe2b92d9f35a8a5104b6b841e424d58f

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

require 'grit'
require 'bundler'

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

4 entries across 4 versions & 1 rubygems

Version Path
shelly-0.1.13 lib/shelly/structure_validator.rb
shelly-0.1.12 lib/shelly/structure_validator.rb
shelly-0.1.11 lib/shelly/structure_validator.rb
shelly-0.1.10 lib/shelly/structure_validator.rb