stealth-favs 0.0.1 → 0.0.2

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: 52b9db129c357a1250d15e742478590f3985f848
4
- data.tar.gz: b204aec2cd8005568a5edfb3292c5609dfd3601c
3
+ metadata.gz: 546647d2ee324dc2b89b42be8e2036cc75c32510
4
+ data.tar.gz: 3d0e1113f17fd3d08f71de42eeb06d25de16dc0a
5
5
  SHA512:
6
- metadata.gz: c47098eb02eb0dcf5f8c2ff9e6f4e5b5731f82a2620afd74d5d34f12b1b42897b72cc098dbd604b7c3f95efd1a252858cc6623779c02b97b074eeec5eeee49a2
7
- data.tar.gz: 22a32a2fdf3fbf8455eb46da042b30e6be1e013f46365bb96a7412a640c68fb320ec5840e2a518537da0c2c97d7af6720620d1dbb36e118420d263be86a85988
6
+ metadata.gz: df2c93e5d26eab9764f3684cec0a38599d878899e279c2553bf4dc7ee59180d802166a1034bd6b8bee4a1f1a3055045811585929bece1eceb9c27d8c6aeafb64
7
+ data.tar.gz: 6aa030744bdc79bb0aef45d0004a0305b5be6f052dfcb7c55a8611ffbbbff1716c2873a5d240478c4283ac7d26e403283d5d2c40a7ff8066b3255de05bd3790c
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem 'twitter'
4
4
  gem 'thor'
5
+ gem 'activerecord'
5
6
 
6
7
  # Specify your gem's dependencies in stealth-favs.gemspec
7
8
  gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Stealth::Favs
2
2
 
3
- TODO: Write a gem description
3
+ Send many stealth-favorites to specific user or status on Twitter.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,8 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ $ stealth-favs user {USER_NAME} [NUM_OF_FAVS]
22
+ $ stealth-favs id {STATUS_ID} [NUM_OF_FAVS]
22
23
 
23
24
  ## Contributing
24
25
 
data/bin/stealth-favs CHANGED
@@ -6,6 +6,4 @@ require 'stealth_favs'
6
6
  #
7
7
  # executable
8
8
  #
9
- if __FILE__ == $0 then
10
- StealthFavs::App.start
11
- end
9
+ StealthFavs::App.start
data/lib/stealth_favs.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
- require 'thor'
4
-
5
3
  require "stealth_favs/version"
4
+ require "stealth_favs/main"
6
5
  require "stealth_favs/cli"
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'thor'
4
4
  require 'stealth_favs/main'
5
+ require 'active_record'
5
6
 
6
7
  module StealthFavs
7
8
 
@@ -10,7 +11,7 @@ module StealthFavs
10
11
 
11
12
  def self.def_command(name)
12
13
  define_method name do |*args|
13
- Main::__send__ "cmd_#{name}",options,*args
14
+ Main::__send__ "cmd_#{name}",*args,options.to_hash.symbolize_keys
14
15
  end
15
16
  end
16
17
 
@@ -18,14 +19,26 @@ module StealthFavs
18
19
  method_option :verbose, :type => :boolean, :aliases => '-v', :default => true, :desc => 'output result'
19
20
  end
20
21
 
22
+ def self.id_option
23
+ method_option :count, :type => :numeric, :aliases => '-c', :default => 20, :desc => 'number of favs'
24
+ end
25
+
26
+ def self.interval_option
27
+ method_option :interval, :type => :numeric, :aliases => '-i', :default => 0.1, :desc => 'interval of favs [sec]'
28
+ end
29
+
21
30
  public
22
31
 
23
32
  desc 'user [USER]', 'stealth favs to USER'
24
33
  verbose_option
34
+ id_option
35
+ interval_option
25
36
  def_command :user
26
37
 
27
38
  desc 'id [STATUS ID]', 'stealth favs to STATUS'
28
39
  verbose_option
40
+ id_option
41
+ interval_option
29
42
  def_command :id
30
43
  end
31
44
 
@@ -23,15 +23,15 @@ module StealthFavs
23
23
 
24
24
  private :config_twitter
25
25
 
26
- def cmd_id(opts, id, num_times = 20)
26
+ def cmd_id(id, verbose: true, count: 20, interval: 0.1)
27
27
  cl = config_twitter
28
- (1..num_times).each do |i|
28
+ (1..count).each do |i|
29
29
  cl.favorite id
30
- puts "[#{i}] Favorited status #{id}" if opts[:verbose]
31
- sleep 0.1
30
+ puts "[#{i}] Favorited status #{id}" if verbose
31
+ sleep interval
32
32
  cl.unfavorite id
33
- puts "[#{i}] Unfavorited status #{id}" if opts[:verbose]
34
- sleep 0.1
33
+ puts "[#{i}] Unfavorited status #{id}" if verbose
34
+ sleep interval
35
35
  end
36
36
  rescue Twitter::Error::NotFound => e
37
37
  STDERR.puts "status is not found"
@@ -41,16 +41,16 @@ module StealthFavs
41
41
  raise e
42
42
  end
43
43
 
44
- def cmd_user(opts, name, num_times = 20)
44
+ def cmd_user(name, verbose: true, count: 20, interval: 0.1)
45
45
  cl = config_twitter
46
46
  begin
47
47
  id = cl.user_timeline(name).first.id
48
- puts "A target status is #{id}." if opts[:verbose]
48
+ puts "A target status is #{id}." if verbose
49
49
  rescue Twitter::Error::NotFound => e
50
50
  STDERR.puts "user is not found"
51
51
  raise e
52
52
  end
53
- cmd_id opts, id, num_times
53
+ cmd_id id, verbose: verbose, count: count, interval: interval
54
54
  end
55
55
 
56
56
  end # module Main
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module StealthFavs
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stealth-favs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rhysd
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-30 00:00:00.000000000 Z
11
+ date: 2013-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler