add a binary runner and support for iTermfile
This commit is contained in:
parent
8e5ea076d6
commit
9ad331f7ca
6
bin/iterm-window
Executable file
6
bin/iterm-window
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require 'iterm_window'
|
||||||
|
|
||||||
|
ItermWindow.run_file(File.read('iTermfile'))
|
||||||
|
|
@ -9,6 +9,7 @@ Gem::Specification.new do |s|
|
|||||||
s.files = ['README.rdoc', 'LICENSE', 'lib/iterm_window.rb']
|
s.files = ['README.rdoc', 'LICENSE', 'lib/iterm_window.rb']
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
s.has_rdoc = true
|
s.has_rdoc = true
|
||||||
|
s.executables << "iterm-window"
|
||||||
|
|
||||||
s.add_development_dependency 'rspec', '~> 2.6.0'
|
s.add_development_dependency 'rspec', '~> 2.6.0'
|
||||||
s.add_development_dependency 'fakefs'
|
s.add_development_dependency 'fakefs'
|
||||||
|
@ -100,6 +100,10 @@ class ItermWindow
|
|||||||
@default_tab = nil
|
@default_tab = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.run_file(file)
|
||||||
|
instance_eval(file)
|
||||||
|
end
|
||||||
|
|
||||||
# Creates a new terminal window, runs the block on it
|
# Creates a new terminal window, runs the block on it
|
||||||
def self.open(options = {}, &block)
|
def self.open(options = {}, &block)
|
||||||
self.new.run(:new, options, &block)
|
self.new.run(:new, options, &block)
|
||||||
|
@ -27,6 +27,18 @@ describe ItermWindow do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '.run_file' do
|
||||||
|
it "should read the file and create a window" do
|
||||||
|
ItermWindow.expects(:new).returns(@window)
|
||||||
|
@window.expects(:run).with(:new, {})
|
||||||
|
ItermWindow.run_file(<<-FILE)
|
||||||
|
open do
|
||||||
|
open_tab :test
|
||||||
|
end
|
||||||
|
FILE
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "opening a tab (example 1)" do
|
describe "opening a tab (example 1)" do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
ItermWindow.expects(:new).returns(@window)
|
ItermWindow.expects(:new).returns(@window)
|
||||||
|
Loading…
Reference in New Issue
Block a user