adncv 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +21 -3
- data/lib/ADNCV/app.rb +18 -16
- data/lib/ADNCV/data.rb +15 -5
- data/lib/ADNCV/display.rb +26 -0
- data/lib/ADNCV/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fb7cefcb0019df6d96bec41011db1263f8f0367
|
4
|
+
data.tar.gz: 4a68e0625a6ad8fa686f268447f947a28b3d3e6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec076280c3647d51787e4e047f79a690ce0d3f001ccdfad71de03e1b06ddf9987ed6c9a3beb0fc87107499d6c2c0caf134da4aced379fff311397846af6d939d
|
7
|
+
data.tar.gz: 37b40b66bb68da042c32db57b2c25531cefbc2d7a389b590ac9a9748fee43353bcd1cdd256fa4daa26be3ba084243d77660d695faeccb9f33b82918a17691e39
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -2,10 +2,28 @@
|
|
2
2
|
|
3
3
|
Statistics from your App.net data.
|
4
4
|
|
5
|
-
1. Download your ADN data
|
6
|
-
|
7
|
-
2.
|
5
|
+
1. [Download](https://account.app.net/settings/content/) your ADN data
|
6
|
+
|
7
|
+
2. Install:
|
8
|
+
|
9
|
+
`gem install adncv`
|
10
|
+
|
11
|
+
3. Run the Gem on the downloaded file:
|
8
12
|
|
9
13
|
```
|
10
14
|
adncv /path/to/appdotnet-data-you-xxxxx-posts.json
|
11
15
|
```
|
16
|
+
|
17
|
+
## Commands
|
18
|
+
|
19
|
+
### Display
|
20
|
+
|
21
|
+
`adncv -d posts.json`
|
22
|
+
|
23
|
+
Displays informations.
|
24
|
+
|
25
|
+
### Export
|
26
|
+
|
27
|
+
`adncv -e posts.json`
|
28
|
+
|
29
|
+
Exports informations as a JSON file, including all your posted links and mentioned users.
|
data/lib/ADNCV/app.rb
CHANGED
@@ -1,31 +1,24 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module ADNCV
|
3
3
|
class App < Thor
|
4
|
-
package_name "
|
4
|
+
package_name "adncv"
|
5
5
|
require_relative "display"
|
6
6
|
require_relative "data"
|
7
7
|
|
8
|
-
desc "display", "
|
8
|
+
desc "display", "Show your account statistics (-d)"
|
9
9
|
map "-d" => :display
|
10
|
+
option :full, aliases: "-f", type: :boolean, desc: "Display full details: links, users, etc"
|
10
11
|
def display(file)
|
11
|
-
|
12
|
-
display
|
13
|
-
display.analyzing
|
14
|
-
data.extract(file)
|
15
|
-
display.done
|
16
|
-
data.display
|
12
|
+
analyze(file)
|
13
|
+
@display.show(@data, options)
|
17
14
|
end
|
18
15
|
|
19
|
-
desc "export", "Export"
|
16
|
+
desc "export", "Export your account statistics (-e)"
|
20
17
|
map "-e" => :export
|
21
18
|
def export(file)
|
22
|
-
|
23
|
-
|
24
|
-
display.
|
25
|
-
data.extract(file)
|
26
|
-
display.done
|
27
|
-
data.export
|
28
|
-
display.exported(data.export_path)
|
19
|
+
analyze(file)
|
20
|
+
@data.export
|
21
|
+
@display.exported(@data.export_path)
|
29
22
|
end
|
30
23
|
|
31
24
|
desc "version", "Show the current version (-v)"
|
@@ -35,5 +28,14 @@ module ADNCV
|
|
35
28
|
display.version
|
36
29
|
end
|
37
30
|
|
31
|
+
private
|
32
|
+
|
33
|
+
def analyze(file)
|
34
|
+
@data = Data.new
|
35
|
+
@display = Display.new
|
36
|
+
@display.analyzing
|
37
|
+
@data.extract(file)
|
38
|
+
end
|
39
|
+
|
38
40
|
end
|
39
41
|
end
|
data/lib/ADNCV/data.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
module ADNCV
|
3
3
|
class Data
|
4
4
|
|
5
|
-
attr_reader :filename, :count, :leadings, :without_mentions, :mentions_not_directed, :replies, :mentions_not_replies, :with_links, :sources, :all_links, :directed_users, :names, :clients, :mentions, :all_clients, :all_mentioned
|
5
|
+
attr_reader :filename, :count, :leadings, :without_mentions, :mentions_not_directed, :replies, :mentions_not_replies, :with_links, :sources, :all_links, :directed_users, :names, :clients, :mentions, :all_clients, :all_mentioned, :reposts, :stars
|
6
6
|
attr_accessor :export_path
|
7
7
|
|
8
8
|
def initialize
|
@@ -19,6 +19,8 @@ module ADNCV
|
|
19
19
|
@leadings = 0
|
20
20
|
@replies = 0
|
21
21
|
@with_links = 0
|
22
|
+
@reposts = 0
|
23
|
+
@stars = 0
|
22
24
|
mentioned = Hash.new(0)
|
23
25
|
directed = Hash.new(0)
|
24
26
|
is_reply = Hash.new(0)
|
@@ -49,15 +51,21 @@ module ADNCV
|
|
49
51
|
links << link['url']
|
50
52
|
end
|
51
53
|
end
|
54
|
+
unless post["num_reposts"].nil?
|
55
|
+
@reposts += post["num_reposts"]
|
56
|
+
end
|
57
|
+
unless post["num_stars"].nil?
|
58
|
+
@stars += post["num_stars"]
|
59
|
+
end
|
52
60
|
end
|
53
61
|
|
54
62
|
all_directed = directed.sort_by {|k,v| v}
|
55
63
|
@all_clients = @clients.sort_by {|k,v| v}
|
56
64
|
@all_mentioned = mentioned.sort_by {|k,v| v}.uniq
|
57
65
|
@all_links = links.uniq.sort
|
58
|
-
@names = @all_mentioned.map {|k,v| "
|
66
|
+
@names = @all_mentioned.map {|k,v| "@#{k} (#{v})"}
|
59
67
|
@sources = @all_clients.map {|k,v| "#{k} (#{v})"}
|
60
|
-
@directed_users = all_directed.uniq.map {|k,v| "
|
68
|
+
@directed_users = all_directed.uniq.map {|k,v| "@#{k} (#{v})"}
|
61
69
|
|
62
70
|
@without_mentions = count - @mentions
|
63
71
|
@mentions_not_directed = @mentions - @leadings
|
@@ -82,7 +90,9 @@ module ADNCV
|
|
82
90
|
with_mentions_not_directed: @mentions_not_directed,
|
83
91
|
with_mentions_are_replies: @replies,
|
84
92
|
with_mentions_are_not_replies: @mentions_not_replies,
|
85
|
-
with_links: @with_links
|
93
|
+
with_links: @with_links,
|
94
|
+
have_been_reposted: @reposts,
|
95
|
+
have_been_starred: @stars
|
86
96
|
}]
|
87
97
|
},
|
88
98
|
users: {
|
@@ -100,7 +110,7 @@ module ADNCV
|
|
100
110
|
}
|
101
111
|
}
|
102
112
|
|
103
|
-
@export_path = "#{Dir.home}/
|
113
|
+
@export_path = "#{Dir.home}/adncv_export.json"
|
104
114
|
File.write(@export_path, export.to_json)
|
105
115
|
end
|
106
116
|
|
data/lib/ADNCV/display.rb
CHANGED
@@ -11,6 +11,7 @@ module ADNCV
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def analyzing
|
14
|
+
puts "\n"
|
14
15
|
@thor.say_status :working, "Analyzing JSON file", :yellow
|
15
16
|
end
|
16
17
|
|
@@ -22,5 +23,30 @@ module ADNCV
|
|
22
23
|
@thor.say_status :done, "Data exported in #{filename}", :green
|
23
24
|
end
|
24
25
|
|
26
|
+
def clear_screen
|
27
|
+
puts "\e[H\e[2J"
|
28
|
+
end
|
29
|
+
|
30
|
+
def show(data, options)
|
31
|
+
clear_screen()
|
32
|
+
puts "Total posts:".ljust(50) + "#{data.count}" + "\n\n"
|
33
|
+
puts "Without mentions:".ljust(50) + "#{data.without_mentions}" + "\n\n"
|
34
|
+
puts "Directed to a user:".ljust(50) + "#{data.leadings}" + "\n\n"
|
35
|
+
puts "Containing mentions but not directed:".ljust(50) + "#{data.mentions_not_directed}" + "\n\n"
|
36
|
+
puts "Containing mentions and are replies:".ljust(50) + "#{data.replies}" + "\n\n"
|
37
|
+
puts "Containing mentions and are not replies:".ljust(50) + "#{data.mentions_not_replies}" + "\n\n"
|
38
|
+
puts "Containing links:".ljust(50) + "#{data.with_links}" + "\n\n"
|
39
|
+
puts "Times your posts have been reposted:".ljust(50) + "#{data.reposts}" + "\n\n"
|
40
|
+
puts "Times your posts have been starred:".ljust(50) + "#{data.stars}" + "\n\n"
|
41
|
+
puts "Users you've posted directly to:".ljust(50) + "#{data.directed_users.size}" + "\n\n"
|
42
|
+
puts "Users you've mentioned:".ljust(50) + "#{data.names.size}" + "\n\n"
|
43
|
+
puts "You've posted with #{data.clients.size} clients:\n\n#{data.sources.reverse.join(', ')}" + "\n\n"
|
44
|
+
if options["full"]
|
45
|
+
puts "Your posted links:".ljust(50) + "#{data.all_links.join(', ')}" + "\n\n"
|
46
|
+
puts "Users you've posted directly to: #{data.directed_users.reverse.join(', ')}" + "\n\n"
|
47
|
+
puts "Users you've mentioned: #{data.names.reverse.join(', ')}" + "\n\n"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
25
51
|
end
|
26
52
|
end
|
data/lib/ADNCV/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adncv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Dejonckheere
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|