class Agave::Dump::SsgDetector

Constants

RUBY

Attributes

path[R]

Public Class Methods

new(path) click to toggle source
# File lib/agave/dump/ssg_detector.rb, line 13
def initialize(path)
  @path = path
end

Public Instance Methods

detect() click to toggle source
# File lib/agave/dump/ssg_detector.rb, line 17
def detect
  ruby_generator ||
    'unknown'
end

Private Instance Methods

ruby_generator() click to toggle source
# File lib/agave/dump/ssg_detector.rb, line 24
def ruby_generator
  gemfile_path = File.join(path, 'Gemfile')
  return unless File.exist?(gemfile_path)

  gemfile = File.read(gemfile_path)

  RUBY.find do |generator|
    gemfile =~ /('#{generator}'|"#{generator}")/
  end
end