#663 add support for project config files with yaml extension (#664)

* #663 - add support for project config files using .yaml extension
This commit is contained in:
Pete Doherty
2018-12-14 13:00:31 -05:00
committed by GitHub
parent 0f093e1553
commit 0e4590e8a1
4 changed files with 52 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
## UNRELEASED
- add support for project config files using .yaml extension
## 0.14.0
### Misc
- Add `--suppress-tmux-version-warning` flag to prevent tmux version warning (#583)

View File

@@ -181,8 +181,8 @@ module Tmuxinator
# recursively searching 'directory'
def project_in(directory, name)
return nil if String(directory).empty?
projects = Dir.glob("#{directory}/**/*.yml").sort
projects.detect { |project| File.basename(project, ".yml") == name }
projects = Dir.glob("#{directory}/**/*.{yml,yaml}").sort
projects.detect { |project| File.basename(project, ".*") == name }
end
end
end

40
spec/fixtures/yaml.yaml vendored Normal file
View File

@@ -0,0 +1,40 @@
# ~/.tmuxinator/sample.yml
# you can make as many tabs as you wish...
name: sample
root: ~/test
socket_name: foo # Remove to use default socket
pre_window: rbenv shell 2.0.0-p247 # Runs in each tab and pane
tmux_options: -f ~/.tmux.mac.conf # Pass arguments to tmux
tmux_detached: false
windows:
- editor:
pre:
- echo "I get run in each pane, before each pane command!"
-
layout: main-vertical
panes:
- vim
- #empty, will just run plain bash
- top
- pane_with_multiple_commands:
- ssh server
- echo "Hello"
- shell:
- git pull
- git merge
- guard:
layout: tiled
pre:
- echo "I get run in each pane."
- echo "Before each pane command!"
panes:
-
- #empty, will just run plain bash
-
- database: bundle exec rails db
- server: bundle exec rails s
- logs: tail -f log/development.log
- console: bundle exec rails c
- capistrano:
- server: ssh user@example.com

View File

@@ -246,6 +246,7 @@ describe Tmuxinator::Config do
let(:directory) { Tmuxinator::Config.directory }
let(:base) { "#{directory}/sample.yml" }
let(:first_dup) { "#{home_config_dir}/dup/local-dup.yml" }
let(:yaml) { "#{directory}/yaml.yaml" }
before do
allow(Tmuxinator::Config).to receive_messages(xdg: fixtures_dir)
@@ -258,6 +259,12 @@ describe Tmuxinator::Config do
end
end
context "with project yaml" do
it "gets the project as path to the yaml file" do
expect(Tmuxinator::Config.global_project("yaml")).to eq yaml
end
end
context "without project yml" do
it "gets the project as path to the yml file" do
expect(Tmuxinator::Config.global_project("new-project")).to be_nil