tweetskim 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,12 +25,16 @@ tweets in your timeline, one on each line.
25
25
 
26
26
  Options:
27
27
 
28
+ -a, --show-all Show all tweets (200max), not just unread tweets
29
+
28
30
  -e, --mentions: Show mentions instead of timeline
29
31
 
30
32
  -i, --inverse-order Inverse/reverse ordered tweets
31
33
 
32
34
  -h, --help Help page
33
35
 
36
+ -m, --mark-all-read Mark everything up to now as read
37
+
34
38
  -n, --last-n-tweets N Show the last N tweets in your timeline
35
39
 
36
40
  -o, --output-mode MODE Output as 'lines', 'column' or 'html'
@@ -57,13 +61,6 @@ TODO:
57
61
  =====
58
62
 
59
63
 
60
- mark-read
61
- ----
62
-
63
- Support -m mark-as-read flag, to toggle "I've read all up till now,
64
- next time only show new stuff"
65
-
66
-
67
64
  show status identifier
68
65
  ----
69
66
 
data/bin/tweetskim CHANGED
@@ -8,7 +8,7 @@ def parse_options
8
8
  options = {}
9
9
 
10
10
  OptionParser.new do |o|
11
- o.on("-a", "--show-all", "Show all tweets, not just unread ones (max 300)") { |b| options[:show_all] = b }
11
+ o.on("-a", "--show-all", "Show all tweets, not just unread ones (max 200)") { |b| options[:show_all] = b }
12
12
  o.on("-e", "--mentions", "Show mentions instead of timeline") { |b| options[:mentions] = b }
13
13
  o.on("-i", "--inverse-order", "Inverse/reverse ordered tweets") { |b| options[:inverse_order] = b }
14
14
  o.on("-h", "--help", "Help page") { puts o; exit }
@@ -34,18 +34,18 @@ def fetch_tweets(options = {})
34
34
  since_id = settings.load_last_read_status_id
35
35
  end
36
36
 
37
- tweet_count = options[:last_n_tweets] || 15
37
+ tweet_count = options[:last_n_tweets] || 10
38
38
  if options[:mentions]
39
39
  tweets = adapter.mentions(tweet_count, since_id)
40
40
  else
41
41
  tweets = adapter.timeline(tweet_count, since_id)
42
42
  end
43
-
43
+ last_tweet = tweets.first
44
+
44
45
  if options[:inverse_order]
45
46
  tweets = tweets.reverse
46
47
  end
47
48
 
48
- last_tweet = tweets.sort { |t| t.id }.last
49
49
  if options[:mark_all_read] && last_tweet
50
50
  settings.save_last_read_status_id(last_tweet.id)
51
51
  end
@@ -74,5 +74,4 @@ end
74
74
 
75
75
  options = parse_options
76
76
  tweets = fetch_tweets(options)
77
- #TODO create result first, send that. Dont put errors in stdout.
78
77
  write_tweets_to_stdout(tweets, options)
@@ -32,17 +32,20 @@ module Tweetskim
32
32
  class Settings
33
33
  SETTINGS_TEMPLATE = {:token => nil,
34
34
  :secret => nil,
35
- :last_read_status_id => "0"}
35
+ :last_read_status_id => "111111"}
36
36
 
37
37
  SETTINGS_FILE_PATH = File.expand_path "~/.tweetskim/default-account"
38
38
 
39
39
  def initialize
40
- if !Dir[" ~/.tweetskim/"].empty?
41
- `mkdir ~/.tweetskim/`
40
+ if !Dir[" ~/.tweetskim"].empty?
41
+ `mkdir ~/.tweetskim`
42
42
  end
43
43
  end
44
44
 
45
45
  def load
46
+ if !File.exists? SETTINGS_FILE_PATH
47
+ `touch #{SETTINGS_FILE_PATH}`
48
+ end
46
49
  yml_str = `cat #{SETTINGS_FILE_PATH}`
47
50
  YAML::load(yml_str) || SETTINGS_TEMPLATE
48
51
  end
@@ -1,3 +1,3 @@
1
1
  module Tweetskim
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
metadata CHANGED
@@ -1,68 +1,89 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: tweetskim
3
- version: !ruby/object:Gem::Version
4
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 15
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Thomas Kjeldahl Nilsson
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-03-05 00:00:00.000000000Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-03-05 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
15
22
  name: twitter
16
- requirement: &15805940 !ruby/object:Gem::Requirement
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
17
25
  none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
22
33
  type: :runtime
23
- prerelease: false
24
- version_requirements: *15805940
25
- - !ruby/object:Gem::Dependency
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
26
36
  name: oauth
27
- requirement: &15805520 !ruby/object:Gem::Requirement
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
28
39
  none: false
29
- requirements:
30
- - - ! '>='
31
- - !ruby/object:Gem::Version
32
- version: '0'
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
33
47
  type: :runtime
34
- prerelease: false
35
- version_requirements: *15805520
36
- - !ruby/object:Gem::Dependency
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
37
50
  name: OptionParser
38
- requirement: &15805100 !ruby/object:Gem::Requirement
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
39
53
  none: false
40
- requirements:
41
- - - ! '>='
42
- - !ruby/object:Gem::Version
43
- version: '0'
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
44
61
  type: :runtime
45
- prerelease: false
46
- version_requirements: *15805100
47
- - !ruby/object:Gem::Dependency
62
+ version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
48
64
  name: mocha
49
- requirement: &15804680 !ruby/object:Gem::Requirement
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
50
67
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
55
75
  type: :development
56
- prerelease: false
57
- version_requirements: *15804680
58
- description: ! 'Usage: tweetskim [username]'
59
- email:
76
+ version_requirements: *id004
77
+ description: "Usage: tweetskim [username]"
78
+ email:
60
79
  - thomas@kjeldahlnilsson.net
61
- executables:
80
+ executables:
62
81
  - tweetskim
63
82
  extensions: []
83
+
64
84
  extra_rdoc_files: []
65
- files:
85
+
86
+ files:
66
87
  - .gitignore
67
88
  - Gemfile
68
89
  - README.md
@@ -74,28 +95,39 @@ files:
74
95
  - test/test_helper.rb
75
96
  - test/test_tweetskim.rb
76
97
  - tweetskim.gemspec
77
- homepage: ''
98
+ has_rdoc: true
99
+ homepage: ""
78
100
  licenses: []
101
+
79
102
  post_install_message:
80
103
  rdoc_options: []
81
- require_paths:
104
+
105
+ require_paths:
82
106
  - lib
83
- required_ruby_version: !ruby/object:Gem::Requirement
107
+ required_ruby_version: !ruby/object:Gem::Requirement
84
108
  none: false
85
- requirements:
86
- - - ! '>='
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ hash: 3
113
+ segments:
114
+ - 0
115
+ version: "0"
116
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
117
  none: false
91
- requirements:
92
- - - ! '>='
93
- - !ruby/object:Gem::Version
94
- version: '0'
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ hash: 3
122
+ segments:
123
+ - 0
124
+ version: "0"
95
125
  requirements: []
126
+
96
127
  rubyforge_project: tweetskim
97
- rubygems_version: 1.8.15
128
+ rubygems_version: 1.4.2
98
129
  signing_key:
99
130
  specification_version: 3
100
131
  summary: A stripped down CLI utility for reading tweets
101
132
  test_files: []
133
+