terminal_velocity 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ Spec::Rake::SpecTask.new do |t|
19
19
  end
20
20
 
21
21
  GEM = "terminal_velocity"
22
- GEM_VERSION = "0.0.2"
22
+ GEM_VERSION = "0.0.3"
23
23
  AUTHOR = "Corey Donohoe"
24
24
  EMAIL = "atmos@atmos.org"
25
25
  HOMEPAGE = "http://www.atmos.org/terminal-velocity/"
@@ -38,9 +38,14 @@ tell application "Terminal"
38
38
  activate
39
39
 
40
40
  -- make a new window with the execution of a trivial command
41
+ <% if options[:current_window] %>
42
+ set tabOffset to 1
43
+ set windowOffset to 0
44
+ <% else %>
41
45
  set tabOffset to 0
42
46
  set windowOffset to 1
43
- my do_submenu("Terminal", "Shell", "New Window", "Pro")
47
+ my do_submenu("Terminal", "Shell", "New Window", "<%= options[:term_theme] %>")
48
+ <% end %>
44
49
 
45
50
  -- load up the window id of the window we just created
46
51
  set window_id to id of first window whose frontmost is true
@@ -48,7 +53,7 @@ tell application "Terminal"
48
53
 
49
54
  -- make tabs 2, 3 and 4
50
55
  repeat with i from 1 to (<%= @users_at_hostnames.size %> - windowOffset)
51
- my do_submenu("Terminal", "Shell", "New Tab", "Pro")
56
+ my do_submenu("Terminal", "Shell", "New Tab", "<%= options[:term_theme] %>")
52
57
  end repeat
53
58
 
54
59
  <% @users_at_hostnames.each_with_index do |user_at_hostname, i| %>
@@ -1,9 +1,12 @@
1
1
  module TerminalVelocity
2
2
  module Templates
3
3
  class Runner
4
- def self.run(username, hostnames)
4
+ def self.run(username, hostnames, custom_options = { })
5
5
  users_at_hostnames = hostnames.map { |hostname| "#{username}@#{hostname}" }
6
- new(users_at_hostnames).run
6
+
7
+ runner = new(users_at_hostnames)
8
+ runner.options.merge!(custom_options)
9
+ runner.run
7
10
  end
8
11
 
9
12
  def initialize(users_at_hostnames)
@@ -15,6 +18,10 @@ module TerminalVelocity
15
18
  launch
16
19
  end
17
20
 
21
+ def options
22
+ @options ||= { :term_theme => "Pro", :current_window => false}
23
+ end
24
+
18
25
  private
19
26
  def ssh_command(user_at_hostname)
20
27
  "clear; ssh -o StrictHostKeyChecking=no #{user_at_hostname}"
@@ -27,7 +34,14 @@ module TerminalVelocity
27
34
  end
28
35
 
29
36
  def launch
30
- %x{#{launcher_script} "#{script_filename}" 2>/dev/null}
37
+ results = `#{launcher_script} "#{script_filename}" 2>&1`
38
+ if $?.to_i != 0
39
+ case results
40
+ when /Can’t get window 1 whose frontmost = true. Invalid index/
41
+ $stderr.puts("You need to 'Enable access for assistive devices.'")
42
+ else
43
+ end
44
+ end
31
45
  end
32
46
 
33
47
  def script_filename
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terminal_velocity
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Corey Donohoe