Module: GemBench

Defined in:
lib/gem_bench/scout.rb,
lib/gem_bench.rb,
lib/gem_bench/team.rb,
lib/gem_bench/player.rb,
lib/gem_bench/version.rb,
lib/gem_bench/strict_version_gem.rb,
lib/gem_bench/gemfile_line_tokenizer.rb,
lib/gem_bench/strict_version_requirement.rb

Overview

Scout’s job is to figure out where gems are hiding

Defined Under Namespace

Modules: Version Classes: GemfileLineTokenizer, Player, Scout, StrictVersionGem, StrictVersionRequirement, Team

Constant Summary collapse

USAGE =
"[GemBench] Usage: Require another gem in this session to evaluate it.\n\tExample:\n\t\trequire 'rails'\n\t\tGemBench.check({verbose: true})\n"
RAILTIE_REGEX =
/Rails::Engine|Rails::Railtie/
TRASH_REGEX =
/^(\s*)(\#+.*)?$/
REQUIRE_FALSE_REGEX =
/^[^#]+require((:\s*)|(\s*=>\s*))false.*/
DEPENDENCY_REGEX_PROC =
->(name) { /^\s*[^#]*\s*gem\s+['"]{1}#{name}['"]{1}/ }
PATH_GLOB =
->(name) { "#{name}*/lib/**/*.rb" }
EXCLUDE_FILE_PATTERN_REGEX_PROC =
->(name) { %r{#{name}/test|features|spec|bin|exe} }
DO_NOT_SCAN =
[]
PLAYER_STATES =
{
  starter: :starter,
  bench: :bench,
}

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.rosterObject

Returns the value of attribute roster.



28
29
30
# File 'lib/gem_bench.rb', line 28

def roster
  @roster
end

Class Method Details

.check(verbose: false) ⇒ Object



30
31
32
# File 'lib/gem_bench.rb', line 30

def check(verbose: false)
  @roster = GemBench::Team.new({verbose: verbose})
end

.find(look_for_regex: GemBench::RAILTIE_REGEX, exclude_file_pattern_regex_proc: GemBench::EXCLUDE_FILE_PATTERN_REGEX_PROC, verbose: false) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/gem_bench.rb', line 44

def find(look_for_regex: GemBench::RAILTIE_REGEX,
  exclude_file_pattern_regex_proc: GemBench::EXCLUDE_FILE_PATTERN_REGEX_PROC, verbose: false)
  @roster = GemBench::Team.new({
    look_for_regex: look_for_regex,
    exclude_file_pattern_regex_proc: exclude_file_pattern_regex_proc,
    verbose: verbose,
  })
end

.list_missing_version_constraints(verbose: false) ⇒ Object



39
40
41
42
# File 'lib/gem_bench.rb', line 39

def list_missing_version_constraints(verbose: false)
  @roster = GemBench::StrictVersionRequirement.new({verbose: verbose})
  @roster.list_missing_version_constraints
end

.versions_present?(verbose: false) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/gem_bench.rb', line 34

def versions_present?(verbose: false)
  @roster = GemBench::StrictVersionRequirement.new({verbose: verbose})
  @roster.versions_present?
end