Class: Packman::WebSettings
- Inherits:
-
Object
- Object
- Packman::WebSettings
- Defined in:
- lib/packman/web_settings.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(funpackfile) ⇒ WebSettings
constructor
A new instance of WebSettings.
- #start! ⇒ Object
Constructor Details
#initialize(funpackfile) ⇒ WebSettings
Returns a new instance of WebSettings.
16 17 18 |
# File 'lib/packman/web_settings.rb', line 16 def initialize(funpackfile) @funpackfile = funpackfile end |
Class Method Details
.generate(filename) ⇒ Object
11 12 13 14 |
# File 'lib/packman/web_settings.rb', line 11 def self.generate(filename) runner = new(Packman::Funpackfile.new(filename)) runner.start! end |
Instance Method Details
#start! ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/packman/web_settings.rb', line 20 def start! settings = nil ProcRunner.run("ruby", "#{Packman::SETTINGS_ROOT}/app.rb") do |runner| runner.each_line do |line| case line when /Listening on ([\d.:]+)/ $stderr.puts line Launchy.open("http://#{$1}") when /settings: (.*)/ Thread.new do sleep 1 runner.kill! end settings = JSON.load($1) end end end settings end |