lolcommits 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWIwMTQwMGNjMWEyMTUwMjQ2MDg2YmE4NGVjZDU4ODUzZjRjN2NiMg==
4
+ MmQ3ODk4ZDY4MWJmN2Y4MWIyMDA0MTM5ZWMyOTUyODNhN2UxNmQwNA==
5
5
  data.tar.gz: !binary |-
6
- NjEwNWUyZWFiNTFiZjhlZjRlMzA2ZGNiYzI5ZTc5ODEzYzk3Njk0ZA==
6
+ NGM2ZDNkZmRlN2NkY2I1NTA4MTYyYWIwNzBjNzg4NjI0OTVkODVhNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZThkZmM5NWQ1NDAzZDc1OTMwMTcxZDg1MjU0NGUxZTQxNWZlNTBiMGVjNWNk
10
- Mjg1YWZhOTk1NGY0NzNiNzY1NjIyMWE3Yzg4N2Y1OTM2OWU4ODg0MzQxYzMx
11
- YjBhZmU1MzMxNmE2ZjY4ZDFhNjkxOTNjMWM1MTlkZWQwZmRhNTc=
9
+ MWVmNTA1OThmMDg4MTBjNWMyNjA2NDk0MDU1NDM0NDZjYzE4N2NiOWFiZjNm
10
+ MTFlZGIxYzU1MWIzZjA2YmNmZTBhZGRlNDI1OGVkMzlhNTg3OGI4ZTRiMjJl
11
+ MzJkNTU3MjlmZmRhNDkwMmNiODFkMDMxYmNlNTE2NGY5MWZjMjg=
12
12
  data.tar.gz: !binary |-
13
- NzExMGYyMDZjZmQ3NjI3OTRlNzhkZTBjZDg2N2YwYWM2MWVmNjU2MjQ5ZTIw
14
- N2M0NWY4NTg5MTE1MWE5NjI3MjViYjY2ZjUyOWJjNjIzYjAxMTVlMmVmZDll
15
- YjQ0OWRhMWM2MmQyNDNiNGNmM2VlMmZlZjFmM2E4NGRlY2VhZjU=
13
+ NGE5M2IxYzZiZmVhMDE3MmE3YTJiY2VlODA1ZDE0NDhkZGNhMDlmZTA3NDAz
14
+ Yjg2OWU0ZjNmZWQ4ODQ2ZWQ2YTgwYTAxN2FhYjMzNjNhYjIyOGEyYTkwMTU0
15
+ ZTdkYzUxMGY1ZmU1NzViNWI4ZDQxNTcxYzNjZGY2OTZjZGY3ZDY=
data/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ project adheres to [Semantic Versioning][Semver].
8
8
  * WIP - extract plugins to separate gems ...
9
9
  * Your contribution here!
10
10
 
11
+ ## [0.8.1][] (11 October 2016)
12
+ * shebang fix in installer (@matthutchinson #317)
13
+ * FlowDock plugin (@mikecrittenden #318)
14
+ * HipChat plugin (@Salzig #320)
15
+ * peg gems for legacy ruby 1.9.3 (@matthutchinson #321)
16
+
11
17
  ## [0.8.0][] (13 July 2016)
12
18
  * New release requires Ruby 1.9.3+ minimum (@matthutchinson #313)
13
19
  * All gems upgraded to latest versions (6 held back, see lolcommits.gemspec)
@@ -249,7 +255,8 @@ project adheres to [Semantic Versioning][Semver].
249
255
  instead of compositing multiply image Caption objects (this seems to be more
250
256
  reliable to not glitch.)
251
257
 
252
- [Unreleased]: https://github.com/mroth/lolcommits/compare/v0.8.0...HEAD
258
+ [Unreleased]: https://github.com/mroth/lolcommits/compare/v0.8.1...HEAD
259
+ [0.8.1]: https://github.com/mroth/lolcommits/compare/v0.8.0...v0.8.1
253
260
  [0.8.0]: https://github.com/mroth/lolcommits/compare/v0.7.0...v0.8.0
254
261
  [0.7.0]: https://github.com/mroth/lolcommits/compare/v0.6.7...v0.7.0
255
262
  [0.6.7]: https://github.com/mroth/lolcommits/compare/v0.6.6...v0.6.7
data/lib/lolcommits.rb CHANGED
@@ -39,6 +39,8 @@ require 'lolcommits/plugins/lol_yammer'
39
39
  require 'lolcommits/plugins/lol_protonet'
40
40
  require 'lolcommits/plugins/lol_tumblr'
41
41
  require 'lolcommits/plugins/lol_slack'
42
+ require 'lolcommits/plugins/lol_flowdock'
43
+ require 'lolcommits/plugins/lol_hipchat'
42
44
 
43
45
  # require runner after all the plugins have been required
44
46
  require 'lolcommits/runner'
@@ -99,7 +99,7 @@ EOS
99
99
 
100
100
  # does the git hook file have a good shebang?
101
101
  def self.good_shebang?
102
- File.read(HOOK_PATH).lines.first =~ %r{^\#\!\/bin\/.*sh}
102
+ File.read(HOOK_PATH).lines.first =~ %r{^\#\!.*\/bin\/.*sh}
103
103
  end
104
104
 
105
105
  def self.remove_existing_hook!
@@ -0,0 +1,70 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require 'rest_client'
3
+
4
+ module Lolcommits
5
+ class LolFlowdock < Plugin
6
+ ENDPOINT_URL = 'api.flowdock.com/flows/'.freeze
7
+ RETRY_COUNT = 2
8
+
9
+ def self.name
10
+ 'flowdock'
11
+ end
12
+
13
+ def self.runner_order
14
+ :postcapture
15
+ end
16
+
17
+ def configured?
18
+ !configuration['access_token'].nil?
19
+ end
20
+
21
+ def configure
22
+ print "Open the URL below and issue a token for your user (Personal API token):\n"
23
+ print "https://flowdock.com/account/tokens\n"
24
+ print "Enter the generated token below, then press enter: \n"
25
+ code = STDIN.gets.to_s.strip
26
+ print "Enter the machine name of the flow you want to post to from this repo.\n"
27
+ print "Go to https://www.flowdock.com/account and click Flows, then click the flow, then get the machine name from the URL:\n"
28
+ flow = STDIN.gets.to_s.strip.downcase
29
+ print "Enter the name of the organization for this Flowdock account.\n"
30
+ organization = STDIN.gets.to_s.strip.downcase
31
+
32
+ {
33
+ 'access_token' => code,
34
+ 'flow' => flow,
35
+ 'organization' => organization
36
+ }
37
+ end
38
+
39
+ def configure_options!
40
+ options = super
41
+ if options['enabled']
42
+ config = configure
43
+ options.merge!(config)
44
+ end
45
+ options
46
+ end
47
+
48
+ def run_postcapture
49
+ return unless valid_configuration?
50
+
51
+ retries = RETRY_COUNT
52
+ begin
53
+
54
+ endpoint = 'https://' + configuration['access_token'] + '@' + ENDPOINT_URL + configuration['organization'] + '/' + configuration['flow'] + '/messages'
55
+ response = RestClient.post(
56
+ endpoint,
57
+ :event => 'file',
58
+ :content => File.new(runner.main_image)
59
+ )
60
+ debug response
61
+ rescue => e
62
+ retries -= 1
63
+ retry if retries > 0
64
+ puts "Posting to flowdock failed - #{e.message}"
65
+ puts 'Try running config again:'
66
+ puts "\tlolcommits --config --plugin flowdock"
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,125 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module Lolcommits
3
+ class LolHipchat < Plugin
4
+ def configure_options!
5
+ options = super
6
+ options.merge! configure_auth_options if options['enabled']
7
+ options
8
+ end
9
+
10
+ def configure_auth_options
11
+ puts '-' * 50
12
+ puts ' Lolcommits HipChat Plugin Configuration'
13
+ puts '-' * 50
14
+
15
+ puts '1.) I need your Team Name '
16
+ puts 'teamname as in teamname.hipchat.com, without .hipchat.com'
17
+ print 'Your Teamname: '
18
+ teamname = STDIN.gets.to_s.strip
19
+ puts "2.) We need a Authentication Token, get yours at https://#{teamname}.hipchat.com/account/api"
20
+ puts 'make sure to select scope "Send Message"'
21
+ print 'Your auth_token: '
22
+ token = STDIN.gets.to_s.strip
23
+ puts '3.) Which Room should be we post to?'
24
+ puts 'can be a id or name'
25
+ print 'Your Room: '
26
+ room = STDIN.gets.to_s.strip
27
+
28
+ {
29
+ 'api_token' => token,
30
+ 'api_team' => teamname,
31
+ 'api_room' => room
32
+ }
33
+ end
34
+
35
+ def run_postcapture
36
+ return unless valid_configuration?
37
+
38
+ http = Net::HTTP.new(api_url.host, api_url.port)
39
+ # http.set_debug_output $stderr # nice for debugging, never ever release with it
40
+ http.start do |connection|
41
+ header = { 'Content-Type' => 'multipart/related; boundary=0123456789ABLEWASIEREISAWELBA9876543210' }
42
+ data = [message_part, picture_part].map do |part|
43
+ "--0123456789ABLEWASIEREISAWELBA9876543210\r\n#{part}"
44
+ end.join('') << '--0123456789ABLEWASIEREISAWELBA9876543210--'
45
+ connection.post("#{api_url.path}?#{api_url.query}", data, header)
46
+ end
47
+ end
48
+
49
+ def message_part
50
+ [
51
+ 'Content-Type: application/json; charset=UTF-8',
52
+ 'Content-Disposition: attachment; name="metadata"',
53
+ '',
54
+ message_json,
55
+ ''
56
+ ].join "\r\n"
57
+ end
58
+
59
+ def message_json
60
+ { :message => message }.to_json.force_encoding('utf-8')
61
+ end
62
+
63
+ def picture_part
64
+ mime_type = MIME::Types.type_for(picture.path)[0] || MIME::Types['application/octet-stream'][0]
65
+ [
66
+ format('Content-Type: %s', mime_type.simplified),
67
+ format('Content-Disposition: attachment; name="file"; filename="%s"', picture.path),
68
+ '',
69
+ "#{picture.read} ",
70
+ ''
71
+ ].join "\r\n"
72
+ end
73
+
74
+ def picture
75
+ @picture ||= File.new(runner.main_image)
76
+ end
77
+
78
+ def api_url
79
+ URI(format('http://%{api_team}.hipchat.com/v2/room/%{api_room}/share/file?auth_token=%{api_token}', symbolized_configuration))
80
+ end
81
+
82
+ def symbolized_configuration
83
+ @symbolized_configuration ||= configuration.each_with_object({}) { |(k, v), obj| obj[k.to_sym] = v }
84
+ end
85
+
86
+ def message
87
+ "commited some #{random_adjective} #{random_object} to #{runner.vcs_info.repo}@#{runner.sha} (#{runner.vcs_info.branch}) "
88
+ end
89
+
90
+ def random_object
91
+ objects = %w(screws bolts exceptions errors cookies)
92
+
93
+ objects.sample
94
+ end
95
+
96
+ def random_adjective
97
+ adjectives = %w(adaptable adventurous affable affectionate agreeable ambitious amiable amicable amusing brave \
98
+ bright broad-minded calm careful charming communicative compassionate conscientious considerate \
99
+ convivial courageous courteous creative decisive determined diligent diplomatic discreet dynamic \
100
+ easygoing emotional energetic enthusiastic exuberant fair-minded faithful fearless forceful \
101
+ frank friendly funny generous gentle good gregarious hard-working helpful honest humorous \
102
+ imaginative impartial independent intellectual intelligent intuitive inventive kind loving loyal \
103
+ modest neat nice optimistic passionate patient persistent pioneering philosophical placid plucky \
104
+ polite powerful practical pro-active quick-witted quiet rational reliable reserved resourceful \
105
+ romantic self-confident self-disciplined sensible sensitive shy sincere sociable straightforward \
106
+ sympathetic thoughtful tidy tough unassuming understanding versatile warmhearted willing witty)
107
+ adjectives.sample
108
+ end
109
+
110
+ def configured?
111
+ super &&
112
+ configuration['api_token'] &&
113
+ configuration['api_team'] &&
114
+ configuration['api_room']
115
+ end
116
+
117
+ def self.name
118
+ 'hipchat'
119
+ end
120
+
121
+ def self.runner_order
122
+ :postcapture
123
+ end
124
+ end
125
+ end
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Lolcommits
3
- VERSION = '0.8.0'.freeze
3
+ VERSION = '0.8.1'.freeze
4
4
  end
data/lolcommits.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'lolcommits/version'
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'lolcommits'
8
- s.version = Lolcommits::VERSION
8
+ s.version = Lolcommits::VERSION.dup
9
9
  s.authors = ['Matthew Rothenberg', 'Matthew Hutchinson']
10
10
  s.email = ['mrothenberg@gmail.com', 'matt@hiddenloop.com']
11
11
  s.homepage = 'http://mroth.github.com/lolcommits/'
@@ -35,6 +35,8 @@ Gem::Specification.new do |s|
35
35
  s.add_development_dependency('tins', '=1.6.0') # ~> 1.7.0+ requires Ruby >= 2.0
36
36
  s.add_development_dependency('aruba', '=0.6.2') # upgrading requires a lot of test code changes
37
37
  s.add_development_dependency('rake', '=10.5.0') # ~> 11+ introduces lots of warnings from other deps
38
+ s.add_runtime_dependency('term-ansicolor', '=1.3.2') # ~> 1.4+ requires Ruby >= 2.0
39
+ s.add_runtime_dependency('net-http-persistent', '=2.9.4') # ~> 3.0+ requires Ruby >= 2.1
38
40
 
39
41
  # core
40
42
  s.add_runtime_dependency('methadone', '~> 1.9.2')
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.8.0
4
+ version: 0.8.1
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: 2016-07-13 00:00:00.000000000 Z
12
+ date: 2016-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -95,6 +95,34 @@ dependencies:
95
95
  - - '='
96
96
  - !ruby/object:Gem::Version
97
97
  version: 10.5.0
98
+ - !ruby/object:Gem::Dependency
99
+ name: term-ansicolor
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - '='
103
+ - !ruby/object:Gem::Version
104
+ version: 1.3.2
105
+ type: :runtime
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - '='
110
+ - !ruby/object:Gem::Version
111
+ version: 1.3.2
112
+ - !ruby/object:Gem::Dependency
113
+ name: net-http-persistent
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '='
117
+ - !ruby/object:Gem::Version
118
+ version: 2.9.4
119
+ type: :runtime
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '='
124
+ - !ruby/object:Gem::Version
125
+ version: 2.9.4
98
126
  - !ruby/object:Gem::Dependency
99
127
  name: methadone
100
128
  requirement: !ruby/object:Gem::Requirement
@@ -408,6 +436,8 @@ files:
408
436
  - lib/lolcommits/platform.rb
409
437
  - lib/lolcommits/plugin.rb
410
438
  - lib/lolcommits/plugins/dot_com.rb
439
+ - lib/lolcommits/plugins/lol_flowdock.rb
440
+ - lib/lolcommits/plugins/lol_hipchat.rb
411
441
  - lib/lolcommits/plugins/lol_protonet.rb
412
442
  - lib/lolcommits/plugins/lol_slack.rb
413
443
  - lib/lolcommits/plugins/lol_tumblr.rb