kimotter 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/bin/kimotter +35 -38
  2. metadata +2 -2
data/bin/kimotter CHANGED
@@ -1,50 +1,47 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: utf-8
3
- $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
3
+ # $LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), "../lib"))
4
4
  require 'kimotter'
5
5
  require 'logger'
6
+ require 'optparse'
6
7
 
7
- if $0 == __FILE__
8
- require 'optparse'
9
- options = {}
10
- OptionParser.new{ |opts|
11
- opts.banner = "Usage: #{$0} [options] tweet_message"
12
- opts.on("-d", "--debug", "Debug Mode"){ |v|
13
- options[:debug_mode] = true
14
- }
15
- opts.on("-f", "--force", "Force execute, ignore api limit"){ |v|
16
- options[:force_execute] = true
17
- }
18
- }.parse!
8
+ options = {}
9
+ OptionParser.new{ |opts|
10
+ opts.banner = "Usage: #{$0} [options] tweet_message"
11
+ opts.on("-d", "--debug", "Debug Mode"){ |v|
12
+ options[:debug_mode] = true
13
+ }
14
+ opts.on("-f", "--force", "Force execute, ignore api limit"){ |v|
15
+ options[:force_execute] = true
16
+ }
17
+ }.parse!
19
18
 
20
- message = ARGV.shift
21
- raise "argument error" unless message
19
+ message = ARGV.shift
20
+ raise "argument error" unless message
22
21
 
23
- logger = options[:debug_mode] ? Logger.new(STDERR) : Logger.new(nil)
24
- kimotter = Kimotter.new(:logger => logger)
22
+ logger = options[:debug_mode] ? Logger.new(STDERR) : Logger.new(nil)
23
+ kimotter = Kimotter.new(:logger => logger)
25
24
 
26
- kimotter.fetch_api_limit
27
- if !options[:force_execute] and kimotter.api_limit?
28
- puts "u cant use this api now(api limit)"
29
- puts "try again later or retry with --force option (ignore API limit)"
30
- exit(1)
31
- end
25
+ kimotter.fetch_api_limit
26
+ if !options[:force_execute] and kimotter.api_limit?
27
+ puts "u cant use this api now(api limit)"
28
+ puts "try again later or retry with --force option (ignore API limit)"
29
+ exit(1)
30
+ end
32
31
 
33
- print kimotter.confirm_msg + "[y/N] "
34
- if user_input_line = $stdin.gets
35
- if user_input_line =~ /^(yes|y)$/i
36
- puts "hi kimoto. try to tweet your message"
37
- puts message
38
- kimotter.tweet(message)
39
- puts "done"
40
- exit(0)
41
- else
42
- puts "u guys so fucking retard"
43
- exit(3)
44
- end
32
+ print kimotter.confirm_msg + "[y/N] "
33
+ if user_input_line = $stdin.gets
34
+ if user_input_line =~ /^(yes|y)$/i
35
+ puts "hi kimoto. try to tweet your message"
36
+ puts message
37
+ kimotter.tweet(message)
38
+ puts "done"
39
+ exit(0)
45
40
  else
46
- puts "omg?"
47
- exit(2)
41
+ puts "u guys so fucking retard"
42
+ exit(3)
48
43
  end
44
+ else
45
+ puts "omg?"
46
+ exit(2)
49
47
  end
50
-
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - kimoto