Skip to content

Commit

Permalink
Merge 0435b76 into dd52cd1
Browse files Browse the repository at this point in the history
  • Loading branch information
christophersjchow committed Feb 24, 2014
2 parents dd52cd1 + 0435b76 commit 1cff0aa
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 9 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rvm:
- "2.0.0"
env:
- TMUX_VERSION=master
- TMUX_VERSION=1.9
- TMUX_VERSION=1.8
- TMUX_VERSION=1.7
- TMUX_VERSION=1.6
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 0.6.7
- Remove use of grep for base-index #171
- Fix bugs in `Tmuxinator::Config.default?` #169
- Fix path for Rails log in directory sample #177
- Add completions for fish shell #179
- Fix grammar in readme #184
- Make commands take precedence over project names #182
- Improve error messages when $EDITOR isn't set #186, #194
- Add confirmation to deletion prompt #197
- Fix broken badge references after organisation move
- Remove dependancy on ActiveSupport #199
- Fix compatability with tmux 1.9

## 0.6.6
- Fix a bug caused by not escaping the root path #145
- Fix bash completion with a single argument #148
Expand Down
6 changes: 4 additions & 2 deletions lib/tmuxinator/assets/template.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ if [ "$?" -eq 1 ]; then
# Create the session and the first window.
TMUX= <%= tmux %> new-session -d -s <%= name %> -n <%= windows.first.name %>
# Set the default path.
<%= tmux %> set-option -t <%= name %> default-path <%= root.shellescape -%> 1>/dev/null
<%- if Tmuxinator::Config.version < 1.7 -%>
# Set the default path for versions prior to 1.7
<%= tmux %> set-option -t <%= name %> <%= Tmuxinator::Config.default_path_option %> <%= root.shellescape -%> 1>/dev/null
<%- end -%>

# Create other windows.
<%- windows.drop(1).each do |window| -%>
Expand Down
8 changes: 8 additions & 0 deletions lib/tmuxinator/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ def installed?
Kernel.system("which tmux > /dev/null")
end

def version
`tmux -V`.split(" ")[1].to_f if installed?
end

def default_path_option
version && version < 1.7 ? "default-path" : "-c"
end

def editor?
!ENV["EDITOR"].nil? && !ENV["EDITOR"].empty?
end
Expand Down
2 changes: 1 addition & 1 deletion lib/tmuxinator/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def windows
end

def root
yaml["project_root"] || yaml["root"]
yaml["project_root"] || File.expand_path(yaml["root"])
end

def name
Expand Down
2 changes: 1 addition & 1 deletion lib/tmuxinator/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Tmuxinator
VERSION = "0.6.6"
VERSION = "0.6.7.pre"
end
2 changes: 1 addition & 1 deletion lib/tmuxinator/window.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def tmux_window_command_prefix
end

def tmux_new_window_command
"#{project.tmux} new-window -c #{project.root.shellescape} -t #{tmux_window_target} -n #{name}"
"#{project.tmux} new-window #{Tmuxinator::Config.default_path_option} #{File.expand_path(project.root).shellescape} -t #{tmux_window_target} -n #{name}"
end

def tmux_layout_command
Expand Down
1 change: 1 addition & 0 deletions spec/lib/tmuxinator/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
before do
ARGV.replace(["start", "foo"])
Tmuxinator::Config.stub(:validate => project)
Tmuxinator::Config.stub(:version => 1.9)
Kernel.stub(:exec)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/lib/tmuxinator/project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@
describe "#root" do
context "without deprecations" do
it "gets the root" do
expect(project.root).to eq "~/test"
expect(project.root).to include("test")
end
end

context "with deprecations" do
it "still gets the root" do
expect(project_with_deprecations.root).to eq "~/test"
expect(project_with_deprecations.root).to include("test")
end
end
end
Expand Down
10 changes: 8 additions & 2 deletions spec/lib/tmuxinator/window_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,14 @@
)
end

it "specifies root path by passing -c to tmux" do
expect(window.tmux_new_window_command).to include("-c /project/tmuxinator")
context "tmux 1.6 and below" do
before do
Tmuxinator::Config.stub(:version => 1.6)
end

it "specifies root path by passing default-path to tmux" do
expect(window.tmux_new_window_command).to include("default-path /project/tmuxinator")
end
end
end
end

0 comments on commit 1cff0aa

Please sign in to comment.