pry-send_tweet.rb 0.3.0 → 0.4.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +6 -1
- data/lib/pry-send_tweet.rb +16 -3
- data/pry-send_tweet.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1ea12e85df53a86fb132f2742e161b385c3d3fcecd8d2be8a5d46ed5c17e303
|
4
|
+
data.tar.gz: 551b008e811ba767defb60ec07ef8760e3b11e9f1e3b014ece1364ce1cbddf27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f049151c4f2ae0e2cc620f4ac00407a9cdeb640926173889a18d4bd0b49e3ba8b6b9462cf59ec13b5124fbfd02118fa6a6238260701cb04ead4bcf61fa0bcd4
|
7
|
+
data.tar.gz: 5a371218f0153b93afc3b16c95aa034ef801072658efa339cdf8bf12c1adaa09cd496ea20043fec155adc56342d36518a343795f9b3f11942b25e2b0659eee61
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -31,13 +31,18 @@ end
|
|
31
31
|
|
32
32
|
__1.__
|
33
33
|
|
34
|
-
|
34
|
+
Send a tweet:
|
35
35
|
|
36
36
|
[1] pry(main)> send-tweet
|
37
37
|
# Your editor opens (`_pry_.editor`), compose a tweet then hit save & close.
|
38
38
|
# You'll then get the url for your tweet:
|
39
39
|
https://twitter.com/xxx/status/xxx
|
40
40
|
|
41
|
+
__2.__
|
42
|
+
|
43
|
+
Send a tweet with an image attached:
|
44
|
+
|
45
|
+
[1] pry(main)> send-tweet -f #{File.join ENV['HOME'], 'photos', 'WinnieThePooh.jpg'}
|
41
46
|
|
42
47
|
## Install
|
43
48
|
|
data/lib/pry-send_tweet.rb
CHANGED
@@ -4,11 +4,18 @@ Pry.commands.add_command Class.new(Pry::ClassCommand) {
|
|
4
4
|
match 'send-tweet'
|
5
5
|
command_options argument_required: false
|
6
6
|
banner <<-BANNER
|
7
|
-
send-tweet
|
7
|
+
send-tweet [options]
|
8
8
|
|
9
9
|
Send a tweet.
|
10
10
|
BANNER
|
11
11
|
|
12
|
+
def options(opts)
|
13
|
+
opts.on :f,
|
14
|
+
:file,
|
15
|
+
'A path to an image or other media to attach to a tweet',
|
16
|
+
argument: true
|
17
|
+
end
|
18
|
+
|
12
19
|
def process(*args)
|
13
20
|
if nil == _pry_.config.twitter
|
14
21
|
raise Pry::CommandError, "_pry_.config.twitter is nil!\n" \
|
@@ -24,7 +31,13 @@ Pry.commands.add_command Class.new(Pry::ClassCommand) {
|
|
24
31
|
tmp_file = Tempfile.new('pry-send_tweet')
|
25
32
|
Pry::Editor.new(_pry_).invoke_editor(tmp_file.path, 0)
|
26
33
|
tmp_file.rewind
|
27
|
-
|
34
|
+
if opts.f?
|
35
|
+
file = File.new opts[:f], 'r'
|
36
|
+
_pry_.output.puts client.update_with_media(tmp_file.read, file).url
|
37
|
+
file.close
|
38
|
+
else
|
39
|
+
_pry_.output.puts client.update(tmp_file.read).url
|
40
|
+
end
|
28
41
|
ensure
|
29
42
|
tmp_file.close
|
30
43
|
tmp_file.unlink
|
@@ -33,7 +46,7 @@ Pry.commands.add_command Class.new(Pry::ClassCommand) {
|
|
33
46
|
|
34
47
|
def client
|
35
48
|
@client ||= begin
|
36
|
-
Twitter::REST::Client.new {|config|
|
49
|
+
Twitter::REST::Client.new { |config|
|
37
50
|
config.consumer_key = _pry_.config.twitter.consumer_key
|
38
51
|
config.consumer_secret = _pry_.config.twitter.consumer_secret
|
39
52
|
config.access_token = _pry_.config.twitter.access_token
|
data/pry-send_tweet.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "pry-send_tweet.rb"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "0.4.0"
|
4
4
|
spec.authors = ["Robert Gleeson"]
|
5
5
|
spec.email = "trebor.g@protonmail.com"
|
6
6
|
spec.summary = "pry-send_tweet.rb adds a Pry command that can send tweets using your personal twitter account."
|