lolcommits-lolsrv 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +34 -0
- data/.github/workflows/push_gem.yml +25 -0
- data/.travis.yml +4 -4
- data/CHANGELOG.md +6 -1
- data/README.md +4 -9
- data/Rakefile +1 -11
- data/lib/lolcommits/lolsrv/version.rb +1 -1
- data/lolcommits-lolsrv.gemspec +3 -4
- metadata +11 -31
- data/test/images/sha123.jpg +0 -0
- data/test/images/sha456.jpg +0 -0
- data/test/lolcommits/plugin/lolsrv_test.rb +0 -125
- data/test/test_helper.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7db7b5a140299bdcebf6dcb79213b954c39ce8855a0ebcaeffb64521ce9902e
|
4
|
+
data.tar.gz: 3a07525a02d973ec73b0fbda941c9f8df27db756bf1aec0855132a6c017ee276
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e4d7dba7ca425b5caafa2342c8d4190ee072f1f213e510813ede0009dd0af884c1e760447b908ecebfe2f9f151af8b120575572e9323dcb6b6b00588104e21c
|
7
|
+
data.tar.gz: cc2d07992a228bf2d8c5c79dbdb50ef991db4e4172a4d0c957257acd25c4feb51257a45acf3a6c3755cbf67200c87063d8b38706a3658a14434ee072555694d4
|
@@ -0,0 +1,34 @@
|
|
1
|
+
name: Tests
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ "main" ]
|
6
|
+
pull_request:
|
7
|
+
branches: [ "main" ]
|
8
|
+
|
9
|
+
permissions:
|
10
|
+
contents: read
|
11
|
+
|
12
|
+
jobs:
|
13
|
+
test:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
strategy:
|
16
|
+
fail-fast: false
|
17
|
+
matrix:
|
18
|
+
ruby-version: ['3.1', '3.2', '3.3', '3.4']
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v4
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby-version }}
|
25
|
+
bundler-cache: true
|
26
|
+
- name: Configure git user name, email
|
27
|
+
run: |
|
28
|
+
git config --global user.name $NAME
|
29
|
+
git config --global user.email $EMAIL
|
30
|
+
env:
|
31
|
+
NAME: "George Costanza"
|
32
|
+
EMAIL: "george.costanza@vandelay.com"
|
33
|
+
- name: Run tests
|
34
|
+
run: bundle exec rake test
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: Publish gem to RubyGems.org
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- v*
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
push:
|
10
|
+
name: Push gem to RubyGems.org
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
|
13
|
+
permissions:
|
14
|
+
id-token: write
|
15
|
+
contents: write
|
16
|
+
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v4
|
19
|
+
- name: Set up Ruby
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
bundler-cache: true
|
23
|
+
ruby-version: ruby
|
24
|
+
|
25
|
+
- uses: rubygems/release-gem@v1
|
data/.travis.yml
CHANGED
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.6.0] - 2024-28-09
|
13
|
+
### Removed
|
14
|
+
- Support for Ruby < 3.1 (older rubies no longer supported)
|
15
|
+
|
12
16
|
## [0.5.0] - 2020-01-24
|
13
17
|
### Removed
|
14
18
|
- Support for Ruby < 2.4 (older rubies no longer supported)
|
@@ -80,7 +84,8 @@ project adheres to [Semantic Versioning][Semver].
|
|
80
84
|
### Changed
|
81
85
|
- Initial release
|
82
86
|
|
83
|
-
[Unreleased]: https://github.com/lolcommits/lolcommits-lolsrv/compare/v0.
|
87
|
+
[Unreleased]: https://github.com/lolcommits/lolcommits-lolsrv/compare/v0.6.0...HEAD
|
88
|
+
[0.6.0]: https://github.com/lolcommits/lolcommits-lolsrv/compare/v0.5.0...v0.6.0
|
84
89
|
[0.5.0]: https://github.com/lolcommits/lolcommits-lolsrv/compare/v0.4.0...v0.5.0
|
85
90
|
[0.4.0]: https://github.com/lolcommits/lolcommits-lolsrv/compare/v0.3.0...v0.4.0
|
86
91
|
[0.3.0]: https://github.com/lolcommits/lolcommits-lolsrv/compare/v0.2.0...v0.3.0
|
data/README.md
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
# Lolcommits Lolsrv
|
2
2
|
|
3
|
+
[![Build](https://img.shields.io/github/actions/workflow/status/lolcommits/lolcommits-lolsrv/build.yml?branch=main&style=flat)](https://github.com/lolcommits/lolcommits-lolsrv/actions/workflows/build.yml)
|
3
4
|
[![Gem](https://img.shields.io/gem/v/lolcommits-lolsrv.svg?style=flat)](http://rubygems.org/gems/lolcommits-lolsrv)
|
4
|
-
[![Travis](https://img.shields.io/travis/com/lolcommits/lolcommits-lolsrv/master.svg?style=flat)](https://travis-ci.com/lolcommits/lolcommits-lolsrv)
|
5
5
|
[![Depfu](https://img.shields.io/depfu/lolcommits/lolcommits-lolsrv.svg?style=flat)](https://depfu.com/github/lolcommits/lolcommits-lolsrv)
|
6
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/309c4d765a49dddebbc9/maintainability)](https://codeclimate.com/github/lolcommits/lolcommits-lolsrv/maintainability)
|
7
|
-
[![Test Coverage](https://api.codeclimate.com/v1/badges/309c4d765a49dddebbc9/test_coverage)](https://codeclimate.com/github/lolcommits/lolcommits-lolsrv/test_coverage)
|
8
6
|
|
9
7
|
[lolcommits](https://lolcommits.github.io/) takes a snapshot with your
|
10
8
|
webcam every time you git commit code, and archives a lolcat style image
|
@@ -36,7 +34,7 @@ The following upload params are `multipart/form-data` encoded:
|
|
36
34
|
|
37
35
|
## Requirements
|
38
36
|
|
39
|
-
* Ruby >=
|
37
|
+
* Ruby >= 3.1
|
40
38
|
* A webcam
|
41
39
|
* [ImageMagick](http://www.imagemagick.org)
|
42
40
|
* [ffmpeg](https://www.ffmpeg.org) (optional) for animated gif capturing
|
@@ -62,8 +60,7 @@ lolcommits will be synced to the remote server. To disable use:
|
|
62
60
|
## Development
|
63
61
|
|
64
62
|
Check out this repo and run `bin/setup`, this will install all
|
65
|
-
dependencies and generate docs. Run `bundle exec rake` to run all tests
|
66
|
-
and generate a coverage report.
|
63
|
+
dependencies and generate docs. Run `bundle exec rake` to run all tests.
|
67
64
|
|
68
65
|
You can also run `bin/console` for an interactive prompt that will allow
|
69
66
|
you to experiment with the gem code.
|
@@ -114,9 +111,7 @@ The gem is available as open source under the terms of
|
|
114
111
|
|
115
112
|
## Links
|
116
113
|
|
117
|
-
* [
|
118
|
-
* [Code Climate](https://codeclimate.com/github/lolcommits/lolcommits-lolsrv)
|
119
|
-
* [Test Coverage](https://codeclimate.com/github/lolcommits/lolcommits-lolsrv/coverage)
|
114
|
+
* [CI](https://github.com/lolcommits/lolcommits-lolsrv/actions/workflows/build.yml)
|
120
115
|
* [RDoc](http://rdoc.info/projects/lolcommits/lolcommits-lolsrv)
|
121
116
|
* [Issues](http://github.com/lolcommits/lolcommits-lolsrv/issues)
|
122
117
|
* [Report a bug](http://github.com/lolcommits/lolcommits-lolsrv/issues/new)
|
data/Rakefile
CHANGED
@@ -18,14 +18,4 @@ Rake::TestTask.new(:test) do |t|
|
|
18
18
|
t.test_files = FileList["test/**/*_test.rb"]
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
namespace :test do
|
23
|
-
desc "Run all tests and features and generate a code coverage report"
|
24
|
-
task :coverage do
|
25
|
-
ENV['COVERAGE'] = 'true'
|
26
|
-
Rake::Task['test'].execute
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
task :default => ['test:coverage']
|
21
|
+
task :default => ['test']
|
data/lolcommits-lolsrv.gemspec
CHANGED
@@ -32,15 +32,14 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.executables = []
|
33
33
|
spec.require_paths = ["lib"]
|
34
34
|
|
35
|
-
spec.required_ruby_version = ">=
|
35
|
+
spec.required_ruby_version = ">= 3.1"
|
36
36
|
|
37
37
|
spec.add_runtime_dependency "rest-client", ">= 2.1.0"
|
38
|
-
spec.add_runtime_dependency "lolcommits", ">= 0.
|
38
|
+
spec.add_runtime_dependency "lolcommits", ">= 0.17.2"
|
39
39
|
|
40
40
|
spec.add_development_dependency "bundler"
|
41
41
|
spec.add_development_dependency "webmock"
|
42
|
-
spec.add_development_dependency "pry"
|
43
42
|
spec.add_development_dependency "rake"
|
43
|
+
spec.add_development_dependency "ostruct"
|
44
44
|
spec.add_development_dependency "minitest"
|
45
|
-
spec.add_development_dependency "simplecov"
|
46
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lolcommits-lolsrv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
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: 2024-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.17.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.17.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: pry
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rake
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,7 +81,7 @@ dependencies:
|
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
84
|
+
name: ostruct
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
100
86
|
requirements:
|
101
87
|
- - ">="
|
@@ -109,7 +95,7 @@ dependencies:
|
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
98
|
+
name: minitest
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
101
|
- - ">="
|
@@ -133,6 +119,8 @@ executables: []
|
|
133
119
|
extensions: []
|
134
120
|
extra_rdoc_files: []
|
135
121
|
files:
|
122
|
+
- ".github/workflows/build.yml"
|
123
|
+
- ".github/workflows/push_gem.yml"
|
136
124
|
- ".gitignore"
|
137
125
|
- ".simplecov"
|
138
126
|
- ".travis.yml"
|
@@ -150,10 +138,6 @@ files:
|
|
150
138
|
- lib/lolcommits/lolsrv/version.rb
|
151
139
|
- lib/lolcommits/plugin/lolsrv.rb
|
152
140
|
- lolcommits-lolsrv.gemspec
|
153
|
-
- test/images/sha123.jpg
|
154
|
-
- test/images/sha456.jpg
|
155
|
-
- test/lolcommits/plugin/lolsrv_test.rb
|
156
|
-
- test/test_helper.rb
|
157
141
|
homepage: https://github.com/lolcommits/lolcommits-lolsrv
|
158
142
|
licenses:
|
159
143
|
- LGPL-3.0
|
@@ -171,19 +155,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
155
|
requirements:
|
172
156
|
- - ">="
|
173
157
|
- !ruby/object:Gem::Version
|
174
|
-
version: '
|
158
|
+
version: '3.1'
|
175
159
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
160
|
requirements:
|
177
161
|
- - ">="
|
178
162
|
- !ruby/object:Gem::Version
|
179
163
|
version: '0'
|
180
164
|
requirements: []
|
181
|
-
rubygems_version: 3.
|
165
|
+
rubygems_version: 3.5.16
|
182
166
|
signing_key:
|
183
167
|
specification_version: 4
|
184
168
|
summary: Sync lolcommits to a remote server
|
185
|
-
test_files:
|
186
|
-
- test/images/sha123.jpg
|
187
|
-
- test/images/sha456.jpg
|
188
|
-
- test/lolcommits/plugin/lolsrv_test.rb
|
189
|
-
- test/test_helper.rb
|
169
|
+
test_files: []
|
data/test/images/sha123.jpg
DELETED
Binary file
|
data/test/images/sha456.jpg
DELETED
Binary file
|
@@ -1,125 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "test_helper"
|
4
|
-
require 'webmock/minitest'
|
5
|
-
|
6
|
-
describe Lolcommits::Plugin::Lolsrv do
|
7
|
-
|
8
|
-
include Lolcommits::TestHelpers::GitRepo
|
9
|
-
include Lolcommits::TestHelpers::FakeIO
|
10
|
-
|
11
|
-
describe "with a runner" do
|
12
|
-
def runner
|
13
|
-
# a simple lolcommits runner with an empty configuration Hash
|
14
|
-
@runner ||= Lolcommits::Runner.new(
|
15
|
-
lolcommit_path: Tempfile.new('lolcommit.jpg'),
|
16
|
-
config: TestConfiguration.new(OpenStruct.new)
|
17
|
-
)
|
18
|
-
end
|
19
|
-
|
20
|
-
def plugin
|
21
|
-
@plugin ||= Lolcommits::Plugin::Lolsrv.new(runner: runner)
|
22
|
-
end
|
23
|
-
|
24
|
-
def valid_enabled_config
|
25
|
-
{
|
26
|
-
enabled: true,
|
27
|
-
server: "https://lolsrv.com"
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "#enabled?" do
|
32
|
-
it "it is disabled by default" do
|
33
|
-
_(plugin.enabled?).must_equal false
|
34
|
-
end
|
35
|
-
|
36
|
-
it "is true when configured" do
|
37
|
-
plugin.configuration = valid_enabled_config
|
38
|
-
_(plugin.enabled?).must_equal true
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "run_capture_ready" do
|
43
|
-
before do
|
44
|
-
commit_repo_with_message
|
45
|
-
end
|
46
|
-
|
47
|
-
after { teardown_repo }
|
48
|
-
|
49
|
-
it "syncs lolcommits" do
|
50
|
-
in_repo do
|
51
|
-
plugin.configuration = valid_enabled_config
|
52
|
-
existing_sha = "sha123"
|
53
|
-
|
54
|
-
stub_request(:get, "https://lolsrv.com/lols").
|
55
|
-
to_return(status: 200, body: [{ sha: existing_sha }].to_json)
|
56
|
-
|
57
|
-
stub_request(:post, "https://lolsrv.com/uplol").
|
58
|
-
to_return(status: 200)
|
59
|
-
|
60
|
-
output = fake_io_capture do
|
61
|
-
plugin.run_capture_ready(do_fork: false)
|
62
|
-
end
|
63
|
-
|
64
|
-
assert_equal output, "Syncing lols ... done!\n"
|
65
|
-
assert_requested :get, "https://lolsrv.com/lols", times: 1
|
66
|
-
assert_requested :post, "https://lolsrv.com/uplol", times: 1,
|
67
|
-
headers: {'Content-Type' => /multipart\/form-data/ } do |req|
|
68
|
-
_(req.body).must_match "sha456"
|
69
|
-
_(req.body).must_match "plugin-test-repo"
|
70
|
-
_(req.body).must_match "name=\"lol\"; filename="
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
it "shows error and aborts on failed lols endpoint" do
|
76
|
-
in_repo do
|
77
|
-
plugin.configuration = valid_enabled_config
|
78
|
-
stub_request(:get, "https://lolsrv.com/lols").to_return(status: 404)
|
79
|
-
|
80
|
-
output = fake_io_capture do
|
81
|
-
plugin.run_capture_ready(do_fork: false)
|
82
|
-
end
|
83
|
-
|
84
|
-
assert_equal output, "Syncing lols ... failed fetching existing lols (try again with --debug)\n"
|
85
|
-
assert_not_requested :post, "https://lolsrv.com/uplol"
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
describe "configuration" do
|
91
|
-
it "allows plugin options to be configured" do
|
92
|
-
# enabled and server option
|
93
|
-
inputs = ["true", "https://my-lolsrv.com"]
|
94
|
-
configured_plugin_options = {}
|
95
|
-
|
96
|
-
fake_io_capture(inputs: inputs) do
|
97
|
-
configured_plugin_options = plugin.configure_options!
|
98
|
-
end
|
99
|
-
|
100
|
-
_(configured_plugin_options).must_equal({
|
101
|
-
enabled: true,
|
102
|
-
server: "https://my-lolsrv.com"
|
103
|
-
})
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "#valid_configuration?" do
|
107
|
-
it "returns false for an invalid configuration" do
|
108
|
-
plugin.configuration = { server: "gibberish" }
|
109
|
-
_(plugin.valid_configuration?).must_equal false
|
110
|
-
end
|
111
|
-
|
112
|
-
it "returns true with a valid configuration" do
|
113
|
-
plugin.configuration = valid_enabled_config
|
114
|
-
_(plugin.valid_configuration?).must_equal true
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|
120
|
-
|
121
|
-
class TestConfiguration < Lolcommits::Configuration
|
122
|
-
def loldir
|
123
|
-
@loldir ||= File.expand_path("#{__dir__}../../../images")
|
124
|
-
end
|
125
|
-
end
|
data/test/test_helper.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
4
|
-
|
5
|
-
# lolcommits gem
|
6
|
-
require 'lolcommits'
|
7
|
-
|
8
|
-
# lolcommit test helpers
|
9
|
-
require 'lolcommits/test_helpers/git_repo'
|
10
|
-
require 'lolcommits/test_helpers/fake_io'
|
11
|
-
|
12
|
-
if ENV['COVERAGE']
|
13
|
-
require 'simplecov'
|
14
|
-
end
|
15
|
-
|
16
|
-
# plugin gem test libs
|
17
|
-
require 'lolcommits/lolsrv'
|
18
|
-
require 'minitest/autorun'
|
19
|
-
|
20
|
-
# swallow all debug output during test runs
|
21
|
-
def debug(msg); end
|