lolcommits-tumblr 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +16 -0
- data/lib/lolcommits/plugin/tumblr.rb +22 -2
- data/lib/lolcommits/tumblr/version.rb +1 -1
- data/test/lolcommits/plugin/tumblr_test.rb +4 -3
- 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: 21b193b25080b02af4303dd41a7d3b174643a857a59b9c03c60952e8ba5168f5
|
4
|
+
data.tar.gz: 2655fde55aa048731e26a2b914ff25a7ffb5cc34da4e2d938ccc0525c8203eef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 570009e87da7aff703f8b9dd441c8a711cc2a0f7c3220518a641b99af005fd6f2471deadcbbf60d5dc1993be5628ca3b110b867208ab8a68b92ff0bf157c5da2
|
7
|
+
data.tar.gz: 4c90252169ae8658faf05f14eb3b205134f4682e5d8786d5afdff4f1740fa7d0c1e249963caeaf64f11c316517c90954a171db076b4c829e403b2bddf37f2e49
|
data/CHANGELOG.md
CHANGED
@@ -9,6 +9,10 @@ project adheres to [Semantic Versioning][Semver].
|
|
9
9
|
|
10
10
|
- Your contribution here!
|
11
11
|
|
12
|
+
## [0.4.1] - 2019-08-16
|
13
|
+
### Added
|
14
|
+
- allow erb captions, thanks to @xurizaemon
|
15
|
+
|
12
16
|
## [0.4.0] - 2019-05-20
|
13
17
|
### Changed
|
14
18
|
- lolcommits gem is a runtime dependency
|
@@ -63,7 +67,8 @@ project adheres to [Semantic Versioning][Semver].
|
|
63
67
|
### Changed
|
64
68
|
- Initial release
|
65
69
|
|
66
|
-
[Unreleased]: https://github.com/lolcommits/lolcommits-tumblr/compare/v0.4.
|
70
|
+
[Unreleased]: https://github.com/lolcommits/lolcommits-tumblr/compare/v0.4.1...HEAD
|
71
|
+
[0.4.1]: https://github.com/lolcommits/lolcommits-tumblr/compare/v0.4.0...v0.4.1
|
67
72
|
[0.4.0]: https://github.com/lolcommits/lolcommits-tumblr/compare/v0.3.0...v0.4.0
|
68
73
|
[0.3.0]: https://github.com/lolcommits/lolcommits-tumblr/compare/v0.2.0...v0.3.0
|
69
74
|
[0.2.0]: https://github.com/lolcommits/lolcommits-tumblr/compare/v0.1.1...v0.2.0
|
data/README.md
CHANGED
@@ -35,6 +35,7 @@ be asked to visit Tumblr to authenticate and allow access.
|
|
35
35
|
# set enabled to `true`
|
36
36
|
# confirm access for this plugin at tumblr.com (link opens automatically)
|
37
37
|
# click 'allow' then return to the console to set your Tumblr name
|
38
|
+
# optionally set a caption for each post (ERB friendly, see below)
|
38
39
|
# optionally set the plugin to auto-open each created Tumblr post
|
39
40
|
|
40
41
|
That's it! Your next lolcommit will automatically be posted to your
|
@@ -43,6 +44,21 @@ Tumblr blog. To disable use:
|
|
43
44
|
$ lolcommits --config -p tumblr
|
44
45
|
# and set enabled to `false`
|
45
46
|
|
47
|
+
### ERB friendly captions
|
48
|
+
|
49
|
+
When configuring this plugin, you may optionally set a caption string to for
|
50
|
+
each Tumblr post. The ERB bind has these variables available:
|
51
|
+
|
52
|
+
* `message` - commit message string
|
53
|
+
* `sha` - commit sha (shortened)
|
54
|
+
* `branch` - commit branch name
|
55
|
+
* `repo` - vcs respository name
|
56
|
+
* `vcs_info` - [vcs_info](https://github.com/lolcommits/lolcommits/blob/master/lib/lolcommits/vcs_info.rb) instance (from lolcommits)
|
57
|
+
|
58
|
+
Allowing you to set caption strings like this:
|
59
|
+
|
60
|
+
Committed <%= sha %> in <%= repo %> on <%= branch %> - <%= message %>
|
61
|
+
|
46
62
|
## Development
|
47
63
|
|
48
64
|
Check out this repo and run `bin/setup`, this will install all
|
@@ -5,6 +5,7 @@ require 'lolcommits/cli/launcher'
|
|
5
5
|
require 'oauth'
|
6
6
|
require 'webrick'
|
7
7
|
require 'cgi'
|
8
|
+
require 'erb'
|
8
9
|
require 'tumblr_client'
|
9
10
|
|
10
11
|
module Lolcommits
|
@@ -30,7 +31,8 @@ module Lolcommits
|
|
30
31
|
print "*** Posting to Tumblr ... "
|
31
32
|
post = client.photo(
|
32
33
|
configuration[:tumblr_name],
|
33
|
-
data: image_path
|
34
|
+
data: image_path,
|
35
|
+
caption: tumblr_caption
|
34
36
|
)
|
35
37
|
|
36
38
|
if post.key?('id')
|
@@ -123,9 +125,12 @@ module Lolcommits
|
|
123
125
|
def configure_tumblr
|
124
126
|
print "\n* What's your Tumblr name? (i.e. 'http://[THIS PART HERE].tumblr.com'): "
|
125
127
|
tumblr_name = parse_user_input(gets.strip)
|
128
|
+
print "\n* Optional caption (ERB friendly with vars message, sha, repo, branch, vcs_info)"
|
129
|
+
print "\n e.g. Committed <%= sha %> in <%= repo %> on <%= branch %> - <%= message %>\n\n"
|
130
|
+
caption_erb = parse_user_input(gets.strip)
|
126
131
|
print "\n* Automatically open Tumblr URL after posting (y/N): "
|
127
132
|
open_url = ask_yes_or_no?
|
128
|
-
{ tumblr_name: tumblr_name, open_url: open_url }
|
133
|
+
{ tumblr_name: tumblr_name, open_url: open_url, caption_erb: caption_erb }
|
129
134
|
end
|
130
135
|
|
131
136
|
def client
|
@@ -157,6 +162,21 @@ module Lolcommits
|
|
157
162
|
"https://#{configuration[:tumblr_name]}.tumblr.com/post/#{post['id']}"
|
158
163
|
end
|
159
164
|
|
165
|
+
def tumblr_caption
|
166
|
+
return if configuration[:caption_erb].to_s.strip.empty?
|
167
|
+
|
168
|
+
ERB.new(configuration[:caption_erb]).result(
|
169
|
+
binding.tap do |bind|
|
170
|
+
vcs_info = runner.vcs_info
|
171
|
+
bind.local_variable_set(:message, vcs_info.message)
|
172
|
+
bind.local_variable_set(:sha, vcs_info.sha)
|
173
|
+
bind.local_variable_set(:repo, vcs_info.repo)
|
174
|
+
bind.local_variable_set(:branch, vcs_info.branch)
|
175
|
+
bind.local_variable_set(:vcs_info, vcs_info)
|
176
|
+
end
|
177
|
+
)
|
178
|
+
end
|
179
|
+
|
160
180
|
def open_url(url)
|
161
181
|
Lolcommits::CLI::Launcher.open_url(url)
|
162
182
|
end
|
@@ -88,8 +88,8 @@ describe Lolcommits::Plugin::Tumblr do
|
|
88
88
|
# allow requests to localhost for this test
|
89
89
|
WebMock.disable_net_connect!(allow_localhost: true)
|
90
90
|
|
91
|
-
# enabled tumblr_name open_url
|
92
|
-
inputs =
|
91
|
+
# enabled tumblr_name caption_erb open_url
|
92
|
+
inputs = [true, 'my-tumblr', ' ', 'Y']
|
93
93
|
configured_plugin_options = {}
|
94
94
|
|
95
95
|
# stub Oauth token request flow
|
@@ -123,7 +123,8 @@ describe Lolcommits::Plugin::Tumblr do
|
|
123
123
|
access_token: "tumblr-access-token",
|
124
124
|
secret: "tumblr-secret",
|
125
125
|
tumblr_name: "my-tumblr",
|
126
|
-
open_url: true
|
126
|
+
open_url: true,
|
127
|
+
caption_erb: nil
|
127
128
|
})
|
128
129
|
|
129
130
|
WebMock.disable_net_connect!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits-tumblr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Hutchinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tumblr_client
|