teamocil 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjRlMmZkZDgyZjIzYzMzOWE2YWRjZmFhNDBmMGQ0YjkxZTMxNThlNg==
4
+ ODJmMjkwMjQ4MmNjMzY2NjczMzBhNGI0NWFmOWRjMzVmNjFmZGQ1NA==
5
5
  data.tar.gz: !binary |-
6
- NWNjNDBiNGEzOGNhYjc0OTUyN2YyZDQzOWZkMGY3ZTI3ZmI3NDU3OA==
6
+ NTgzZDZmMDkwNTlkOWY0NGU1MjQ5ZDJhY2FhMTExYTU4ZGY1ZmQ0YQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MGExNzQ2NDg4NmIzNzIyMWI0YTc1NDFlMmU3YmQ4Y2YwY2I2MGFmYTcyYTRk
10
- NWZjZjQxYjIzNjg3OTc3YjNkN2ZkM2Q2ODQyOWQ3NjYwNWUzYWE2MjE1M2Nl
11
- YmM3YmRkNWM1YjIyZWFiNTk1MGQ4YTI5ZWQyNWNkMGNiZjQ4MzY=
9
+ Y2YwMDYyNGM4ZmQ5ODQwMjA1MTBiZDUyNDVjYjE3MDQ4MWJkNmQ3NjAyZjcz
10
+ MGQ5MjE0NWYyNTUxMDRkMjBhMDFkYTdkMzFkMmUxNTI2YmJkOWJiNThlMTk2
11
+ NTZmYzViZjFiY2JkMTdmMWIxNmYwOWE0YWViNTM5Y2I5MDdkMWY=
12
12
  data.tar.gz: !binary |-
13
- ZDY1MGFjMzE0YjZkMjkyZGU1NmM0NDg3MGNiZDkxZjU0MTEyOTI4MTQ5Y2Rj
14
- MTg4OGJhMzUxMDA3MWM4NDY1NjM5OGI5YWVjZWU4YTBjYjJjNmFiMDQ4Mjll
15
- NGMxMDQ5MTc3YzAxNjQ2ZTkzOTk2MmViMGViN2MwYTQzNjg1Mjg=
13
+ ODhkNDZkMWNmMTc5NzM3YTdiM2ViZjAxYmQyZTg0MmRiN2ZlY2U1MmQ4OTc1
14
+ ZWZjODE1MzEyNTIxNjhmMTA4ODc0NDM3NTQ2NDlhODlmMWIxOGQ3YmZlYTc1
15
+ YTYwMjkyMTNiYjVjNDBjMzcxMTJjYjdkNzBlMjFlZjY0NGZlNzI=
data/README.md CHANGED
@@ -231,9 +231,11 @@ windows:
231
231
 
232
232
  Feel free to contribute and submit issues/pull requests [on GitHub](https://github.com/remiprev/teamocil/issues), just like these fine folks did:
233
233
 
234
- * Samuel Garneau ([garno](https://github.com/garno))
235
- * Jimmy Bourassa ([jbourassa](https://github.com/jbourassa))
236
- * Brandon Dimcheff ([bdimcheff](https://github.com/bdimcheff))
234
+ * [@garno](https://github.com/garno)
235
+ * [@jbourassa](https://github.com/jbourassa)
236
+ * [@bdimcheff](https://github.com/bdimcheff)
237
+ * [@jscheel](https://github.com/jscheel)
238
+ * [@mklappstuhl](https://github.com/mklappstuhl)
237
239
 
238
240
  Take a look at the `spec` folder before you do, and make sure `bundle exec rake spec` passes after your modifications :)
239
241
 
data/lib/teamocil/cli.rb CHANGED
@@ -24,7 +24,7 @@ module Teamocil
24
24
 
25
25
  if @options[:edit]
26
26
  ::FileUtils.touch file unless File.exists?(file)
27
- Kernel.system("$EDITOR \"#{file}\"")
27
+ Kernel.system("${EDITOR:-vim} \"#{file}\"")
28
28
  elsif @options[:show]
29
29
  ::FileUtils.touch file unless File.exists?(file)
30
30
  Kernel.system("cat \"#{file}\"")
@@ -48,10 +48,15 @@ module Teamocil
48
48
  @cmd.unshift "cd \"#{@window.root}\"" unless @window.root.nil?
49
49
 
50
50
  # Set the TEAMOCIL environment variable
51
- @cmd.unshift "export TEAMOCIL=1"
51
+ # depending on the shell set in ENV
52
+ if ENV['SHELL'].scan(/fish/).empty?
53
+ @cmd.unshift "export TEAMOCIL=1"
54
+ else
55
+ @cmd.unshift "set -gx TEAMOCIL 1"
56
+ end
52
57
 
53
58
  # Execute each pane command
54
- commands << "tmux send-keys -t #{@index} \"#{@cmd.flatten.compact.join(" && ")}\""
59
+ commands << "tmux send-keys -t #{@index} \"#{@cmd.flatten.compact.join("; ")}\""
55
60
  commands << "tmux send-keys -t #{@index} Enter"
56
61
 
57
62
  commands
@@ -10,7 +10,7 @@ module Teamocil
10
10
  # @param attrs [Hash] the session data from the layout file
11
11
  def initialize(options, attrs={})
12
12
  raise Teamocil::Error::LayoutError.new("You must specify a `windows` or `session` key for your layout.") unless attrs["windows"]
13
- @name = attrs["name"] || "teamocil-session"
13
+ @name = attrs["name"] || "teamocil-session-#{rand(10000) + 1}"
14
14
  @windows = attrs["windows"].each_with_index.map { |window, window_index| Window.new(self, window_index, window) }
15
15
  @options = options
16
16
  end
@@ -1,3 +1,3 @@
1
1
  module Teamocil
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
data/spec/cli_spec.rb CHANGED
@@ -13,7 +13,7 @@ describe Teamocil::CLI do
13
13
  context "not in tmux" do
14
14
  it "should allow editing" do
15
15
  FileUtils.stub(:touch)
16
- Kernel.should_receive(:system).with("$EDITOR #{File.join(@fake_env["HOME"], ".teamocil", "my-layout.yml").inspect}")
16
+ Kernel.should_receive(:system).with("${EDITOR:-vim} #{File.join(@fake_env["HOME"], ".teamocil", "my-layout.yml").inspect}")
17
17
  Teamocil::CLI.new(["--edit", "my-layout"], @fake_env)
18
18
  end
19
19
  end
data/spec/layout_spec.rb CHANGED
@@ -3,7 +3,10 @@ require File.join(File.dirname(__FILE__), "spec_helper.rb")
3
3
 
4
4
  describe Teamocil::Layout do
5
5
  let(:window_pane_base_index) { 0 }
6
- before { Teamocil::Layout::Window.any_instance.stub(:pane_base_index).and_return(window_pane_base_index) }
6
+ before do
7
+ Teamocil::Layout::Window.any_instance.stub(:pane_base_index).and_return(window_pane_base_index)
8
+ ENV.stub(:[]).with("SHELL").and_return("/usr/bin/bash")
9
+ end
7
10
 
8
11
  context "compiling" do
9
12
  before do
@@ -145,6 +148,12 @@ describe Teamocil::Layout do
145
148
  session.windows.length.should == 3
146
149
  session.name.should == "my awesome session"
147
150
  end
151
+
152
+ it "should assign a random name if none is provided" do
153
+ layout = Teamocil::Layout.new(layouts["two-windows"], {})
154
+ session = layout.compile!
155
+ session.name.should match /teamocil-session-\d+/
156
+ end
148
157
  end
149
158
  end
150
159
 
@@ -155,13 +164,13 @@ describe Teamocil::Layout do
155
164
  session = @layout.compile!
156
165
  commands = session.windows.last.panes[0].generate_commands
157
166
  commands.length.should == 2
158
- commands.first.should == "tmux send-keys -t 0 \"export TEAMOCIL=1 && cd \"/bar\" && echo 'bar' && echo 'bar in an array'\""
167
+ commands.first.should == "tmux send-keys -t 0 \"export TEAMOCIL=1; cd \"/bar\"; echo 'bar'; echo 'bar in an array'\""
159
168
  commands.last.should == "tmux send-keys -t 0 Enter"
160
169
 
161
170
  session = @layout.compile!
162
171
  commands = session.windows.first.panes[0].generate_commands
163
172
  commands.length.should == 2
164
- commands.first.should == "tmux send-keys -t 0 \"export TEAMOCIL=1 && cd \"/foo\" && clear && echo 'foo'\""
173
+ commands.first.should == "tmux send-keys -t 0 \"export TEAMOCIL=1; cd \"/foo\"; clear; echo 'foo'\""
165
174
  commands.last.should == "tmux send-keys -t 0 Enter"
166
175
  end
167
176
 
@@ -175,8 +184,17 @@ describe Teamocil::Layout do
175
184
  it "should apply the layout after each pane is created" do
176
185
  session = @layout.compile!
177
186
  commands = session.windows.first.generate_commands
178
- commands[1][0].should == ["tmux send-keys -t 0 \"export TEAMOCIL=1 && cd \"/foo\" && clear && echo 'foo'\"", "tmux send-keys -t 0 Enter", "tmux select-layout \"tiled\""]
179
- commands[1][1].should == ["tmux split-window", "tmux send-keys -t 1 \"export TEAMOCIL=1 && cd \"/foo\" && clear && echo 'foo again'\"", "tmux send-keys -t 1 Enter", "tmux select-layout \"tiled\""]
187
+ commands[1][0].should == ["tmux send-keys -t 0 \"export TEAMOCIL=1; cd \"/foo\"; clear; echo 'foo'\"", "tmux send-keys -t 0 Enter", "tmux select-layout \"tiled\""]
188
+ commands[1][1].should == ["tmux split-window", "tmux send-keys -t 1 \"export TEAMOCIL=1; cd \"/foo\"; clear; echo 'foo again'\"", "tmux send-keys -t 1 Enter", "tmux select-layout \"tiled\""]
189
+ end
190
+
191
+ it "should use fish syntax when fish shell is default shell" do
192
+ ENV.stub(:[]).with("SHELL").and_return("/usr/local/bin/fish")
193
+ session = @layout.compile!
194
+ commands = session.windows.last.panes[0].generate_commands
195
+ commands.length.should == 2
196
+ commands.first.should == "tmux send-keys -t 0 \"set -gx TEAMOCIL 1; cd \"/bar\"; echo 'bar'; echo 'bar in an array'\""
197
+ commands.last.should == "tmux send-keys -t 0 Enter"
180
198
  end
181
199
 
182
200
  context "with custom pane-base-index option" do
@@ -186,7 +204,7 @@ describe Teamocil::Layout do
186
204
  session = @layout.compile!
187
205
  commands = session.windows.last.panes[0].generate_commands
188
206
  commands.length.should == 2
189
- commands.first.should == "tmux send-keys -t 2 \"export TEAMOCIL=1 && cd \"/bar\" && echo 'bar' && echo 'bar in an array'\""
207
+ commands.first.should == "tmux send-keys -t 2 \"export TEAMOCIL=1; cd \"/bar\"; echo 'bar'; echo 'bar in an array'\""
190
208
  commands.last.should == "tmux send-keys -t 2 Enter"
191
209
  end
192
210
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teamocil
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémi Prévost
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-28 00:00:00.000000000 Z
11
+ date: 2013-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake