alltweets 1.1.1 → 1.1.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: 5f3df4ff1aecd2551599fb8f12cf83081818d0f8
4
- data.tar.gz: 10f70e07aa24d15363c4f0c8cadbd37d56428f98
3
+ metadata.gz: cbc242aaa738c9ff355f6bf278eb9feb43bdc326
4
+ data.tar.gz: 4ff73009c35018981159be625d0002ac272356ac
5
5
  SHA512:
6
- metadata.gz: 7abc182054937b3df345880408ec54eb4216670aad6a32c8182bcbcc111e9c0f462f7c2813d8c206df7de984e2d4c3e37dc8c378e1b8a4fcbcc9575bd7307e69
7
- data.tar.gz: 2c27a6ac69d42f33b870fa6d23bf006fc96adadceafeb233ab54875f43b03e0b31a3ba1b24639c089d715dc0958805e9d45dfffdc3abc97874b269542af6c0d5
6
+ metadata.gz: 58ccb2e1643a564fef9acb0a8831c5a125e33a2739cca377e8c3a591d9a494050c66ba1054f212aad6601b28a06b271584c80e14ee968a54d4bdf324de5ded33
7
+ data.tar.gz: e687977c6f16cebb8aeba9443f53f732ebfc0dbe88edf6d0d3a57c8405c811c2ef309dc584cd73ea335f3055be72a3fd7d99e17f42da8665585a38631b29abd4
data/README.md CHANGED
@@ -12,7 +12,7 @@ $ gem install alltweets
12
12
 
13
13
  ### Commands
14
14
 
15
- * `alltweets <screen name>`: Download &lt;screen name&gt;'s all tweets.
15
+ * `alltweets [options] SCREEN_NAME`: Download SCREEN_NAME's all tweets.
16
16
 
17
17
  ### Options
18
18
 
@@ -1,6 +1,10 @@
1
1
  require "colorize"
2
2
  require "json"
3
- require "trollop"
3
+ require "optparse"
4
+ require "yaml"
5
+ require "alltweets/fetcher"
6
+ require "alltweets/settings"
7
+ require "alltweets/version"
4
8
 
5
9
  module AllTweets
6
10
  class CLI
@@ -18,9 +22,9 @@ module AllTweets
18
22
 
19
23
  def run
20
24
  warn "Downloading @#{@screen_name}'s all tweets"
21
- result = @fetcher.fetch_all_tweets(@screen_name, include_retweets: @opts[:retweets]).map(&:to_h)
25
+ result = @fetcher.fetch_all_tweets(@screen_name, include_retweets: @opts["retweets"]).map(&:to_h)
22
26
 
23
- if @opts[:yaml]
27
+ if @opts["yaml"]
24
28
  dump_data = YAML.dump(result)
25
29
  else
26
30
  dump_data = JSON.dump(result)
@@ -34,14 +38,31 @@ module AllTweets
34
38
 
35
39
  private
36
40
  def parse_args
37
- opts = Trollop::options do
38
- opt :retweets, "Include retweets"
39
- opt :yaml, "Use YAML instead of JSON"
40
- version "alltweets #{VERSION}"
41
+ opts = ARGV.getopts("", "retweets", "yaml", "help", "version")
42
+
43
+ if opts["help"]
44
+ puts <<EOS
45
+ alltweets #{VERSION}
46
+
47
+ Usage:
48
+ alltweets [options] SCREEN_NAME
49
+
50
+ Options:
51
+ -r, --retweets Include retweets
52
+ -y, --yaml Use YAML instead of JSON
53
+ -v, --version Print version and exit
54
+ -h, --help Show this message
55
+ EOS
56
+ exit
57
+ end
58
+
59
+ if opts["version"]
60
+ puts "alltweets #{VERSION}"
61
+ exit
41
62
  end
42
63
 
43
64
  unless ARGV.size == 1
44
- warn "usage: alltweets [options] <screen name>"
65
+ warn "usage: alltweets [options] SCREEN_NAME"
45
66
  exit 1
46
67
  end
47
68
 
@@ -1,3 +1,3 @@
1
1
  module AllTweets
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alltweets
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tatsuya Otsuka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-13 00:00:00.000000000 Z
11
+ date: 2016-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubyforge_project:
154
- rubygems_version: 2.6.6
154
+ rubygems_version: 2.6.8
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Downloads someone's all tweets.