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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b96f7a18e27638f83bd1e64baa96bae13e0bbad3
4
- data.tar.gz: a6795233d5cb394a55fed0044c8181e42a3c5183
3
+ metadata.gz: 0e655852c0fc6940cb711d690f34e33a29835736
4
+ data.tar.gz: cc19d5cb5b96318abe5d19d899d5f3fb2f30f1bd
5
5
  SHA512:
6
- metadata.gz: ada6058ab93e308840fde62d63742e00e6bd71fab9028b1b7fb5992d04b0e5da3d7e5d6c54e34cb40affec6a829c3263e7cdf16305a08edaee72af03facd0008
7
- data.tar.gz: c5ba35c86c3b4c192fcb4a1a1fc727636555c5b0b25f22fdb076d90f60df3cd0e5ac675427e2c51cbc8701cf0e5c3396c8901ce9bff2c926eeaba7889b2226b2
6
+ metadata.gz: 0b609580c1c1c37d7c483632beabbc59fa87807040bd53a144e96bffa819d40473cfb4531f131f0aac0065531d97b1a7fe6caf1d2af91984c409fcea7e2ed58d
7
+ data.tar.gz: 34e75475902e2fe4bb0778881269fc0c79a5f75b6df6e81dcd4412d68395fa760248fca71861b3b29c25fac06d2324e1ada2cef2be3b359be395314bd7abf0ce
@@ -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.5
1
+ 0.0.6
@@ -6,104 +6,109 @@
6
6
  require 'optparse'
7
7
  require 'ruby-unfollow'
8
8
 
9
- begin
10
- options = OpenStruct.new
11
- options.type = :all
12
- options.unfollow = false
13
- options.max_days = 15
14
- options.list = 10
15
- options.file = ""
16
-
17
- opt_parser = OptionParser.new do |opts|
18
- opts.banner = "Usage: ruby-unfollow [options]"
19
-
20
- opts.separator ""
21
- opts.separator "Specific options:"
22
-
23
- opts.on("-s","--show TYPE", [:inactive, :unfollower, :and, :or, :all],
24
- "Select follower type to show (inactive, unfollower, and, or, all)",
25
- "and = inactive and unfollower","or = inactive or unfollower") do |t|
26
- options.type = t
27
- end
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
- opts.on("-d","--day [DAY]", Float, "Select inactive days limit (default: 15 days)") do |d|
30
- options.max_days = d
31
- end
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
- opts.on("-l", "--list [N]", Integer, "List users N by N (default: 10 users)") do |l|
34
- options.list = l
35
- end
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
- opts.on("-F", "--file [FILE]", String, "Save follower to file") do |f|
38
- options.file = f
39
- end
42
+ opts.on("-F", "--file [FILE]", String, "Save follower to file") do |f|
43
+ options.file = f
44
+ end
40
45
 
41
- opts.on("-u", "--[no-]unfollow", "Automatic unfollow") do |u|
42
- options.unfollow = u
43
- end
46
+ opts.on("-u", "--[no-]unfollow", "Automatic unfollow") do |u|
47
+ options.unfollow = u
48
+ end
44
49
 
45
- opts.separator ""
46
- opts.separator "Common options:"
50
+ opts.separator ""
51
+ opts.separator "Common options:"
47
52
 
48
- opts.on_tail("-h", "--help", "Show this message") do
49
- puts opts
50
- exit
51
- end
53
+ opts.on_tail("-h", "--help", "Show this message") do
54
+ puts opts
55
+ exit
56
+ end
52
57
 
53
- opts.on_tail("--version", "Show version") do
54
- puts OptparseExample::Version.join('.')
55
- exit
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
- opt_parser.parse!(ARGV)
64
+ opt_parser.parse!(ARGV)
60
65
 
61
- un = Unfollow::Unfollow.new(options)
66
+ un = Unfollow::Unfollow.new(options)
62
67
 
63
- if un.client.authorized? then
64
- info=un.client.info()
65
- un.username=info["screen_name"]
68
+ if un.client.authorized? then
69
+ info=un.client.info()
70
+ un.username=info["screen_name"]
66
71
 
67
- if un.exist_save? then
68
- file_conf=JSON.parse(File.read("#{Dir.home}/.ruby-unfollow/unfollow.json"))
69
- following=file_conf["following"]
70
- follower=file_conf["follower"]
71
- non_follower=file_conf["non_follower"]
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
- # debug ahahah
74
- #puts following.count.to_s+" "+info["friends_count"].to_s+" "+follower.count.to_s+" "+info["followers_count"].to_s
75
- if following.count != info["friends_count"] || follower.count != info["followers_count"] then
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
- puts "Stats: "+un.username.green
82
- puts "Following: "+following.count.to_s
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
@@ -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.5"
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
- else
220
+ end
221
+
222
+ if ! @client.authorized? then
220
223
  @client = TwitterOAuth::Client.new(
221
224
  :consumer_key => "XegcON7xJ0ONDc16BijevA",
222
225
  :consumer_secret => "ktFOJy92lgDKHkQhvUPmU3JM9oBI19UfhyeuUwhfVho"
@@ -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 ruby lib
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.5"
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"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-unfollow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - thez3ro