Skip to content

Commit

Permalink
Fix console command bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vifreefly committed Jan 30, 2019
1 parent 96fe695 commit a4ec725
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/kimurai/base.rb
Expand Up @@ -173,7 +173,7 @@ def self.parse!(handler, *args, **request)
attr_accessor :with_info

def initialize(engine = self.class.engine, config: {})
@engine = engine
@engine = engine || self.class.engine
@config = self.class.config.deep_merge_excl(config, DMERGE_EXCLUDE)
@pipelines = self.class.pipelines.map do |pipeline_name|
klass = Pipeline.descendants.find { |kl| kl.name == pipeline_name }
Expand Down
6 changes: 5 additions & 1 deletion lib/kimurai/cli.rb
Expand Up @@ -116,7 +116,11 @@ def console(spider_name = nil)
end

engine = options["engine"]&.delete(":")&.to_sym
klass.parse!(:console, engine, url: options["url"])
if url = options["url"]
klass.new(engine).request_to(:console, url: options["url"])
else
klass.new(engine).public_send(:console)
end
end

desc "list", "List all available spiders in the current project"
Expand Down

0 comments on commit a4ec725

Please sign in to comment.