lolcommits 0.5.8 → 0.5.9.pre1

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
- YWM2Mjk1ZjlmYWQ4YmI1MTE0YzYxZDk0MjVkOGE1MmI3NDk2ZDBlMg==
4
+ NDI1ODQ5NGJmYzNmZmY3NDFkYmQ4ZGVjYWI4MmZhNzMyZGM4ZjdiNQ==
5
5
  data.tar.gz: !binary |-
6
- NjE0YzAxODgxNTRmOTNhNjUzNzgxNGI5MjNiZmJhZjFmNzc4MTAxNg==
6
+ Njg3MjU3ZTYxZDdmNWE1ZTEyNTQ4ZTI1NDUzNWU0OWZjYjc1M2M1OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZDY3NmUwYzI2YmIwMDE4ZDRlYzlkYmJiYWQ0Y2E3OTIwN2Y0MjNlY2MxZTYy
10
- ZDg2ZTdmZWFjOTE4NTUwZjg2ZDYwNDdkYjhkMzY4ZTY5ZGExOTE1Yzk5YmUw
11
- MTI0ODMxNjNiMzE3MjNkYjU2OTE5NWIwZDFlNzUxMDgzOWQ4ZDc=
9
+ M2JiZDE3NWQ1M2RjODAxZjNiM2RhYjNhYmNmOGYwMDVhMzdiMjZkNjg0ZTg3
10
+ OTk5YWFhNmQ4NzdjMWViNzY4MzFjOGYwZWM0OTU5MDQ1MzdhMTgzNTcyNDI4
11
+ ZWJmMzgwZDE4NjVlMWJiZDY4ZDgyMWU1YzUxYzAxYWJiZDJmNmQ=
12
12
  data.tar.gz: !binary |-
13
- YjRjYWJlMTY3ZGNmNTc4Y2EyM2QwODk4ZjNkYWVkZDUxMmM3Yjc1MGU0YTFk
14
- ODYyY2ZlNzQwNDkzMDcwZWYxZGRjZGUxNzRmYWU0MzI5NjFmMTE2MDY1Zjky
15
- MDZhNWFlYWY2ZWVjNzU4Y2NlZTA2ZmFjMDRmMzZjZTExZDU0OGU=
13
+ NzhmYTFkN2JmMTQwNDQ0ZTM0ZmQ5MGUyNzFlMmNlMGUzNTkzMGJhNDI0YzQ2
14
+ MzljZjZlZGE5MWFjYzIzMTE0ODhkMDdkMGI1YmE3YjBjNDY5M2I4YjQzNGQz
15
+ ZjJhNDM2NTIxY2NlZGJkOWM5YWY4MmM0ZjVlODkyYWViMTNjMGU=
@@ -26,7 +26,6 @@ branches:
26
26
  - gh-pages
27
27
 
28
28
  notifications:
29
- irc: chat.freenode.net#lolcommits
30
29
  slack:
31
30
  secure: BkGsQOYMJqW55j94S1QwmR17BkwuTIULKVhwzRdnv37BvVcC17y9KLMo8NH+bcao36XZx9DukXcTyaDQc6tCSlFEbG/FcPUJM8bx9EWjHUoGVg1KdpVu/nVHu+GKosrB41lM3nfJWCnF0TOSnmTXU+bV8Pwkij+L5X+gNyAT2Ns=
32
31
 
@@ -163,15 +163,21 @@ Choice.options do
163
163
  option :enable do
164
164
  long '--enable'
165
165
  short '-e'
166
- action { Installation.do_enable }
167
166
  desc 'install lolcommits for this repo'
167
+ action do
168
+ Installation.do_enable
169
+ exit 0
170
+ end
168
171
  end
169
172
 
170
173
  option :disable do
171
174
  long '--disable'
172
175
  short '-d'
173
- action { Installation.do_disable }
174
176
  desc 'uninstall lolcommits for this repo'
177
+ action do
178
+ Installation.do_disable
179
+ exit 0
180
+ end
175
181
  end
176
182
 
177
183
  option :capture do
@@ -314,27 +320,25 @@ load_local_plugins!
314
320
  #
315
321
  # Handle actions manually since choice seems weird
316
322
  #
317
- if !Choice.choices[:enable] || !Choice.choices[:disable]
318
- if Choice.choices[:capture]
319
- do_capture
320
- elsif Choice.choices[:configure]
321
- do_configure
322
- elsif Choice.choices[:show_config]
323
- puts configuration
324
- elsif Choice.choices[:plugins]
325
- configuration.puts_plugins
326
- elsif Choice.choices[:devices]
327
- puts Platform.device_list
328
- puts "Specify a device with --device=\"{device name}\" "\
329
- 'or set the LOLCOMMITS_DEVICE env variable'
330
- elsif Choice.choices[:last]
331
- do_last
332
- elsif Choice.choices[:browse]
333
- Fatals.die_if_not_git_repo!
334
- Launcher.open_folder(configuration.loldir)
335
- elsif Choice.choices[:gif]
336
- TimelapseGif.new(configuration).run(Choice.choices[:gif])
337
- else
338
- do_noargs
339
- end
323
+ if Choice.choices[:capture]
324
+ do_capture
325
+ elsif Choice.choices[:configure]
326
+ do_configure
327
+ elsif Choice.choices[:show_config]
328
+ puts configuration
329
+ elsif Choice.choices[:plugins]
330
+ configuration.puts_plugins
331
+ elsif Choice.choices[:devices]
332
+ puts Platform.device_list
333
+ puts "Specify a device with --device=\"{device name}\" "\
334
+ 'or set the LOLCOMMITS_DEVICE env variable'
335
+ elsif Choice.choices[:last]
336
+ do_last
337
+ elsif Choice.choices[:browse]
338
+ Fatals.die_if_not_git_repo!
339
+ Launcher.open_folder(configuration.loldir)
340
+ elsif Choice.choices[:gif]
341
+ TimelapseGif.new(configuration).run(Choice.choices[:gif])
342
+ else
343
+ do_noargs
340
344
  end
@@ -1,2 +1,2 @@
1
1
  ---
2
- default: <%= (RUBY_PLATFORM =~ /darwin/) ? 'features' : '--tags ~@mac-only' %>
2
+ default: <%= (RbConfig::CONFIG['host_os'] =~ /darwin/) ? 'features' : '--tags ~@mac-only' %>
@@ -9,14 +9,14 @@ Feature: Basic UI functionality
9
9
  And the banner should be present
10
10
 
11
11
  Scenario: Help should show the animate option on a Mac platform
12
- Given I am using a "Mac" platform
12
+ Given I am using a "darwin" platform
13
13
  When I get help for "lolcommits"
14
14
  Then the following options should be documented:
15
15
  | --animate | which is optional |
16
16
  | -a | which is optional |
17
17
 
18
18
  Scenario: Help should not show the animate option on a Windows plaftorm
19
- Given I am using a "Windows" platform
19
+ Given I am using a "win32" platform
20
20
  When I get help for "lolcommits"
21
21
  Then the output should not match /\-a\, \-\-animate\=SECONDS/
22
22
 
@@ -242,7 +242,6 @@ Feature: Basic UI functionality
242
242
  Scenario: should generate an animated gif on the Mac platform
243
243
  Given I am in a git repo named "animate"
244
244
  And I do a git commit
245
- And I am using a "Mac" platform
246
245
  When I run `lolcommits --capture --animate=1`
247
246
  Then the output should contain "*** Preserving this moment in history."
248
247
  And a directory named "~/.lolcommits/animate" should exist
@@ -252,10 +251,17 @@ Feature: Basic UI functionality
252
251
 
253
252
  @fake-no-ffmpeg
254
253
  Scenario: gracefully fail when ffmpeg not installed and --animate is used
255
- Given I am using a "Mac" platform
254
+ Given I am using a "darwin" platform
256
255
  When I run `lolcommits --animate=3`
257
256
  Then the output should contain:
258
257
  """
259
258
  ffmpeg does not appear to be properly installed
260
259
  """
261
260
  And the exit status should be 1
261
+
262
+ Scenario: Enable on windows platform setting PATH in post-commit hook
263
+ Given I am using a "win32" platform
264
+ And I am in a git repo
265
+ When I successfully run `lolcommits --enable`
266
+ Then the post-commit hook should contain "set path"
267
+ And the exit status should be 0
@@ -132,8 +132,8 @@ Then(/^there should be (\d+) commit entries in the git log$/) do |n|
132
132
  expect(n.to_i).to eq `git shortlog | grep -E '^[ ]+\w+' | wc -l`.chomp.to_i
133
133
  end
134
134
 
135
- Given(/^I am using a "(.*?)" platform$/) do |platform_name|
136
- set_env 'LOLCOMMITS_FAKEPLATFORM', platform_name
135
+ Given(/^I am using a "(.*?)" platform$/) do |host_os_name|
136
+ set_env 'LOLCOMMITS_FAKE_HOST_OS', host_os_name
137
137
  end
138
138
 
139
139
  When(/^I wait for the child process to exit in "(.*?)"$/) do |repo_name|
@@ -15,11 +15,13 @@ Before do
15
15
  @puts = true
16
16
  @aruba_timeout_seconds = 20
17
17
 
18
- set_env 'LOLCOMMITS_FAKECAPTURE', '1'
18
+ # prevent launchy from opening gifs in tests
19
19
  set_env 'LAUNCHY_DRY_RUN', 'true'
20
+ set_env 'LOLCOMMITS_CAPTURER', 'CaptureFake'
20
21
 
21
22
  author_name = 'Testy McTesterson'
22
23
  author_email = 'testy@tester.com'
24
+
23
25
  set_env 'GIT_AUTHOR_NAME', author_name
24
26
  set_env 'GIT_COMMITTER_NAME', author_name
25
27
  set_env 'GIT_AUTHOR_EMAIL', author_email
@@ -53,6 +55,7 @@ end
53
55
  Before('@in-tempdir') do
54
56
  @dirs = [Dir.mktmpdir]
55
57
  end
58
+
56
59
  After('@in-tempdir') do
57
60
  FileUtils.rm_rf(@dirs.first)
58
61
  end
@@ -68,11 +68,17 @@ module Lolcommits
68
68
  end
69
69
  end
70
70
 
71
- def self.hook_script(_add_shebang = true)
71
+ def self.hook_script
72
72
  ruby_path = Lolcommits::Platform.command_which('ruby', true)
73
73
  imagick_path = Lolcommits::Platform.command_which('identify', true)
74
- locale_export = "export LANG=\"#{ENV['LANG']}\"\n"
75
- hook_export = "export PATH=\"#{ruby_path}:#{imagick_path}:$PATH\"\n"
74
+
75
+ if Lolcommits::Platform.platform_windows?
76
+ hook_export = "set path \"#{ruby_path};#{imagick_path};%PATH%\"\n"
77
+ else
78
+ locale_export = "export LANG=\"#{ENV['LANG']}\"\n"
79
+ hook_export = "export PATH=\"#{ruby_path}:#{imagick_path}:$PATH\"\n"
80
+ end
81
+
76
82
  capture_cmd = 'lolcommits --capture'
77
83
  capture_args = " #{ARGV[1..-1].join(' ')}" if ARGV.length > 1
78
84
 
@@ -1,17 +1,22 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'mini_magick'
3
+ require 'rbconfig'
3
4
 
4
5
  module Lolcommits
5
6
  class Platform
6
- # A convenience name for the platform. Mainly used for metaprogramming.
7
- # @return String
8
- def self.platform
9
- if platform_fakeplatform? then ENV['LOLCOMMITS_FAKEPLATFORM']
10
- elsif platform_fakecapture? then 'Fake'
11
- elsif platform_mac? then 'Mac'
12
- elsif platform_linux? then 'Linux'
13
- elsif platform_windows? then 'Windows'
14
- elsif platform_cygwin? then 'Cygwin'
7
+ # The capturer class constant to use
8
+ # @return Class
9
+ def self.capturer_class(animate = false)
10
+ if ENV['LOLCOMMITS_CAPTURER']
11
+ const_get(ENV['LOLCOMMITS_CAPTURER'])
12
+ elsif platform_mac?
13
+ animate ? CaptureMacAnimated : CaptureMac
14
+ elsif platform_linux?
15
+ animate ? CaptureLinuxAnimated : CaptureLinux
16
+ elsif platform_windows?
17
+ CaptureWindows
18
+ elsif platform_cygwin?
19
+ CaptureCygwin
15
20
  else
16
21
  fail 'Unknown / Unsupported Platform.'
17
22
  end
@@ -20,49 +25,37 @@ module Lolcommits
20
25
  # Are we on a Mac platform?
21
26
  # @return Boolean
22
27
  def self.platform_mac?
23
- RUBY_PLATFORM.to_s.downcase.include?('darwin')
28
+ host_os.include?('darwin')
24
29
  end
25
30
 
26
31
  # Are we on a Linux platform?
27
32
  # @return Boolean
28
33
  def self.platform_linux?
29
- RUBY_PLATFORM.to_s.downcase.include?('linux')
34
+ host_os.include?('linux')
30
35
  end
31
36
 
32
37
  # Are we on a Windows platform?
33
38
  # @return Boolean
34
39
  def self.platform_windows?
35
- !RUBY_PLATFORM.match(/(win|w)32/).nil?
40
+ !host_os.match(/(win|w)32/).nil?
36
41
  end
37
42
 
38
43
  # Are we on a Cygwin platform?
39
44
  # @return Boolean
40
45
  def self.platform_cygwin?
41
- RUBY_PLATFORM.to_s.downcase.include?('cygwin')
42
- end
43
-
44
- # Are we currently faking webcam capture for test purposes?
45
- # @return Boolean
46
- def self.platform_fakecapture?
47
- (ENV['LOLCOMMITS_FAKECAPTURE'] == '1' || false)
46
+ host_os.include?('cygwin')
48
47
  end
49
48
 
50
- # Are we currently overriding and faking the platform entirely?
51
- # @todo possibly make this a private method?
52
- # @return Boolean
53
- def self.platform_fakeplatform?
54
- ENV['LOLCOMMITS_FAKEPLATFORM']
49
+ # return host_os identifier from the RbConfig::CONFIG constant
50
+ # @return String
51
+ def self.host_os
52
+ ENV['LOLCOMMITS_FAKE_HOST_OS'] || RbConfig::CONFIG['host_os'].downcase
55
53
  end
56
54
 
57
55
  # Is the platform capable of capturing animated GIFs from webcam?
58
56
  # @return Boolean
59
57
  def self.can_animate?
60
- # FIXME: this is currently matching against string instead of
61
- # simply returning platform_mac? || platform_linux?
62
- # This is not ideal... but otherwise overriding platform via
63
- # LOLCOMMITS_FAKEPLATFORM when running cucumber tests won't work.
64
- # We should come up with a better solution.
65
- %w(Mac Linux).include? platform
58
+ platform_linux? || platform_mac?
66
59
  end
67
60
 
68
61
  # Is a valid install of imagemagick present on the system?
@@ -80,7 +80,8 @@ module Lolcommits
80
80
  puts '*** Preserving this moment in history.' unless capture_stealth
81
81
  self.snapshot_loc = config.raw_image(image_file_type)
82
82
  self.main_image = config.main_image(sha, image_file_type)
83
- capturer = capturer_class.new(
83
+
84
+ capturer = Platform.capturer_class(animate?).new(
84
85
  :capture_device => capture_device,
85
86
  :capture_delay => capture_delay,
86
87
  :snapshot_location => snapshot_loc,
@@ -98,11 +99,10 @@ module Lolcommits
98
99
 
99
100
  private
100
101
 
101
- def capturer_class
102
- capturer_module = 'Lolcommits'
103
- capturer_class = "Capture#{Platform.platform}#{animate? ? 'Animated' : nil}"
104
- Object.const_get(capturer_module).const_get(capturer_class)
105
- end
102
+ # def capturer_class
103
+ # capturer_module = 'Lolcommits'
104
+ # Object.const_get(capturer_module).const_get(Platform.capturer_class(animate?))
105
+ # end
106
106
 
107
107
  def image_file_type
108
108
  animate? ? 'gif' : 'jpg'
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module Lolcommits
3
- VERSION = '0.5.8'
3
+ VERSION = '0.5.9.pre1'
4
4
  end
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.5.8
4
+ version: 0.5.9.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: 2015-04-22 00:00:00.000000000 Z
12
+ date: 2015-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -435,9 +435,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
435
435
  version: 1.8.7
436
436
  required_rubygems_version: !ruby/object:Gem::Requirement
437
437
  requirements:
438
- - - ! '>='
438
+ - - ! '>'
439
439
  - !ruby/object:Gem::Version
440
- version: '0'
440
+ version: 1.3.1
441
441
  requirements:
442
442
  - imagemagick
443
443
  - a webcam