Module: GemBench

Defined in:
lib/gem_bench/scout.rb,
lib/gem_bench.rb,
lib/gem_bench/team.rb,
lib/gem_bench/jersey.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, Jersey, 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 Method Summary collapse

Class Method Details

.check(verbose: false, gemfile_path: nil) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/gem_bench.rb', line 29

def check(verbose: false, gemfile_path: nil)
  options = {
    verbose: verbose,
  }
  options[:gemfile_path] = gemfile_path if gemfile_path
  GemBench::Team.new(**options)
end

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



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/gem_bench.rb', line 53

def find(look_for_regex: GemBench::RAILTIE_REGEX,
  exclude_file_pattern_regex_proc: GemBench::EXCLUDE_FILE_PATTERN_REGEX_PROC,
  verbose: false,
  gemfile_path: nil)
  options = {
    verbose: verbose,
    look_for_regex: look_for_regex,
    exclude_file_pattern_regex_proc: exclude_file_pattern_regex_proc,
  }
  options[:gemfile_path] = gemfile_path if gemfile_path
  GemBench::Team.new(**options)
end

.list_missing_version_constraints(verbose: false, gemfile_path: nil) ⇒ Object



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

def list_missing_version_constraints(verbose: false, gemfile_path: nil)
  options = {
    verbose: verbose,
  }
  options[:gemfile_path] = gemfile_path if gemfile_path
  GemBench::StrictVersionRequirement.new(**options).list_missing_version_constraints
end

.versions_present?(verbose: false, gemfile_path: nil) ⇒ Boolean

Returns:

  • (Boolean)


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

def versions_present?(verbose: false, gemfile_path: nil)
  options = {
    verbose: verbose,
  }
  options[:gemfile_path] = gemfile_path if gemfile_path
  GemBench::StrictVersionRequirement.new(**options).versions_present?
end