Module: MultiTerm
- Defined in:
- lib/multiterm.rb,
lib/multiterm/version.rb
Defined Under Namespace
Modules: VERSION
Class Method Summary collapse
-
.configuration ⇒ Object
Memoized copy of the default configuration.
- .execute ⇒ Object
-
.read_configuration(path = nil) ⇒ Object
Loads the configuration file for the current path.
Class Method Details
.configuration ⇒ Object
Memoized copy of the default configuration.
21 22 23 |
# File 'lib/multiterm.rb', line 21 def self.configuration @@configuration ||= read_configuration end |
.execute ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/multiterm.rb', line 47 def self.execute if configuration app = Osaka::Terminal.new app.activate for tab_config in configuration[:tabs] app.new_tab( script: tab_config[:script], name: tab_config[:name] ) end else puts "Missing '.multiterm.yml' configuration." end end |
.read_configuration(path = nil) ⇒ Object
Loads the configuration file for the current path.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/multiterm.rb', line 27 def self.read_configuration(path=nil) if path != nil && File.exists?(path) && File.directory?(path) current_path = path elsif path != nil && File.exists?(path) && !File.directory?(path) current_path = File.dirname(path) else current_path = File.('.') end home_path = File.('~') search_path = current_path while search_path != '/' && search_path != home_path if File.exists?(File.join(search_path, '.multiterm.yml')) settings = YAML.load(File.read(File.join(search_path, '.multiterm.yml'))) return settings if settings end search_path = File.(File.join(search_path, '..')) end return nil end |