Module: Cangrejo

Defined in:
lib/cangrejo.rb,
lib/cangrejo/errors.rb,
lib/cangrejo/session.rb,
lib/cangrejo/version.rb,
lib/cangrejo/modes/git.rb,
lib/cangrejo/modes/local.rb,
lib/cangrejo/configurator.rb,
lib/cangrejo/modes/remote.rb

Defined Under Namespace

Modules: Modes Classes: ConfigurationError, Configurator, CrawlerError, Error, LaunchTimeout, Session

Constant Summary collapse

VERSION =
"0.2.5"
@@config =
OpenStruct.new({
  crabfarm_host: 'https://grid.crabfarm.io',
  crawler_cache_path: 'tmp/crawler_cache',
  temp_path: 'tmp',
  crawlers: Hash.new
})

Class Method Summary collapse

Class Method Details

.configObject



15
16
17
# File 'lib/cangrejo.rb', line 15

def self.config
  @@config
end

.configure {|Configurator.new @@config| ... } ⇒ Object

Yields:



19
20
21
# File 'lib/cangrejo.rb', line 19

def self.configure
  yield Configurator.new @@config
end

.connect(_name_or_config = nil, &_block) ⇒ Object



23
24
25
26
# File 'lib/cangrejo.rb', line 23

def self.connect _name_or_config=nil, &_block
  _name_or_config = config[:crawlers].values.first if _name_or_config.nil?
  Session.connect _name_or_config, &_block
end