Module: TLDR::Run
- Defined in:
- lib/tldr.rb
Constant Summary collapse
- @@at_exit_registered =
false
Class Method Summary collapse
Class Method Details
.at_exit!(config = Config.new) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/tldr.rb', line 48 def self.at_exit! config = Config.new # Ignore at_exit when running tldr CLI, since that will run any tests return if $PROGRAM_NAME.end_with?("tldr") # Also ignore if we're running from within our rake task return if caller.any? { |line| line.include?("lib/tldr/rake.rb") } # Ignore at_exit when we've already registered an at_exit hook return if @@at_exit_registered Kernel.at_exit do Run.tests(config) end @@at_exit_registered = true end |
.cli(argv) ⇒ Object
32 33 34 35 |
# File 'lib/tldr.rb', line 32 def self.cli argv config = ArgvParser.new.parse(argv) tests(config) end |
.tests(config = Config.new) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/tldr.rb', line 37 def self.tests config = Config.new if config.watch Watcher.new.watch(config) else PathUtil.chdir_maybe(config.base_path) do Runner.new.run(config, Planner.new.plan(config)) end end end |