ruby-unfollow 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +12 -0
- data/Rakefile +0 -15
- data/VERSION +1 -1
- data/bin/ruby-unfollow +88 -83
- data/lib/ruby-unfollow.rb +7 -4
- data/ruby-unfollow.gemspec +2 -2
- 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: 0e655852c0fc6940cb711d690f34e33a29835736
|
4
|
+
data.tar.gz: cc19d5cb5b96318abe5d19d899d5f3fb2f30f1bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b609580c1c1c37d7c483632beabbc59fa87807040bd53a144e96bffa819d40473cfb4531f131f0aac0065531d97b1a7fe6caf1d2af91984c409fcea7e2ed58d
|
7
|
+
data.tar.gz: 34e75475902e2fe4bb0778881269fc0c79a5f75b6df6e81dcd4412d68395fa760248fca71861b3b29c25fac06d2324e1ada2cef2be3b359be395314bd7abf0ce
|
data/README.rdoc
CHANGED
@@ -1,7 +1,19 @@
|
|
1
1
|
= ruby-unfollow
|
2
2
|
|
3
|
+
{<img src="https://badge.fury.io/rb/ruby-unfollow.svg" alt="Gem Version" />}[http://badge.fury.io/rb/ruby-unfollow]
|
4
|
+
|
3
5
|
Automatically find unfollower and inactive user to unfollow
|
4
6
|
|
7
|
+
== Gem
|
8
|
+
|
9
|
+
https://rubygems.org/gems/ruby-unfollow
|
10
|
+
|
11
|
+
|
12
|
+
Installation:
|
13
|
+
|
14
|
+
$ gem install ruby-unfollow
|
15
|
+
|
16
|
+
|
5
17
|
== Contributing to ruby-unfollow
|
6
18
|
|
7
19
|
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
data/Rakefile
CHANGED
@@ -25,21 +25,6 @@ Jeweler::Tasks.new do |gem|
|
|
25
25
|
end
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
27
27
|
|
28
|
-
require 'rake/testtask'
|
29
|
-
Rake::TestTask.new(:test) do |test|
|
30
|
-
test.libs << 'lib' << 'test'
|
31
|
-
test.pattern = 'test/**/test_*.rb'
|
32
|
-
test.verbose = true
|
33
|
-
end
|
34
|
-
|
35
|
-
desc "Code coverage detail"
|
36
|
-
task :simplecov do
|
37
|
-
ENV['COVERAGE'] = "true"
|
38
|
-
Rake::Task['test'].execute
|
39
|
-
end
|
40
|
-
|
41
|
-
task :default => :test
|
42
|
-
|
43
28
|
require 'rdoc/task'
|
44
29
|
Rake::RDocTask.new do |rdoc|
|
45
30
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/bin/ruby-unfollow
CHANGED
@@ -6,104 +6,109 @@
|
|
6
6
|
require 'optparse'
|
7
7
|
require 'ruby-unfollow'
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
9
|
+
trap "SIGINT" do
|
10
|
+
puts "\nExiting ruby-unfollow. Bye~"
|
11
|
+
exit 130
|
12
|
+
end
|
13
|
+
|
14
|
+
#begin
|
15
|
+
options = OpenStruct.new
|
16
|
+
options.type = :all
|
17
|
+
options.unfollow = false
|
18
|
+
options.max_days = 15
|
19
|
+
options.list = 10
|
20
|
+
options.file = ""
|
21
|
+
|
22
|
+
opt_parser = OptionParser.new do |opts|
|
23
|
+
opts.banner = "Usage: ruby-unfollow [options]"
|
24
|
+
|
25
|
+
opts.separator ""
|
26
|
+
opts.separator "Specific options:"
|
27
|
+
|
28
|
+
opts.on("-s","--show TYPE", [:inactive, :unfollower, :and, :or, :all],
|
29
|
+
"Select follower type to show (inactive, unfollower, and, or, all)",
|
30
|
+
"and = inactive and unfollower","or = inactive or unfollower") do |t|
|
31
|
+
options.type = t
|
32
|
+
end
|
28
33
|
|
29
|
-
|
30
|
-
|
31
|
-
|
34
|
+
opts.on("-d","--day [DAY]", Float, "Select inactive days limit (default: 15 days)") do |d|
|
35
|
+
options.max_days = d
|
36
|
+
end
|
32
37
|
|
33
|
-
|
34
|
-
|
35
|
-
|
38
|
+
opts.on("-l", "--list [N]", Integer, "List users N by N (default: 10 users)") do |l|
|
39
|
+
options.list = l
|
40
|
+
end
|
36
41
|
|
37
|
-
|
38
|
-
|
39
|
-
|
42
|
+
opts.on("-F", "--file [FILE]", String, "Save follower to file") do |f|
|
43
|
+
options.file = f
|
44
|
+
end
|
40
45
|
|
41
|
-
|
42
|
-
|
43
|
-
|
46
|
+
opts.on("-u", "--[no-]unfollow", "Automatic unfollow") do |u|
|
47
|
+
options.unfollow = u
|
48
|
+
end
|
44
49
|
|
45
|
-
|
46
|
-
|
50
|
+
opts.separator ""
|
51
|
+
opts.separator "Common options:"
|
47
52
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
54
|
+
puts opts
|
55
|
+
exit
|
56
|
+
end
|
52
57
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
end
|
58
|
+
opts.on_tail("--version", "Show version") do
|
59
|
+
puts OptparseExample::Version.join('.')
|
60
|
+
exit
|
57
61
|
end
|
62
|
+
end
|
58
63
|
|
59
|
-
|
64
|
+
opt_parser.parse!(ARGV)
|
60
65
|
|
61
|
-
|
66
|
+
un = Unfollow::Unfollow.new(options)
|
62
67
|
|
63
|
-
|
64
|
-
|
65
|
-
|
68
|
+
if un.client.authorized? then
|
69
|
+
info=un.client.info()
|
70
|
+
un.username=info["screen_name"]
|
66
71
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
+
if un.exist_save? then
|
73
|
+
file_conf=JSON.parse(File.read("#{Dir.home}/.ruby-unfollow/unfollow.json"))
|
74
|
+
following=file_conf["following"]
|
75
|
+
follower=file_conf["follower"]
|
76
|
+
non_follower=file_conf["non_follower"]
|
72
77
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
follower,following,non_follower=un.get_unfollow()
|
77
|
-
end
|
78
|
-
else
|
78
|
+
# debug ahahah
|
79
|
+
#puts following.count.to_s+" "+info["friends_count"].to_s+" "+follower.count.to_s+" "+info["followers_count"].to_s
|
80
|
+
if following.count != info["friends_count"] || follower.count != info["followers_count"] then
|
79
81
|
follower,following,non_follower=un.get_unfollow()
|
80
82
|
end
|
81
|
-
|
82
|
-
|
83
|
-
puts "Follower: "+follower.count.to_s
|
84
|
-
puts "Unfollower: "+non_follower.count.to_s+"\n\n"
|
85
|
-
puts "Alert! ".red+"If you have a lot of follower this can take "+"LOT".red+" of time\n"
|
86
|
-
|
87
|
-
if un.options.type == :unfollower then
|
88
|
-
if un.options.list != nil && un.options.list != false then
|
89
|
-
un.non_follower_list(non_follower,un.options.list)
|
90
|
-
else
|
91
|
-
un.non_follower(non_follower)
|
92
|
-
end
|
93
|
-
elsif un.options.type == :inactive then
|
94
|
-
un.inactive(follower)
|
95
|
-
elsif un.options.type == :and then
|
96
|
-
un.non_follower(non_follower,:and)
|
97
|
-
elsif un.options.type == :or then
|
98
|
-
un.or_follower(following,non_follower)
|
99
|
-
elsif un.options.type == :all then
|
100
|
-
un.following(following,non_follower)
|
101
|
-
end
|
102
|
-
else
|
103
|
-
puts "Auth Error:".red+" authorized? "+un.client.authorized?.to_s
|
104
|
-
un = Unfollow.new(arg)
|
105
|
-
puts "Please restart this program!"
|
83
|
+
else
|
84
|
+
follower,following,non_follower=un.get_unfollow()
|
106
85
|
end
|
86
|
+
puts "Stats: "+un.username.green
|
87
|
+
puts "Following: "+following.count.to_s
|
88
|
+
puts "Follower: "+follower.count.to_s
|
89
|
+
puts "Unfollower: "+non_follower.count.to_s+"\n\n"
|
90
|
+
puts "Alert! ".red+"If you have a lot of follower this can take "+"LOT".red+" of time\nTo exit type ^C\n"
|
91
|
+
|
92
|
+
puts "List: "
|
93
|
+
if un.options.type == :unfollower then
|
94
|
+
if un.options.list != nil && un.options.list != false then
|
95
|
+
un.non_follower_list(non_follower,un.options.list)
|
96
|
+
else
|
97
|
+
un.non_follower(non_follower)
|
98
|
+
end
|
99
|
+
elsif un.options.type == :inactive then
|
100
|
+
un.inactive(follower)
|
101
|
+
elsif un.options.type == :and then
|
102
|
+
un.non_follower(non_follower,:and)
|
103
|
+
elsif un.options.type == :or then
|
104
|
+
un.or_follower(following,non_follower)
|
105
|
+
elsif un.options.type == :all then
|
106
|
+
un.following(following,non_follower)
|
107
|
+
end
|
108
|
+
else
|
109
|
+
puts "Auth Error:".red+" authorized? "+un.client.authorized?.to_s
|
110
|
+
puts "Please restart this program!"
|
111
|
+
end
|
107
112
|
#rescue => e
|
108
113
|
# puts "Alert! ".red+e.message.to_s
|
109
|
-
end
|
114
|
+
#end
|
data/lib/ruby-unfollow.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'fileutils'
|
1
2
|
require 'net/http'
|
2
3
|
require 'json'
|
3
4
|
require 'twitter_oauth'
|
@@ -13,7 +14,7 @@ end
|
|
13
14
|
|
14
15
|
module Unfollow
|
15
16
|
|
16
|
-
VERSION="0.0.
|
17
|
+
VERSION="0.0.6"
|
17
18
|
|
18
19
|
class Unfollow
|
19
20
|
attr_accessor :username, :client, :options
|
@@ -186,8 +187,8 @@ module Unfollow
|
|
186
187
|
if File.exist?(file) then
|
187
188
|
File.open(file, "a+") {|f| f.write(str+"\n") }
|
188
189
|
else
|
189
|
-
FileUtils.mkdir_p(file)
|
190
|
-
File.open(file, "w") {|f| f.write(str+"\n") }
|
190
|
+
FileUtils.mkdir_p(File.dirname(File.absolute_path(file)))
|
191
|
+
File.open(File.absolute_path(file), "w") {|f| f.write(str+"\n") }
|
191
192
|
end
|
192
193
|
end
|
193
194
|
else
|
@@ -216,7 +217,9 @@ module Unfollow
|
|
216
217
|
:token => conf["token"],
|
217
218
|
:secret => conf["secret"]
|
218
219
|
)
|
219
|
-
|
220
|
+
end
|
221
|
+
|
222
|
+
if ! @client.authorized? then
|
220
223
|
@client = TwitterOAuth::Client.new(
|
221
224
|
:consumer_key => "XegcON7xJ0ONDc16BijevA",
|
222
225
|
:consumer_secret => "ktFOJy92lgDKHkQhvUPmU3JM9oBI19UfhyeuUwhfVho"
|
data/ruby-unfollow.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: ruby-unfollow 0.0.
|
5
|
+
# stub: ruby-unfollow 0.0.6 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "ruby-unfollow"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.6"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|