Skip to content

Commit

Permalink
added Terminal action in order to automate the workflow and launch a …
Browse files Browse the repository at this point in the history
…Terminal the first pomodoro of the day and maybe use http://github.com/achiu/terminitor to configure which tabs to open
  • Loading branch information
21croissants committed Oct 4, 2010
1 parent 5f54f1f commit 8378f0e
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
22 changes: 22 additions & 0 deletions 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
1 change: 1 addition & 0 deletions config.rb.sample
Expand Up @@ -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}",
Expand Down
25 changes: 25 additions & 0 deletions 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.