lolcommits 0.9.6 → 0.9.7.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33ddf0cccf67ca8a53bca770511378f57aa078fa
4
- data.tar.gz: 9d2daa0667501a5586cc2c3ed5cba15edff372a8
3
+ metadata.gz: eabd6f7bcb218a41800639928db4cb88cc0ea270
4
+ data.tar.gz: 58a67da5eb1241edda555e12341805a6fd0ce15c
5
5
  SHA512:
6
- metadata.gz: 1b7f3e952d3cd800e07b9a13569b35bf4f6a74d303ec56ec44147629b78b105dbc2b1f32300c1dedc12a2c1eb1d90e6b2259e31f44b8e4ed1093a22e7fab40ea
7
- data.tar.gz: 46b71b2b04d56a99dc7240dea7d431599136f6780575725d5c260011c1eaa6bec87463dbfe13f6b4b9ca524a80746e365e1eefa50320eb99428ce7b0bd0c3f37
6
+ metadata.gz: e5e9b23c5e2ed563887a1492be9c34bb2641902989ea354ce41ef0ed76c2603ebca4e7241711185eb2603fa9fdb105981621fec792c54f873812f1501582b3cd
7
+ data.tar.gz: c6b3b127488061f76b706fbc1bb5d7164a48cdbb34aa992ae9c75858e18110abc8dc0f35963b80c40df66e7a392ea631e9ab0b779421cc71ab5050c34f5556df
data/.travis.yml CHANGED
@@ -12,7 +12,7 @@ rvm:
12
12
 
13
13
  before_install:
14
14
  # stub mplayer/ffmpeg so it looks like they are installed
15
- - mkdir ~/bin
15
+ - mkdir -p ~/bin
16
16
  - touch ~/bin/mplayer ~/bin/ffmpeg
17
17
  - chmod +x ~/bin/mplayer ~/bin/ffmpeg
18
18
  - export PATH=~/bin:$PATH
data/CHANGELOG.md CHANGED
@@ -8,6 +8,11 @@ project adheres to [Semantic Versioning][Semver].
8
8
  * WIP - extract more plugins to gems ...
9
9
  * Your contribution here!
10
10
 
11
+ ## [0.9.7][] (17 September 2017)
12
+ * Extract dotcom to gem (@matthutchinson [#355][])
13
+ * Extract uploldz to gem (@matthutchinson [#354][])
14
+ * Extract lolsrv to gem (@matthutchinson [#353][])
15
+
11
16
  ## [0.9.6][] (28 August 2017)
12
17
  * Clean legacy plugin methods (@matthutchinson [#348][])
13
18
  * Extract Slack Plugin to gem (@matthutchinson [#349][])
@@ -289,8 +294,9 @@ project adheres to [Semantic Versioning][Semver].
289
294
  instead of compositing multiply image Caption objects (this seems to be more
290
295
  reliable to not glitch.)
291
296
 
292
- [Unreleased]: https://github.com/mroth/lolcommits/compare/v0.9.6...HEAD
293
- [0.9.5]: https://github.com/mroth/lolcommits/compare/v0.9.5...v0.9.6
297
+ [Unreleased]: https://github.com/mroth/lolcommits/compare/v0.9.7...HEAD
298
+ [0.9.7]: https://github.com/mroth/lolcommits/compare/v0.9.6...v0.9.7
299
+ [0.9.6]: https://github.com/mroth/lolcommits/compare/v0.9.5...v0.9.6
294
300
  [0.9.5]: https://github.com/mroth/lolcommits/compare/v0.9.4...v0.9.5
295
301
  [0.9.4]: https://github.com/mroth/lolcommits/compare/v0.9.3...v0.9.4
296
302
  [0.9.3]: https://github.com/mroth/lolcommits/compare/v0.9.2...v0.9.3
@@ -460,3 +466,6 @@ project adheres to [Semantic Versioning][Semver].
460
466
  [#349]: https://github.com/mroth/lolcommits/pull/349
461
467
  [#351]: https://github.com/mroth/lolcommits/pull/351
462
468
  [#352]: https://github.com/mroth/lolcommits/pull/352
469
+ [#353]: https://github.com/mroth/lolcommits/pull/353
470
+ [#354]: https://github.com/mroth/lolcommits/pull/354
471
+ [#355]: https://github.com/mroth/lolcommits/pull/355
@@ -4,7 +4,7 @@ require 'open3'
4
4
  require 'ffaker'
5
5
  require 'fileutils'
6
6
 
7
- require File.join(File.expand_path(File.dirname(__FILE__)), 'path_helpers')
7
+ require File.join(__dir__, 'path_helpers')
8
8
  include Lolcommits
9
9
 
10
10
  World(PathHelpers)
data/lib/lolcommits.rb CHANGED
@@ -29,10 +29,7 @@ require 'lolcommits/backends/git_info'
29
29
  require 'lolcommits/backends/mercurial_info'
30
30
 
31
31
  require 'lolcommits/plugin/base'
32
- require 'lolcommits/plugin/dot_com'
33
- require 'lolcommits/plugin/uploldz'
34
32
  require 'lolcommits/plugin/term_output'
35
- require 'lolcommits/plugin/lolsrv'
36
33
  require 'lolcommits/plugin/lol_yammer'
37
34
  require 'lolcommits/plugin/lol_protonet'
38
35
  require 'lolcommits/plugin/lol_tumblr'
@@ -17,6 +17,7 @@ module Lolcommits
17
17
  debug "GitInfo: \t#{repo_internal_path}"
18
18
  debug "GitInfo: \t#{repo}"
19
19
  debug "GitInfo: \t#{branch}"
20
+ debug "GitInfo: \t#{commit_date}"
20
21
  debug "GitInfo: \t#{author_name}" if author_name
21
22
  debug "GitInfo: \t#{author_email}" if author_email
22
23
  end
@@ -42,7 +43,9 @@ module Lolcommits
42
43
 
43
44
  def url
44
45
  @url ||= begin
45
- remote_https_url(repository.remote.url) if repository.remote
46
+ if repository.remote && repository.remote.url
47
+ remote_https_url(repository.remote.url)
48
+ end
46
49
  end
47
50
  end
48
51
 
@@ -68,10 +71,14 @@ module Lolcommits
68
71
  @author_email ||= last_commit.author.email if last_commit.author
69
72
  end
70
73
 
74
+ def commit_date
75
+ @commit_date ||= last_commit.date.utc
76
+ end
77
+
71
78
  private
72
79
 
73
80
  def remote_https_url(url)
74
- url.tr(':', '/').tr(/^git@/, 'https://').tr(/\.git$/, '') + '/commit/'
81
+ url.tr(':', '/').gsub(/^git@/, 'https://').gsub(/\.git$/, '') + '/commit/'
75
82
  end
76
83
 
77
84
  def repository(path = '.')
@@ -67,11 +67,11 @@ module Lolcommits
67
67
  exports = "set path=\"#{ruby_path};#{imagick_path};%PATH%\""
68
68
  end
69
69
 
70
- <<-EOS
70
+ <<-HOOK
71
71
  ### lolcommits hook (begin) ###
72
72
  #{exports} && #{capture_cmd}
73
73
  ### lolcommits hook (end) ###
74
- EOS
74
+ HOOK
75
75
  end
76
76
 
77
77
  # does a git hook exist at all?
@@ -24,6 +24,7 @@ module Lolcommits
24
24
  debug "MercurialInfo: \t#{repo_internal_path}"
25
25
  debug "MercurialInfo: \t#{repo}"
26
26
  debug "MercurialInfo: \t#{branch}"
27
+ debug "MercurialInfo: \t#{commit_date}"
27
28
  debug "MercurialInfo: \t#{author_name}" if author_name
28
29
  debug "MercurialInfo: \t#{author_email}" if author_email
29
30
  end
@@ -63,6 +64,10 @@ module Lolcommits
63
64
  @author_email ||= last_commit.author_email
64
65
  end
65
66
 
67
+ def commit_date
68
+ @commit_date ||= last_commit.date.utc
69
+ end
70
+
66
71
  private
67
72
 
68
73
  def repository(path = '.')
@@ -2,7 +2,9 @@ module Lolcommits
2
2
  class Configuration
3
3
  LOLCOMMITS_BASE = ENV['LOLCOMMITS_DIR'] || File.join(ENV['HOME'], '.lolcommits')
4
4
  LOLCOMMITS_ROOT = File.join(File.dirname(__FILE__), '../..')
5
- attr_accessor :plugin_manager, :loldir
5
+
6
+ attr_accessor :plugin_manager
7
+ attr_writer :loldir
6
8
 
7
9
  def initialize(plugin_manager, test_mode: false)
8
10
  @plugin_manager = plugin_manager
@@ -14,7 +14,7 @@ module Lolcommits
14
14
  rescue LoadError => e
15
15
  warn "Found plugin #{name}, but could not require gem '#{gem_name}'"
16
16
  warn e
17
- rescue => e
17
+ rescue StandardError => e
18
18
  warn "require gem '#{gem_name}' failed with: #{e}"
19
19
  end
20
20
 
@@ -40,7 +40,7 @@ module Lolcommits
40
40
 
41
41
  def plugin_klass
42
42
  self.class.const_get(plugin_klass_name)
43
- rescue => e
43
+ rescue StandardError => e
44
44
  warn "failed to load constant from plugin gem '#{plugin_klass_name}: #{e}'"
45
45
  end
46
46
 
@@ -65,7 +65,7 @@ module Lolcommits
65
65
  # cli_version check will throw a MiniMagick::Error exception if IM is not
66
66
  # installed in PATH, since it attempts to parse output from `identify`
67
67
  !MiniMagick.cli_version.nil?
68
- rescue
68
+ rescue StandardError
69
69
  return false
70
70
  end
71
71
 
@@ -56,7 +56,7 @@ module Lolcommits
56
56
  content: File.new(runner.main_image)
57
57
  )
58
58
  debug response
59
- rescue => e
59
+ rescue StandardError => e
60
60
  retries -= 1
61
61
  retry if retries > 0
62
62
  puts "Posting to flowdock failed - #{e.message}"
@@ -71,7 +71,7 @@ module Lolcommits
71
71
  response = client.create_message(post, attachment1: lolimage)
72
72
  debug response.body.inspect
73
73
  puts "\t--> Status posted!" if response
74
- rescue => e
74
+ rescue StandardError => e
75
75
  retries -= 1
76
76
  retry if retries > 0
77
77
  puts "Status not posted - #{e.message}"
@@ -6,7 +6,7 @@ module Lolcommits
6
6
  end
7
7
 
8
8
  def repo_path
9
- '~/.lolcommits/sample-plugin-test-repo'
9
+ '~/.lolcommits/plugin-test-repo'
10
10
  end
11
11
 
12
12
  def repo_exists?
@@ -1,4 +1,4 @@
1
1
  module Lolcommits
2
- VERSION = '0.9.6'.freeze
2
+ VERSION = '0.9.7.pre1'.freeze
3
3
  GEM_NAME = 'lolcommits'.freeze
4
4
  end
data/lolcommits.gemspec CHANGED
@@ -12,13 +12,13 @@ Gem::Specification.new do |s|
12
12
  s.license = 'LGPL-3'
13
13
  s.summary = 'Capture webcam image on git commit for lulz.'
14
14
 
15
- s.description = <<-EOF
15
+ s.description = <<-DESC
16
16
  lolcommits takes a snapshot with your webcam every time you git commit code,
17
17
  and archives a lolcat style image with it. It's selfies for software
18
18
  developers. `git blame` has never been so much fun.
19
- EOF
19
+ DESC
20
20
 
21
- s.post_install_message = <<-EOF
21
+ s.post_install_message = <<-POSTINSTALL
22
22
  -------------------------------------------------------------------------------
23
23
 
24
24
  Lolcommits: quick message from the dev team! v0.9.5 extracts the Twitter plugin
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  Happy Lol'ing!
37
37
 
38
38
  -------------------------------------------------------------------------------
39
- EOF
39
+ POSTINSTALL
40
40
 
41
41
  s.files = `git ls-files`.split("\n")
42
42
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -67,7 +67,6 @@ EOF
67
67
 
68
68
  # plugin gems
69
69
  s.add_runtime_dependency('yam', '~> 2.5.0') # yammer
70
- s.add_runtime_dependency('httmultiparty', '~> 0.3.16') # dot_com
71
70
  s.add_runtime_dependency('tumblr_client', '~> 0.8.5') # tumblr
72
71
 
73
72
  # development gems
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolcommits
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Rothenberg
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-28 00:00:00.000000000 Z
12
+ date: 2017-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aruba
@@ -179,20 +179,6 @@ dependencies:
179
179
  - - "~>"
180
180
  - !ruby/object:Gem::Version
181
181
  version: 2.5.0
182
- - !ruby/object:Gem::Dependency
183
- name: httmultiparty
184
- requirement: !ruby/object:Gem::Requirement
185
- requirements:
186
- - - "~>"
187
- - !ruby/object:Gem::Version
188
- version: 0.3.16
189
- type: :runtime
190
- prerelease: false
191
- version_requirements: !ruby/object:Gem::Requirement
192
- requirements:
193
- - - "~>"
194
- - !ruby/object:Gem::Version
195
- version: 0.3.16
196
182
  - !ruby/object:Gem::Dependency
197
183
  name: tumblr_client
198
184
  requirement: !ruby/object:Gem::Requirement
@@ -382,15 +368,12 @@ files:
382
368
  - lib/lolcommits/installation.rb
383
369
  - lib/lolcommits/platform.rb
384
370
  - lib/lolcommits/plugin/base.rb
385
- - lib/lolcommits/plugin/dot_com.rb
386
371
  - lib/lolcommits/plugin/lol_flowdock.rb
387
372
  - lib/lolcommits/plugin/lol_hipchat.rb
388
373
  - lib/lolcommits/plugin/lol_protonet.rb
389
374
  - lib/lolcommits/plugin/lol_tumblr.rb
390
375
  - lib/lolcommits/plugin/lol_yammer.rb
391
- - lib/lolcommits/plugin/lolsrv.rb
392
376
  - lib/lolcommits/plugin/term_output.rb
393
- - lib/lolcommits/plugin/uploldz.rb
394
377
  - lib/lolcommits/plugin_manager.rb
395
378
  - lib/lolcommits/runner.rb
396
379
  - lib/lolcommits/test_helpers/fake_io.rb
@@ -438,14 +421,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
438
421
  version: '2.0'
439
422
  required_rubygems_version: !ruby/object:Gem::Requirement
440
423
  requirements:
441
- - - ">="
424
+ - - ">"
442
425
  - !ruby/object:Gem::Version
443
- version: '0'
426
+ version: 1.3.1
444
427
  requirements:
445
428
  - imagemagick
446
429
  - a webcam
447
430
  rubyforge_project:
448
- rubygems_version: 2.4.5
431
+ rubygems_version: 2.6.13
449
432
  signing_key:
450
433
  specification_version: 4
451
434
  summary: Capture webcam image on git commit for lulz.
@@ -1,50 +0,0 @@
1
- require 'httmultiparty'
2
-
3
- module Lolcommits
4
- module Plugin
5
- class DotCom < Base
6
- BASE_URL = 'http://lolcommits-dot-com.herokuapp.com'.freeze
7
-
8
- def initialize(runner: nil, config: nil)
9
- super
10
- options.concat(%w(api_key api_secret repo_id))
11
- end
12
-
13
- def run_capture_ready
14
- t = Time.now.to_i.to_s
15
- HTTMultiParty.post(
16
- "#{BASE_URL}/git_commits.json",
17
- body: {
18
- git_commit: {
19
- sha: runner.sha,
20
- repo_external_id: configuration['repo_id'],
21
- image: File.open(runner.main_image),
22
- raw: File.open(runner.snapshot_loc)
23
- },
24
-
25
- key: configuration['api_key'],
26
- t: t,
27
- token: Digest::SHA1.hexdigest(configuration['api_secret'] + t)
28
- }
29
- )
30
- rescue => e
31
- log_error(e, "ERROR: HTTMultiParty POST FAILED #{e.class} - #{e.message}")
32
- end
33
-
34
- def configured?
35
- !configuration['enabled'].nil? &&
36
- configuration['api_key'] &&
37
- configuration['api_secret'] &&
38
- configuration['repo_id']
39
- end
40
-
41
- def self.name
42
- 'dot_com'
43
- end
44
-
45
- def self.runner_order
46
- :capture_ready
47
- end
48
- end
49
- end
50
- end
@@ -1,58 +0,0 @@
1
- require 'rest_client'
2
- require 'pp'
3
- require 'json'
4
-
5
- module Lolcommits
6
- module Plugin
7
- class Lolsrv < Base
8
- def initialize(runner: nil, config: nil)
9
- super
10
- options << 'server'
11
- end
12
-
13
- def run_capture_ready
14
- fork { sync }
15
- end
16
-
17
- def configured?
18
- !configuration['enabled'].nil? && configuration['server']
19
- end
20
-
21
- def sync
22
- existing = existing_lols
23
- return unless existing.nil?
24
- Dir[runner.config.loldir + '/*.{jpg,gif}'].each do |item|
25
- sha = File.basename(item, '.*')
26
- upload(item, sha) unless existing.include?(sha) || sha == 'tmp_snapshot'
27
- end
28
- end
29
-
30
- def existing_lols
31
- lols = JSON.parse(RestClient.get(configuration['server'] + '/lols'))
32
- lols.map { |lol| lol['sha'] }
33
- rescue => e
34
- log_error(e, "ERROR: existing lols could not be retrieved #{e.class} - #{e.message}")
35
- return nil
36
- end
37
-
38
- def upload(file, sha)
39
- RestClient.post(configuration['server'] + '/uplol',
40
- lol: File.new(file),
41
- url: runner.vcs_info.url + sha,
42
- repo: runner.vcs_info.repo,
43
- date: File.ctime(file),
44
- sha: sha)
45
- rescue => e
46
- log_error(e, "ERROR: Upload of lol #{sha} FAILED #{e.class} - #{e.message}")
47
- end
48
-
49
- def self.name
50
- 'lolsrv'
51
- end
52
-
53
- def self.runner_order
54
- :capture_ready
55
- end
56
- end
57
- end
58
- end
@@ -1,65 +0,0 @@
1
- require 'rest_client'
2
- require 'base64'
3
-
4
- module Lolcommits
5
- module Plugin
6
- class Uploldz < Base
7
- attr_accessor :endpoint
8
-
9
- def initialize(runner: nil, config: nil)
10
- super
11
- options.concat(
12
- %w(
13
- endpoint
14
- optional_key
15
- optional_http_auth_username
16
- optional_http_auth_password
17
- )
18
- )
19
- end
20
-
21
- def run_capture_ready
22
- if !runner.vcs_info || runner.vcs_info.repo.empty?
23
- puts 'Repo is empty, skipping upload'
24
- else
25
- debug "Posting capture to #{configuration['endpoint']}"
26
- RestClient.post(
27
- configuration['endpoint'],
28
- {
29
- file: File.new(runner.main_image),
30
- message: runner.message,
31
- repo: runner.vcs_info.repo,
32
- author_name: runner.vcs_info.author_name,
33
- author_email: runner.vcs_info.author_email,
34
- sha: runner.sha,
35
- key: configuration['optional_key']
36
- },
37
- Authorization: authorization_header
38
- )
39
- end
40
- rescue => e
41
- log_error(e, "ERROR: RestClient POST FAILED #{e.class} - #{e.message}")
42
- end
43
-
44
- def configured?
45
- !configuration['enabled'].nil? && configuration['endpoint']
46
- end
47
-
48
- def authorization_header
49
- user = configuration['optional_http_auth_username']
50
- password = configuration['optional_http_auth_password']
51
- return unless user || password
52
-
53
- 'Basic ' + Base64.encode64("#{user}:#{password}").chomp
54
- end
55
-
56
- def self.name
57
- 'uploldz'
58
- end
59
-
60
- def self.runner_order
61
- :capture_ready
62
- end
63
- end
64
- end
65
- end