atig 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.travis.yml +3 -2
- data/Gemfile +2 -0
- data/README.mkdn +2 -0
- data/Rakefile +0 -6
- data/atig.gemspec +21 -20
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/{bin → exe}/atig +0 -0
- data/lib/atig/agent/agent.rb +4 -4
- data/lib/atig/agent/dm.rb +4 -4
- data/lib/atig/agent/following.rb +3 -3
- data/lib/atig/agent/list.rb +2 -2
- data/lib/atig/agent/list_status.rb +6 -6
- data/lib/atig/agent/stream_follow.rb +2 -2
- data/lib/atig/agent/user_stream.rb +3 -3
- data/lib/atig/basic_twitter.rb +1 -3
- data/lib/atig/bitly.rb +1 -1
- data/lib/atig/channel/channel.rb +1 -1
- data/lib/atig/channel/list.rb +3 -3
- data/lib/atig/channel/retweet.rb +1 -1
- data/lib/atig/channel/timeline.rb +1 -1
- data/lib/atig/command/autofix.rb +4 -4
- data/lib/atig/command/destroy.rb +1 -1
- data/lib/atig/command/dm.rb +2 -2
- data/lib/atig/command/favorite.rb +1 -1
- data/lib/atig/command/info.rb +2 -2
- data/lib/atig/command/reply.rb +2 -2
- data/lib/atig/command/retweet.rb +2 -2
- data/lib/atig/command/search.rb +2 -2
- data/lib/atig/command/status.rb +3 -3
- data/lib/atig/command/user.rb +3 -3
- data/lib/atig/command/version.rb +3 -3
- data/lib/atig/db/followings.rb +5 -6
- data/lib/atig/db/statuses.rb +12 -10
- data/lib/atig/db/transaction.rb +1 -1
- data/lib/atig/gateway/channel.rb +1 -2
- data/lib/atig/gateway/session.rb +13 -13
- data/lib/atig/http.rb +4 -4
- data/lib/atig/ifilter/expand_url.rb +1 -1
- data/lib/atig/ifilter/retweet.rb +1 -1
- data/lib/atig/ifilter/retweet_time.rb +1 -1
- data/lib/atig/ifilter/sanitize.rb +1 -1
- data/lib/atig/ifilter/strip.rb +1 -1
- data/lib/atig/ifilter/xid.rb +1 -1
- data/lib/atig/oauth.rb +3 -3
- data/lib/atig/ofilter/escape_url.rb +1 -1
- data/lib/atig/ofilter/footer.rb +1 -1
- data/lib/atig/ofilter/geo.rb +1 -1
- data/lib/atig/ofilter/short_url.rb +1 -1
- data/lib/atig/option.rb +1 -1
- data/lib/atig/optparse.rb +22 -11
- data/lib/atig/search.rb +4 -2
- data/lib/atig/stream.rb +1 -1
- data/lib/atig/twitter.rb +5 -4
- data/lib/atig/update_checker.rb +2 -2
- data/lib/atig/url_escape.rb +1 -1
- data/lib/atig/version.rb +1 -1
- data/lib/memory_profiler.rb +1 -1
- data/spec/command/autofix_spec.rb +7 -8
- data/spec/command/destroy_spec.rb +12 -13
- data/spec/command/dm_spec.rb +5 -6
- data/spec/command/favorite_spec.rb +11 -12
- data/spec/command/limit_spec.rb +6 -7
- data/spec/command/location_spec.rb +4 -5
- data/spec/command/name_spec.rb +2 -3
- data/spec/command/option_spec.rb +28 -29
- data/spec/command/refresh_spec.rb +3 -4
- data/spec/command/reply_spec.rb +22 -23
- data/spec/command/retweet_spec.rb +17 -18
- data/spec/command/spam_spec.rb +4 -5
- data/spec/command/status_spec.rb +19 -20
- data/spec/command/thread_spec.rb +20 -21
- data/spec/command/time_spec.rb +18 -21
- data/spec/command/uptime_spec.rb +17 -18
- data/spec/command/user_info_spec.rb +13 -16
- data/spec/command/user_spec.rb +13 -14
- data/spec/command/version_spec.rb +25 -29
- data/spec/command/whois_spec.rb +25 -26
- data/spec/command_helper.rb +2 -2
- data/spec/db/followings_spec.rb +22 -23
- data/spec/db/listenable_spec.rb +2 -3
- data/spec/db/lists_spec.rb +16 -17
- data/spec/db/roman_spec.rb +3 -5
- data/spec/db/sized_uniq_array_spec.rb +13 -14
- data/spec/db/statuses_spec.rb +69 -70
- data/spec/ifilter/expand_url_spec.rb +18 -20
- data/spec/ifilter/retweet_spec.rb +4 -5
- data/spec/ifilter/retweet_time_spec.rb +4 -5
- data/spec/ifilter/sanitize_spec.rb +5 -6
- data/spec/ifilter/sid_spec.rb +6 -7
- data/spec/ifilter/strip_spec.rb +3 -4
- data/spec/ifilter/tid_spec.rb +6 -7
- data/spec/levenshtein_spec.rb +2 -3
- data/spec/ofilter/escape_url_spec.rb +13 -14
- data/spec/ofilter/footer_spec.rb +10 -11
- data/spec/ofilter/geo_spec.rb +12 -13
- data/spec/ofilter/short_url_spec.rb +28 -29
- data/spec/option_spec.rb +23 -24
- data/spec/sized_hash_spec.rb +5 -6
- data/spec/spec_helper.rb +8 -6
- data/spec/update_checker_spec.rb +14 -15
- metadata +9 -32
- data/docs/_static/allow.png +0 -0
- data/docs/_static/emacs.png +0 -0
- data/docs/_static/irc_setting.png +0 -0
- data/docs/_static/irssi.png +0 -0
- data/docs/_static/limechat.png +0 -0
- data/docs/_static/limechat_s.png +0 -0
- data/docs/_static/oauth_channel.png +0 -0
- data/docs/_static/screenshot.png +0 -0
- data/docs/_static/structure.png +0 -0
- data/docs/_static/verify.png +0 -0
- data/docs/changelog.rst +0 -233
- data/docs/commandline_options.rst +0 -21
- data/docs/commands.rst +0 -84
- data/docs/conf.py +0 -194
- data/docs/config.rst +0 -159
- data/docs/feature.rst +0 -41
- data/docs/hacking_guide.rst +0 -43
- data/docs/index.rst +0 -102
- data/docs/irc.rst +0 -31
- data/docs/options.rst +0 -76
- data/docs/quickstart.rst +0 -96
- data/docs/resize.sh +0 -7
- data/docs/tiarra.rst +0 -2
- data/docs/tig.rst +0 -21
- data/requirements.txt +0 -5
data/lib/atig/command/retweet.rb
CHANGED
@@ -23,10 +23,10 @@ module Atig
|
|
23
23
|
|
24
24
|
chars = text.each_char.to_a
|
25
25
|
if chars.size > 140 then
|
26
|
-
url = @bitly.shorten "
|
26
|
+
url = @bitly.shorten "https://twitter.com/#{entry.user.screen_name}/status/#{entry.status.id}"
|
27
27
|
text = chars[0,140-url.size-1].join('') + ' ' + url
|
28
28
|
end
|
29
|
-
q = gateway.output_message(:
|
29
|
+
q = gateway.output_message(status: text)
|
30
30
|
api.delay(0) do|t|
|
31
31
|
ret = t.post("statuses/update", q)
|
32
32
|
gateway.update_status ret,target, "RT to #{entry.user.screen_name}: #{entry.status.text}"
|
data/lib/atig/command/search.rb
CHANGED
@@ -17,7 +17,7 @@ module Atig
|
|
17
17
|
end
|
18
18
|
|
19
19
|
q = mesg.sub(/^#{command}\s+/, '')
|
20
|
-
opts = { :
|
20
|
+
opts = { q: q }
|
21
21
|
while /^:(?:(lang)=(\w+))/ =~ args.first
|
22
22
|
opts[$1] = $2
|
23
23
|
q.sub!(/^#{args.first}\W+/, "")
|
@@ -35,7 +35,7 @@ module Atig
|
|
35
35
|
db.statuses.transaction do|d|
|
36
36
|
user = TwitterStruct.make('id' => status.from_user_id,
|
37
37
|
'screen_name' => status.from_user)
|
38
|
-
d.add :
|
38
|
+
d.add status: status, user: user, source: :user
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
data/lib/atig/command/status.rb
CHANGED
@@ -15,14 +15,14 @@ module Atig
|
|
15
15
|
return
|
16
16
|
end
|
17
17
|
text = mesg.split(" ", 2)[1]
|
18
|
-
previous,*_ = db.statuses.find_by_user( db.me, :
|
18
|
+
previous,*_ = db.statuses.find_by_user( db.me, limit: 1)
|
19
19
|
if previous and
|
20
20
|
((::Time.now - ::Time.parse(previous.status.created_at)).to_i < 60*60*24 rescue true) and
|
21
21
|
text.strip == previous.status.text.strip
|
22
22
|
yield "You can't submit the same status twice in a row."
|
23
23
|
return
|
24
24
|
end
|
25
|
-
q = gateway.output_message(:
|
25
|
+
q = gateway.output_message(status: text)
|
26
26
|
|
27
27
|
case tweet_invalid? q[:status]
|
28
28
|
when :too_long
|
@@ -33,7 +33,7 @@ module Atig
|
|
33
33
|
return
|
34
34
|
end
|
35
35
|
|
36
|
-
api.delay(0, :
|
36
|
+
api.delay(0, retry:3) do|t|
|
37
37
|
ret = t.post("statuses/update", q)
|
38
38
|
gateway.update_status ret,target
|
39
39
|
end
|
data/lib/atig/command/user.rb
CHANGED
@@ -20,15 +20,15 @@ module Atig
|
|
20
20
|
api.delay(0) do|t|
|
21
21
|
begin
|
22
22
|
statuses = t.get("statuses/user_timeline",
|
23
|
-
{ :
|
23
|
+
{ count: count, screen_name: nick})
|
24
24
|
statuses.reverse_each do|status|
|
25
25
|
db.statuses.transaction do|d|
|
26
|
-
d.add :
|
26
|
+
d.add status: status, user: status.user, source: :user
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
db.statuses.
|
31
|
-
find_by_screen_name(nick, :
|
31
|
+
find_by_screen_name(nick, limit:count).
|
32
32
|
reverse_each do|entry|
|
33
33
|
gateway[target].message entry, Net::IRC::Constants::NOTICE
|
34
34
|
end
|
data/lib/atig/command/version.rb
CHANGED
@@ -15,7 +15,7 @@ module Atig
|
|
15
15
|
end
|
16
16
|
nick,*_ = args
|
17
17
|
|
18
|
-
entries = db.statuses.find_by_screen_name(nick, :
|
18
|
+
entries = db.statuses.find_by_screen_name(nick, limit: 1)
|
19
19
|
if entries && !entries.empty? then
|
20
20
|
entry = TwitterStruct.make('user' => entries.first.user,
|
21
21
|
'status' => { 'text' =>
|
@@ -24,9 +24,9 @@ module Atig
|
|
24
24
|
else
|
25
25
|
api.delay(0) do|t|
|
26
26
|
begin
|
27
|
-
user = t.get("users/show", { :
|
27
|
+
user = t.get("users/show", { screen_name: nick})
|
28
28
|
db.statuses.transaction do|d|
|
29
|
-
d.add :
|
29
|
+
d.add user: user, status: user.status, source: :version
|
30
30
|
entry = TwitterStruct.make('user' => user,
|
31
31
|
'status' => { 'text' =>
|
32
32
|
format(user.status.source) })
|
data/lib/atig/db/followings.rb
CHANGED
@@ -83,7 +83,6 @@ module Atig
|
|
83
83
|
}
|
84
84
|
|
85
85
|
names = users.map{|u| u.screen_name.inspect }.join(",")
|
86
|
-
parts =
|
87
86
|
may_notify :part, db.execute(%{SELECT screen_name,data FROM users
|
88
87
|
WHERE screen_name NOT IN (#{names})}).map{|_,data|
|
89
88
|
@db.load(data)
|
@@ -109,11 +108,11 @@ module Atig
|
|
109
108
|
else
|
110
109
|
db.execute("INSERT INTO users
|
111
110
|
VALUES(NULL, :screen_name, :user_id, :protected, :only, :data)",
|
112
|
-
:
|
113
|
-
:
|
114
|
-
:
|
115
|
-
:
|
116
|
-
:
|
111
|
+
screen_name: user.screen_name,
|
112
|
+
user_id: user.id,
|
113
|
+
protected: bool(user.protected),
|
114
|
+
only: bool(user.only),
|
115
|
+
data: @db.dump(user))
|
117
116
|
end
|
118
117
|
end
|
119
118
|
end
|
data/lib/atig/db/statuses.rb
CHANGED
@@ -63,17 +63,17 @@ module Atig
|
|
63
63
|
screen_name = opt[:user].screen_name
|
64
64
|
sum = db.get_first_value("SELECT sum(count) FROM id").to_i
|
65
65
|
count = db.get_first_value("SELECT count FROM id WHERE screen_name = ?", screen_name).to_i
|
66
|
-
entry = OpenStruct.new opt.merge(:
|
67
|
-
:
|
66
|
+
entry = OpenStruct.new opt.merge(tid: @roman.make(sum),
|
67
|
+
sid: "#{screen_name}:#{@roman.make(count)}")
|
68
68
|
db.execute(%{INSERT INTO status
|
69
69
|
VALUES(NULL, :id, :tid, :sid, :screen_name, :user_id, :created_at, :data)},
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
76
|
-
:
|
70
|
+
id: id,
|
71
|
+
tid: entry.tid,
|
72
|
+
sid: entry.sid,
|
73
|
+
screen_name: screen_name,
|
74
|
+
user_id: opt[:user].id,
|
75
|
+
created_at: Time.parse(opt[:status].created_at).to_i,
|
76
|
+
data: @db.dump(entry))
|
77
77
|
if count == 0 then
|
78
78
|
db.execute("INSERT INTO id VALUES(NULL,?,?)", screen_name, 1)
|
79
79
|
else
|
@@ -129,8 +129,10 @@ module Atig
|
|
129
129
|
|
130
130
|
private
|
131
131
|
def find(lhs,rhs, opt={},&f)
|
132
|
+
rhs.encoding!("UTF-8") if rhs.respond_to? :encoding!
|
133
|
+
|
132
134
|
query = "SELECT id,data FROM status WHERE #{lhs} = :rhs ORDER BY created_at DESC LIMIT :limit"
|
133
|
-
params = { :
|
135
|
+
params = { rhs: rhs, limit: opt.fetch(:limit,20) }
|
134
136
|
res = []
|
135
137
|
|
136
138
|
@db.execute do|db|
|
data/lib/atig/db/transaction.rb
CHANGED
data/lib/atig/gateway/channel.rb
CHANGED
@@ -44,7 +44,6 @@ END
|
|
44
44
|
def message(entry, command = PRIVMSG)
|
45
45
|
GC.start
|
46
46
|
user = entry.user
|
47
|
-
screen_name = user.screen_name
|
48
47
|
prefix = prefix user
|
49
48
|
str = run_filters entry
|
50
49
|
|
@@ -88,7 +87,7 @@ END
|
|
88
87
|
private
|
89
88
|
|
90
89
|
def run_filters(entry)
|
91
|
-
status = entry.status.merge(:
|
90
|
+
status = entry.status.merge(tid:entry.tid, sid:entry.sid)
|
92
91
|
@filters.inject(status) {|x, f| f.call x }.text
|
93
92
|
end
|
94
93
|
|
data/lib/atig/gateway/session.rb
CHANGED
@@ -16,7 +16,7 @@ require 'atig/option'
|
|
16
16
|
|
17
17
|
begin
|
18
18
|
require 'continuation'
|
19
|
-
rescue LoadError
|
19
|
+
rescue LoadError
|
20
20
|
end
|
21
21
|
|
22
22
|
module Atig
|
@@ -50,7 +50,7 @@ END
|
|
50
50
|
|
51
51
|
def update_status(ret, target, msg='')
|
52
52
|
@db.transaction do|db|
|
53
|
-
db.statuses.add(:
|
53
|
+
db.statuses.add(source: :me, status: ret, user: ret.user )
|
54
54
|
end
|
55
55
|
|
56
56
|
msg = "(#{msg})" unless msg.empty?
|
@@ -58,12 +58,12 @@ END
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def channel(name,opts={})
|
61
|
-
opts.update(:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
61
|
+
opts.update(session: self,
|
62
|
+
name: name,
|
63
|
+
filters: @ifilters,
|
64
|
+
prefix: @prefix,
|
65
|
+
nick: @nick,
|
66
|
+
opts: @opts)
|
67
67
|
channel = Channel.new opts
|
68
68
|
@channels[name] = channel
|
69
69
|
channel
|
@@ -111,7 +111,7 @@ END
|
|
111
111
|
load_config
|
112
112
|
|
113
113
|
@opts = Atig::Option.parse @real
|
114
|
-
context = OpenStruct.new(
|
114
|
+
context = OpenStruct.new(log:@log, opts:@opts)
|
115
115
|
|
116
116
|
oauth = OAuth.new(context, @nick)
|
117
117
|
unless oauth.verified? then
|
@@ -166,12 +166,12 @@ END
|
|
166
166
|
|
167
167
|
post server_name, MODE, @nick, "+o"
|
168
168
|
|
169
|
-
@db = Atig::Db::Db.new context, :me
|
169
|
+
@db = Atig::Db::Db.new context, me:me, size: 100, tmpdir: @tmpdir
|
170
170
|
run_new @@commands, context, self, @api, @db
|
171
171
|
run_new @@agents , context, @api, @db
|
172
172
|
run_new @@channels, context, self, @db
|
173
173
|
|
174
|
-
@db.statuses.add :
|
174
|
+
@db.statuses.add user: me, source: :me, status: me.status
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
@@ -210,7 +210,7 @@ END
|
|
210
210
|
def on_ctcp_action(target, mesg)
|
211
211
|
command, *args = mesg.split(" ")
|
212
212
|
last_match = nil
|
213
|
-
|
213
|
+
command = command.to_s.downcase
|
214
214
|
_, action = @ctcp_actions.find{|define, f|
|
215
215
|
r = (define === command)
|
216
216
|
last_match = Regexp.last_match
|
@@ -244,7 +244,7 @@ END
|
|
244
244
|
end
|
245
245
|
|
246
246
|
def on_kick(m)
|
247
|
-
channel, nick,
|
247
|
+
channel, nick, _ = *m.params
|
248
248
|
|
249
249
|
if not nick.screen_name? or @db.me.screen_name.casecmp(nick).zero?
|
250
250
|
post server_name, ERR_NOSUCHNICK, nick, "No such nick: #{nick}" # or yourself
|
data/lib/atig/http.rb
CHANGED
@@ -9,10 +9,10 @@ module Atig
|
|
9
9
|
def self.proxy=(proxy)
|
10
10
|
if proxy =~ /\A(?:([^:@]+)(?::([^@]+))?@)?([^:]+)(?::(\d+))?\z/ then
|
11
11
|
@@proxy = OpenStruct.new({
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
12
|
+
user: $1,
|
13
|
+
password: $2,
|
14
|
+
address: $3,
|
15
|
+
port: $4.to_i,
|
16
16
|
})
|
17
17
|
end
|
18
18
|
end
|
@@ -18,7 +18,7 @@ module Atig
|
|
18
18
|
def call(status)
|
19
19
|
target = short_url_regexp
|
20
20
|
entities = (entities = status.entities).nil? ? [] : entities.urls
|
21
|
-
status.merge :
|
21
|
+
status.merge text: status.text.gsub(target) {|url|
|
22
22
|
unless entities.nil? or entities.empty?
|
23
23
|
@cache[url] ||= search_url_from_entities(url, entities)
|
24
24
|
url = @cache[url] if @cache[url] =~ target
|
data/lib/atig/ifilter/retweet.rb
CHANGED
@@ -7,7 +7,7 @@ module Atig
|
|
7
7
|
def self.call(status)
|
8
8
|
return status unless status.retweeted_status
|
9
9
|
rt = status.retweeted_status
|
10
|
-
status.merge :
|
10
|
+
status.merge text: "#{Prefix}RT @#{rt.user.screen_name}: #{rt.text}"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -8,7 +8,7 @@ module Atig
|
|
8
8
|
status
|
9
9
|
else
|
10
10
|
t = Time.gm(*Time.parse(status.retweeted_status.created_at).to_a)
|
11
|
-
status.merge :
|
11
|
+
status.merge text: "#{status.text} \x0310[#{t.strftime "%Y-%m-%d %H:%M"}]\x0F"
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/lib/atig/ifilter/strip.rb
CHANGED
data/lib/atig/ifilter/xid.rb
CHANGED
data/lib/atig/oauth.rb
CHANGED
@@ -27,8 +27,8 @@ module Atig
|
|
27
27
|
|
28
28
|
@nick = nick
|
29
29
|
@oauth = ::OAuth::Consumer.new(CONSUMER_KEY, CONSUMER_SECRET, {
|
30
|
-
:
|
31
|
-
:
|
30
|
+
site: site,
|
31
|
+
proxy: ENV["HTTP_PROXY"] || ENV["http_proxy"]
|
32
32
|
})
|
33
33
|
|
34
34
|
if @@profiles.key? @nick
|
@@ -47,7 +47,7 @@ module Atig
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def verify(code)
|
50
|
-
@access = @request.get_access_token(:
|
50
|
+
@access = @request.get_access_token(oauth_verifier: code)
|
51
51
|
if @access then
|
52
52
|
@@profiles[@nick] = [ @access.token , @access.secret ]
|
53
53
|
end
|
data/lib/atig/ofilter/footer.rb
CHANGED
data/lib/atig/ofilter/geo.rb
CHANGED
data/lib/atig/option.rb
CHANGED
@@ -30,7 +30,7 @@ module Atig
|
|
30
30
|
end
|
31
31
|
|
32
32
|
default_value :api_base, 'https://api.twitter.com/1.1/'
|
33
|
-
default_value :stream_api_base, 'https://userstream.twitter.com/
|
33
|
+
default_value :stream_api_base, 'https://userstream.twitter.com/1.1/'
|
34
34
|
default_value :search_api_base, 'https://search.twitter.com/'
|
35
35
|
|
36
36
|
def initialize(table)
|
data/lib/atig/optparse.rb
CHANGED
@@ -6,16 +6,17 @@ module Atig
|
|
6
6
|
class << self
|
7
7
|
def parse!(argv)
|
8
8
|
opts = {
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
9
|
+
port: 16668,
|
10
|
+
host: "localhost",
|
11
|
+
log: nil,
|
12
|
+
debug: false,
|
13
|
+
foreground: false,
|
14
|
+
tmpdir: ::Dir.tmpdir,
|
15
|
+
conf: '~/.atig/config',
|
16
16
|
}
|
17
17
|
|
18
18
|
OptionParser.new do |parser|
|
19
|
+
parser.version = Atig::VERSION
|
19
20
|
parser.instance_eval do
|
20
21
|
self.banner = <<EOB.gsub(/^\t+/, "")
|
21
22
|
usage: #{$0} [opts]
|
@@ -23,6 +24,16 @@ EOB
|
|
23
24
|
separator ""
|
24
25
|
|
25
26
|
separator "Options:"
|
27
|
+
on("--help", "show this help") do
|
28
|
+
puts help
|
29
|
+
exit
|
30
|
+
end
|
31
|
+
|
32
|
+
on("-v", "--version", "show version") do
|
33
|
+
puts version
|
34
|
+
exit
|
35
|
+
end
|
36
|
+
|
26
37
|
on("-p", "--port [PORT=#{opts[:port]}]", "port number to listen") do |port|
|
27
38
|
opts[:port] = port
|
28
39
|
end
|
@@ -35,20 +46,20 @@ EOB
|
|
35
46
|
opts[:log] = log
|
36
47
|
end
|
37
48
|
|
38
|
-
on("--debug", "Enable debug mode") do |debug|
|
49
|
+
on("-d", "--debug", "Enable debug mode") do |debug|
|
39
50
|
opts[:log] ||= $stderr
|
40
51
|
opts[:debug] = true
|
41
52
|
end
|
42
53
|
|
43
|
-
on("--tmpdir path", "temporary directory path") do |tmp|
|
54
|
+
on("-t", "--tmpdir path", "temporary directory path") do |tmp|
|
44
55
|
opts[:tmpdir] = tmp
|
45
56
|
end
|
46
57
|
|
47
|
-
on("--memprof", "Enable memory profiler") do|_|
|
58
|
+
on("-m", "--memprof", "Enable memory profiler") do|_|
|
48
59
|
require 'memory_profiler'
|
49
60
|
require 'fileutils'
|
50
61
|
FileUtils.mkdir_p "log"
|
51
|
-
MemoryProfiler.start(:
|
62
|
+
MemoryProfiler.start(string_debug: true)
|
52
63
|
end
|
53
64
|
|
54
65
|
on("-c","--conf [file=#{opts[:conf]}]", "atig configuration file; default is '~/.atig/config'") do|name|
|