Hello community, here is the log from the commit of package rubygem-tmuxinator for openSUSE:Factory checked in at 2019-03-04 09:21:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/rubygem-tmuxinator (Old) and /work/SRC/openSUSE:Factory/.rubygem-tmuxinator.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-tmuxinator" Mon Mar 4 09:21:14 2019 rev:2 rq:679538 version:0.15.0 Changes: -------- --- /work/SRC/openSUSE:Factory/rubygem-tmuxinator/rubygem-tmuxinator.changes 2019-01-21 10:24:40.381795518 +0100 +++ /work/SRC/openSUSE:Factory/.rubygem-tmuxinator.new.28833/rubygem-tmuxinator.changes 2019-03-04 09:21:17.128591154 +0100 @@ -1,0 +2,12 @@ +Mon Jan 14 14:00:29 UTC 2019 - Stephan Kulow <[email protected]> + +- updated to version 0.15.0 + no changelog found + +------------------------------------------------------------------- +Wed Dec 19 07:17:20 UTC 2018 - Stephan Kulow <[email protected]> + +- updated to version 0.14.0 + no changelog found + +------------------------------------------------------------------- Old: ---- tmuxinator-0.13.0.gem New: ---- tmuxinator-0.15.0.gem ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ rubygem-tmuxinator.spec ++++++ --- /var/tmp/diff_new_pack.doO5Vp/_old 2019-03-04 09:21:17.660591058 +0100 +++ /var/tmp/diff_new_pack.doO5Vp/_new 2019-03-04 09:21:17.664591057 +0100 @@ -1,7 +1,7 @@ # # spec file for package rubygem-tmuxinator # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -24,7 +24,7 @@ # Name: rubygem-tmuxinator -Version: 0.13.0 +Version: 0.15.0 Release: 0 %define mod_name tmuxinator %define mod_full_name %{mod_name}-%{version} @@ -58,7 +58,6 @@ %gem_install \ --symlink-binaries \ -f - # MANUAL # delete custom files here or do other fancy stuff for i in $(find %{buildroot} -type l -name mux.fish) ; do ++++++ tmuxinator-0.13.0.gem -> tmuxinator-0.15.0.gem ++++++ Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tmuxinator/cli.rb new/lib/tmuxinator/cli.rb --- old/lib/tmuxinator/cli.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/lib/tmuxinator/cli.rb 2018-12-27 02:22:44.000000000 +0100 @@ -202,14 +202,27 @@ def render_project(project) if project.deprecations.any? project.deprecations.each { |deprecation| say deprecation, :red } - say - print "Press ENTER to continue." - STDIN.getc + show_continuation_prompt end Kernel.exec(project.render) end + def version_warning?(suppress_flag) + !Tmuxinator::TmuxVersion.supported? && !suppress_flag + end + + def show_version_warning + say Tmuxinator::TmuxVersion::UNSUPPORTED_VERSION_MSG, :red + show_continuation_prompt + end + + def show_continuation_prompt + say + print "Press ENTER to continue." + STDIN.getc + end + def kill_project(project) Kernel.exec(project.kill) end @@ -224,6 +237,8 @@ desc: "Give the session a different name" method_option "project-config", aliases: "-p", desc: "Path to project config file" + method_option "suppress-tmux-version-warning", + desc: "Don't show a warning for unsupported tmux versions" def start(name = nil, *args) # project-config takes precedence over a named project in the case that @@ -241,25 +256,41 @@ project_config: options["project-config"] } + show_version_warning if version_warning?( + options["suppress-tmux-version-warning"] + ) + project = create_project(params) render_project(project) end desc "stop [PROJECT]", COMMANDS[:stop] map "st" => :stop + method_option "suppress-tmux-version-warning", + desc: "Don't show a warning for unsupported tmux versions" def stop(name) params = { name: name } + show_version_warning if version_warning?( + options["suppress-tmux-version-warning"] + ) + project = create_project(params) kill_project(project) end desc "local", COMMANDS[:local] map "." => :local + method_option "suppress-tmux-version-warning", + desc: "Don't show a warning for unsupported tmux versions" def local + show_version_warning if version_warning?( + options["suppress-tmux-version-warning"] + ) + render_project(create_project(attach: options[:attach])) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tmuxinator/config.rb new/lib/tmuxinator/config.rb --- old/lib/tmuxinator/config.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/lib/tmuxinator/config.rb 2018-12-27 02:22:44.000000000 +0100 @@ -9,9 +9,9 @@ class << self # The directory (created if needed) in which to store new projects def directory - return environment if File.directory?(environment) - return xdg if File.directory?(xdg) - return home if File.directory?(home) + return environment if environment? + return xdg if xdg? + return home if home? # No project directory specified or existant, default to XDG: FileUtils::mkdir_p(xdg) xdg @@ -21,6 +21,10 @@ ENV["HOME"] + "/.tmuxinator" end + def home? + File.directory?(home) + end + # ~/.config/tmuxinator unless $XDG_CONFIG_HOME has been configured to use # a custom value. (e.g. if $XDG_CONFIG_HOME is set to ~/my-config, the # return value will be ~/my-config/tmuxinator) @@ -28,6 +32,10 @@ XDG["CONFIG"].to_s + "/tmuxinator" end + def xdg? + File.directory?(xdg) + end + # $TMUXINATOR_CONFIG (and create directory) or "". def environment environment = ENV["TMUXINATOR_CONFIG"] @@ -36,6 +44,10 @@ environment end + def environment? + File.directory?(environment) + end + def sample asset_path "sample.yml" end @@ -119,7 +131,7 @@ # Listed in search order # Used by `implode` and `list` commands def directories - if !environment.nil? && !environment.empty? + if environment? [environment] else [xdg, home].select { |d| File.directory? d } @@ -181,8 +193,8 @@ # 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tmuxinator/project.rb new/lib/tmuxinator/project.rb --- old/lib/tmuxinator/project.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/lib/tmuxinator/project.rb 2018-12-27 02:22:44.000000000 +0100 @@ -34,11 +34,6 @@ DEPRECATION: The `post` option has been replaced by project hooks and will not be supported anymore. M - TMUX_MASTER_DEP_MSG = <<-M - DEPRECATION: You are running tmuxinator with an unsupported version of tmux. - Please consider using a supported version: - (#{Tmuxinator::SUPPORTED_TMUX_VERSIONS.join(', ')}) - M attr_reader :yaml attr_reader :force_attach @@ -276,8 +271,7 @@ cli_args?, legacy_synchronize?, pre?, - post?, - unsupported_version? + post? ] end @@ -288,8 +282,7 @@ CLIARGS_DEP_MSG, SYNC_DEP_MSG, PRE_DEP_MSG, - POST_DEP_MSG, - TMUX_MASTER_DEP_MSG + POST_DEP_MSG ] end @@ -321,10 +314,6 @@ yaml["post"] end - def unsupported_version? - !Tmuxinator::SUPPORTED_TMUX_VERSIONS.include?(Tmuxinator::Config.version) - end - def get_pane_base_index tmux_config["pane-base-index"] end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tmuxinator/tmux_version.rb new/lib/tmuxinator/tmux_version.rb --- old/lib/tmuxinator/tmux_version.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/lib/tmuxinator/tmux_version.rb 2018-12-27 02:22:44.000000000 +0100 @@ -0,0 +1,29 @@ +module Tmuxinator + module TmuxVersion + SUPPORTED_TMUX_VERSIONS = [ + 1.5, + 1.6, + 1.7, + 1.8, + 1.9, + 2.0, + 2.1, + 2.2, + 2.3, + 2.4, + 2.5, + 2.6, + 2.7, + 2.8 + ].freeze + UNSUPPORTED_VERSION_MSG = <<-MSG.freeze + WARNING: You are running tmuxinator with an unsupported version of tmux. + Please consider using a supported version: + (#{SUPPORTED_TMUX_VERSIONS.join(', ')}) + MSG + + def self.supported?(version = Tmuxinator::Config.version) + SUPPORTED_TMUX_VERSIONS.include?(version) + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tmuxinator/version.rb new/lib/tmuxinator/version.rb --- old/lib/tmuxinator/version.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/lib/tmuxinator/version.rb 2018-12-27 02:22:44.000000000 +0100 @@ -1,3 +1,3 @@ module Tmuxinator - VERSION = "0.13.0".freeze + VERSION = "0.15.0".freeze end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/lib/tmuxinator.rb new/lib/tmuxinator.rb --- old/lib/tmuxinator.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/lib/tmuxinator.rb 2018-12-27 02:22:44.000000000 +0100 @@ -7,24 +7,9 @@ require "yaml" module Tmuxinator - SUPPORTED_TMUX_VERSIONS = [ - 1.5, - 1.6, - 1.7, - 1.8, - 1.9, - 2.0, - 2.1, - 2.2, - 2.3, - 2.4, - 2.5, - 2.6, - 2.7, - 2.8 - ].freeze end +require "tmuxinator/tmux_version" require "tmuxinator/util" require "tmuxinator/deprecations" require "tmuxinator/wemux_support" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/metadata new/metadata --- old/metadata 2018-10-23 18:37:02.000000000 +0200 +++ new/metadata 2018-12-27 02:22:44.000000000 +0100 @@ -1,7 +1,7 @@ --- !ruby/object:Gem::Specification name: tmuxinator version: !ruby/object:Gem::Version - version: 0.13.0 + version: 0.15.0 platform: ruby authors: - Allen Bargi @@ -9,7 +9,7 @@ autorequire: bindir: bin cert_chain: [] -date: 2018-10-23 00:00:00.000000000 Z +date: 2018-12-27 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: erubis @@ -113,14 +113,14 @@ requirements: - - "~>" - !ruby/object:Gem::Version - version: '0.7' + version: '0.8' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: '0.7' + version: '0.8' - !ruby/object:Gem::Dependency name: factory_bot requirement: !ruby/object:Gem::Requirement @@ -197,14 +197,28 @@ requirements: - - "~>" - !ruby/object:Gem::Version - version: 0.11.0 + version: '0.16' type: :development prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version - version: 0.11.0 + version: '0.16' +- !ruby/object:Gem::Dependency + name: unicode-display_width + requirement: !ruby/object:Gem::Requirement + requirements: + - - "~>" + - !ruby/object:Gem::Version + version: '1.3' + type: :development + prerelease: false + version_requirements: !ruby/object:Gem::Requirement + requirements: + - - "~>" + - !ruby/object:Gem::Version + version: '1.3' description: Create and manage complex tmux sessions easily. email: - [email protected] @@ -232,6 +246,7 @@ - lib/tmuxinator/hooks/project.rb - lib/tmuxinator/pane.rb - lib/tmuxinator/project.rb +- lib/tmuxinator/tmux_version.rb - lib/tmuxinator/util.rb - lib/tmuxinator/version.rb - lib/tmuxinator/wemux_support.rb @@ -257,6 +272,7 @@ - spec/fixtures/sample_with_project_config.yml - spec/fixtures/xdg-tmuxinator/both.yml - spec/fixtures/xdg-tmuxinator/xdg.yml +- spec/fixtures/yaml.yaml - spec/lib/tmuxinator/cli_spec.rb - spec/lib/tmuxinator/config_spec.rb - spec/lib/tmuxinator/doctor_spec.rb @@ -294,7 +310,7 @@ version: 1.8.23 requirements: [] rubyforge_project: -rubygems_version: 2.7.6 +rubygems_version: 2.7.7 signing_key: specification_version: 4 summary: Create and manage complex tmux sessions easily. @@ -320,6 +336,7 @@ - spec/fixtures/sample_with_project_config.yml - spec/fixtures/xdg-tmuxinator/both.yml - spec/fixtures/xdg-tmuxinator/xdg.yml +- spec/fixtures/yaml.yaml - spec/lib/tmuxinator/cli_spec.rb - spec/lib/tmuxinator/config_spec.rb - spec/lib/tmuxinator/doctor_spec.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/fixtures/yaml.yaml new/spec/fixtures/yaml.yaml --- old/spec/fixtures/yaml.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/spec/fixtures/yaml.yaml 2018-12-27 02:22:44.000000000 +0100 @@ -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 [email protected] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/lib/tmuxinator/cli_spec.rb new/spec/lib/tmuxinator/cli_spec.rb --- old/spec/lib/tmuxinator/cli_spec.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/spec/lib/tmuxinator/cli_spec.rb 2018-12-27 02:22:44.000000000 +0100 @@ -24,7 +24,8 @@ end end - let(:cli) { Tmuxinator::Cli } + subject(:cli) { described_class } + let(:fixtures_dir) { File.expand_path("../../../fixtures/", __FILE__) } let(:project) { FactoryBot.build(:project) } let(:project_config) do @@ -207,6 +208,47 @@ end end + shared_examples_for :unsupported_version_message do |*args| + before do + ARGV.replace([*args]) + end + + context "unsupported version" do + before do + allow($stdin).to receive_messages(getc: "y") + allow(Tmuxinator::TmuxVersion).to receive(:supported?).and_return(false) + end + + it "prints the warning" do + out, _err = capture_io { cli.start } + expect(out).to include "WARNING" + end + + context "with --suppress-tmux-version-warning flag" do + before do + ARGV.replace([*args, "--suppress-tmux-version-warning"]) + end + + it "does not print the warning" do + out, _err = capture_io { cli.start } + expect(out).not_to include "WARNING" + end + end + end + + context "supported version" do + before do + allow($stdin).to receive_messages(getc: "y") + allow(Tmuxinator::TmuxVersion).to receive(:supported?).and_return(true) + end + + it "does not print the warning" do + out, _err = capture_io { cli.start } + expect(out).not_to include "WARNING" + end + end + end + describe "#start" do before do ARGV.replace(["start", "foo"]) @@ -255,6 +297,8 @@ expect(out).to include "DEPRECATION" end end + + include_examples :unsupported_version_message, :start, :foo end describe "#stop" do @@ -273,16 +317,18 @@ expect(out).to eq "" end end + + include_examples :unsupported_version_message, :stop, :foo end describe "#local" do - shared_examples_for :local_project do - before do - allow(Tmuxinator::Config).to receive_messages(validate: project) - allow(Tmuxinator::Config).to receive_messages(version: 1.9) - allow(Kernel).to receive(:exec) - end + before do + allow(Tmuxinator::Config).to receive_messages(validate: project) + allow(Tmuxinator::Config).to receive_messages(version: 1.9) + allow(Kernel).to receive(:exec) + end + shared_examples_for :local_project do it "starts the project" do expect(Kernel).to receive(:exec) out, err = capture_io { cli.start } @@ -304,6 +350,8 @@ end it_should_behave_like :local_project end + + include_examples :unsupported_version_message, :local end describe "#start(custom_name)" do @@ -374,7 +422,7 @@ expect(File).not_to exist(path) # now generate a project file - expect(Tmuxinator::Cli.new.generate_project_file(name, path)).to eq path + expect(described_class.new.generate_project_file(name, path)).to eq path expect(File).to exist path # add some content to the project file @@ -782,7 +830,7 @@ end it "should generate a project file" do - new_path = Tmuxinator::Cli.new.find_project_file(name, false) + new_path = described_class.new.find_project_file(name, false) expect(new_path).to eq path expect(File).to exist new_path end @@ -793,7 +841,7 @@ before do expect(File).not_to exist(path), "expected file at #{path} not to exist" - expect(Tmuxinator::Cli.new.generate_project_file(name, path)).to eq path + expect(described_class.new.generate_project_file(name, path)).to eq path expect(File).to exist path File.open(path, "w") do |f| @@ -804,7 +852,7 @@ end it "should _not_ generate a new project file" do - new_path = Tmuxinator::Cli.new.find_project_file(name, false) + new_path = described_class.new.find_project_file(name, false) expect(new_path).to eq path expect(File).to exist new_path expect(File.read(new_path)).to match %r{#{extra}} @@ -819,7 +867,7 @@ Dir.mktmpdir do |dir| path = "#{dir}/#{name}.yml" expect(File).not_to exist(path), "expected file at #{path} not to exist" - new_path = Tmuxinator::Cli.new.generate_project_file(name, path) + new_path = described_class.new.generate_project_file(name, path) expect(new_path).to eq path expect(File).to exist new_path end @@ -830,7 +878,7 @@ allow(File).to receive(:open) { |&block| block.yield file } Dir.mktmpdir do |dir| path = "#{dir}/#{name}.yml" - _ = Tmuxinator::Cli.new.generate_project_file(name, path) + _ = described_class.new.generate_project_file(name, path) expect(file.string).to match %r{\A# #{path}$} end end @@ -868,18 +916,18 @@ context "attach option" do describe "detach" do it "sets force_detach to false when no attach argument is provided" do - project = Tmuxinator::Cli.new.create_project(name: name) + project = described_class.new.create_project(name: name) expect(project.force_detach).to eq(false) end it "sets force_detach to true when 'attach: false' is provided" do - project = Tmuxinator::Cli.new.create_project(attach: false, + project = described_class.new.create_project(attach: false, name: name) expect(project.force_detach).to eq(true) end it "sets force_detach to false when 'attach: true' is provided" do - project = Tmuxinator::Cli.new.create_project(attach: true, + project = described_class.new.create_project(attach: true, name: name) expect(project.force_detach).to eq(false) end @@ -887,18 +935,18 @@ describe "attach" do it "sets force_attach to false when no attach argument is provided" do - project = Tmuxinator::Cli.new.create_project(name: name) + project = described_class.new.create_project(name: name) expect(project.force_attach).to eq(false) end it "sets force_attach to true when 'attach: true' is provided" do - project = Tmuxinator::Cli.new.create_project(attach: true, + project = described_class.new.create_project(attach: true, name: name) expect(project.force_attach).to eq(true) end it "sets force_attach to false when 'attach: false' is provided" do - project = Tmuxinator::Cli.new.create_project(attach: false, + project = described_class.new.create_project(attach: false, name: name) expect(project.force_attach).to eq(false) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/lib/tmuxinator/config_spec.rb new/spec/lib/tmuxinator/config_spec.rb --- old/spec/lib/tmuxinator/config_spec.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/spec/lib/tmuxinator/config_spec.rb 2018-12-27 02:22:44.000000000 +0100 @@ -11,55 +11,50 @@ allow(ENV).to receive(:[]).with("TMUXINATOR_CONFIG"). and_return "expected" allow(File).to receive(:directory?).and_return true - expect(Tmuxinator::Config.directory).to eq "expected" + expect(described_class.directory).to eq "expected" end end context "only ~/.tmuxinator exists" do it "is ~/.tmuxinator" do - allow(File).to receive(:directory?). - with(Tmuxinator::Config.environment).and_return false - allow(File).to receive(:directory?). - with(Tmuxinator::Config.xdg).and_return false - allow(File).to receive(:directory?). - with(Tmuxinator::Config.home).and_return true - expect(Tmuxinator::Config.directory).to eq Tmuxinator::Config.home + allow(described_class).to receive(:environment?).and_return false + allow(described_class).to receive(:xdg?).and_return false + allow(described_class).to receive(:home?).and_return true + + expect(described_class.directory).to eq described_class.home end end context "only $XDG_CONFIG_HOME/tmuxinator exists" do it "is #xdg" do - allow(File).to receive(:directory?). - with(Tmuxinator::Config.environment).and_return false - allow(File).to receive(:directory?). - with(Tmuxinator::Config.xdg).and_return true - allow(File).to receive(:directory?). - with(Tmuxinator::Config.home).and_return false - expect(Tmuxinator::Config.directory).to eq Tmuxinator::Config.xdg + allow(described_class).to receive(:environment?).and_return false + allow(described_class).to receive(:xdg?).and_return true + allow(described_class).to receive(:home?).and_return false + + expect(described_class.directory).to eq described_class.xdg end end context "both $XDG_CONFIG_HOME/tmuxinator and ~/.tmuxinator exist" do it "is #xdg" do - allow(File).to receive(:directory?). - with(Tmuxinator::Config.environment).and_return false - allow(File).to receive(:directory?). - with(Tmuxinator::Config.xdg).and_return true - allow(File).to receive(:directory?). - with(Tmuxinator::Config.home).and_return true - expect(Tmuxinator::Config.directory).to eq Tmuxinator::Config.xdg + allow(described_class).to receive(:environment?).and_return false + allow(described_class).to receive(:xdg?).and_return true + allow(described_class).to receive(:home?).and_return true + + expect(described_class.directory).to eq described_class.xdg end end - context "parent directory(s) do not exist" do + context "defaulting to xdg with parent directory(s) that do not exist" do it "creates parent directories if required" do - allow(File).to receive(:directory?).and_call_original - allow(File).to receive(:directory?).with(Tmuxinator::Config.home). - and_return false + allow(described_class).to receive(:environment?).and_return false + allow(described_class).to receive(:xdg?).and_return false + allow(described_class).to receive(:home?).and_return false + Dir.mktmpdir do |dir| config_parent = "#{dir}/non_existant_parent/s" allow(XDG).to receive(:[]).with("CONFIG").and_return config_parent - expect(Tmuxinator::Config.directory). + expect(described_class.directory). to eq "#{config_parent}/tmuxinator" expect(File.directory?("#{config_parent}/tmuxinator")).to be true end @@ -74,7 +69,7 @@ and_return "expected" # allow(XDG).to receive(:[]).with("CONFIG").and_return "expected" allow(File).to receive(:directory?).and_return true - expect(Tmuxinator::Config.environment).to eq "expected" + expect(described_class.environment).to eq "expected" end end @@ -84,67 +79,79 @@ and_return nil # allow(XDG).to receive(:[]).with("CONFIG").and_return nil allow(File).to receive(:directory?).and_return true - expect(Tmuxinator::Config.environment).to eq "" + expect(described_class.environment).to eq "" end end context "environment variable $TMUXINATOR_CONFIG is set and empty" do it "is an empty string" do allow(XDG).to receive(:[]).with("CONFIG").and_return "" - expect(Tmuxinator::Config.environment).to eq "" + allow(ENV).to receive(:[]).with("TMUXINATOR_CONFIG").and_return "" + expect(described_class.environment).to eq "" end end end describe "#directories" do - it "is empty if no configuration directories exist" do - allow(File).to receive(:directory?).and_return false - expect(Tmuxinator::Config.directories).to eq [] - end + context "without TMUXINATOR_CONFIG environment" do + before do + allow(described_class).to receive(:environment?).and_return false + end - it "is only [$TMUXINATOR_CONFIG] if set" do - allow(ENV).to receive(:[]).with("TMUXINATOR_CONFIG"). - and_return "expected" - allow(File).to receive(:directory?).and_return true - expect(Tmuxinator::Config.directories).to eq ["expected"] + it "is empty if no configuration directories exist" do + allow(File).to receive(:directory?).and_return false + expect(described_class.directories).to eq [] + end + + it "contains #xdg before #home" do + allow(described_class).to receive(:xdg).and_return "XDG" + allow(described_class).to receive(:home).and_return "HOME" + allow(File).to receive(:directory?).and_return true + + expect(described_class.directories).to eq \ + ["XDG", "HOME"] + end end - it "contains #xdg before #home" do - allow(File).to receive(:directory?).with(Tmuxinator::Config.xdg). - and_return true - allow(File).to receive(:directory?).with(Tmuxinator::Config.home). - and_return true - expect(Tmuxinator::Config.directories).to eq \ - [Tmuxinator::Config.xdg, Tmuxinator::Config.home] + context "with TMUXINATOR_CONFIG environment" do + before do + allow(ENV).to receive(:[]).with("TMUXINATOR_CONFIG"). + and_return "TMUXINATOR_CONFIG" + end + it "is only [$TMUXINATOR_CONFIG] if set" do + allow(File).to receive(:directory?).and_return true + + expect(described_class.directories).to eq ["TMUXINATOR_CONFIG"] + end end end describe "#home" do it "is ~/.tmuxinator" do - expect(Tmuxinator::Config.home).to eq "#{ENV['HOME']}/.tmuxinator" + expect(described_class.home).to eq "#{ENV['HOME']}/.tmuxinator" end end describe "#xdg" do it "is $XDG_CONFIG_HOME/tmuxinator" do - expect(Tmuxinator::Config.xdg).to eq "#{XDG['CONFIG_HOME']}/tmuxinator" + expect(described_class.xdg).to eq "#{XDG['CONFIG_HOME']}/tmuxinator" end end describe "#sample" do it "gets the path of the sample project" do - expect(Tmuxinator::Config.sample).to include("sample.yml") + expect(described_class.sample).to include("sample.yml") end end describe "#default" do it "gets the path of the default config" do - expect(Tmuxinator::Config.default).to include("default.yml") + expect(described_class.default).to include("default.yml") end end describe "#version" do - subject { Tmuxinator::Config.version } + subject { described_class.version } before do expect(Tmuxinator::Doctor).to receive(:installed?).and_return(true) @@ -166,29 +173,29 @@ describe "#default_path_option" do context ">= 1.8" do before do - allow(Tmuxinator::Config).to receive(:version).and_return(1.8) + allow(described_class).to receive(:version).and_return(1.8) end it "returns -c" do - expect(Tmuxinator::Config.default_path_option).to eq "-c" + expect(described_class.default_path_option).to eq "-c" end end context "< 1.8" do before do - allow(Tmuxinator::Config).to receive(:version).and_return(1.7) + allow(described_class).to receive(:version).and_return(1.7) end it "returns default-path" do - expect(Tmuxinator::Config.default_path_option).to eq "default-path" + expect(described_class.default_path_option).to eq "default-path" end end end describe "#default?" do - let(:directory) { Tmuxinator::Config.directory } - let(:local_default) { Tmuxinator::Config::LOCAL_DEFAULT } - let(:proj_default) { Tmuxinator::Config.default } + let(:directory) { described_class.directory } + let(:local_default) { described_class::LOCAL_DEFAULT } + let(:proj_default) { described_class.default } context "when the file exists" do before do @@ -197,7 +204,7 @@ end it "returns true" do - expect(Tmuxinator::Config.default?).to be_truthy + expect(described_class.default?).to be_truthy end end @@ -208,105 +215,115 @@ end it "returns true" do - expect(Tmuxinator::Config.default?).to be_falsey + expect(described_class.default?).to be_falsey end end end describe "#configs" do before do - allow(Tmuxinator::Config).to receive_messages(xdg: xdg_config_dir) - allow(Tmuxinator::Config).to receive_messages(home: home_config_dir) + allow(described_class).to receive_messages(xdg: xdg_config_dir) + allow(described_class).to receive_messages(home: home_config_dir) end it "gets a sorted list of all projects" do - expect(Tmuxinator::Config.configs). + allow(described_class).to receive(:environment?).and_return false + + expect(described_class.configs). to eq ["both", "both", "dup/local-dup", "home", "local-dup", "xdg"] end it "lists only projects in $TMUXINATOR_CONFIG when set" do allow(ENV).to receive(:[]).with("TMUXINATOR_CONFIG"). and_return "#{fixtures_dir}/TMUXINATOR_CONFIG" - expect(Tmuxinator::Config.configs).to eq ["TMUXINATOR_CONFIG"] + expect(described_class.configs).to eq ["TMUXINATOR_CONFIG"] end end describe "#exists?" do before do allow(File).to receive_messages(exist?: true) - allow(Tmuxinator::Config).to receive_messages(project: "") + allow(described_class).to receive_messages(project: "") end it "checks if the given project exists" do - expect(Tmuxinator::Config.exists?(name: "test")).to be_truthy + expect(described_class.exists?(name: "test")).to be_truthy end end describe "#global_project" do - let(:directory) { Tmuxinator::Config.directory } + let(:directory) { described_class.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) - allow(Tmuxinator::Config).to receive_messages(home: fixtures_dir) + allow(described_class).to receive(:environment?).and_return false + allow(described_class).to receive(:xdg).and_return fixtures_dir + allow(described_class).to receive(:home).and_return fixtures_dir end context "with project yml" do it "gets the project as path to the yml file" do - expect(Tmuxinator::Config.global_project("sample")).to eq base + expect(described_class.global_project("sample")).to eq base + 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 + expect(described_class.global_project("new-project")).to be_nil end end context "with duplicate project files" do it "is the first .yml file found" do - expect(Tmuxinator::Config.global_project("local-dup")).to eq first_dup + expect(described_class.global_project("local-dup")).to eq first_dup end end end describe "#local?" do it "checks if the given project exists" do - path = Tmuxinator::Config::LOCAL_DEFAULT + path = described_class::LOCAL_DEFAULT expect(File).to receive(:exist?).with(path) { true } - expect(Tmuxinator::Config.local?).to be_truthy + expect(described_class.local?).to be_truthy end end describe "#local_project" do - let(:default) { Tmuxinator::Config::LOCAL_DEFAULT } + let(:default) { described_class::LOCAL_DEFAULT } context "with a project yml" do it "gets the project as path to the yml file" do expect(File).to receive(:exist?).with(default) { true } - expect(Tmuxinator::Config.local_project).to eq default + expect(described_class.local_project).to eq default end end context "without project yml" do it "gets the project as path to the yml file" do - expect(Tmuxinator::Config.local_project).to be_nil + expect(described_class.local_project).to be_nil end end end describe "#project" do - let(:directory) { Tmuxinator::Config.directory } - let(:default) { Tmuxinator::Config::LOCAL_DEFAULT } + let(:directory) { described_class.directory } + let(:default) { described_class::LOCAL_DEFAULT } context "with an non-local project yml" do before do - allow(Tmuxinator::Config).to receive_messages(directory: fixtures_dir) + allow(described_class).to receive_messages(directory: fixtures_dir) end it "gets the project as path to the yml file" do - expect(Tmuxinator::Config.project("sample")). + expect(described_class.project("sample")). to eq "#{directory}/sample.yml" end end @@ -314,48 +331,48 @@ context "with a local project, but no global project" do it "gets the project as path to the yml file" do expect(File).to receive(:exist?).with(default) { true } - expect(Tmuxinator::Config.project("sample")).to eq "./.tmuxinator.yml" + expect(described_class.project("sample")).to eq "./.tmuxinator.yml" end end context "without project yml" do let(:expected) { "#{directory}/new-project.yml" } it "gets the project as path to the yml file" do - expect(Tmuxinator::Config.project("new-project")).to eq expected + expect(described_class.project("new-project")).to eq expected end end end describe "#validate" do - let(:default) { Tmuxinator::Config::LOCAL_DEFAULT } + let(:default) { described_class::LOCAL_DEFAULT } context "when a project config file is provided" do it "should raise if the project config file can't be found" do project_config = "dont-exist.yml" regex = /Project config \(#{project_config}\) doesn't exist\./ expect do - Tmuxinator::Config.validate(project_config: project_config) + described_class.validate(project_config: project_config) end.to raise_error RuntimeError, regex end it "should load and validate the project" do project_config = File.join(fixtures_dir, "sample.yml") - expect(Tmuxinator::Config.validate(project_config: project_config)).to \ + expect(described_class.validate(project_config: project_config)).to \ be_a Tmuxinator::Project end it "should take precedence over a named project" do - allow(Tmuxinator::Config).to receive_messages(directory: fixtures_dir) + allow(described_class).to receive_messages(directory: fixtures_dir) project_config = File.join(fixtures_dir, "sample_number_as_name.yml") - project = Tmuxinator::Config.validate(name: "sample", - project_config: project_config) + project = described_class.validate(name: "sample", + project_config: project_config) expect(project.name).to eq("222") end it "should take precedence over a local project" do - expect(Tmuxinator::Config).not_to receive(:local?) + expect(described_class).not_to receive(:local?) project_config = File.join(fixtures_dir, "sample_number_as_name.yml") - project = Tmuxinator::Config.validate(project_config: project_config) + project = described_class.validate(project_config: project_config) expect(project.name).to eq("222") end end @@ -363,13 +380,13 @@ context "when a project name is provided" do it "should raise if the project file can't be found" do expect do - Tmuxinator::Config.validate(name: "sample") + described_class.validate(name: "sample") end.to raise_error RuntimeError, %r{Project.+doesn't.exist} end it "should load and validate the project" do - expect(Tmuxinator::Config).to receive_messages(directory: fixtures_dir) - expect(Tmuxinator::Config.validate(name: "sample")).to \ + expect(described_class).to receive_messages(directory: fixtures_dir) + expect(described_class.validate(name: "sample")).to \ be_a Tmuxinator::Project end end @@ -378,7 +395,7 @@ it "should raise if the local project file doesn't exist" do expect(File).to receive(:exist?).with(default) { false } expect do - Tmuxinator::Config.validate + described_class.validate end.to raise_error RuntimeError, %r{Project.+doesn't.exist} end @@ -388,18 +405,19 @@ expect(File).to receive(:exist?).with(default).at_least(:once) { true } expect(File).to receive(:read).with(default).and_return(content) - expect(Tmuxinator::Config.validate).to be_a Tmuxinator::Project + expect(described_class.validate).to be_a Tmuxinator::Project end end context "when no project can be found" do it "should raise with NO_PROJECT_FOUND_MSG" do - config = Tmuxinator::Config - expect(config).to receive(:valid_project_config?).and_return(false) - expect(config).to receive(:valid_local_project?).and_return(false) - expect(config).to receive(:valid_standard_project?).and_return(false) + expect(described_class).to receive_messages( + valid_project_config?: false, + valid_local_project?: false, + valid_standard_project?: false + ) expect do - Tmuxinator::Config.validate + described_class.validate end.to raise_error RuntimeError, %r{Project could not be found\.} end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/lib/tmuxinator/doctor_spec.rb new/spec/lib/tmuxinator/doctor_spec.rb --- old/spec/lib/tmuxinator/doctor_spec.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/spec/lib/tmuxinator/doctor_spec.rb 2018-12-27 02:22:44.000000000 +0100 @@ -8,7 +8,7 @@ end it "returns true" do - expect(Tmuxinator::Doctor.installed?).to be_truthy + expect(described_class.installed?).to be_truthy end end @@ -18,7 +18,7 @@ end it "returns false" do - expect(Tmuxinator::Doctor.installed?).to be_falsey + expect(described_class.installed?).to be_falsey end end end @@ -30,7 +30,7 @@ end it "returns true" do - expect(Tmuxinator::Doctor.editor?).to be_truthy + expect(described_class.editor?).to be_truthy end end @@ -40,7 +40,7 @@ end it "returns false" do - expect(Tmuxinator::Doctor.editor?).to be_falsey + expect(described_class.editor?).to be_falsey end end end @@ -52,7 +52,7 @@ end it "returns true" do - expect(Tmuxinator::Doctor.shell?).to be_truthy + expect(described_class.shell?).to be_truthy end end @@ -62,7 +62,7 @@ end it "returns false" do - expect(Tmuxinator::Doctor.shell?).to be_falsey + expect(described_class.shell?).to be_falsey end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/spec/lib/tmuxinator/window_spec.rb new/spec/lib/tmuxinator/window_spec.rb --- old/spec/lib/tmuxinator/window_spec.rb 2018-10-23 18:37:02.000000000 +0200 +++ new/spec/lib/tmuxinator/window_spec.rb 2018-12-27 02:22:44.000000000 +0100 @@ -33,12 +33,12 @@ } end - let(:window) { Tmuxinator::Window.new(yaml, 0, project) } - let(:window_root) { Tmuxinator::Window.new(yaml_root, 0, project) } + let(:window) { described_class.new(yaml, 0, project) } + let(:window_root) { described_class.new(yaml_root, 0, project) } shared_context "window command context" do let(:project) { double(:project) } - let(:window) { Tmuxinator::Window.new(yaml, 0, project) } + let(:window) { described_class.new(yaml, 0, project) } let(:root?) { true } let(:root) { "/project/tmuxinator" }
