class Tmuxinator::Config
Public Instance Methods
configs()
click to toggle source
# File lib/tmuxinator/config.rb, line 59 def configs Dir["#{Tmuxinator::Config.root}/*.yml"].sort.map do |path| File.basename(path, ".yml") end end
default()
click to toggle source
# File lib/tmuxinator/config.rb, line 13 def default "#{ENV["HOME"]}/.tmuxinator/default.yml" end
default?()
click to toggle source
# File lib/tmuxinator/config.rb, line 17 def default? exists?("default") end
default_path_option()
click to toggle source
# File lib/tmuxinator/config.rb, line 29 def default_path_option version && version < 1.7 ? "default-path" : "-c" end
editor?()
click to toggle source
# File lib/tmuxinator/config.rb, line 33 def editor? !ENV["EDITOR"].nil? && !ENV["EDITOR"].empty? end
exists?(name)
click to toggle source
# File lib/tmuxinator/config.rb, line 41 def exists?(name) File.exists?(project(name)) end
installed?()
click to toggle source
# File lib/tmuxinator/config.rb, line 21 def installed? Kernel.system("which tmux > /dev/null") end
project(name)
click to toggle source
# File lib/tmuxinator/config.rb, line 45 def project(name) projects = Dir.glob("#{root}/**/*.yml") project_file = projects.detect { |project| project =~ /^#{name}.yml$/ } project_file || "#{root}/#{name}.yml" end
root()
click to toggle source
# File lib/tmuxinator/config.rb, line 4 def root Dir.mkdir("#{ENV["HOME"]}/.tmuxinator") unless File.directory?(File.expand_path("~/.tmuxinator")) "#{ENV["HOME"]}/.tmuxinator" end
sample()
click to toggle source
# File lib/tmuxinator/config.rb, line 9 def sample "#{File.dirname(__FILE__)}/assets/sample.yml" end
shell?()
click to toggle source
# File lib/tmuxinator/config.rb, line 37 def shell? !ENV["SHELL"].nil? && !ENV["SHELL"].empty? end
template()
click to toggle source
# File lib/tmuxinator/config.rb, line 51 def template "#{File.dirname(__FILE__)}/assets/template.erb" end
validate(name)
click to toggle source
# File lib/tmuxinator/config.rb, line 65 def validate(name) unless Tmuxinator::Config.exists?(name) puts "Project #{name} doesn't exist." exit! end config_path = Tmuxinator::Config.project(name) yaml = begin YAML.load(File.read(config_path)) rescue SyntaxError, StandardError puts "Failed to parse config file. Please check your formatting." exit! end project = Tmuxinator::Project.new(yaml) unless project.windows? puts "Your project file should include some windows." exit! end unless project.root? puts "Your project file didn't specify a 'project_root'" exit! end unless project.name? puts "Your project file didn't specify a 'project_name'" end project end
version()
click to toggle source
# File lib/tmuxinator/config.rb, line 25 def version %xtmux -V`.split(" ")[1].to_f if installed? end
wemux_template()
click to toggle source
# File lib/tmuxinator/config.rb, line 55 def wemux_template "#{File.dirname(__FILE__)}/assets/wemux_template.erb" end