Module: Crabfarm
- Defined in:
- lib/crabfarm.rb,
lib/crabfarm/cli.rb,
lib/crabfarm/base.rb,
lib/crabfarm/rspec.rb,
lib/crabfarm/errors.rb,
lib/crabfarm/context.rb,
lib/crabfarm/version.rb,
lib/crabfarm/dsl/surfer.rb,
lib/crabfarm/modes/live.rb,
lib/crabfarm/strategies.rb,
lib/crabfarm/base_struct.rb,
lib/crabfarm/driver_pool.rb,
lib/crabfarm/http_client.rb,
lib/crabfarm/state_store.rb,
lib/crabfarm/support/gli.rb,
lib/crabfarm/base_reducer.rb,
lib/crabfarm/global_state.rb,
lib/crabfarm/live/helpers.rb,
lib/crabfarm/live/manager.rb,
lib/crabfarm/live/watcher.rb,
lib/crabfarm/modes/server.rb,
lib/crabfarm/utils/naming.rb,
lib/crabfarm/configuration.rb,
lib/crabfarm/modes/console.rb,
lib/crabfarm/base_navigator.rb,
lib/crabfarm/phantom_runner.rb,
lib/crabfarm/context_factory.rb,
lib/crabfarm/crabtrap_runner.rb,
lib/crabfarm/live/controller.rb,
lib/crabfarm/modes/generator.rb,
lib/crabfarm/modes/publisher.rb,
lib/crabfarm/utils/processes.rb,
lib/crabfarm/assertion/fields.rb,
lib/crabfarm/crabtrap_context.rb,
lib/crabfarm/forked_navigator.rb,
lib/crabfarm/assertion/context.rb,
lib/crabfarm/assertion/parsers.rb,
lib/crabfarm/assertion/wrapper.rb,
lib/crabfarm/live/interactable.rb,
lib/crabfarm/transition_service.rb,
lib/crabfarm/live/reducer_runner.rb,
lib/crabfarm/support/custom_puma.rb,
lib/crabfarm/utils/port_discovery.rb,
lib/crabfarm/adapters/browser/noop.rb,
lib/crabfarm/assertion/validations.rb,
lib/crabfarm/live/navigator_runner.rb,
lib/crabfarm/modes/recorder/memento.rb,
lib/crabfarm/adapters/browser/chrome.rb,
lib/crabfarm/dsl/surfer/surf_context.rb,
lib/crabfarm/modes/recorder/snapshot.rb,
lib/crabfarm/adapters/browser/firefox.rb,
lib/crabfarm/adapters/parser/nokogiri.rb,
lib/crabfarm/dsl/surfer/search_context.rb,
lib/crabfarm/support/webdriver_factory.rb,
lib/crabfarm/adapters/parser/pdf_reader.rb,
lib/crabfarm/engines/sync_state_manager.rb,
lib/crabfarm/adapters/browser/phantom_js.rb,
lib/crabfarm/engines/async_state_manager.rb,
lib/crabfarm/adapters/driver_wrapper/surfer.rb,
lib/crabfarm/modes/shared/snapshot_decorator.rb,
lib/crabfarm/adapters/driver_wrapper/capybara.rb,
lib/crabfarm/adapters/browser/remote_webdriver.rb,
lib/crabfarm/modes/shared/interactive_decorator.rb,
lib/crabfarm/adapters/browser/abstract_webdriver.rb,
lib/crabfarm/adapters/driver_wrapper/watir.rb
Defined Under Namespace
Modules: Adapters, Assertion, Base, ContextFactory, Dsl, Engines, GlobalState, Live, Modes, RSpec, Strategies, Support, Utils
Classes: ApiError, ArgumentError, AssertionError, BaseNavigator, BaseReducer, BaseStruct, BinaryMissingError, CLI, Configuration, ConfigurationError, Context, CrabtrapContext, CrabtrapRunner, CrawlerBaseError, CrawlerError, DriverPool, Error, ForkedNavigator, HttpClient, PhantomRunner, ResourceNotFoundError, StateStore, StillWorkingError, TimeoutError, TransitionService
Constant Summary
collapse
- VERSION =
"0.4.0"
- @@config =
Configuration.new
- @@logger =
nil
- @@live =
nil
- @@debug =
false
Class Method Summary
collapse
Class Method Details
.config ⇒ Object
36
37
38
|
# File 'lib/crabfarm.rb', line 36
def self.config
@@config
end
|
.debug? ⇒ Boolean
70
71
72
|
# File 'lib/crabfarm.rb', line 70
def self.debug?
@@debug
end
|
.enable_debugging! ⇒ Object
65
66
67
68
|
# File 'lib/crabfarm.rb', line 65
def self.enable_debugging!
require 'pry-byebug'
@@debug = true
end
|
.install_live_backend! ⇒ Object
52
53
54
55
|
# File 'lib/crabfarm.rb', line 52
def self.install_live_backend!
require "crabfarm/live/manager"
@@live = Live::Manager.new
end
|
.live ⇒ Object
57
58
59
|
# File 'lib/crabfarm.rb', line 57
def self.live
@@live
end
|
.live? ⇒ Boolean
61
62
63
|
# File 'lib/crabfarm.rb', line 61
def self.live?
not @@live.nil?
end
|
.logger ⇒ Object
40
41
42
43
44
45
46
|
# File 'lib/crabfarm.rb', line 40
def self.logger
if @@logger.nil?
@@logger = Logger.new(@@config.log_path.nil? ? STDOUT : File.join(@@config.log_path, 'crawler.log'))
@@logger.level = Logger::INFO
end
@@logger
end
|
.read_crabfile(_path) ⇒ Object
48
49
50
|
# File 'lib/crabfarm.rb', line 48
def self.read_crabfile(_path)
@@config.instance_eval File.read _path
end
|
.root ⇒ Object
32
33
34
|
# File 'lib/crabfarm.rb', line 32
def self.root
File.dirname __dir__
end
|