Class: Jetbrains::Launcher
- Inherits:
-
Object
- Object
- Jetbrains::Launcher
- Defined in:
- lib/jetbrains.rb
Overview
Launches the most recent version found of the given jetbrains IDE
Instance Method Summary collapse
-
#initialize(name = 'idea') ⇒ Launcher
constructor
A new instance of Launcher.
Constructor Details
#initialize(name = 'idea') ⇒ Launcher
Returns a new instance of Launcher.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jetbrains.rb', line 22 def initialize(name = 'idea') candidates = Dir.glob("#{Jetbrains.app_root}/**/#{name}.sh").sort raise ArgumentError, "No files named '#{name}.sh' found under '#{Jetbrains.app_root}" if candidates.empty? if candidates.length > 1 puts 'Multiple candidates found...' puts candidates end pid = spawn(candidates.last) puts "Launched #{candidates.last} with pid #{pid}" end |