augury 0.2.0 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +10 -0
- data/.gitignore +5 -2
- data/.rubocop.yml +45 -0
- data/.solargraph.yml +15 -0
- data/.travis.yml +14 -2
- data/CHANGELOG.md +37 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +179 -0
- data/README.md +144 -40
- data/Rakefile +5 -3
- data/TODO.md +1 -2
- data/augury.gemspec +16 -34
- data/bin/console +2 -0
- data/bin/extract_creds +7 -0
- data/bin/setup +1 -3
- data/lib/augury.rb +3 -2
- data/lib/augury/cli.rb +72 -15
- data/lib/augury/exception.rb +3 -1
- data/lib/augury/fortune.rb +56 -32
- data/lib/augury/version.rb +3 -1
- metadata +23 -322
data/Rakefile
CHANGED
data/TODO.md
CHANGED
@@ -4,8 +4,7 @@ Some ideas for things that could be added:
|
|
4
4
|
|
5
5
|
- Add an option to limit the tweets from a certain date forward.
|
6
6
|
This would allow for adding the latest tweets via cron.
|
7
|
-
- Add options for how many tweets to retrieve
|
8
7
|
- Ask user for twitter config on first start, save it out
|
9
|
-
- Sign each entry with the name of the twitter account
|
10
8
|
- Series of regex that could be applied.
|
11
9
|
This would be a way to make SeinfeldToday dialog get put on their own lines.
|
10
|
+
- Different word wrapping options. To a width, or by sentence, or whatever.
|
data/augury.gemspec
CHANGED
@@ -1,45 +1,27 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
require 'augury/version'
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/augury/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
6
|
+
spec.name = 'augury'
|
8
7
|
spec.version = Augury::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
8
|
+
spec.authors = ['Clayton Parker']
|
9
|
+
spec.email = ['robots@claytron.com']
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
14
|
-
spec.homepage =
|
15
|
-
spec.license =
|
11
|
+
spec.summary = 'Turn a twitter feed into a fortune file'
|
12
|
+
spec.description = 'This gem turns a twitter feed into a fortune file that you can use with the fortune program'
|
13
|
+
spec.homepage = 'https://github.com/claytron/augury'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
16
16
|
|
17
17
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir =
|
18
|
+
spec.bindir = 'exe'
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = [
|
20
|
+
spec.require_paths = ['lib']
|
21
21
|
|
22
22
|
# Actual dependencies
|
23
|
-
spec.add_dependency
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency "twitter"
|
26
|
-
## Handle booleans from simple config
|
27
|
-
spec.add_dependency "wannabe_bool"
|
23
|
+
spec.add_dependency 'thor', '~>1.0'
|
24
|
+
spec.add_dependency 'twitter', '~>7.0'
|
28
25
|
## For the word_wrap function
|
29
|
-
spec.add_dependency
|
30
|
-
|
31
|
-
# Development dependencies
|
32
|
-
## Setup
|
33
|
-
spec.add_development_dependency "bundler", "~> 1.10"
|
34
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
35
|
-
## Testing
|
36
|
-
spec.add_development_dependency "rspec"
|
37
|
-
spec.add_development_dependency "cucumber"
|
38
|
-
spec.add_development_dependency "aruba"
|
39
|
-
## Debugging
|
40
|
-
spec.add_development_dependency "pry"
|
41
|
-
spec.add_development_dependency 'pry-stack_explorer'
|
42
|
-
spec.add_development_dependency 'pry-byebug'
|
43
|
-
spec.add_development_dependency 'pry-doc'
|
44
|
-
spec.add_development_dependency 'pry-awesome_print'
|
26
|
+
spec.add_dependency 'facets', '~>3.0'
|
45
27
|
end
|
data/bin/console
CHANGED
data/bin/extract_creds
ADDED
data/bin/setup
CHANGED
data/lib/augury.rb
CHANGED
data/lib/augury/cli.rb
CHANGED
@@ -1,27 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
4
|
+
require 'yaml'
|
2
5
|
require 'augury'
|
3
6
|
|
4
7
|
module Augury
|
5
8
|
class CLI < Thor
|
6
9
|
desc 'generate USERNAME [PATH]', 'Generate a fortune file for the given username'
|
7
|
-
|
8
|
-
option :
|
10
|
+
|
11
|
+
option :width,
|
12
|
+
type: :numeric,
|
13
|
+
aliases: '-w',
|
14
|
+
desc: 'The maximum number of columns that will be written on a line. DEFAULT: 72'
|
15
|
+
|
16
|
+
option :append,
|
17
|
+
type: :boolean,
|
18
|
+
aliases: '-a',
|
19
|
+
desc: 'If set, the target path will be appended to instead of overwritten'
|
20
|
+
|
21
|
+
option :count,
|
22
|
+
type: :numeric,
|
23
|
+
aliases: '-c',
|
24
|
+
desc: 'The number of tweets to get. Set to 0 to get all. DEFAULT: 200'
|
25
|
+
|
26
|
+
option :retweets,
|
27
|
+
type: :boolean,
|
28
|
+
aliases: '-r',
|
29
|
+
desc: 'Include retweets. DEFAULT: false'
|
30
|
+
|
31
|
+
option :replies,
|
32
|
+
type: :boolean,
|
33
|
+
aliases: '-R',
|
34
|
+
desc: 'Include replies. DEFAULT: false'
|
35
|
+
|
36
|
+
option :links,
|
37
|
+
type: :boolean,
|
38
|
+
aliases: '-l',
|
39
|
+
desc: 'Include tweets with links in them. DEFAULT: false'
|
40
|
+
|
41
|
+
option :attribution,
|
42
|
+
type: :boolean,
|
43
|
+
aliases: '-A',
|
44
|
+
desc: 'Add an author attribution to each fortune. DEFAULT: false'
|
45
|
+
|
9
46
|
def generate(username, *path)
|
10
47
|
path = File.expand_path(path[0] || username)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
48
|
+
augury = Augury::Fortune.new(username, path, options)
|
49
|
+
augury.twitter_setup
|
50
|
+
augury.retrieve_tweets
|
51
|
+
augury.write_fortune
|
52
|
+
say "Fortune written out to #{path}"
|
53
|
+
rescue StandardError => e
|
54
|
+
say 'There was an error running the command. Details below:'
|
55
|
+
say e.message
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def options
|
62
|
+
original_options = super
|
63
|
+
defaults = Thor::CoreExt::HashWithIndifferentAccess.new(
|
64
|
+
{
|
65
|
+
width: 72,
|
66
|
+
append: false,
|
67
|
+
count: 200,
|
68
|
+
retweets: false,
|
69
|
+
replies: false,
|
70
|
+
links: false,
|
71
|
+
attribution: false,
|
72
|
+
},
|
73
|
+
)
|
74
|
+
|
75
|
+
config_path = File.expand_path('~/.augury.yml')
|
76
|
+
if File.file?(config_path)
|
77
|
+
config_options = Thor::CoreExt::HashWithIndifferentAccess.new(YAML.load_file(config_path) || {})
|
78
|
+
defaults = defaults.merge(config_options)
|
21
79
|
end
|
22
|
-
|
23
|
-
|
24
|
-
puts "Fortune written out to #{path}"
|
80
|
+
|
81
|
+
Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))
|
25
82
|
end
|
26
83
|
end
|
27
84
|
end
|
data/lib/augury/exception.rb
CHANGED
data/lib/augury/fortune.rb
CHANGED
@@ -1,55 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'cgi'
|
1
4
|
require 'facets/string/word_wrap'
|
2
|
-
require 'parseconfig'
|
3
5
|
require 'twitter'
|
4
|
-
require 'wannabe_bool'
|
5
6
|
|
6
7
|
module Augury
|
7
8
|
class Fortune
|
8
|
-
def initialize(username, path,
|
9
|
-
begin
|
10
|
-
@config = ParseConfig.new(File.expand_path('~/.augury.cfg'))
|
11
|
-
rescue Errno::EACCES
|
12
|
-
@config = ParseConfig.new
|
13
|
-
end
|
14
|
-
|
15
|
-
augury_config = @config.params['augury'] || {}
|
9
|
+
def initialize(username, path, config)
|
16
10
|
@username = username
|
17
11
|
@path = path
|
18
|
-
@
|
19
|
-
@
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
12
|
+
@config = config
|
13
|
+
@tweets = []
|
14
|
+
end
|
15
|
+
|
16
|
+
def collect_with_max_id(collection = [], max_id = nil, &block)
|
17
|
+
response = yield(max_id)
|
18
|
+
collection += response
|
19
|
+
if response.empty?
|
20
|
+
collection
|
21
|
+
elsif !@config[:count].zero? && collection.length >= @config[:count]
|
22
|
+
# Get everything or trim the results to the count
|
23
|
+
@config[:count].zero? ? collection : collection[0..@config[:count] - 1]
|
24
|
+
else
|
25
|
+
collect_with_max_id(collection, response.last.id - 1, &block)
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
|
-
def
|
32
|
-
@
|
29
|
+
def retrieve_tweets
|
30
|
+
@tweets = collect_with_max_id do |max_id|
|
31
|
+
options = {
|
32
|
+
count: 200,
|
33
|
+
include_rts: @config[:retweets],
|
34
|
+
exclude_replies: !@config[:replies],
|
35
|
+
}
|
36
|
+
options[:max_id] = max_id unless max_id.nil?
|
37
|
+
@twitter.user_timeline(@username, options)
|
38
|
+
end
|
39
|
+
rescue Twitter::Error::TooManyRequests => e
|
40
|
+
reset_length = e.rate_limit.reset_in + 1
|
41
|
+
puts "Twitter rate limit exceeded. Waiting #{reset_length} minute(s)"
|
42
|
+
sleep reset_length
|
33
43
|
end
|
34
44
|
|
35
|
-
def format_fortune
|
36
|
-
tweets.flat_map
|
45
|
+
def format_fortune
|
46
|
+
filtered = @tweets.flat_map(&:full_text).reject do |tweet|
|
47
|
+
tweet.match(/https?:/) unless @config[:links]
|
48
|
+
end
|
49
|
+
formatted = filtered.flat_map { |tweet| CGI.unescapeHTML(tweet).word_wrap(@config[:width]) }
|
50
|
+
author = @config[:attribution] ? "\n-- #{@twitter.user(@username).name}\n" : ''
|
51
|
+
formatted.join("#{author}%\n")
|
37
52
|
end
|
38
53
|
|
39
|
-
def write_fortune
|
54
|
+
def write_fortune
|
40
55
|
# Write out the file
|
41
56
|
begin
|
42
|
-
mode = @append ? 'a' : 'w'
|
57
|
+
mode = @config[:append] ? 'a' : 'w'
|
43
58
|
file = File.open(@path, mode)
|
44
|
-
file.write("%\n") if @append
|
45
|
-
file.write(
|
46
|
-
rescue IOError => e
|
47
|
-
puts e
|
59
|
+
file.write("%\n") if @config[:append]
|
60
|
+
file.write(format_fortune)
|
48
61
|
ensure
|
49
|
-
file
|
62
|
+
file&.close
|
50
63
|
end
|
51
64
|
# Create the dat file too
|
52
|
-
`strfile #{@path} #{@path}.dat`
|
65
|
+
`strfile '#{@path}' '#{@path}.dat'`
|
66
|
+
end
|
67
|
+
|
68
|
+
def twitter_setup
|
69
|
+
raise Augury::TwitterConfigError unless @config[:twitter]
|
70
|
+
|
71
|
+
@twitter = Twitter::REST::Client.new do |cfg|
|
72
|
+
cfg.consumer_key = @config[:twitter]['consumer_key']
|
73
|
+
cfg.consumer_secret = @config[:twitter]['consumer_secret']
|
74
|
+
cfg.access_token = @config[:twitter]['access_token']
|
75
|
+
cfg.access_token_secret = @config[:twitter]['access_token_secret']
|
76
|
+
end
|
53
77
|
end
|
54
78
|
end
|
55
79
|
end
|
data/lib/augury/version.rb
CHANGED
metadata
CHANGED
@@ -1,362 +1,59 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: augury
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Clayton Parker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: parseconfig
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: thor
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- - "
|
17
|
+
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
19
|
+
version: '1.0'
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- - "
|
24
|
+
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
26
|
+
version: '1.0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: twitter
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: wannabe_bool
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: facets
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: bundler
|
85
29
|
requirement: !ruby/object:Gem::Requirement
|
86
30
|
requirements:
|
87
31
|
- - "~>"
|
88
32
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
90
|
-
type: :
|
33
|
+
version: '7.0'
|
34
|
+
type: :runtime
|
91
35
|
prerelease: false
|
92
36
|
version_requirements: !ruby/object:Gem::Requirement
|
93
37
|
requirements:
|
94
38
|
- - "~>"
|
95
39
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
40
|
+
version: '7.0'
|
97
41
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
42
|
+
name: facets
|
99
43
|
requirement: !ruby/object:Gem::Requirement
|
100
44
|
requirements:
|
101
45
|
- - "~>"
|
102
46
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
104
|
-
type: :
|
47
|
+
version: '3.0'
|
48
|
+
type: :runtime
|
105
49
|
prerelease: false
|
106
50
|
version_requirements: !ruby/object:Gem::Requirement
|
107
51
|
requirements:
|
108
52
|
- - "~>"
|
109
53
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
|
112
|
-
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: cucumber
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: aruba
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: pry
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ">="
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ">="
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: pry-stack_explorer
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - ">="
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - ">="
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '0'
|
181
|
-
- !ruby/object:Gem::Dependency
|
182
|
-
name: pry-byebug
|
183
|
-
requirement: !ruby/object:Gem::Requirement
|
184
|
-
requirements:
|
185
|
-
- - ">="
|
186
|
-
- !ruby/object:Gem::Version
|
187
|
-
version: '0'
|
188
|
-
type: :development
|
189
|
-
prerelease: false
|
190
|
-
version_requirements: !ruby/object:Gem::Requirement
|
191
|
-
requirements:
|
192
|
-
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
version: '0'
|
195
|
-
- !ruby/object:Gem::Dependency
|
196
|
-
name: pry-doc
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - ">="
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '0'
|
202
|
-
type: :development
|
203
|
-
prerelease: false
|
204
|
-
version_requirements: !ruby/object:Gem::Requirement
|
205
|
-
requirements:
|
206
|
-
- - ">="
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
version: '0'
|
209
|
-
- !ruby/object:Gem::Dependency
|
210
|
-
name: pry-awesome_print
|
211
|
-
requirement: !ruby/object:Gem::Requirement
|
212
|
-
requirements:
|
213
|
-
- - ">="
|
214
|
-
- !ruby/object:Gem::Version
|
215
|
-
version: '0'
|
216
|
-
type: :development
|
217
|
-
prerelease: false
|
218
|
-
version_requirements: !ruby/object:Gem::Requirement
|
219
|
-
requirements:
|
220
|
-
- - ">="
|
221
|
-
- !ruby/object:Gem::Version
|
222
|
-
version: '0'
|
223
|
-
description: |
|
224
|
-
# Augury
|
225
|
-
|
226
|
-
Have you ever wanted to turn a twitter account into a fortune file?
|
227
|
-
Well, today is your lucky day!
|
228
|
-
|
229
|
-
Here is an example:
|
230
|
-
|
231
|
-
```
|
232
|
-
$ augury generate SeinfeldToday
|
233
|
-
```
|
234
|
-
|
235
|
-
This just created the fortune files in the current directory:
|
236
|
-
|
237
|
-
```
|
238
|
-
$ ls
|
239
|
-
SeinfeldToday SeinfeldToday.dat
|
240
|
-
```
|
241
|
-
|
242
|
-
You can now read the new fortunes!
|
243
|
-
|
244
|
-
```
|
245
|
-
$ fortune SeinfeldToday
|
246
|
-
Elaine has no idea what her BF does for a living and it's now too
|
247
|
-
late to ask. E:"Teacher, I think. Or a doctor? Wait Is
|
248
|
-
'computers' a job?"
|
249
|
-
```
|
250
|
-
|
251
|
-
Thanks for all the laughs fortune :)
|
252
|
-
|
253
|
-
## Installation
|
254
|
-
|
255
|
-
Add this line to your application's Gemfile:
|
256
|
-
|
257
|
-
```ruby
|
258
|
-
gem 'augury'
|
259
|
-
```
|
260
|
-
|
261
|
-
And then execute:
|
262
|
-
|
263
|
-
```
|
264
|
-
$ bundle
|
265
|
-
```
|
266
|
-
|
267
|
-
Or install it yourself as:
|
268
|
-
|
269
|
-
```
|
270
|
-
$ gem install augury
|
271
|
-
```
|
272
|
-
|
273
|
-
### Requirements
|
274
|
-
|
275
|
-
This gem requires that the fortune program is also installed.
|
276
|
-
The fortune program ships with a `strfile` program that converts the plain text files to something that fortune can select from.
|
277
|
-
|
278
|
-
For example,
|
279
|
-
if you are using Homebrew on OS X:
|
280
|
-
|
281
|
-
```
|
282
|
-
$ brew install fortune
|
283
|
-
```
|
284
|
-
|
285
|
-
## Configuration
|
286
|
-
|
287
|
-
### Augury Config
|
288
|
-
|
289
|
-
Create the `~/.augry.cfg` file and then set the permissions since your Twitter API info will be in there.
|
290
|
-
|
291
|
-
```sh
|
292
|
-
$ touch ~/.augury.cfg
|
293
|
-
$ chmod 600 ~/.augury.cfg
|
294
|
-
```
|
295
|
-
|
296
|
-
Set any of these settings in the `augury` section of the config like this:
|
297
|
-
|
298
|
-
```ini
|
299
|
-
[augury]
|
300
|
-
example_option = "An interesting value"
|
301
|
-
```
|
302
|
-
|
303
|
-
### Option list
|
304
|
-
|
305
|
-
These are the available options for the `~/.augury.cfg`
|
306
|
-
|
307
|
-
- `append` Make the script add more entries to the specified file instead of re-writing it. DEFAULT: False
|
308
|
-
- `width` Set the default width used if none is given on the command line. DEFAULT: 72
|
309
|
-
|
310
|
-
### Twitter Setup
|
311
|
-
|
312
|
-
First, you will need to create a new Twitter application by going here:
|
313
|
-
https://apps.twitter.com
|
314
|
-
|
315
|
-
This will give you the ability to generate the consumer and access information used below.
|
316
|
-
|
317
|
-
Add the following to your `~/.augury.cfg` file.
|
318
|
-
|
319
|
-
```ini
|
320
|
-
[twitter]
|
321
|
-
consumer_key = "YOUR_CONSUMER_KEY"
|
322
|
-
consumer_secret = "YOUR_CONSUMER_SECRET"
|
323
|
-
access_token = "YOUR_ACCESS_TOKEN"
|
324
|
-
access_token_secret = "YOUR_ACCESS_SECRET"
|
325
|
-
```
|
326
|
-
|
327
|
-
## Usage
|
328
|
-
|
329
|
-
Create a fortune for the latest SeinfeldToday tweets.
|
330
|
-
|
331
|
-
```
|
332
|
-
$ augury generate SeinfeldToday
|
333
|
-
```
|
334
|
-
|
335
|
-
Now you have some fortunes.
|
336
|
-
|
337
|
-
```
|
338
|
-
$ fortune SeinfeldToday
|
339
|
-
```
|
340
|
-
|
341
|
-
## Development
|
342
|
-
|
343
|
-
After checking out the repo, run `bin/setup` to install dependencies.
|
344
|
-
Then, run `rake spec` to run the tests.
|
345
|
-
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
346
|
-
|
347
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
348
|
-
To release a new version, update the version number in `version.rb`,
|
349
|
-
and then run `bundle exec rake release`,
|
350
|
-
which will create a git tag for the version,
|
351
|
-
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
352
|
-
|
353
|
-
## Contributing
|
354
|
-
|
355
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/claytron/augury.
|
356
|
-
|
357
|
-
## License
|
358
|
-
|
359
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
54
|
+
version: '3.0'
|
55
|
+
description: This gem turns a twitter feed into a fortune file that you can use with
|
56
|
+
the fortune program
|
360
57
|
email:
|
361
58
|
- robots@claytron.com
|
362
59
|
executables:
|
@@ -364,16 +61,22 @@ executables:
|
|
364
61
|
extensions: []
|
365
62
|
extra_rdoc_files: []
|
366
63
|
files:
|
64
|
+
- ".codeclimate.yml"
|
367
65
|
- ".gitignore"
|
368
66
|
- ".rspec"
|
67
|
+
- ".rubocop.yml"
|
68
|
+
- ".solargraph.yml"
|
369
69
|
- ".travis.yml"
|
70
|
+
- CHANGELOG.md
|
370
71
|
- Gemfile
|
72
|
+
- Gemfile.lock
|
371
73
|
- LICENSE.txt
|
372
74
|
- README.md
|
373
75
|
- Rakefile
|
374
76
|
- TODO.md
|
375
77
|
- augury.gemspec
|
376
78
|
- bin/console
|
79
|
+
- bin/extract_creds
|
377
80
|
- bin/setup
|
378
81
|
- exe/augury
|
379
82
|
- lib/augury.rb
|
@@ -393,17 +96,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
393
96
|
requirements:
|
394
97
|
- - ">="
|
395
98
|
- !ruby/object:Gem::Version
|
396
|
-
version:
|
99
|
+
version: 2.6.0
|
397
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
398
101
|
requirements:
|
399
102
|
- - ">="
|
400
103
|
- !ruby/object:Gem::Version
|
401
104
|
version: '0'
|
402
105
|
requirements: []
|
403
|
-
|
404
|
-
rubygems_version: 2.4.5
|
106
|
+
rubygems_version: 3.1.4
|
405
107
|
signing_key:
|
406
108
|
specification_version: 4
|
407
109
|
summary: Turn a twitter feed into a fortune file
|
408
110
|
test_files: []
|
409
|
-
has_rdoc:
|