From 7de4fe7d30b0972eb658eb017655803c32eeef7c Mon Sep 17 00:00:00 2001 From: Matthew Rothenberg Date: Tue, 16 May 2017 21:14:20 -0400 Subject: [PATCH] repair timelapse feature MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this seems perhaps outside of core functionality of lolcommits, but as it is already there, so… I guess it is fun. --- features/history.feature | 8 ++------ lib/lolcommits/cli/commands/history.rb | 10 ++++++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/features/history.feature b/features/history.feature index 9cb3728e..5838421a 100644 --- a/features/history.feature +++ b/features/history.feature @@ -112,7 +112,7 @@ 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` @@ -120,12 +120,8 @@ Feature: History command 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" - - - - diff --git a/lib/lolcommits/cli/commands/history.rb b/lib/lolcommits/cli/commands/history.rb index fcd5faf4..04411175 100644 --- a/lib/lolcommits/cli/commands/history.rb +++ b/lib/lolcommits/cli/commands/history.rb @@ -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 @@ -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? @@ -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? @@ -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