Class: Tmuxinator::ITermConfigWriter
- Inherits:
-
ConfigWriter
- Object
- ConfigWriter
- Tmuxinator::ITermConfigWriter
- Includes:
- Helper
- Defined in:
- lib/tmuxinator/iterm_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) ⇒ ITermConfigWriter
constructor
A new instance of ITermConfigWriter.
- #write! ⇒ Object
Methods included from Helper
Constructor Details
#initialize(this_full_path = nil) ⇒ ITermConfigWriter
Returns a new instance of ITermConfigWriter.
12 13 14 |
# File 'lib/tmuxinator/iterm_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/iterm_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/iterm_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/iterm_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/iterm_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/iterm_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/iterm_config_writer.rb', line 4 def rvm @rvm end |
#tabs ⇒ Object
Returns the value of attribute tabs.
4 5 6 |
# File 'lib/tmuxinator/iterm_config_writer.rb', line 4 def tabs @tabs end |
Class Method Details
.write_aliases(aliases) ⇒ Object
8 9 10 |
# File 'lib/tmuxinator/iterm_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/iterm_config_writer.rb', line 30 def config_path "#{root_dir}#{file_name}.AppleScript" if file_name end |
#write! ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/tmuxinator/iterm_config_writer.rb', line 22 def write! raise "Unable to write with out a file_name defined" unless file_name erb = ERB.new(IO.read(ITERM_TEMPLATE)).result(binding) tmp = File.open(config_path, 'w') {|f| f.write(erb) } "alias iterm_#{file_name}='cat #{config_path} | osascript'" end |