diff --git a/CHANGELOG.md b/CHANGELOG.md index 17e1458..1f36a5b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/lib/tmuxinator/config.rb b/lib/tmuxinator/config.rb index 522c18a..d25ef30 100644 --- a/lib/tmuxinator/config.rb +++ b/lib/tmuxinator/config.rb @@ -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 diff --git a/spec/fixtures/yaml.yaml b/spec/fixtures/yaml.yaml new file mode 100644 index 0000000..0889d48 --- /dev/null +++ b/spec/fixtures/yaml.yaml @@ -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 diff --git a/spec/lib/tmuxinator/config_spec.rb b/spec/lib/tmuxinator/config_spec.rb index 7d2f811..abdb2df 100644 --- a/spec/lib/tmuxinator/config_spec.rb +++ b/spec/lib/tmuxinator/config_spec.rb @@ -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