Class: FubuRake::BottleServices
- Inherits:
-
Object
- Object
- FubuRake::BottleServices
- Defined in:
- lib/fuburake.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ BottleServices
constructor
A new instance of BottleServices.
- #to_install_args(options) ⇒ Object
- #to_start_stop_args(verb, options) ⇒ Object
- #to_task(name, args, description) ⇒ Object
Constructor Details
#initialize(options) ⇒ BottleServices
Returns a new instance of BottleServices.
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/fuburake.rb', line 260 def initialize() @directory = [:dir] @prefix = .fetch(:prefix, 'service') @command = File.join(@directory, 'BottleServiceRunner.exe') consoleTask = Rake::Task.define_task "#{@prefix}:console" do sh "#{Platform.start(Platform.runtime(@command))}" end consoleTask.add_description "Run service in console at #{@directory}" to_task 'install', to_install_args(), "Install the service locally" to_task 'start', to_start_stop_args('start', ), "Start the service locally" to_task 'stop', to_start_stop_args('stop', ), "Stop the service locally" to_task 'uninstall', to_start_stop_args('uninstall', ), "Stop the service locally" cleanTask = Rake::Task.define_task "#{@prefix}:clean" do dir = File.join(@directory, 'fubu-content') cleanDirectory dir end cleanTask.add_description "Cleans out any exploded bottle content at fubu-content" end |
Instance Method Details
#to_install_args(options) ⇒ Object
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
# File 'lib/fuburake.rb', line 296 def to_install_args() args = "install"; if ([:name] != nil) args += " -servicename:#{[:name]}" end if ([:instance] != nil) args += " -i:#{[:instance]}" end if ([:user] != nil) args += " -u:#{[:user]}" end if ([:password] != nil) args += " -p:#{[:password]}" end if ([:sudo] == true) args += " --sudo" end if ([:autostart] == true) args += " --autostart" end if ([:manual] == true) args += " --manual" end if ([:disabled] == true) args += " --disabled" end if ([:delayed] == true) args += " --delayed" end if ([:local_service] == true) args += " --localservice" end if ([:network_service] == true) args += " --networkservice" end if ([:interactive] == true) args += " --interactive" end if ([:description] != nil) args += ' -d:"' + [:description] + "'" end return args end |
#to_start_stop_args(verb, options) ⇒ Object
282 283 284 285 286 287 288 289 290 291 292 293 294 |
# File 'lib/fuburake.rb', line 282 def to_start_stop_args(verb, ) args = "#{verb}" if ([:name] != nil) args += " -servicename:#{[:name]}" end if ([:instance] != nil) args += " -i:#{[:instance]}" end return args end |
#to_task(name, args, description) ⇒ Object
354 355 356 357 358 359 360 361 |
# File 'lib/fuburake.rb', line 354 def to_task(name, args, description) task = Rake::Task.define_task "#{@prefix}:#{name}" do sh "#{@command} #{args}" end task.add_description description return task end |