Module: ThinService::Command::Commands::ServiceInstall

Included in:
Install, Installdaemon
Defined in:
lib/thin_service/command.rb

Instance Method Summary collapse

Instance Method Details

#add_service(svc_name, svc_display, argv) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/thin_service/command.rb', line 137

def add_service( svc_name, svc_display, argv)
  begin
    ServiceManager.create(
      svc_name,
      svc_display,
      argv.join(' ')
    )
    puts "#{svc_display} service created."
  rescue ServiceManager::CreateError => e
    puts "There was a problem installing the service:"
    puts e
  end
end

#validate_thin_service_exeObject



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/thin_service/command.rb', line 117

def validate_thin_service_exe
  # check if thin_service.exe is in ruby bindir.
  gem_root = File.join(File.dirname(__FILE__), "..", "..")
  gem_executable = File.join(gem_root, "resource/thin_service_wrapper.exe")
  bindir_executable = File.join(RbConfig::CONFIG['bindir'], '/thin_service_wrapper.exe')

  unless File.exist?(bindir_executable)
    STDERR.puts "** Copying native thin_service executable..."
    FileUtils.cp gem_executable, bindir_executable rescue nil
  end

  unless FileUtils.compare_file(bindir_executable, gem_executable)
    STDERR.puts "** Updating native thin_service executable..."
    FileUtils.rm_f bindir_executable rescue nil
    FileUtils.cp gem_executable, bindir_executable rescue nil
  end

  bindir_executable
end