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.
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/fuburake.rb', line 269 def initialize() @directory = [:dir] @prefix = .fetch(:prefix, 'service') @command = File.join(@directory, 'BottleServiceRunner') consoleTask = Rake::Task.define_task "#{@prefix}:console" do sh "start #{@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
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 353 354 355 356 357 |
# File 'lib/fuburake.rb', line 305 def to_install_args() args = "install"; if ([:name] != nil) args += " -servicename:#{options[:name]}" end if ([:instance] != nil) args += " -i:#{options[:instance]}" end if ([:user] != nil) args += " -u:#{options[:user]}" end if ([:password] != nil) args += " -p:#{options[:password]}" 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
291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/fuburake.rb', line 291 def to_start_stop_args(verb, ) args = "#{verb}" if ([:name] != nil) args += " -servicename:#{options[:name]}" end if ([:instance] != nil) args += " -i:#{options[:instance]}" end return args end |
#to_task(name, args, description) ⇒ Object
359 360 361 362 363 364 365 366 |
# File 'lib/fuburake.rb', line 359 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 |