Permalink
Browse files

added Terminal action in order to automate the workflow and launch a …

…Terminal the first pomodoro of the day and maybe use http://github.com/achiu/terminitor to configure which tabs to open
  • Loading branch information...
1 parent 5f54f1f commit 8378f0e44da2c1235a63f41dc875d823fcf447ea @jmgarnier committed Oct 4, 2010
Showing with 48 additions and 0 deletions.
  1. +22 −0 actions/terminal.rb
  2. +1 −0 config.rb.sample
  3. +25 −0 spec/actions/terminal_spec.rb
View
22 actions/terminal.rb
@@ -0,0 +1,22 @@
+class Terminal < CapreseAction
+ include Appscript
+ config_schema [String]
+
+ def start
+ unless Terminal.caprese_application.running?
+ Terminal.caprese_application.activate!
+ app = Terminal.caprese_application.handle
+ app.do_script(config, :in => app.windows.first)
+ end
+ end
+
+ def stop
+ end
+
+ class << self
+ def caprese_application
+ @@terminal ||= Application.new("Terminal")
+ end
+ end
+
+end
View
1 config.rb.sample
@@ -38,6 +38,7 @@ BlockDomains(
LaunchApplications "Campfire", "Pivotal Tracker", "Ruby Docs (and others)", "TextMate"
QuitApplications "Google Calendar", "Remember the Milk", "Preview"
QuitAndBlockApplications "GMail", "Google Reader", "Google Voice", "Colloquy", "Mail", "TweetDeck"
+Terminal "cd Code;git pull"
AdiumStatus(
:away => "Pomodoro! Ends at #{stop_time.to_short_time}",
View
25 spec/actions/terminal_spec.rb
@@ -0,0 +1,25 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe Terminal do
+
+ before :each do
+ @action = Terminal.new(["echo 'hello world!'"])
+ end
+
+ describe "#start" do
+ it "launch a Terminal only if it isn't running already" do
+ @action.start
+ Terminal.caprese_application.should be_running
+ end
+
+ it "should run the script in the first windows" do
+ # I don't know how to write a test for this!
+ end
+
+ after :each do
+ Terminal.caprese_application.quit!
+ end
+
+ end
+
+end

0 comments on commit 8378f0e

Please sign in to comment.