pry-send_tweet.rb 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +5 -9
- data/lib/pry-send_tweet.rb +16 -5
- data/pry-send_tweet.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85531325d58b00ce100db9fccfaf9b065c54a120be53dc0ea007e1124203a3fb
|
4
|
+
data.tar.gz: de15dd71201380491e4cd2a4e571ca159b4bea2834d4a11364768a5d5053fcf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4f59a3d61d26ee4439ba8542ca5fb75879f6bd3c6ef5ce8653c35d4a91a80a079da14a622d5c6fc392c3ef80fe9b9359b3004e83e1dacca27bbd64f96f79cd0
|
7
|
+
data.tar.gz: 8d79e56d4caeaa08ee870a818eb9051a1d3ee2a9f18b5ad4e95d4119aef835c7f2c76104fa11856eb93ae2c5c0cabea0bea87f1be8ecb6aa7cc23633380b69b5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Twitter requires the following keys and tokens to do that:
|
|
10
10
|
|
11
11
|
* `consumer_key`, `consumer_secret`, `access_token`, `access_token_secret`
|
12
12
|
|
13
|
-
The required keys & tokens can be created on
|
13
|
+
The required keys & tokens can be created on Twitter by signing up for a
|
14
14
|
developer account and then creating an "app" for your account. This can be done
|
15
15
|
at [https://developer.twitter.com](https://developer.twitter.com).
|
16
16
|
|
@@ -33,15 +33,11 @@ __1.__
|
|
33
33
|
|
34
34
|
Sending a tweet:
|
35
35
|
|
36
|
-
[1] pry(main)> send-tweet
|
36
|
+
[1] pry(main)> send-tweet
|
37
|
+
# Your editor opens (`_pry_.editor`), compose a tweet then hit save & close.
|
38
|
+
# You'll then get the url for your tweet:
|
37
39
|
https://twitter.com/xxx/status/xxx
|
38
40
|
|
39
|
-
__2.__
|
40
|
-
|
41
|
-
Sending a tweet, with eval'ed ruby:
|
42
|
-
|
43
|
-
[2] pry(main)> send-tweet #{rand(100)}
|
44
|
-
https://twitter.com/xxx/status/xxx
|
45
41
|
|
46
42
|
## Install
|
47
43
|
|
@@ -49,4 +45,4 @@ Sending a tweet, with eval'ed ruby:
|
|
49
45
|
|
50
46
|
## License
|
51
47
|
|
52
|
-
[MIT](./LICENSE.txt)
|
48
|
+
[MIT](./LICENSE.txt)
|
data/lib/pry-send_tweet.rb
CHANGED
@@ -2,24 +2,35 @@ require 'pry' if not defined?(Pry::ClassCommand)
|
|
2
2
|
Pry.commands.add_command Class.new(Pry::ClassCommand) {
|
3
3
|
require 'twitter'
|
4
4
|
match 'send-tweet'
|
5
|
-
command_options argument_required:
|
5
|
+
command_options argument_required: false
|
6
6
|
banner <<-BANNER
|
7
|
-
send-tweet
|
7
|
+
send-tweet
|
8
8
|
|
9
9
|
Send a tweet.
|
10
10
|
BANNER
|
11
11
|
|
12
12
|
def process(*args)
|
13
|
-
if _pry_.config.twitter
|
13
|
+
if nil == _pry_.config.twitter
|
14
14
|
raise Pry::CommandError, "_pry_.config.twitter is nil!\n" \
|
15
15
|
"Please set the required keys and tokens to send " \
|
16
16
|
"tweets using Twitters API. \n" \
|
17
17
|
"Visit https://github.com/r-obert/pry-send_tweet.rb#readme to learn how."
|
18
18
|
end
|
19
|
-
|
20
|
-
_pry_.output.puts tweet.url
|
19
|
+
send_tweet_using_editor
|
21
20
|
end
|
22
21
|
|
22
|
+
private
|
23
|
+
def send_tweet_using_editor
|
24
|
+
tmp_file = Tempfile.new('pry-send_tweet')
|
25
|
+
Pry::Editor.new(_pry_).invoke_editor(tmp_file.path, 0)
|
26
|
+
tmp_file.rewind
|
27
|
+
_pry_.output.puts client.update(tmp_file.read).url
|
28
|
+
ensure
|
29
|
+
tmp_file.close
|
30
|
+
tmp_file.unlink
|
31
|
+
end
|
32
|
+
|
33
|
+
|
23
34
|
def client
|
24
35
|
@client ||= begin
|
25
36
|
Twitter::REST::Client.new {|config|
|
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.3.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."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-send_tweet.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Gleeson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|