lolcommits-loltext 0.0.5 → 0.0.6
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 +5 -5
- data/.travis.yml +14 -7
- data/README.md +4 -4
- data/lib/lolcommits/loltext/version.rb +1 -1
- data/lib/lolcommits/plugin/loltext.rb +20 -69
- data/lolcommits-loltext.gemspec +1 -2
- data/test/lolcommits/plugin/loltext_test.rb +11 -31
- data/test/test_helper.rb +1 -6
- metadata +5 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7bb994beb14f6500f65e7daa1627799a8dcebae3e0b878ff555acd189c1a0214
|
4
|
+
data.tar.gz: 5c9f29f4df2846f487c195d94f206f369e2191bda72ac79e0f50e112d766754e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55b8edd9835ee27558dfb64a63b5ae54fa651dc7f1b967fbe43e0fcc6e14ad18cc4e72282dbca1a5bc8940403294cb6f774aabb353b531c314fc9f8efab46d48
|
7
|
+
data.tar.gz: be8f188a027eda28a1ee3295a3abe8d32b8ce6be4a4077a1d4c9aa9a08277ced7b58e2ba3ccaf659bd82b281e1d43965083e687f8390932820a48bf0f43300aa
|
data/.travis.yml
CHANGED
@@ -3,10 +3,10 @@ language: ruby
|
|
3
3
|
cache: bundler
|
4
4
|
rvm:
|
5
5
|
- 2.0.0
|
6
|
-
- 2.1.
|
7
|
-
- 2.2.
|
8
|
-
- 2.3.
|
9
|
-
- 2.4.
|
6
|
+
- 2.1.10
|
7
|
+
- 2.2.8
|
8
|
+
- 2.3.5
|
9
|
+
- 2.4.2
|
10
10
|
- ruby-head
|
11
11
|
|
12
12
|
before_install:
|
@@ -19,6 +19,13 @@ matrix:
|
|
19
19
|
allow_failures:
|
20
20
|
- rvm: ruby-head
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
-
|
22
|
+
env:
|
23
|
+
global:
|
24
|
+
- CC_TEST_REPORTER_ID=8d879fff974ae19930e4c3ae89623aec6a2d86a236a350e5a128360c4142332a
|
25
|
+
- GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
|
26
|
+
before_script:
|
27
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
28
|
+
- chmod +x ./cc-test-reporter
|
29
|
+
- ./cc-test-reporter before-build - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
|
30
|
+
after_script:
|
31
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
data/README.md
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
[](http://rubygems.org/gems/lolcommits-loltext)
|
4
4
|
[](https://travis-ci.org/lolcommits/lolcommits-loltext)
|
5
|
-
[](https://codeclimate.com/github/lolcommits/lolcommits-loltext/maintainability)
|
6
|
+
[](https://codeclimate.com/github/lolcommits/lolcommits-loltext/test_coverage)
|
7
7
|
[](https://gemnasium.com/github.com/lolcommits/lolcommits-loltext)
|
8
8
|
|
9
9
|
[lolcommits](https://lolcommits.github.io/) takes a snapshot with your webcam
|
@@ -83,7 +83,7 @@ try the following:
|
|
83
83
|
|
84
84
|
```
|
85
85
|
loltext:
|
86
|
-
enabled: true
|
86
|
+
:enabled: true
|
87
87
|
:message:
|
88
88
|
:color: white
|
89
89
|
:font: "/Users/matt/Library/Fonts/Raleway-Light.ttf"
|
@@ -159,7 +159,7 @@ The gem is available as open source under the terms of
|
|
159
159
|
## Links
|
160
160
|
|
161
161
|
* [Travis CI](https://travis-ci.org/lolcommits/lolcommits-loltext)
|
162
|
-
* [Test Coverage](https://
|
162
|
+
* [Test Coverage](https://codeclimate.com/github/lolcommits/lolcommits-loltext/test_coverage)
|
163
163
|
* [Code Climate](https://codeclimate.com/github/lolcommits/lolcommits-loltext)
|
164
164
|
* [RDoc](http://rdoc.info/projects/lolcommits/lolcommits-loltext)
|
165
165
|
* [Issues](http://github.com/lolcommits/lolcommits-loltext/issues)
|
@@ -8,15 +8,6 @@ module Lolcommits
|
|
8
8
|
File.dirname(__FILE__), "../../../vendor/fonts/Impact.ttf"
|
9
9
|
).freeze
|
10
10
|
|
11
|
-
##
|
12
|
-
# Returns the name of the plugin. Identifies the plugin to lolcommits.
|
13
|
-
#
|
14
|
-
# @return [String] the plugin name
|
15
|
-
#
|
16
|
-
def self.name
|
17
|
-
'loltext'
|
18
|
-
end
|
19
|
-
|
20
11
|
# Returns position(s) of when this plugin should run during the capture
|
21
12
|
# process. We want to add text to the image after capturing, but before
|
22
13
|
# capture is ready for sharing.
|
@@ -34,7 +25,7 @@ module Lolcommits
|
|
34
25
|
# @return [Boolean] true/false indicating if plugin is enabled
|
35
26
|
#
|
36
27
|
def enabled?
|
37
|
-
|
28
|
+
configuration.empty? || super
|
38
29
|
end
|
39
30
|
|
40
31
|
##
|
@@ -46,7 +37,7 @@ module Lolcommits
|
|
46
37
|
# @return [Boolean] true/false indicating if plugin is correct configured
|
47
38
|
#
|
48
39
|
def valid_configuration?
|
49
|
-
|
40
|
+
configuration.empty? || super
|
50
41
|
end
|
51
42
|
|
52
43
|
##
|
@@ -55,27 +46,20 @@ module Lolcommits
|
|
55
46
|
# @return [Hash] a hash of configured plugin options
|
56
47
|
#
|
57
48
|
def configure_options!
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
options[:message] = configure_sub_options(:message)
|
74
|
-
options[:sha] = configure_sub_options(:sha)
|
75
|
-
options[:overlay] = configure_sub_options(:overlay)
|
76
|
-
options[:border] = configure_sub_options(:border)
|
77
|
-
end
|
78
|
-
options
|
49
|
+
puts '---------------------------------------------------------------'
|
50
|
+
puts ' LolText options '
|
51
|
+
puts ''
|
52
|
+
puts ' * any blank options will use the (default)'
|
53
|
+
puts ' * always use the full absolute path to fonts'
|
54
|
+
puts ' * valid text positions are NE, NW, SE, SW, S, C (centered)'
|
55
|
+
puts ' * colors can be hex #FC0 value or a string \'white\''
|
56
|
+
puts ' - use `none` for no stroke color'
|
57
|
+
puts ' * overlay fills your image with a random color'
|
58
|
+
puts ' - set one or more overlay_colors with a comma seperator'
|
59
|
+
puts ' - overlay_percent (0-100) sets the fill colorize strength'
|
60
|
+
puts '---------------------------------------------------------------'
|
61
|
+
|
62
|
+
super
|
79
63
|
end
|
80
64
|
|
81
65
|
##
|
@@ -89,7 +73,7 @@ module Lolcommits
|
|
89
73
|
image = MiniMagick::Image.open(runner.main_image)
|
90
74
|
if config_option(:overlay, :enabled)
|
91
75
|
image.combine_options do |c|
|
92
|
-
c.fill config_option(:overlay, :overlay_colors).sample
|
76
|
+
c.fill config_option(:overlay, :overlay_colors).split(',').map(&:strip).sample
|
93
77
|
c.colorize config_option(:overlay, :overlay_percent)
|
94
78
|
end
|
95
79
|
end
|
@@ -143,31 +127,8 @@ module Lolcommits
|
|
143
127
|
end
|
144
128
|
end
|
145
129
|
|
146
|
-
# TODO: consider this type of configuration prompting in Plugin::Base
|
147
|
-
# i.e. allow sub option and working with hash of defaults
|
148
|
-
def configure_sub_options(type)
|
149
|
-
print "#{type}:\n"
|
150
|
-
defaults = config_defaults[type]
|
151
|
-
|
152
|
-
# sort option keys since different `Hash#keys` varys across Ruby versions
|
153
|
-
defaults.keys.sort_by(&:to_s).reduce({}) do |acc, opt|
|
154
|
-
# if we have an enabled key set to false, abort asking for any more options
|
155
|
-
if acc.key?(:enabled) && acc[:enabled] != true
|
156
|
-
acc
|
157
|
-
else
|
158
|
-
print " #{opt.to_s.tr('_', ' ')} (#{defaults[opt]}): "
|
159
|
-
val = parse_user_input(gets.chomp.strip)
|
160
|
-
# handle array options (comma seperated string)
|
161
|
-
if defaults[opt].is_a?(Array) && !val.nil?
|
162
|
-
val = val.split(',').map(&:strip).delete_if(&:empty?)
|
163
|
-
end
|
164
|
-
acc.merge(opt => val)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
130
|
# default text styling and positions
|
170
|
-
def
|
131
|
+
def default_options
|
171
132
|
{
|
172
133
|
message: {
|
173
134
|
color: 'white',
|
@@ -191,27 +152,17 @@ module Lolcommits
|
|
191
152
|
'#2e4970', '#674685', '#ca242f', '#1e7882', '#2884ae', '#4ba000',
|
192
153
|
'#187296', '#7e231f', '#017d9f', '#e52d7b', '#0f5eaa', '#e40087',
|
193
154
|
'#5566ac', '#ed8833', '#f8991c', '#408c93', '#ba9109'
|
194
|
-
],
|
155
|
+
].join(','),
|
195
156
|
overlay_percent: 50
|
196
157
|
},
|
197
158
|
border: {
|
198
|
-
color: 'white',
|
199
159
|
enabled: false,
|
160
|
+
color: 'white',
|
200
161
|
size: 10,
|
201
162
|
}
|
202
163
|
}
|
203
164
|
end
|
204
165
|
|
205
|
-
# return the config option, defaults apply if not set
|
206
|
-
def config_option(type, option)
|
207
|
-
default_option = config_defaults[type][option]
|
208
|
-
if configuration[type]
|
209
|
-
configuration[type][option] || default_option
|
210
|
-
else
|
211
|
-
default_option
|
212
|
-
end
|
213
|
-
end
|
214
|
-
|
215
166
|
# explode psuedo-names for text positioning
|
216
167
|
def position_transform(position)
|
217
168
|
case position
|
data/lolcommits-loltext.gemspec
CHANGED
@@ -35,10 +35,9 @@ Gem::Specification.new do |spec|
|
|
35
35
|
|
36
36
|
spec.required_ruby_version = ">= 2.0.0"
|
37
37
|
|
38
|
-
spec.add_development_dependency "lolcommits", ">= 0.
|
38
|
+
spec.add_development_dependency "lolcommits", ">= 0.10.0"
|
39
39
|
spec.add_development_dependency "bundler"
|
40
40
|
spec.add_development_dependency "rake"
|
41
41
|
spec.add_development_dependency "minitest"
|
42
42
|
spec.add_development_dependency "simplecov"
|
43
|
-
spec.add_development_dependency "coveralls"
|
44
43
|
end
|
@@ -2,17 +2,12 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
describe Lolcommits::Plugin::Loltext do
|
4
4
|
|
5
|
-
include Lolcommits::TestHelpers::GitRepo
|
6
5
|
include Lolcommits::TestHelpers::FakeIO
|
7
6
|
|
8
7
|
def plugin_name
|
9
8
|
'loltext'
|
10
9
|
end
|
11
10
|
|
12
|
-
it 'should have a name' do
|
13
|
-
::Lolcommits::Plugin::Loltext.name.must_equal plugin_name
|
14
|
-
end
|
15
|
-
|
16
11
|
it 'should run on post capturing' do
|
17
12
|
::Lolcommits::Plugin::Loltext.runner_order.must_equal [:post_capture]
|
18
13
|
end
|
@@ -28,9 +23,7 @@ describe Lolcommits::Plugin::Loltext do
|
|
28
23
|
describe 'with a runner' do
|
29
24
|
def runner
|
30
25
|
# a simple lolcommits runner with an empty configuration Hash
|
31
|
-
@runner ||= Lolcommits::Runner.new
|
32
|
-
config: OpenStruct.new(read_configuration: {})
|
33
|
-
)
|
26
|
+
@runner ||= Lolcommits::Runner.new
|
34
27
|
end
|
35
28
|
|
36
29
|
def plugin
|
@@ -38,17 +31,13 @@ describe Lolcommits::Plugin::Loltext do
|
|
38
31
|
end
|
39
32
|
|
40
33
|
def valid_enabled_config
|
41
|
-
|
42
|
-
read_configuration: {
|
43
|
-
'loltext'=> { 'enabled' => true }
|
44
|
-
}
|
45
|
-
)
|
34
|
+
{ enabled: true }
|
46
35
|
end
|
47
36
|
|
48
37
|
describe 'initalizing' do
|
49
38
|
it 'should assign runner and an enabled option' do
|
50
39
|
plugin.runner.must_equal runner
|
51
|
-
plugin.options.must_equal [
|
40
|
+
plugin.options.must_equal [:enabled]
|
52
41
|
end
|
53
42
|
end
|
54
43
|
|
@@ -58,16 +47,12 @@ describe Lolcommits::Plugin::Loltext do
|
|
58
47
|
end
|
59
48
|
|
60
49
|
it 'should true when configured' do
|
61
|
-
plugin.
|
50
|
+
plugin.configuration = valid_enabled_config
|
62
51
|
plugin.enabled?.must_equal true
|
63
52
|
end
|
64
53
|
end
|
65
54
|
|
66
55
|
describe 'configuration' do
|
67
|
-
it 'should not be configured by default' do
|
68
|
-
plugin.configured?.must_equal false
|
69
|
-
end
|
70
|
-
|
71
56
|
it 'should allow plugin options to be configured' do
|
72
57
|
# enabled
|
73
58
|
inputs = ['true']
|
@@ -83,18 +68,18 @@ describe Lolcommits::Plugin::Loltext do
|
|
83
68
|
) * 2
|
84
69
|
|
85
70
|
# styling overlay
|
86
|
-
inputs += %w(true
|
71
|
+
inputs += %w(true #2884ae,#7e231f 40)
|
87
72
|
|
88
73
|
# border options
|
89
|
-
inputs += %w(#e96d46
|
74
|
+
inputs += %w(true #e96d46 23)
|
90
75
|
|
91
76
|
configured_plugin_options = {}
|
92
|
-
|
77
|
+
fake_io_capture(inputs: inputs) do
|
93
78
|
configured_plugin_options = plugin.configure_options!
|
94
79
|
end
|
95
80
|
|
96
81
|
configured_plugin_options.must_equal( {
|
97
|
-
|
82
|
+
enabled: true,
|
98
83
|
message: {
|
99
84
|
color: 'red',
|
100
85
|
font: 'myfont.ttf',
|
@@ -113,29 +98,24 @@ describe Lolcommits::Plugin::Loltext do
|
|
113
98
|
},
|
114
99
|
overlay: {
|
115
100
|
enabled: true,
|
116
|
-
overlay_colors:
|
101
|
+
overlay_colors: "#2884ae,#7e231f",
|
117
102
|
overlay_percent: 40
|
118
103
|
},
|
119
104
|
border: {
|
120
|
-
color: '#e96d46',
|
121
105
|
enabled: true,
|
106
|
+
color: '#e96d46',
|
122
107
|
size: 23,
|
123
108
|
}
|
124
109
|
})
|
125
110
|
end
|
126
111
|
|
127
|
-
it 'should indicate when configured' do
|
128
|
-
plugin.config = valid_enabled_config
|
129
|
-
plugin.configured?.must_equal true
|
130
|
-
end
|
131
|
-
|
132
112
|
describe '#valid_configuration?' do
|
133
113
|
it 'should be trye even if config is not set' do
|
134
114
|
plugin.valid_configuration?.must_equal(true)
|
135
115
|
end
|
136
116
|
|
137
117
|
it 'should be true for a valid configuration' do
|
138
|
-
plugin.
|
118
|
+
plugin.configuration = valid_enabled_config
|
139
119
|
plugin.valid_configuration?.must_equal true
|
140
120
|
end
|
141
121
|
end
|
data/test/test_helper.rb
CHANGED
@@ -11,12 +11,7 @@ require 'lolcommits/test_helpers/git_repo'
|
|
11
11
|
require 'lolcommits/test_helpers/fake_io'
|
12
12
|
|
13
13
|
if ENV['COVERAGE']
|
14
|
-
|
15
|
-
require 'coveralls'
|
16
|
-
Coveralls.wear!
|
17
|
-
else
|
18
|
-
require 'simplecov'
|
19
|
-
end
|
14
|
+
require 'simplecov'
|
20
15
|
end
|
21
16
|
|
22
17
|
# plugin gem test libs
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits-loltext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Hutchinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lolcommits
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.10.0
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.10.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: coveralls
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
description: |2
|
98
84
|
Overlay the commit message and sha on your lolcommit. Configure text style,
|
99
85
|
positioning and an optional transparent overlay.
|
@@ -142,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
128
|
version: '0'
|
143
129
|
requirements: []
|
144
130
|
rubyforge_project:
|
145
|
-
rubygems_version: 2.
|
131
|
+
rubygems_version: 2.7.3
|
146
132
|
signing_key:
|
147
133
|
specification_version: 4
|
148
134
|
summary: lolcommits commit message annotation plugin
|