forked from whiteleaf7/narou
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnarou.rb
More file actions
47 lines (37 loc) · 1.27 KB
/
narou.rb
File metadata and controls
47 lines (37 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /usr/bin/env ruby
# frozen_string_literal: true
#
# Narou.rb ― 小説家になろうダウンロード&整形スクリプト
#
# Copyright 2013 whiteleaf. All rights reserved.
#
require_relative "lib/extension"
require_relative "lib/extensions/monkey_patches"
require_relative "lib/backtracer"
script_dir = File.expand_path(File.dirname(__FILE__))
$debug = File.exist?(File.join(script_dir, "debug"))
Encoding.default_external = Encoding::UTF_8
Narou::Backtracer.argv = ARGV
if ARGV.delete("--time")
now = Time.now
at_exit do
puts "実行時間 #{Time.now - now}秒"
end
end
require_relative "lib/inventory"
$development = Narou.commit_version.!
# NOTE:
# 開発用の pry / awesome_print は console コマンド内でのみ遅延ロードします。
# ここ(narou.rb)で require しないことで通常起動を軽くします。
global = Inventory.load("global_setting", :global)
$display_backtrace = ARGV.delete("--backtrace")
$display_backtrace ||= $debug
$disable_color = ARGV.delete("--no-color")
$disable_color ||= global["no-color"]
$color_parser ||= global["color-parser"] || "system"
require_relative "lib/narou_logger"
require_relative "lib/version"
require_relative "lib/commandline"
exit Narou::Backtracer.capture {
CommandLine.run!(ARGV.map(&:dup))
}