Skip to content

Commit

Permalink
repair timelapse feature
Browse files Browse the repository at this point in the history
this seems perhaps outside of core functionality of lolcommits, but as
it is already there, so… I guess it is fun.
  • Loading branch information
mroth committed May 17, 2017
1 parent d376bc1 commit 7de4fe7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 2 additions & 6 deletions features/history.feature
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,16 @@ Feature: History command
"""
And the exit status should be 0

Scenario: generate gif should store in its own archive directory
Scenario: timelapse gif should store in its own archive directory
Given I am in a git repo named "giffy" with lolcommits enabled
And a loldir named "giffy" with 2 lolimages
When I successfully run `lolcommits history timelapse`
Then the output should contain "Generating animated gif."
And a directory named "~/.lolcommits/giffy/archive" should exist
And a file named "~/.lolcommits/giffy/archive/archive.gif" should exist

Scenario: generate gif with argument 'today'
Scenario: timelapse gif with argument 'today'
Given I am in a git repo named "sunday" with lolcommits enabled
And a loldir named "sunday" with 2 lolimages
When I successfully run `lolcommits history timelapse --period today`
Then there should be exactly 1 gif in "~/.lolcommits/sunday/archive"




10 changes: 6 additions & 4 deletions lib/lolcommits/cli/commands/history.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require 'lolcommits/cli/command'
require 'lolcommits/cli/fatals'
require 'lolcommits/cli/launcher'
require 'lolcommits/cli/timelapse_gif'

module Lolcommits
module CLI
Expand All @@ -9,7 +10,7 @@ class HistoryCommand < Command
option '--open', :flag, 'open directory for display in OS'
def execute
Fatals.die_if_not_vcs_repo!
# change_dir_to_root_or_repo!
# TODO: change_dir_to_root_or_repo!
config = Configuration.new(PluginManager.init, test_mode: test?)
puts config.loldir
Launcher.open_folder(config.loldir) if open?
Expand All @@ -20,7 +21,7 @@ def execute
option '--open', :flag, 'open file for display in OS'
def execute
Fatals.die_if_not_vcs_repo!
# change_dir_to_root_or_repo!
# TODO: change_dir_to_root_or_repo!
config = Configuration.new(PluginManager.init, test_mode: test?)
lolimage = Dir.glob(File.join(config.loldir, '*.{jpg,gif}')).max_by { |f| File.mtime(f) }
if lolimage.nil?
Expand All @@ -33,11 +34,12 @@ def execute
end

subcommand 'timelapse', 'generate animated timelapse .gif' do
option '--period', 'PERIOD', '"today" or "all"', default: 'all'
def execute
Fatals.die_if_not_vcs_repo!
# change_dir_to_root_or_repo!
# TODO: change_dir_to_root_or_repo!
config = Configuration.new(PluginManager.init, test_mode: test?)
TimelapseGif.new(config).run(options[:period])
TimelapseGif.new(config).run(period)
end
end
end
Expand Down

0 comments on commit 7de4fe7

Please sign in to comment.