class Nerdinator::Config
Constants
- SETTINGS_KEY
Public Instance Methods
link(name)
click to toggle source
# File lib/nerdinator/config.rb, line 54 def link(name) path = "#{tmuxinator_root}/#{name}.yml" File.symlink(local, path) unless File.symlink?(path) end
local()
click to toggle source
# File lib/nerdinator/config.rb, line 15 def local File.expand_path("#{ENV['PWD']}/tmuxinator.yml") end
parse_settings(data)
click to toggle source
# File lib/nerdinator/config.rb, line 35 def parse_settings(data) if settings = data[SETTINGS_KEY] settings.map { |k, v| "#{k}=#{v}" }.join(' ') end end
read(path = root)
click to toggle source
# File lib/nerdinator/config.rb, line 24 def read(path = root) setup(path) unless File.exists?(path) YAML.load_file(path) end
root()
click to toggle source
# File lib/nerdinator/config.rb, line 11 def root File.expand_path("#{ENV['HOME']}/.nerdinator/nerdinator.yml") end
setup(path)
click to toggle source
# File lib/nerdinator/config.rb, line 19 def setup(path) Dir.mkdir(path.split('/')[0...-1].join('/')) File.write(path, '') end
start(sessions)
click to toggle source
# File lib/nerdinator/config.rb, line 45 def start(sessions) puts 'Nerdinator Sessions started:' sessions.each do |session| puts "#{session}" settings = parse_settings(read("#{tmuxinator_root}/#{session}.yml")) tmuxinator_command(session, settings) end end
tmuxinator_command(session, settings)
click to toggle source
# File lib/nerdinator/config.rb, line 41 def tmuxinator_command(session, settings) %x[tmuxinator start #{session} #{settings}] end
tmuxinator_root()
click to toggle source
# File lib/nerdinator/config.rb, line 7 def tmuxinator_root File.expand_path("#{ENV['HOME']}/.tmuxinator") end
write(data)
click to toggle source
# File lib/nerdinator/config.rb, line 29 def write(data) File.open(root, 'w+') do |f| YAML.dump(data, f) end end