Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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...
commit 8378f0e44da2c1235a63f41dc875d823fcf447ea 1 parent 5f54f1f
@21croissants authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.