teamocil 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE CHANGED
@@ -1,3 +1,7 @@
1
- Copyright 2011-2012 Rémi Prévost.
2
- You may use this work without restrictions, as long as this notice is included.
3
- The work is provided "as is" without warranty of any kind, neither express nor implied.
1
+ Copyright (c) 2011-2012 Rémi Prévost
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -201,4 +201,4 @@ Take a look at the `spec` folder before you do, and make sure `bundle exec rake
201
201
 
202
202
  ## License
203
203
 
204
- Teamocil is © 2011-2012 [Rémi Prévost](http://exomel.com) and may be freely distributed under the [LITL license](http://litl.info/). See the `LICENSE` file.
204
+ Teamocil is © 2011-2012 [Rémi Prévost](http://exomel.com) and may be freely distributed under the [MIT license](https://github.com/remiprev/teamocil/blob/master/LICENSE). See the `LICENSE` file.
data/lib/teamocil.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Teamocil
2
- VERSION = "0.3.4"
2
+ VERSION = "0.3.5"
3
3
  autoload :Layout, "teamocil/layout"
4
4
  autoload :CLI, "teamocil/cli"
5
5
  end
data/lib/teamocil/cli.rb CHANGED
@@ -25,6 +25,9 @@ module Teamocil
25
25
  if @options[:edit]
26
26
  ::FileUtils.touch file unless File.exists?(file)
27
27
  Kernel.system("$EDITOR \"#{file}\"")
28
+ elsif @options[:show]
29
+ ::FileUtils.touch file unless File.exists?(file)
30
+ Kernel.system("cat \"#{file}\"")
28
31
  else
29
32
  bail "There is no file \"#{file}\"" unless File.exists?(file)
30
33
  bail "You must be in a tmux session to use teamocil" unless env["TMUX"]
@@ -59,6 +62,10 @@ module Teamocil
59
62
  @options[:list] = true
60
63
  end
61
64
 
65
+ opts.on("--show", "Show the content of the layout file instead of executing it") do
66
+ @options[:show] = true
67
+ end
68
+
62
69
  end
63
70
  opts.parse! args
64
71
  end # }}}
data/spec/cli_spec.rb CHANGED
@@ -13,9 +13,8 @@ describe Teamocil::CLI do
13
13
 
14
14
  it "should allow editing" do # {{{
15
15
  FileUtils.stub(:touch)
16
- Kernel.should_receive(:system).with(any_args())
17
-
18
- @cli = Teamocil::CLI.new(["--edit", "my-layout"], @fake_env)
16
+ Kernel.should_receive(:system).with("$EDITOR #{File.join(@fake_env["HOME"], ".teamocil", "my-layout.yml").inspect}")
17
+ Teamocil::CLI.new(["--edit", "my-layout"], @fake_env)
19
18
  end # }}}
20
19
 
21
20
  end
@@ -57,6 +56,12 @@ describe Teamocil::CLI do
57
56
  @cli.layouts.should == ["sample", "sample-2"]
58
57
  end # }}}
59
58
 
59
+ it "should show the content" do # {{{
60
+ FileUtils.stub(:touch)
61
+ Kernel.should_receive(:system).with("cat #{File.join(@fake_env["HOME"], ".teamocil", "sample.yml").inspect}")
62
+ Teamocil::CLI.new(["--show", "sample"], @fake_env)
63
+ end # }}}
64
+
60
65
  end
61
66
 
62
67
  end
data/spec/layout_spec.rb CHANGED
@@ -4,13 +4,11 @@ require File.join(File.dirname(__FILE__), "spec_helper.rb")
4
4
  describe Teamocil::Layout do
5
5
 
6
6
  context "compiling" do
7
-
8
7
  before do # {{{
9
8
  @layout = Teamocil::Layout.new(layouts["two-windows"], {})
10
9
  end # }}}
11
10
 
12
- describe "windows" do
13
-
11
+ describe "windows" do # {{{
14
12
  it "creates windows" do # {{{
15
13
  session = @layout.compile!
16
14
  session.windows.each do |window|
@@ -29,11 +27,9 @@ describe Teamocil::Layout do
29
27
  session.windows[0].root.should == "/foo"
30
28
  session.windows[1].root.should == "/bar"
31
29
  end # }}}
30
+ end # }}}
32
31
 
33
- end
34
-
35
- describe "splits" do
36
-
32
+ describe "splits" do # {{{
37
33
  it "creates splits" do # {{{
38
34
  session = @layout.compile!
39
35
  session.windows.first.splits.each do |split|
@@ -58,11 +54,9 @@ describe Teamocil::Layout do
58
54
  session.windows.last.splits[0].cmd.first.should == "echo 'bar'"
59
55
  session.windows.last.splits[0].cmd.last.should == "echo 'bar in an array'"
60
56
  end # }}}
57
+ end # }}}
61
58
 
62
- end
63
-
64
- describe "filters" do
65
-
59
+ describe "filters" do # {{{
66
60
  it "creates windows with before filters" do # {{{
67
61
  layout = Teamocil::Layout.new(layouts["two-windows-with-filters"], {})
68
62
  session = layout.compile!
@@ -86,11 +80,9 @@ describe Teamocil::Layout do
86
80
  session.windows.first.filters["after"].should be_empty
87
81
  session.windows.first.filters["before"].should be_empty
88
82
  end # }}}
83
+ end # }}}
89
84
 
90
- end
91
-
92
- describe "targets" do
93
-
85
+ describe "targets" do # {{{
94
86
  it "should handle splits without a target" do # {{{
95
87
  session = @layout.compile!
96
88
  session.windows.last.splits.last.target.should == nil
@@ -100,20 +92,30 @@ describe Teamocil::Layout do
100
92
  session = @layout.compile!
101
93
  session.windows.last.splits.first.target.should == "bottom-right"
102
94
  end # }}}
95
+ end # }}}
103
96
 
104
- end
105
-
106
- describe "sessions" do
107
-
97
+ describe "sessions" do # {{{
108
98
  it "should handle windows within a session" do # {{{
109
99
  layout = Teamocil::Layout.new(layouts["three-windows-within-a-session"], {})
110
100
  session = layout.compile!
111
101
  session.windows.length.should == 3
112
102
  session.name.should == "my awesome session"
113
103
  end # }}}
104
+ end # }}}
105
+ end
114
106
 
115
- end
107
+ context "generating commands" do
108
+ before do # {{{
109
+ @layout = Teamocil::Layout.new(layouts["two-windows"], {})
110
+ end # }}}
116
111
 
112
+ it "should generate commands" do #{{{
113
+ session = @layout.compile!
114
+ commands = session.windows.last.splits[0].generate_commands
115
+ commands.length.should == 2
116
+ commands.first.should == "tmux send-keys -t 0 \"export TEAMOCIL=1 && cd \"/bar\" && echo 'bar' && echo 'bar in an array'\""
117
+ commands.last.should == "tmux send-keys -t 0 Enter"
118
+ end # }}}
117
119
  end
118
120
 
119
121
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamocil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-15 00:00:00.000000000Z
12
+ date: 2012-05-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -124,7 +124,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
124
  version: '0'
125
125
  segments:
126
126
  - 0
127
- hash: -4268793689318262582
127
+ hash: 83380787884678327
128
128
  required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  segments:
135
135
  - 0
136
- hash: -4268793689318262582
136
+ hash: 83380787884678327
137
137
  requirements: []
138
138
  rubyforge_project:
139
139
  rubygems_version: 1.8.18