phusler-rb_terminal 0.0.1

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.
@@ -0,0 +1,15 @@
1
+ = Rb Terminal
2
+ A simple wrapper to create several terminal tabs on OSX and run commands on them. For instance, you can use it to the usual tabs for a rails project.
3
+
4
+ #!/usr/bin/env ruby
5
+ require 'rb_terminal'
6
+
7
+ project_dir = "~/work/rails/awesomeapp"
8
+ RbTerminal::Terminal.new("cd #{project_dir} && git status") do |term|
9
+ term.tab("cd #{project_dir} && tail -f -n 100 log/development.log")
10
+ term.tab("cd #{project_dir} && script/console")
11
+ term.tab("cd #{project_dir} && script/server")
12
+ end
13
+
14
+ == Install
15
+ gem install phusler-rb_terminal --source http://gems.github.com
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('rb_terminal', '0.0.1') do |p|
6
+ p.description = "A simple wrapper to create several terminal tabs on OSX and run commands on them"
7
+ p.url = "http://github.com/phusler/rb_terminal"
8
+ p.author = "Patrick Huesler"
9
+ p.email = "patrick.huesler@gmail.com"
10
+ p.ignore_pattern = ["tmp/*"]
11
+ p.development_dependencies = []
12
+ end
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ require 'appscript'
3
+ module RbTerminal
4
+ class Terminal
5
+ include Appscript
6
+ def initialize(init_command="")
7
+ @terminal = app('Terminal')
8
+ @terminal.do_script(init_command)
9
+ @current_window = @terminal.windows.first
10
+ yield self if block_given?
11
+ end
12
+
13
+ def tab(command, *args)
14
+ options = args.first && args.first.is_a?(Hash) ? args.first : {}
15
+ create_tab
16
+ @current_tab.normal_text_color.set(options[:text_color]) if options[:text_color]
17
+ @current_tab.background_color.set(options[:background_color]) if options[:background_color]
18
+ @current_tab.cursor_color.set(options[:cursor_color]) if options[:cursor_color]
19
+ @terminal.do_script(command, :in => @current_tab)
20
+ end
21
+
22
+ private
23
+
24
+ def create_tab
25
+ app("System Events").application_processes["Terminal.app"].keystroke("t", :using => :command_down)
26
+ @current_tab = @current_window.tabs.last
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rb_terminal}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Patrick Huesler"]
9
+ s.date = %q{2009-01-28}
10
+ s.description = %q{A simple wrapper to create several terminal tabs on OSX and run commands on them}
11
+ s.email = %q{patrick.huesler@gmail.com}
12
+ s.extra_rdoc_files = ["lib/rb_terminal.rb", "README.rdoc"]
13
+ s.files = ["lib/rb_terminal.rb", "Rakefile", "README.rdoc", "Manifest", "rb_terminal.gemspec"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/phusler/rb_terminal}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rb_terminal", "--main", "README.rdoc"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{rb_terminal}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{A simple wrapper to create several terminal tabs on OSX and run commands on them}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: phusler-rb_terminal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Patrick Huesler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-01-28 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A simple wrapper to create several terminal tabs on OSX and run commands on them
17
+ email: patrick.huesler@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - lib/rb_terminal.rb
24
+ - README.rdoc
25
+ files:
26
+ - lib/rb_terminal.rb
27
+ - Rakefile
28
+ - README.rdoc
29
+ - Manifest
30
+ - rb_terminal.gemspec
31
+ has_rdoc: true
32
+ homepage: http://github.com/phusler/rb_terminal
33
+ post_install_message:
34
+ rdoc_options:
35
+ - --line-numbers
36
+ - --inline-source
37
+ - --title
38
+ - Rb_terminal
39
+ - --main
40
+ - README.rdoc
41
+ require_paths:
42
+ - lib
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: "0"
48
+ version:
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "1.2"
54
+ version:
55
+ requirements: []
56
+
57
+ rubyforge_project: rb_terminal
58
+ rubygems_version: 1.2.0
59
+ signing_key:
60
+ specification_version: 2
61
+ summary: A simple wrapper to create several terminal tabs on OSX and run commands on them
62
+ test_files: []
63
+