facy 1.2.9 → 1.2.10.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/bin/facy +1 -1
- data/facy.gemspec +1 -0
- data/lib/facy.rb +11 -1
- data/lib/facy/command.rb +27 -2
- data/lib/facy/converter.rb +2 -1
- data/lib/facy/core.rb +10 -1
- data/lib/facy/facebook.rb +4 -3
- data/lib/facy/get_token.rb +1 -1
- data/lib/facy/output.rb +3 -2
- data/lib/facy/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3eb2d20894254602ff05d10db9ca3688223cd66
|
4
|
+
data.tar.gz: e6d4f592528a3da0911aa1f4b663054fd7ade42c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13daf2fbfbb2ba54105b3994c6cbb91a7eddbb9a529a72819c9700ed899f4da0f6252cea9a48dcc7211859f45c94b3c88275184dc0daee84b6f7d07511a196c8
|
7
|
+
data.tar.gz: d5ecbd1f7d3ffec32f0f39afc81c13001b4b03bd37a5b17440fa615e9b745ea9e0ac2be7993d0654ed9033304c69ead1cc773a145bd1ffd610d575feb59da1d1
|
data/README.md
CHANGED
@@ -12,6 +12,11 @@ I recommend rvm to control the version of installed ruby.
|
|
12
12
|
|
13
13
|
![](http://i.gyazo.com/01de9c8da6191b79bcec201048361f58.png)
|
14
14
|
|
15
|
+
Imageview by asii-art also available by option config, however image quality is quite bad, so it seems quite useless.
|
16
|
+
|
17
|
+
![](http://i.gyazo.com/ede1444083fda6d16c1ce2531a05aabf.png)
|
18
|
+
|
19
|
+
|
15
20
|
## Installation
|
16
21
|
Install it yourself as:
|
17
22
|
```
|
data/bin/facy
CHANGED
data/facy.gemspec
CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
+
spec.required_ruby_version = '>= 1.9.3'
|
20
21
|
|
21
22
|
spec.add_runtime_dependency "bundler", "~> 1.5"
|
22
23
|
spec.add_runtime_dependency "koala", "~>1.10"
|
data/lib/facy.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
%w(
|
2
|
-
rmagick
|
3
2
|
koala
|
4
3
|
readline
|
5
4
|
yaml
|
@@ -11,6 +10,17 @@
|
|
11
10
|
active_support/dependencies
|
12
11
|
).each { |lib| require lib }
|
13
12
|
|
13
|
+
begin
|
14
|
+
require "rmagick"
|
15
|
+
rescue LoadError
|
16
|
+
begin
|
17
|
+
require "RMagick"
|
18
|
+
rescue LoadError
|
19
|
+
p "can not require rmagick library in this computer"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
14
24
|
Thread.abort_on_exception = true
|
15
25
|
Encoding.default_external = Encoding.find('UTF-8')
|
16
26
|
|
data/lib/facy/command.rb
CHANGED
@@ -95,11 +95,14 @@ module Facy
|
|
95
95
|
help :comment, 'comment to a post,', ':comment [code] [content]'
|
96
96
|
|
97
97
|
command :seen do |notif_code|
|
98
|
+
notif_code = "$#{notif_code}"
|
99
|
+
item = post_code_reverse_map[notif_code]
|
98
100
|
async {
|
99
|
-
ret = facebook_set_seen(
|
101
|
+
ret = facebook_set_seen(item.id)
|
100
102
|
instant_output(Item.new(info: :info, content: 'unseen success')) if ret
|
101
103
|
}
|
102
104
|
end
|
105
|
+
help :seen, "set a notification to seen", ":seen [code]"
|
103
106
|
|
104
107
|
command :view_raw do |post_code|
|
105
108
|
post_code = "$#{post_code}"
|
@@ -124,6 +127,7 @@ module Facy
|
|
124
127
|
instant_output(Item.new(info: :error, content: "use facy -enable_img_view to enable image viewer"))
|
125
128
|
end
|
126
129
|
end
|
130
|
+
help :view_img, "view an image as ascii art", ":view_img [code]"
|
127
131
|
|
128
132
|
command :view_comments do |post_code|
|
129
133
|
post_code = "$#{post_code}"
|
@@ -136,7 +140,7 @@ module Facy
|
|
136
140
|
end
|
137
141
|
end
|
138
142
|
end
|
139
|
-
help :view_comments, "view
|
143
|
+
help :view_comments, "view comments from a post", ":view_comments [code]"
|
140
144
|
|
141
145
|
command :view_likes do |post_code|
|
142
146
|
post_code = "$#{post_code}"
|
@@ -148,6 +152,7 @@ module Facy
|
|
148
152
|
end
|
149
153
|
end
|
150
154
|
end
|
155
|
+
help :view_likes, "view likes detail from a post", ":view_likes [code]"
|
151
156
|
|
152
157
|
command :dump_log do
|
153
158
|
if config[:debug_log]
|
@@ -162,6 +167,18 @@ module Facy
|
|
162
167
|
end
|
163
168
|
help :dump_log, "dump debug log to file", ":dump_log"
|
164
169
|
|
170
|
+
command :reconfig do
|
171
|
+
begin
|
172
|
+
FileUtils.rm(config_file)
|
173
|
+
FileUtils.rm(session_file)
|
174
|
+
instant_output(Item.new(info: :info, content: "restart facy to reconfig"))
|
175
|
+
stop_process
|
176
|
+
rescue Exception => e
|
177
|
+
error e.message
|
178
|
+
end
|
179
|
+
end
|
180
|
+
help :reconfig, "reconfig app_id, app_secret access token", ":reconfig"
|
181
|
+
|
165
182
|
command :commands do
|
166
183
|
helps.each do |help|
|
167
184
|
puts ":#{help[:target].to_s.colorize(38,5,8)} #{help[:usage]}"
|
@@ -169,6 +186,14 @@ module Facy
|
|
169
186
|
end
|
170
187
|
help :commands, "list all available commands", ":commands"
|
171
188
|
|
189
|
+
command :clear_cache do
|
190
|
+
sync {
|
191
|
+
printed_item.clear
|
192
|
+
#TODO clear also code table
|
193
|
+
}
|
194
|
+
end
|
195
|
+
help :clear_cache, "clear posts and notification cache and fetch again", ":clear_cache"
|
196
|
+
|
172
197
|
completion_proc = proc {|s|
|
173
198
|
commands
|
174
199
|
.map{|c|c[:pattern]}
|
data/lib/facy/converter.rb
CHANGED
@@ -14,6 +14,7 @@ module Facy
|
|
14
14
|
content: graph_item["title"],
|
15
15
|
},
|
16
16
|
date: graph_item["created_time"],
|
17
|
+
link: graph_item["link"]
|
17
18
|
})
|
18
19
|
else
|
19
20
|
content =
|
@@ -31,7 +32,7 @@ module Facy
|
|
31
32
|
when "video"
|
32
33
|
"share a video: #{graph_item['message']}"
|
33
34
|
when "link"
|
34
|
-
"#{graph_item["message"]} #{graph_item["link"]}"
|
35
|
+
"#{graph_item["message"]} #{graph_item["link"]} #{graph_item["name"]}"
|
35
36
|
end
|
36
37
|
|
37
38
|
link =
|
data/lib/facy/core.rb
CHANGED
@@ -12,6 +12,12 @@ module Facy
|
|
12
12
|
inits << block
|
13
13
|
end
|
14
14
|
|
15
|
+
def config_file
|
16
|
+
config_file_folder = "/tmp"
|
17
|
+
config_file_name = ".facy_config.yml"
|
18
|
+
File.expand_path(config_file_name, config_file_folder)
|
19
|
+
end
|
20
|
+
|
15
21
|
def _init
|
16
22
|
load_config
|
17
23
|
login_flow
|
@@ -25,7 +31,10 @@ module Facy
|
|
25
31
|
end
|
26
32
|
|
27
33
|
def default_config
|
28
|
-
|
34
|
+
default_conf_file = File.expand_path("../../../config.yml", __FILE__)
|
35
|
+
file = File.exist?(config_file) ? config_file : default_conf_file
|
36
|
+
|
37
|
+
config = YAML.load_file(file)
|
29
38
|
{
|
30
39
|
session_file_folder: "/tmp",
|
31
40
|
session_file_name: ".facy_access_token.yml",
|
data/lib/facy/facebook.rb
CHANGED
@@ -61,10 +61,11 @@ module Facy
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def facebook_set_seen(notification_id)
|
64
|
-
@graph.
|
65
|
-
rescue Koala::Facebook::ServerError
|
64
|
+
@graph.put_connections("#{notification_id}", "unread=false")
|
65
|
+
rescue Koala::Facebook::ServerError => e
|
66
66
|
retry_wait
|
67
|
-
rescue Koala::Facebook::APIError
|
67
|
+
rescue Koala::Facebook::APIError => e
|
68
|
+
error e.message
|
68
69
|
expired_session
|
69
70
|
rescue Exception => e
|
70
71
|
error e
|
data/lib/facy/get_token.rb
CHANGED
data/lib/facy/output.rb
CHANGED
@@ -24,7 +24,7 @@ module Facy
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def instant_output(item)
|
27
|
-
printed_item << item.id if item.id
|
27
|
+
sync { printed_item << item.id if item.id }
|
28
28
|
info = item.info
|
29
29
|
print_registers.each do |pattern|
|
30
30
|
if info == pattern[:name]
|
@@ -144,12 +144,13 @@ module Facy
|
|
144
144
|
end
|
145
145
|
|
146
146
|
print_register :notification do |item|
|
147
|
+
code = post_code(item).colorize(38,5,8).strip
|
147
148
|
info = "☢ #{item.info.to_s.capitalize}".colorize(0,31)
|
148
149
|
uname = item.data.user
|
149
150
|
uname = uname.colorize(username_color(uname))
|
150
151
|
content = item.data.content.colorize(0,55)
|
151
152
|
|
152
|
-
puts "[#{info}] #{uname} #{content}"
|
153
|
+
puts "[#{code}][#{info}] #{uname} #{content}"
|
153
154
|
end
|
154
155
|
|
155
156
|
print_register :info do |item|
|
data/lib/facy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.10.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- dxhuy1988
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-08-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,12 +137,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
137
137
|
requirements:
|
138
138
|
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
140
|
+
version: 1.9.3
|
141
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - ">"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
145
|
+
version: 1.3.1
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
148
|
rubygems_version: 2.2.2
|