flumtter 5.9.0 → 5.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/flumtter/app/core/core.rb +34 -6
- data/lib/flumtter/app/core/util.rb +8 -1
- data/lib/flumtter/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 156f65c65db5ef313d2d8faf580365d26c407d79
|
|
4
|
+
data.tar.gz: 85bd0502b9aedf977fac5c3b83ac2b6c52547efa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a2e8eea4c8236284e7738f3487dc8ce765bd1b658ee415f0514f4e517646340386038dd92537481499270d37a2035fcbb939fa5d64545fab1da2ae9d6a1df25f
|
|
7
|
+
data.tar.gz: 724c7d1536ed2f6aa86d27432902d485147d4989f8ac8f1927a646ba083f2be653d1272fdda50dc96fa37c7aaf2da174588c3f177910a365f13dccf1cd9cb632
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
require 'pry'
|
|
2
2
|
require 'json'
|
|
3
|
+
require 'logger'
|
|
3
4
|
|
|
4
5
|
module Flumtter
|
|
6
|
+
StartTime = Time.now
|
|
5
7
|
SourcePath = File.expand_path('../../', __FILE__)
|
|
6
8
|
UserPath = File.expand_path('~/.flumtter')
|
|
7
9
|
[SourcePath, UserPath].each do |path|
|
|
@@ -13,6 +15,12 @@ module Flumtter
|
|
|
13
15
|
FileUtils.cp_r(SourcePath.join(".flumtter"), UserPath)
|
|
14
16
|
end
|
|
15
17
|
|
|
18
|
+
Logger = Logger.new(UserPath.join('flumtter.log'))
|
|
19
|
+
Logger.level = ARGV.include?('--debug') ? ::Logger::DEBUG : ::Logger::INFO
|
|
20
|
+
Logger.datetime_format = "%Y-%m-%d %H:%M:%S.%L "
|
|
21
|
+
|
|
22
|
+
Logger.debug("Start: #{ARGV.join(" ")}")
|
|
23
|
+
|
|
16
24
|
data_path = UserPath.join("data", "data.bin")
|
|
17
25
|
Config = Marshal.load(File.read(data_path)) rescue {}
|
|
18
26
|
at_exit {
|
|
@@ -22,14 +30,24 @@ module Flumtter
|
|
|
22
30
|
Thread.abort_on_exception = true
|
|
23
31
|
|
|
24
32
|
module_function
|
|
25
|
-
def
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
def logger
|
|
34
|
+
Logger
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def load_plugin(source, path, file=nil)
|
|
38
|
+
path = file.nil? ? source.join(path, '*.rb') : source.join(path, file)
|
|
39
|
+
Dir.glob(path).each do |plugin|
|
|
40
|
+
logger.debug("Load: #{plugin}")
|
|
41
|
+
require plugin
|
|
42
|
+
end
|
|
28
43
|
end
|
|
29
44
|
|
|
30
|
-
def
|
|
31
|
-
|
|
32
|
-
|
|
45
|
+
def sarastire(*args)
|
|
46
|
+
load_plugin(SourcePath, *args)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def sarastire_user(*args)
|
|
50
|
+
load_plugin(UserPath, *args)
|
|
33
51
|
end
|
|
34
52
|
|
|
35
53
|
@events = Hash.new{|h,k|h[k] = []}
|
|
@@ -49,12 +67,22 @@ module Flumtter
|
|
|
49
67
|
sarastire 'plugins'
|
|
50
68
|
sarastire_user 'plugins'
|
|
51
69
|
|
|
70
|
+
logger.debug("Plugin load complete.")
|
|
71
|
+
|
|
52
72
|
TITLE.terminal_title
|
|
53
73
|
|
|
74
|
+
logger.debug("Initialization time(#{Time.now-StartTime}s)")
|
|
75
|
+
|
|
54
76
|
def start
|
|
55
77
|
options = Initializer.optparse
|
|
56
78
|
Setting.merge!(options)
|
|
57
79
|
Client.new AccountSelector.select(options)
|
|
58
80
|
rescue Interrupt
|
|
81
|
+
rescue Exception => ex
|
|
82
|
+
logger.fatal(<<~EOS)
|
|
83
|
+
#{ex.backtrace.shift}: #{ex.message} (#{ex.class})
|
|
84
|
+
#{ex.backtrace.join("\n")}
|
|
85
|
+
EOS
|
|
86
|
+
raise ex
|
|
59
87
|
end
|
|
60
88
|
end
|
|
@@ -5,10 +5,13 @@ module Flumtter
|
|
|
5
5
|
|
|
6
6
|
module Util
|
|
7
7
|
def error(e)
|
|
8
|
-
|
|
8
|
+
text = <<~EOF
|
|
9
9
|
#{e.backtrace.shift}: #{e.message} (#{e.class})
|
|
10
10
|
#{e.backtrace.join("\n")}
|
|
11
11
|
EOF
|
|
12
|
+
e.class.ancestors.include?(StandardError) ? logger.error(text) : logger.fatal(text)
|
|
13
|
+
print text.color(Setting[:color][:error])
|
|
14
|
+
|
|
12
15
|
end
|
|
13
16
|
|
|
14
17
|
def parse_time(time)
|
|
@@ -102,6 +105,10 @@ module Flumtter
|
|
|
102
105
|
end
|
|
103
106
|
end
|
|
104
107
|
|
|
108
|
+
def logger
|
|
109
|
+
Flumtter.logger
|
|
110
|
+
end
|
|
111
|
+
|
|
105
112
|
def sarastire(*args)
|
|
106
113
|
Flumtter.sarastire(*args)
|
|
107
114
|
end
|
data/lib/flumtter/version.rb
CHANGED