lib/termup/base.rb in termup-1.2.2 vs lib/termup/base.rb in termup-1.3.0
- old
+ new
@@ -7,13 +7,13 @@
ITERM2 = /^1.0/
include Appscript
def initialize(project)
- @apps = app("System Events").application_processes
+ @apps = app('System Events').application_processes
@frontmost = @apps.get.select{|i| i.frontmost.get }.map{|i| i.name.get }.first
- return unless ["Terminal", "iTerm"].include?(@frontmost)
+ return unless ['Terminal', 'iTerm'].include?(@frontmost)
@terminal = app(@frontmost)
@project = YAML.load(File.read("#{TERMUP_DIR}/#{project}.yml"))
# Split panes for iTerm 2
@@ -35,45 +35,45 @@
end
def new_tab
if @got_first_tab_already
if iterm2?
- @apps[@frontmost].keystroke("]", :using => :command_down)
+ @apps[@frontmost].keystroke(']', :using => :command_down)
else
- @apps[@frontmost].keystroke("t", :using => :command_down)
+ @apps[@frontmost].keystroke('t', :using => :command_down)
end
end
@got_first_tab_already = true
sleep 0.01 # Allow some time to complete opening a new tab
@terminal.windows[1].tabs.last.get if terminal?
end
def split_panes
# Virtical splits
(@project['options']['iterm']['width'] - 1).times do |i|
- @apps[@frontmost].keystroke("d", :using => :command_down)
+ @apps[@frontmost].keystroke('d', :using => :command_down)
end
# Back to home
- @apps[@frontmost].keystroke("]", :using => :command_down)
+ @apps[@frontmost].keystroke(']', :using => :command_down)
# Horizontal splits
@project['options']['iterm']['width'].times do |i|
(@project['options']['iterm']['height'] - 1).times do |i|
- @apps[@frontmost].keystroke("d", :using => [ :command_down, :shift_down ])
+ @apps[@frontmost].keystroke('d', :using => [ :command_down, :shift_down ])
end
# Move to the right
- @apps[@frontmost].keystroke("]", :using => :command_down)
+ @apps[@frontmost].keystroke(']', :using => :command_down)
end
end
def terminal?
- @frontmost == "Terminal"
+ @frontmost == 'Terminal'
end
def iterm1?
- @frontmost == "iTerm" and @terminal.version.get =~ ITERM1
+ @frontmost == 'iTerm' and @terminal.version.get =~ ITERM1
end
def iterm2?
- @frontmost == "iTerm" and @terminal.version.get =~ ITERM2
+ @frontmost == 'iTerm' and @terminal.version.get =~ ITERM2
end
end
end