module CrawlStation::Concerns::CrawlStationClass

Public Instance Methods

boot() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 96
def boot
  init_application
  load_modules
  config_adapter
  config_parsers
end
cache() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 52
def cache
  Cache.adapter
end
cache=(item) click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 56
def cache=(item)
  Cache.adapter = item
end
concurrent_count() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 36
def concurrent_count
  @_concurrent_count ||= ENV['CRAWL_STATION_CONCURRENT_COUNT'] || 1
end
concurrent_count=(count) click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 40
def concurrent_count=(count)
  @_concurrent_count = count
end
config() { |config| ... } click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 8
def config
  yield @config if block_given?
end
config_adapter() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 85
def config_adapter
  adapter = @config.adapter || 'memory'
  CS.schedule = adapter
  CS.cache = adapter
end
config_parsers() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 91
def config_parsers
  parsers = @config.parsers || []
  parsers.each { |p| schedule.push p }
end
env() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 12
def env
  @_env ||= ActiveSupport::StringInquirer.new(ENV['CRAWL_STATION_ENV'] || 'development')
end
env=(environment) click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 16
def env=(environment)
  @_env = ActiveSupport::StringInquirer.new(environment)
end
init_application() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 80
def init_application
  @config ||= CrawlStation::Configuration
  Dir["#{CS.root}/config/initializers/**/*.rb"].each { |f| require f }
end
load_modules() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 74
def load_modules
  %w(item parser config).each do |path|
    Dir["#{CS.root}/module/*/#{path}/**/*.rb"].each { |f| require f }
  end
end
load_tasks() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 66
def load_tasks
  task_path = File.expand_path('../../', __FILE__)
  [
    "#{task_path}/tasks/*.rake",
    "#{CrawlStation.root}/lib/tasks/**/*.rake"
  ].each { |path| Dir[path].each { |f| load f } }
end
logger() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 24
def logger
  @_logger ||= begin
                 CrawlStation::Logger.logger ||= ::Logger.new(STDERR) do |log|
                   log.level = ::Logger.DEBUG
                 end
               end
end
logger=(logger) click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 32
def logger=(logger)
  @_logger = CrawlStation::Logger.logger = logger
end
proxies() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 60
def proxies
end
root() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 20
def root
  Pathname.new(File.expand_path('.'))
end
schedule() click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 44
def schedule
  Schedule.adapter
end
schedule=(item) click to toggle source
# File lib/crawl_station/concerns/crawl_station_class.rb, line 48
def schedule=(item)
  Schedule.adapter = item
end