teamocil 0.2.2 → 0.3.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.
- data/.travis.yml +2 -0
 - data/Gemfile.lock +1 -1
 - data/README.md +80 -67
 - data/lib/teamocil/cli.rb +36 -10
 - data/lib/teamocil/layout.rb +1 -0
 - data/lib/teamocil.rb +1 -1
 - data/spec/cli_spec.rb +26 -0
 - data/spec/fixtures/.teamocil/sample-2.yml +10 -0
 - data/spec/fixtures/.teamocil/sample.yml +10 -0
 - data/spec/mock/cli.rb +20 -0
 - data/spec/mock/layout.rb +20 -0
 - data/spec/spec_helper.rb +2 -0
 - data/teamocil.gemspec +2 -1
 - metadata +24 -13
 
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -2,13 +2,17 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            Teamocil is a simple tool used to automatically create sessions, windows and splits in [tmux](http://tmux.sourceforge.net/) with YAML files.
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            [](http://travis-ci.org/remiprev/teamocil)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       5 
7 
     | 
    
         
             
            ## Usage
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
            ```bash
         
     | 
| 
      
 10 
     | 
    
         
            +
            $ gem install teamocil
         
     | 
| 
      
 11 
     | 
    
         
            +
            $ mkdir ~/.teamocil
         
     | 
| 
      
 12 
     | 
    
         
            +
            $ teamocil --edit sample
         
     | 
| 
      
 13 
     | 
    
         
            +
            $ tmux
         
     | 
| 
      
 14 
     | 
    
         
            +
            $ teamocil sample
         
     | 
| 
      
 15 
     | 
    
         
            +
            ```
         
     | 
| 
       12 
16 
     | 
    
         | 
| 
       13 
17 
     | 
    
         
             
            ## Options
         
     | 
| 
       14 
18 
     | 
    
         | 
| 
         @@ -30,10 +34,12 @@ You can wrap your entire layout file in a `session` and Teamocil will rename the 
     | 
|
| 
       30 
34 
     | 
    
         | 
| 
       31 
35 
     | 
    
         
             
            #### Example
         
     | 
| 
       32 
36 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
      
 37 
     | 
    
         
            +
            ```yaml
         
     | 
| 
      
 38 
     | 
    
         
            +
            session:
         
     | 
| 
      
 39 
     | 
    
         
            +
              name: "my-awesome-session"
         
     | 
| 
      
 40 
     | 
    
         
            +
              windows:
         
     | 
| 
      
 41 
     | 
    
         
            +
                [windows list]
         
     | 
| 
      
 42 
     | 
    
         
            +
            ```
         
     | 
| 
       37 
43 
     | 
    
         | 
| 
       38 
44 
     | 
    
         
             
            ### Windows
         
     | 
| 
       39 
45 
     | 
    
         | 
| 
         @@ -49,27 +55,27 @@ If you are not using a top-level `session` key, then the first key of your layou 
     | 
|
| 
       49 
55 
     | 
    
         | 
| 
       50 
56 
     | 
    
         
             
            #### Example
         
     | 
| 
       51 
57 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                     
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                   
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
      
 58 
     | 
    
         
            +
            ```yaml
         
     | 
| 
      
 59 
     | 
    
         
            +
            windows:
         
     | 
| 
      
 60 
     | 
    
         
            +
              - name: "my-first-window"
         
     | 
| 
      
 61 
     | 
    
         
            +
                options:
         
     | 
| 
      
 62 
     | 
    
         
            +
                  synchronize-panes: true
         
     | 
| 
      
 63 
     | 
    
         
            +
                root: "~/Projects/foo-www"
         
     | 
| 
      
 64 
     | 
    
         
            +
                filters:
         
     | 
| 
      
 65 
     | 
    
         
            +
                  before:
         
     | 
| 
      
 66 
     | 
    
         
            +
                    - "echo 'Let’s use ruby-1.9.2 for each split in this window.'"
         
     | 
| 
      
 67 
     | 
    
         
            +
                    - "rvm use 1.9.2"
         
     | 
| 
      
 68 
     | 
    
         
            +
                splits:
         
     | 
| 
      
 69 
     | 
    
         
            +
                  [splits list]
         
     | 
| 
      
 70 
     | 
    
         
            +
              - name: "my-second-window"
         
     | 
| 
      
 71 
     | 
    
         
            +
                root: "~/Projects/foo-api"
         
     | 
| 
      
 72 
     | 
    
         
            +
                splits:
         
     | 
| 
      
 73 
     | 
    
         
            +
                  [splits list]
         
     | 
| 
      
 74 
     | 
    
         
            +
              - name: "my-third-window"
         
     | 
| 
      
 75 
     | 
    
         
            +
                root: "~/Projects/foo-daemons"
         
     | 
| 
      
 76 
     | 
    
         
            +
                splits:
         
     | 
| 
      
 77 
     | 
    
         
            +
                  [splits list]
         
     | 
| 
      
 78 
     | 
    
         
            +
            ```
         
     | 
| 
       73 
79 
     | 
    
         | 
| 
       74 
80 
     | 
    
         
             
            ### Splits
         
     | 
| 
       75 
81 
     | 
    
         | 
| 
         @@ -84,20 +90,22 @@ Every window must define an array of splits that will be created within it. A ve 
     | 
|
| 
       84 
90 
     | 
    
         | 
| 
       85 
91 
     | 
    
         
             
            #### Example
         
     | 
| 
       86 
92 
     | 
    
         | 
| 
       87 
     | 
    
         
            -
             
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
             
     | 
| 
       91 
     | 
    
         
            -
             
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
             
     | 
| 
       95 
     | 
    
         
            -
             
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
             
     | 
| 
      
 93 
     | 
    
         
            +
            ```yaml
         
     | 
| 
      
 94 
     | 
    
         
            +
            windows:
         
     | 
| 
      
 95 
     | 
    
         
            +
              - name: "my-first-window"
         
     | 
| 
      
 96 
     | 
    
         
            +
                root: "~/Projects/foo-www"
         
     | 
| 
      
 97 
     | 
    
         
            +
                filters:
         
     | 
| 
      
 98 
     | 
    
         
            +
                  before: "rvm use 1.9.2"
         
     | 
| 
      
 99 
     | 
    
         
            +
                  after: "echo 'I am done initializing this split.'"
         
     | 
| 
      
 100 
     | 
    
         
            +
                splits:
         
     | 
| 
      
 101 
     | 
    
         
            +
                  - cmd: "git status"
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - cmd: "bundle exec rails server --port 4000"
         
     | 
| 
      
 103 
     | 
    
         
            +
                    width: 50
         
     | 
| 
      
 104 
     | 
    
         
            +
                  - cmd:
         
     | 
| 
      
 105 
     | 
    
         
            +
                      - "sudo service memcached start"
         
     | 
| 
      
 106 
     | 
    
         
            +
                      - "sudo service mongodb start"
         
     | 
| 
      
 107 
     | 
    
         
            +
                    height: 50
         
     | 
| 
      
 108 
     | 
    
         
            +
            ```
         
     | 
| 
       101 
109 
     | 
    
         | 
| 
       102 
110 
     | 
    
         
             
            ## Layout examples
         
     | 
| 
       103 
111 
     | 
    
         | 
| 
         @@ -107,15 +115,16 @@ See more example files in the `examples` directory. 
     | 
|
| 
       107 
115 
     | 
    
         | 
| 
       108 
116 
     | 
    
         
             
            #### Content of `~/.teamocil/sample-1.yml`
         
     | 
| 
       109 
117 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
             
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
       115 
     | 
    
         
            -
             
     | 
| 
       116 
     | 
    
         
            -
             
     | 
| 
       117 
     | 
    
         
            -
             
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
      
 118 
     | 
    
         
            +
            ```yaml
         
     | 
| 
      
 119 
     | 
    
         
            +
            windows:
         
     | 
| 
      
 120 
     | 
    
         
            +
              - name: "sample-two-splits"
         
     | 
| 
      
 121 
     | 
    
         
            +
                root: "~/Code/sample/www"
         
     | 
| 
      
 122 
     | 
    
         
            +
                splits:
         
     | 
| 
      
 123 
     | 
    
         
            +
                  - cmd: ["pwd", "ls -la"]
         
     | 
| 
      
 124 
     | 
    
         
            +
                  - cmd: "rails server --port 3000"
         
     | 
| 
      
 125 
     | 
    
         
            +
                    width: 50
         
     | 
| 
      
 126 
     | 
    
         
            +
            ```
         
     | 
| 
      
 127 
     | 
    
         
            +
                    
         
     | 
| 
       119 
128 
     | 
    
         | 
| 
       120 
129 
     | 
    
         
             
            #### Result of `$ teamocil sample-1`
         
     | 
| 
       121 
130 
     | 
    
         | 
| 
         @@ -135,19 +144,21 @@ See more example files in the `examples` directory. 
     | 
|
| 
       135 
144 
     | 
    
         | 
| 
       136 
145 
     | 
    
         
             
            #### Content of `~/.teamocil/sample-2.yml`
         
     | 
| 
       137 
146 
     | 
    
         | 
| 
       138 
     | 
    
         
            -
             
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
             
     | 
| 
       141 
     | 
    
         
            -
             
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
             
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
             
     | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
       147 
     | 
    
         
            -
             
     | 
| 
       148 
     | 
    
         
            -
             
     | 
| 
       149 
     | 
    
         
            -
             
     | 
| 
       150 
     | 
    
         
            -
             
     | 
| 
      
 147 
     | 
    
         
            +
            ```yaml
         
     | 
| 
      
 148 
     | 
    
         
            +
            windows:
         
     | 
| 
      
 149 
     | 
    
         
            +
              - name: "sample-four-splits"
         
     | 
| 
      
 150 
     | 
    
         
            +
                root: "~/Code/sample/www"
         
     | 
| 
      
 151 
     | 
    
         
            +
                splits:
         
     | 
| 
      
 152 
     | 
    
         
            +
                  - cmd: "pwd"
         
     | 
| 
      
 153 
     | 
    
         
            +
                  - cmd: "pwd"
         
     | 
| 
      
 154 
     | 
    
         
            +
                    width: 50
         
     | 
| 
      
 155 
     | 
    
         
            +
                  - cmd: "pwd"
         
     | 
| 
      
 156 
     | 
    
         
            +
                    height: 50
         
     | 
| 
      
 157 
     | 
    
         
            +
                    target: "bottom-right"
         
     | 
| 
      
 158 
     | 
    
         
            +
                  - cmd: "pwd"
         
     | 
| 
      
 159 
     | 
    
         
            +
                    height: 50
         
     | 
| 
      
 160 
     | 
    
         
            +
                    target: "bottom-left"
         
     | 
| 
      
 161 
     | 
    
         
            +
            ```
         
     | 
| 
       151 
162 
     | 
    
         | 
| 
       152 
163 
     | 
    
         
             
            #### Result of `$ teamocil sample-2`
         
     | 
| 
       153 
164 
     | 
    
         | 
| 
         @@ -169,7 +180,9 @@ See more example files in the `examples` directory. 
     | 
|
| 
       169 
180 
     | 
    
         | 
| 
       170 
181 
     | 
    
         
             
            To get autocompletion when typing `teamocil <Tab>` in a zsh session, add this line to your `~/.zshrc` file:
         
     | 
| 
       171 
182 
     | 
    
         | 
| 
       172 
     | 
    
         
            -
             
     | 
| 
      
 183 
     | 
    
         
            +
            ```zsh
         
     | 
| 
      
 184 
     | 
    
         
            +
            compctl -g '~/.teamocil/*(:t:r)' teamocil
         
     | 
| 
      
 185 
     | 
    
         
            +
            ```
         
     | 
| 
       173 
186 
     | 
    
         | 
| 
       174 
187 
     | 
    
         
             
            ## Todo list
         
     | 
| 
       175 
188 
     | 
    
         | 
    
        data/lib/teamocil/cli.rb
    CHANGED
    
    | 
         @@ -5,6 +5,8 @@ module Teamocil 
     | 
|
| 
       5 
5 
     | 
    
         
             
              # This class handles interaction with the `tmux` utility.
         
     | 
| 
       6 
6 
     | 
    
         
             
              class CLI
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
      
 8 
     | 
    
         
            +
                attr_accessor :layout, :layouts
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       8 
10 
     | 
    
         
             
                # Initialize a new run of `tmux`
         
     | 
| 
       9 
11 
     | 
    
         
             
                #
         
     | 
| 
       10 
12 
     | 
    
         
             
                # @param argv [Hash] the command line parameters hash (usually `ARGV`).
         
     | 
| 
         @@ -12,11 +14,18 @@ module Teamocil 
     | 
|
| 
       12 
14 
     | 
    
         
             
                def initialize(argv, env) # {{{
         
     | 
| 
       13 
15 
     | 
    
         
             
                  bail "You must be in a tmux session to use teamocil" unless env["TMUX"]
         
     | 
| 
       14 
16 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                  parse_options!
         
     | 
| 
      
 17 
     | 
    
         
            +
                  parse_options! argv
         
     | 
| 
      
 18 
     | 
    
         
            +
                  layout_path = File.join("#{env["HOME"]}", ".teamocil")
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  if @options.include?(:list)
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @layouts = get_layouts(layout_path)
         
     | 
| 
      
 22 
     | 
    
         
            +
                    return print_layouts
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       16 
25 
     | 
    
         
             
                  if @options.include?(:layout)
         
     | 
| 
       17 
     | 
    
         
            -
                    file = options[:layout]
         
     | 
| 
      
 26 
     | 
    
         
            +
                    file = @options[:layout]
         
     | 
| 
       18 
27 
     | 
    
         
             
                  else
         
     | 
| 
       19 
     | 
    
         
            -
                    file = ::File.join( 
     | 
| 
      
 28 
     | 
    
         
            +
                    file = ::File.join(layout_path, "#{argv[0]}.yml")
         
     | 
| 
       20 
29 
     | 
    
         
             
                  end
         
     | 
| 
       21 
30 
     | 
    
         | 
| 
       22 
31 
     | 
    
         
             
                  if @options[:edit]
         
     | 
| 
         @@ -25,14 +34,14 @@ module Teamocil 
     | 
|
| 
       25 
34 
     | 
    
         
             
                  else
         
     | 
| 
       26 
35 
     | 
    
         
             
                    bail "There is no file \"#{file}\"" unless File.exists?(file)
         
     | 
| 
       27 
36 
     | 
    
         
             
                    parsed_layout = YAML.load_file(file)
         
     | 
| 
       28 
     | 
    
         
            -
                    layout = Teamocil::Layout.new(parsed_layout, @options)
         
     | 
| 
       29 
     | 
    
         
            -
                    layout.compile!
         
     | 
| 
       30 
     | 
    
         
            -
                    layout.execute_commands(layout.generate_commands)
         
     | 
| 
      
 37 
     | 
    
         
            +
                    @layout = Teamocil::Layout.new(parsed_layout, @options)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    @layout.compile!
         
     | 
| 
      
 39 
     | 
    
         
            +
                    @layout.execute_commands(@layout.generate_commands)
         
     | 
| 
       31 
40 
     | 
    
         
             
                  end
         
     | 
| 
       32 
41 
     | 
    
         
             
                end # }}}
         
     | 
| 
       33 
42 
     | 
    
         | 
| 
       34 
43 
     | 
    
         
             
                # Parse the command line options
         
     | 
| 
       35 
     | 
    
         
            -
                def parse_options! # {{{
         
     | 
| 
      
 44 
     | 
    
         
            +
                def parse_options!(args) # {{{
         
     | 
| 
       36 
45 
     | 
    
         
             
                  @options = {}
         
     | 
| 
       37 
46 
     | 
    
         
             
                  opts = ::OptionParser.new do |opts|
         
     | 
| 
       38 
47 
     | 
    
         
             
                    opts.banner = "Usage: teamocil [options] <layout>
         
     | 
| 
         @@ -47,19 +56,36 @@ module Teamocil 
     | 
|
| 
       47 
56 
     | 
    
         
             
                      @options[:edit] = true
         
     | 
| 
       48 
57 
     | 
    
         
             
                    end
         
     | 
| 
       49 
58 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
                    opts.on("--layout [LAYOUT]", "Use a specific layout file, instead of  
     | 
| 
      
 59 
     | 
    
         
            +
                    opts.on("--layout [LAYOUT]", "Use a specific layout file, instead of `~/.teamocil/<layout>.yml`") do |layout|
         
     | 
| 
       51 
60 
     | 
    
         
             
                      @options[:layout] = layout
         
     | 
| 
       52 
61 
     | 
    
         
             
                    end
         
     | 
| 
       53 
62 
     | 
    
         | 
| 
      
 63 
     | 
    
         
            +
                    opts.on("--list", "List all available layouts in `~/.teamocil/`") do
         
     | 
| 
      
 64 
     | 
    
         
            +
                      @options[:list] = true
         
     | 
| 
      
 65 
     | 
    
         
            +
                    end
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
       54 
67 
     | 
    
         
             
                  end
         
     | 
| 
       55 
     | 
    
         
            -
                  opts.parse!
         
     | 
| 
      
 68 
     | 
    
         
            +
                  opts.parse! args
         
     | 
| 
      
 69 
     | 
    
         
            +
                end # }}}
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
                # Return an array of available layouts
         
     | 
| 
      
 72 
     | 
    
         
            +
                #
         
     | 
| 
      
 73 
     | 
    
         
            +
                # @param path [String] the path used to look for layouts
         
     | 
| 
      
 74 
     | 
    
         
            +
                def get_layouts(path) # {{{
         
     | 
| 
      
 75 
     | 
    
         
            +
                  Dir.glob(File.join(path, "*.yml")).map { |file| File.basename(file).gsub(/\..+$/, "") }.sort
         
     | 
| 
      
 76 
     | 
    
         
            +
                end # }}}
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                # Print each layout on a single line
         
     | 
| 
      
 79 
     | 
    
         
            +
                def print_layouts # {{{
         
     | 
| 
      
 80 
     | 
    
         
            +
                  STDOUT.puts @layouts.join("\n")
         
     | 
| 
      
 81 
     | 
    
         
            +
                  exit 0
         
     | 
| 
       56 
82 
     | 
    
         
             
                end # }}}
         
     | 
| 
       57 
83 
     | 
    
         | 
| 
       58 
84 
     | 
    
         
             
                # Print an error message and exit the utility
         
     | 
| 
       59 
85 
     | 
    
         
             
                #
         
     | 
| 
       60 
86 
     | 
    
         
             
                # @param msg [Mixed] something to print before exiting.
         
     | 
| 
       61 
87 
     | 
    
         
             
                def bail(msg) # {{{
         
     | 
| 
       62 
     | 
    
         
            -
                  puts "[teamocil] #{msg}"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  STDERR.puts "[teamocil] #{msg}"
         
     | 
| 
       63 
89 
     | 
    
         
             
                  exit 1
         
     | 
| 
       64 
90 
     | 
    
         
             
                end # }}}
         
     | 
| 
       65 
91 
     | 
    
         | 
    
        data/lib/teamocil/layout.rb
    CHANGED
    
    
    
        data/lib/teamocil.rb
    CHANGED
    
    
    
        data/spec/cli_spec.rb
    ADDED
    
    | 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require File.join(File.dirname(__FILE__), "spec_helper.rb")
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            describe Teamocil::CLI do
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
              context "executing" do
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                before do # {{{
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @fake_env = { "TMUX" => 1, "HOME" => File.join(File.dirname(__FILE__), "fixtures") }
         
     | 
| 
      
 9 
     | 
    
         
            +
                end # }}}
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                it "creates a layout" do # {{{
         
     | 
| 
      
 12 
     | 
    
         
            +
                  @cli = Teamocil::CLI.new(["sample"], @fake_env)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  @cli.layout.session.name.should == "sample"
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @cli.layout.session.windows.length.should == 2
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @cli.layout.session.windows.first.name.should == "foo"
         
     | 
| 
      
 16 
     | 
    
         
            +
                  @cli.layout.session.windows.last.name.should == "bar"
         
     | 
| 
      
 17 
     | 
    
         
            +
                end # }}}
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                it "lists available layouts" do # {{{
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @cli = Teamocil::CLI.new(["--list"], @fake_env)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  @cli.layouts.should == ["sample", "sample-2"]
         
     | 
| 
      
 22 
     | 
    
         
            +
                end # }}}
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/mock/cli.rb
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Teamocil
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Mock
         
     | 
| 
      
 3 
     | 
    
         
            +
                module CLI
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def self.included(base) # {{{
         
     | 
| 
      
 6 
     | 
    
         
            +
                    base.class_eval do
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                      # Do not print anything
         
     | 
| 
      
 9 
     | 
    
         
            +
                      def print_layouts
         
     | 
| 
      
 10 
     | 
    
         
            +
                        # Nothing
         
     | 
| 
      
 11 
     | 
    
         
            +
                      end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end # }}}
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            Teamocil::CLI.send :include, Teamocil::Mock::CLI
         
     | 
    
        data/spec/mock/layout.rb
    ADDED
    
    | 
         @@ -0,0 +1,20 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Teamocil
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Mock
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Layout
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def self.included(base) # {{{
         
     | 
| 
      
 6 
     | 
    
         
            +
                    base.class_eval do
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                      # Do not execute anything
         
     | 
| 
      
 9 
     | 
    
         
            +
                      def execute_commands(commands)
         
     | 
| 
      
 10 
     | 
    
         
            +
                        # Nothing
         
     | 
| 
      
 11 
     | 
    
         
            +
                      end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                    end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end # }}}
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
              end
         
     | 
| 
      
 18 
     | 
    
         
            +
            end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            Teamocil::Layout.send :include, Teamocil::Mock::Layout
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        data/teamocil.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: teamocil
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 17
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 8 
     | 
    
         
            +
              - 3
         
     | 
| 
      
 9 
     | 
    
         
            +
              - 1
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.3.1
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - "R\xC3\xA9mi Pr\xC3\xA9vost"
         
     | 
| 
         @@ -15,11 +15,11 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date:  
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2012-01-21 00:00:00 Z
         
     | 
| 
       19 
19 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       21 
21 
     | 
    
         
             
              name: rake
         
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
      
 22 
     | 
    
         
            +
              type: :development
         
     | 
| 
       23 
23 
     | 
    
         
             
              version_requirements: &id001 !ruby/object:Gem::Requirement 
         
     | 
| 
       24 
24 
     | 
    
         
             
                none: false
         
     | 
| 
       25 
25 
     | 
    
         
             
                requirements: 
         
     | 
| 
         @@ -29,11 +29,11 @@ dependencies: 
     | 
|
| 
       29 
29 
     | 
    
         
             
                    segments: 
         
     | 
| 
       30 
30 
     | 
    
         
             
                    - 0
         
     | 
| 
       31 
31 
     | 
    
         
             
                    version: "0"
         
     | 
| 
       32 
     | 
    
         
            -
               
     | 
| 
      
 32 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
       33 
33 
     | 
    
         
             
              requirement: *id001
         
     | 
| 
       34 
34 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       35 
35 
     | 
    
         
             
              name: rspec
         
     | 
| 
       36 
     | 
    
         
            -
               
     | 
| 
      
 36 
     | 
    
         
            +
              type: :development
         
     | 
| 
       37 
37 
     | 
    
         
             
              version_requirements: &id002 !ruby/object:Gem::Requirement 
         
     | 
| 
       38 
38 
     | 
    
         
             
                none: false
         
     | 
| 
       39 
39 
     | 
    
         
             
                requirements: 
         
     | 
| 
         @@ -43,11 +43,11 @@ dependencies: 
     | 
|
| 
       43 
43 
     | 
    
         
             
                    segments: 
         
     | 
| 
       44 
44 
     | 
    
         
             
                    - 0
         
     | 
| 
       45 
45 
     | 
    
         
             
                    version: "0"
         
     | 
| 
       46 
     | 
    
         
            -
               
     | 
| 
      
 46 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
       47 
47 
     | 
    
         
             
              requirement: *id002
         
     | 
| 
       48 
48 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       49 
49 
     | 
    
         
             
              name: yard
         
     | 
| 
       50 
     | 
    
         
            -
               
     | 
| 
      
 50 
     | 
    
         
            +
              type: :development
         
     | 
| 
       51 
51 
     | 
    
         
             
              version_requirements: &id003 !ruby/object:Gem::Requirement 
         
     | 
| 
       52 
52 
     | 
    
         
             
                none: false
         
     | 
| 
       53 
53 
     | 
    
         
             
                requirements: 
         
     | 
| 
         @@ -57,11 +57,11 @@ dependencies: 
     | 
|
| 
       57 
57 
     | 
    
         
             
                    segments: 
         
     | 
| 
       58 
58 
     | 
    
         
             
                    - 0
         
     | 
| 
       59 
59 
     | 
    
         
             
                    version: "0"
         
     | 
| 
       60 
     | 
    
         
            -
               
     | 
| 
      
 60 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
       61 
61 
     | 
    
         
             
              requirement: *id003
         
     | 
| 
       62 
62 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       63 
63 
     | 
    
         
             
              name: maruku
         
     | 
| 
       64 
     | 
    
         
            -
               
     | 
| 
      
 64 
     | 
    
         
            +
              type: :development
         
     | 
| 
       65 
65 
     | 
    
         
             
              version_requirements: &id004 !ruby/object:Gem::Requirement 
         
     | 
| 
       66 
66 
     | 
    
         
             
                none: false
         
     | 
| 
       67 
67 
     | 
    
         
             
                requirements: 
         
     | 
| 
         @@ -71,7 +71,7 @@ dependencies: 
     | 
|
| 
       71 
71 
     | 
    
         
             
                    segments: 
         
     | 
| 
       72 
72 
     | 
    
         
             
                    - 0
         
     | 
| 
       73 
73 
     | 
    
         
             
                    version: "0"
         
     | 
| 
       74 
     | 
    
         
            -
               
     | 
| 
      
 74 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
       75 
75 
     | 
    
         
             
              requirement: *id004
         
     | 
| 
       76 
76 
     | 
    
         
             
            description: Teamocil helps you set up window and splits layouts for tmux using YAML configuration files.
         
     | 
| 
       77 
77 
     | 
    
         
             
            email: remi@exomel.com
         
     | 
| 
         @@ -83,6 +83,7 @@ extra_rdoc_files: [] 
     | 
|
| 
       83 
83 
     | 
    
         | 
| 
       84 
84 
     | 
    
         
             
            files: 
         
     | 
| 
       85 
85 
     | 
    
         
             
            - .gitignore
         
     | 
| 
      
 86 
     | 
    
         
            +
            - .travis.yml
         
     | 
| 
       86 
87 
     | 
    
         
             
            - .yardopts
         
     | 
| 
       87 
88 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       88 
89 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
         @@ -98,8 +99,13 @@ files: 
     | 
|
| 
       98 
99 
     | 
    
         
             
            - lib/teamocil.rb
         
     | 
| 
       99 
100 
     | 
    
         
             
            - lib/teamocil/cli.rb
         
     | 
| 
       100 
101 
     | 
    
         
             
            - lib/teamocil/layout.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - spec/cli_spec.rb
         
     | 
| 
      
 103 
     | 
    
         
            +
            - spec/fixtures/.teamocil/sample-2.yml
         
     | 
| 
      
 104 
     | 
    
         
            +
            - spec/fixtures/.teamocil/sample.yml
         
     | 
| 
       101 
105 
     | 
    
         
             
            - spec/fixtures/layouts.yml
         
     | 
| 
       102 
106 
     | 
    
         
             
            - spec/layout_spec.rb
         
     | 
| 
      
 107 
     | 
    
         
            +
            - spec/mock/cli.rb
         
     | 
| 
      
 108 
     | 
    
         
            +
            - spec/mock/layout.rb
         
     | 
| 
       103 
109 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       104 
110 
     | 
    
         
             
            - teamocil.gemspec
         
     | 
| 
       105 
111 
     | 
    
         
             
            homepage: http://github.com/remiprev/teamocil
         
     | 
| 
         @@ -136,6 +142,11 @@ signing_key: 
     | 
|
| 
       136 
142 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       137 
143 
     | 
    
         
             
            summary: Easy window and split layouts for tmux
         
     | 
| 
       138 
144 
     | 
    
         
             
            test_files: 
         
     | 
| 
      
 145 
     | 
    
         
            +
            - spec/cli_spec.rb
         
     | 
| 
      
 146 
     | 
    
         
            +
            - spec/fixtures/.teamocil/sample-2.yml
         
     | 
| 
      
 147 
     | 
    
         
            +
            - spec/fixtures/.teamocil/sample.yml
         
     | 
| 
       139 
148 
     | 
    
         
             
            - spec/fixtures/layouts.yml
         
     | 
| 
       140 
149 
     | 
    
         
             
            - spec/layout_spec.rb
         
     | 
| 
      
 150 
     | 
    
         
            +
            - spec/mock/cli.rb
         
     | 
| 
      
 151 
     | 
    
         
            +
            - spec/mock/layout.rb
         
     | 
| 
       141 
152 
     | 
    
         
             
            - spec/spec_helper.rb
         
     |