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.
Instance Method Summary collapse
- #config_path ⇒ Object
-
#initialize(this_full_path = nil) ⇒ ConfigWriter
constructor
A new instance of ConfigWriter.
- #render ⇒ Object
- #socket ⇒ Object
- #write! ⇒ Object
Methods included from Helper
Constructor Details
#initialize(this_full_path = nil) ⇒ ConfigWriter
Returns a new instance of ConfigWriter.
8 9 10 |
# File 'lib/tmuxinator/config_writer.rb', line 8 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 |
Instance Method Details
#config_path ⇒ Object
27 28 29 |
# File 'lib/tmuxinator/config_writer.rb', line 27 def config_path "#{root_dir}#{file_name}.tmux" if file_name end |
#render ⇒ Object
23 24 25 |
# File 'lib/tmuxinator/config_writer.rb', line 23 def render ERB.new(IO.read(TMUX_TEMPLATE)).result(binding) end |
#socket ⇒ Object
31 32 33 |
# File 'lib/tmuxinator/config_writer.rb', line 31 def socket "-L #{@socket_name}" if @socket_name end |
#write! ⇒ Object
18 19 20 21 |
# File 'lib/tmuxinator/config_writer.rb', line 18 def write! raise "Unable to write with out a file_name defined" unless self.file_name tmp = File.open(config_path, 'w') {|f| f.write(render) } end |