commit 12e8040f034c271c8357bd7833255d8a6ccc7250 Author: Rémi Prévost Date: Mon Sep 26 08:43:21 2011 -0400 Initial commit diff --git a/doc/Teamocil.html b/doc/Teamocil.html new file mode 100644 index 0000000..358c08d --- /dev/null +++ b/doc/Teamocil.html @@ -0,0 +1,121 @@ + + + + + + Module: Teamocil + + — Teamocil + + + + + + + + + + + + + + + + + + + + + + +

Module: Teamocil + + + +

+ +
+ + + + + + + + +
Defined in:
+
lib/teamocil.rb,
+ lib/teamocil/cli.rb,
lib/teamocil/layout.rb
+
+ +
+
+ +

Defined Under Namespace

+

+ + + + + Classes: CLI, Layout + + +

+ +

Constant Summary

+ +
+ +
VERSION = + +
+
'0.1.9'
+
+ +
+ + + + + + + + +
+ + + + + \ No newline at end of file diff --git a/doc/Teamocil/CLI.html b/doc/Teamocil/CLI.html new file mode 100644 index 0000000..2cdbc14 --- /dev/null +++ b/doc/Teamocil/CLI.html @@ -0,0 +1,438 @@ + + + + + + Class: Teamocil::CLI + + — Teamocil + + + + + + + + + + + + + + + + + + + + + + +

Class: Teamocil::CLI + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/teamocil/cli.rb
+ +
+
+ +

Overview

+
+

This class handles interaction with the tmux utility.

+ +
+
+
+ +
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (CLI) initialize(argv, env) + + + +

+
+

Initialize a new run of tmux

+ +
+
+
+

Parameters:

+
    + +
  • + + argv + + + (Hash) + + + + — +

    the command line parameters hash (usually ARGV).

    + +
  • + +
  • + + env + + + (Hash) + + + + — +

    the environment variables hash (usually ENV).

    + +
  • + +
+ +
+ + + + +
+
+
+
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+
+
# File 'lib/teamocil/cli.rb', line 12
+
+def initialize(argv, env) # {{{
+  bail "You must be in a tmux session to use teamocil" unless env["TMUX"]
+
+  parse_options!
+  if @options.include?(:layout)
+    file = options[:layout]
+  else
+    file = ::File.join("#{env["HOME"]}/.teamocil", "#{argv[0]}.yml")
+  end
+
+  if @options[:edit]
+    ::FileUtils.touch file unless File.exists?(file)
+    system("$EDITOR \"#{file}\"")
+  else
+    bail "There is no file \"#{file}\"" unless File.exists?(file)
+    layout = Teamocil::Layout.new(file, @options)
+    layout.to_tmux
+  end
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) bail(msg) + + + +

+
+

Print an error message and exit the utility

+ +
+
+
+

Parameters:

+
    + +
  • + + msg + + + (Mixed) + + + + — +

    something to print before exiting.

    + +
  • + +
+ +
+ + + + +
+
+
+
+59
+60
+61
+62
+
+
# File 'lib/teamocil/cli.rb', line 59
+
+def bail(msg) # {{{
+  puts "[teamocil] #{msg}"
+  exit 1
+end
+
+
+
+ +
+

+ + - (Object) parse_options! + + + +

+
+

Parse the command line options

+ +
+
+
+ +
+ + + + +
+
+
+
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+
+
# File 'lib/teamocil/cli.rb', line 33
+
+def parse_options! 
+  @options = {}
+  opts = ::OptionParser.new do |opts|
+    opts. = "Usage: teamocil [options] <layout>
+
+  Options:
+    "
+    opts.on("--here", "Set up the first window in the current window") do
+      @options[:here] = true
+    end
+
+    opts.on("--edit", "Edit the YAML layout file instead of using it") do
+      @options[:edit] = true
+    end
+
+    opts.on("--layout [LAYOUT]", "Use a specific layout file, instead of ~/.teamocil/<layout>.yml") do |layout|
+      @options[:layout] = layout
+    end
+
+  end
+  opts.parse!
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/Teamocil/Layout.html b/doc/Teamocil/Layout.html new file mode 100644 index 0000000..0b51b8e --- /dev/null +++ b/doc/Teamocil/Layout.html @@ -0,0 +1,515 @@ + + + + + + Class: Teamocil::Layout + + — Teamocil + + + + + + + + + + + + + + + + + + + + + + +

Class: Teamocil::Layout + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/teamocil/layout.rb
+ +
+
+ +

Overview

+
+

This class act as a wrapper around a tmux YAML layout file.

+ +
+
+
+ +
+ + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Layout) initialize(file, options) + + + +

+
+

Initialize a new layout from a file

+ +
+
+
+

Parameters:

+
    + +
  • + + file + + + (String) + + + + — +

    the complete layout file path

    + +
  • + +
  • + + options + + + (Hash) + + + +
  • + +
+ +
+ + + + +
+
+
+
+9
+10
+11
+12
+
+
# File 'lib/teamocil/layout.rb', line 9
+
+def initialize(file, options) # {{{
+  @layout = YAML.load_file(file)
+  @options = options
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) execute_commands(commands) + + + +

+
+

Execute each command in the shell

+ +
+
+
+

Parameters:

+
    + +
  • + + commands + + + (Array) + + + + — +

    an array of complete commands to send to the shell

    + +
  • + +
+ +
+ + + + +
+
+
+
+73
+74
+75
+
+
# File 'lib/teamocil/layout.rb', line 73
+
+def execute_commands(commands) # {{{
+  `#{commands.join("; ")}`
+end
+
+
+
+ +
+

+ + - (Object) generate_commands + + + +

+
+

Generate tmux commands based on the data found in the layout file

+ +
+
+
+ +
+ + + + +
+
+
+
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+
+
# File 'lib/teamocil/layout.rb', line 21
+
+def generate_commands 
+  output = []
+
+  if @layout["session"].nil?
+    windows = @layout["windows"]
+  else
+    output << "tmux rename-session #{@layout["session"]["name"]}" if @layout["session"]["name"]
+    windows = @layout["session"]["windows"]
+  end
+
+  windows.each_with_index do |window, window_index|
+
+    if @options.include?(:here) and window_index == 0
+      output << "tmux rename-window \"#{window["name"]}\""
+    else
+      output << "tmux new-window -n \"#{window["name"]}\""
+    end
+
+    window["splits"].each_with_index do |split, index|
+      unless index == 0
+        if split.include?("width")
+          cmd = "tmux split-window -h -p #{split["width"]}"
+        elsif split.include?("height")
+          cmd = "tmux split-window -p #{split["height"]}"
+        else
+          cmd = "tmux split-window"
+        end
+        cmd << " -t #{split["target"]}" if split.include?("target")
+        output << cmd
+      end
+
+      # Support single command splits, but treat it as an array nevertheless
+      split["cmd"] = [split["cmd"]] unless split["cmd"].is_a? Array
+
+      # If a `root` key exist, start each split in this directory
+      split["cmd"] = ["cd \"#{window["root"]}\""] + split["cmd"] if window.include?("root")
+
+      # Execute each split command
+      split["cmd"].each do |command|
+        output << "tmux send-keys -t #{index} \"#{command}\""
+        output << "tmux send-keys -t #{index} Enter"
+      end
+    end
+
+  end
+
+  output << "tmux select-pane -t 0"
+end
+
+
+
+ +
+

+ + - (Object) to_tmux + + + +

+
+

Generate commands and sends them to tmux

+ +
+
+
+ +
+ + + + +
+
+
+
+15
+16
+17
+18
+
+
# File 'lib/teamocil/layout.rb', line 15
+
+def to_tmux 
+  commands = generate_commands
+  execute_commands(commands)
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/_index.html b/doc/_index.html new file mode 100644 index 0000000..8a5f18d --- /dev/null +++ b/doc/_index.html @@ -0,0 +1,136 @@ + + + + + + Teamocil + + + + + + + + + + + + + + + + + + + + + + +

Teamocil

+
+

Alphabetic Index

+ +

File Listing

+ + +
+

Namespace Listing A-Z

+ + + + + + + + +
+ + +
    +
  • C
  • +
      + +
    • + CLI + + (Teamocil) + +
    • + +
    +
+ + +
    +
  • L
  • +
      + +
    • + Layout + + (Teamocil) + +
    • + +
    +
+ + + + +
+ +
+ +
+ + + + + \ No newline at end of file diff --git a/doc/class_list.html b/doc/class_list.html new file mode 100644 index 0000000..21b42db --- /dev/null +++ b/doc/class_list.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + +
+

Class List

+ + + + +
+ + diff --git a/doc/css/common.css b/doc/css/common.css new file mode 100644 index 0000000..cf25c45 --- /dev/null +++ b/doc/css/common.css @@ -0,0 +1 @@ +/* Override this file with custom rules */ \ No newline at end of file diff --git a/doc/css/full_list.css b/doc/css/full_list.css new file mode 100644 index 0000000..f95e4e6 --- /dev/null +++ b/doc/css/full_list.css @@ -0,0 +1,53 @@ +body { + margin: 0; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; + height: 101%; + overflow-x: hidden; +} + +h1 { padding: 12px 10px; padding-bottom: 0; margin: 0; font-size: 1.4em; } +.clear { clear: both; } +#search { position: absolute; right: 5px; top: 9px; padding-left: 24px; } +#content.insearch #search, #content.insearch #noresults { background: url(data:image/gif;base64,R0lGODlhEAAQAPYAAP///wAAAPr6+pKSkoiIiO7u7sjIyNjY2J6engAAAI6OjsbGxjIyMlJSUuzs7KamppSUlPLy8oKCghwcHLKysqSkpJqamvT09Pj4+KioqM7OzkRERAwMDGBgYN7e3ujo6Ly8vCoqKjY2NkZGRtTU1MTExDw8PE5OTj4+PkhISNDQ0MrKylpaWrS0tOrq6nBwcKysrLi4uLq6ul5eXlxcXGJiYoaGhuDg4H5+fvz8/KKiohgYGCwsLFZWVgQEBFBQUMzMzDg4OFhYWBoaGvDw8NbW1pycnOLi4ubm5kBAQKqqqiQkJCAgIK6urnJyckpKSjQ0NGpqatLS0sDAwCYmJnx8fEJCQlRUVAoKCggICLCwsOTk5ExMTPb29ra2tmZmZmhoaNzc3KCgoBISEiIiIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+Q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4kigynKaqKCyMnKqSEK05StgAGQRxPYZaENqccFgIID4KXmQBhXFkzDgOnFYLNgltaSAAEpxa7BQoQF4aBACH5BAkIAAAALAAAAAAQABAAAAdogACCg4SFggJiPUqCJSWGgkZjCUwZACQkgxGEXAmdT4UYGZqCGWQ+IjKGGIUwPzGPhAc0NTewhDOdL7Ykji+dOLuOLhI2BbaFETICx4MlQitdqoUsCQ2vhKGjglNfU0SWmILaj43M5oEAOwAAAAAAAAAAAA==) no-repeat center left; } +#full_list { padding: 0; list-style: none; margin-left: 0; } +#full_list ul { padding: 0; } +#full_list li { padding: 5px; padding-left: 12px; margin: 0; font-size: 1.1em; list-style: none; } +#noresults { padding: 7px 12px; } +#content.insearch #noresults { margin-left: 7px; } +ul.collapsed ul, ul.collapsed li { display: none; } +li a.toggle { cursor: default; position: relative; left: -5px; top: 4px; text-indent: -999px; width: 10px; height: 9px; margin-left: -10px; display: block; float: left; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAASCAYAAABb0P4QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK8AAACvABQqw0mAAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTM5jWRgMAAAAVdEVYdENyZWF0aW9uIFRpbWUAMy8xNC8wOeNZPpQAAAE2SURBVDiNrZTBccIwEEXfelIAHUA6CZ24BGaWO+FuzZAK4k6gg5QAdGAq+Bxs2Yqx7BzyL7Llp/VfzZeQhCTc/ezuGzKKnKSzpCxXJM8fwNXda3df5RZETlIt6YUzSQDs93sl8w3wBZxCCE10GM1OcWbWjB2mWgEH4Mfdyxm3PSepBHibgQE2wLe7r4HjEidpnXMYdQPKEMJcsZ4zs2POYQOcaPfwMVOo58zsAdMt18BuoVDPxUJRacELbXv3hUIX2vYmOUvi8C8ydz/ThjXrqKqqLbDIAdsCKBd+Wo7GWa7o9qzOQHVVVXeAbs+yHHCH4aTsaCOQqunmUy1yBUAXkdMIfMlgF5EXLo2OpV/c/Up7jG4hhHcYLgWzAZXUc2b2ixsfvc/RmNNfOXD3Q/oeL9axJE1yT9IOoUu6MGUkAAAAAElFTkSuQmCC) no-repeat bottom left; } +li.collapsed a.toggle { opacity: 0.5; cursor: default; background-position: top left; } +li { color: #888; cursor: pointer; } +li.deprecated { text-decoration: line-through; font-style: italic; } +li.r1 { background: #f0f0f0; } +li.r2 { background: #fafafa; } +li:hover { background: #ddd; } +li small:before { content: "("; } +li small:after { content: ")"; } +li small.search_info { display: none; } +a:link, a:visited { text-decoration: none; color: #05a; } +li.clicked { background: #05a; color: #ccc; } +li.clicked a:link, li.clicked a:visited { color: #eee; } +li.clicked a.toggle { opacity: 0.5; background-position: bottom right; } +li.collapsed.clicked a.toggle { background-position: top right; } +#search input { border: 1px solid #bbb; -moz-border-radius: 3px; -webkit-border-radius: 3px; } +#nav { margin-left: 10px; font-size: 0.9em; display: none; color: #aaa; } +#nav a:link, #nav a:visited { color: #358; } +#nav a:hover { background: transparent; color: #5af; } + +.frames #content h1 { margin-top: 0; } +.frames li { white-space: nowrap; cursor: normal; } +.frames li small { display: block; font-size: 0.8em; } +.frames li small:before { content: ""; } +.frames li small:after { content: ""; } +.frames li small.search_info { display: none; } +.frames #search { width: 170px; position: static; margin: 3px; margin-left: 10px; font-size: 0.9em; color: #888; padding-left: 0; padding-right: 24px; } +.frames #content.insearch #search { background-position: center right; } +.frames #search input { width: 110px; } +.frames #nav { display: block; } + +#full_list.insearch li { display: none; } +#full_list.insearch li.found { display: list-item; padding-left: 10px; } +#full_list.insearch li a.toggle { display: none; } +#full_list.insearch li small.search_info { display: block; } diff --git a/doc/css/style.css b/doc/css/style.css new file mode 100644 index 0000000..2c70d8f --- /dev/null +++ b/doc/css/style.css @@ -0,0 +1,320 @@ +body { + padding: 0 20px; + font-family: "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + font-size: 13px; +} +body.frames { padding: 0 5px; } +h1 { font-size: 25px; margin: 1em 0 0.5em; padding-top: 4px; border-top: 1px dotted #d5d5d5; } +h1.noborder { border-top: 0px; margin-top: 0; padding-top: 4px; } +h1.title { margin-bottom: 10px; } +h1.alphaindex { margin-top: 0; font-size: 22px; } +h2 { + padding: 0; + padding-bottom: 3px; + border-bottom: 1px #aaa solid; + font-size: 1.4em; + margin: 1.8em 0 0.5em; +} +h2 small { font-weight: normal; font-size: 0.7em; display: block; float: right; } +.clear { clear: both; } +.inline { display: inline; } +.inline p:first-child { display: inline; } +.docstring h1, .docstring h2, .docstring h3, .docstring h4 { padding: 0; border: 0; border-bottom: 1px dotted #bbb; } +.docstring h1 { font-size: 1.2em; } +.docstring h2 { font-size: 1.1em; } +.docstring h3, .docstring h4 { font-size: 1em; border-bottom: 0; padding-top: 10px; } +.summary_desc .object_link, .docstring .object_link { font-family: monospace; } + +/* style for