13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/git_fit/cli/geo_cli.rb', line 13
def detect
config = GitFit::Config.new
conn = GitFit::DB::Connection.new(config.db_path)
conn.migrate!
db = conn.db
amap_key = ENV['AMAP_API_KEY'] || config.sync_config('amap')['api_key']
detector = GitFit::Geo::DivisionDetector.new(
db: db,
amap_key: amap_key,
batch: options[:batch],
limit: options[:limit],
strategy: options[:strategy],
time_budget: options[:time],
dry_run: options[:"dry-run"],
)
detector.run
rescue StandardError => e
say_status :error, "Geo detection failed: #{e.message}", :red
end
|