Class: Tmuxinator::ConfigWriter
- Inherits:
-
Object
- Object
- Tmuxinator::ConfigWriter
- Includes:
- Helper
- Defined in:
- lib/tmuxinator/config_writer.rb
Instance Attribute Summary collapse
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#pre ⇒ Object
Returns the value of attribute pre.
-
#project_name ⇒ Object
Returns the value of attribute project_name.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
-
#rvm ⇒ Object
Returns the value of attribute rvm.
-
#tabs ⇒ Object
Returns the value of attribute tabs.
Class Method Summary collapse
Instance Method Summary collapse
- #config_path ⇒ Object
-
#initialize(this_full_path = nil) ⇒ ConfigWriter
constructor
A new instance of ConfigWriter.
- #write! ⇒ Object
Methods included from Helper
Constructor Details
#initialize(this_full_path = nil) ⇒ ConfigWriter
Returns a new instance of ConfigWriter.
12 13 14 |
# File 'lib/tmuxinator/config_writer.rb', line 12 def initialize this_full_path=nil self.file_path = this_full_path if this_full_path end |
Instance Attribute Details
#file_name ⇒ Object
Returns the value of attribute file_name.
4 5 6 |
# File 'lib/tmuxinator/config_writer.rb', line 4 def file_name @file_name end |
#file_path ⇒ Object
Returns the value of attribute file_path.
4 5 6 |
# File 'lib/tmuxinator/config_writer.rb', line 4 def file_path @file_path end |
#pre ⇒ Object
Returns the value of attribute pre.
4 5 6 |
# File 'lib/tmuxinator/config_writer.rb', line 4 def pre @pre end |
#project_name ⇒ Object
Returns the value of attribute project_name.
4 5 6 |
# File 'lib/tmuxinator/config_writer.rb', line 4 def project_name @project_name end |
#project_root ⇒ Object
Returns the value of attribute project_root.
4 5 6 |
# File 'lib/tmuxinator/config_writer.rb', line 4 def project_root @project_root end |
#rvm ⇒ Object
Returns the value of attribute rvm.
4 5 6 |
# File 'lib/tmuxinator/config_writer.rb', line 4 def rvm @rvm end |
#tabs ⇒ Object
Returns the value of attribute tabs.
4 5 6 |
# File 'lib/tmuxinator/config_writer.rb', line 4 def tabs @tabs end |
Class Method Details
.write_aliases(aliases) ⇒ Object
8 9 10 |
# File 'lib/tmuxinator/config_writer.rb', line 8 def self.write_aliases aliases File.open("#{ENV["HOME"]}/.tmuxinator/scripts/tmuxinator", 'w') {|f| f.write(aliases.join("\n")) } end |
Instance Method Details
#config_path ⇒ Object
30 31 32 |
# File 'lib/tmuxinator/config_writer.rb', line 30 def config_path "#{root_dir}#{file_name}.tmux" if file_name end |
#write! ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/tmuxinator/config_writer.rb', line 22 def write! raise "Unable to write with out a file_name defined" unless self.file_name erb = ERB.new(IO.read(TMUX_TEMPLATE)).result(binding) tmp = File.open(config_path, 'w') {|f| f.write(erb) } "alias start_#{file_name}='$SHELL #{config_path}'" end |