Class: ActiveScripts::Packages::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/active_scripts/packages/base.rb

Constant Summary collapse

COMMANDS =

INFO: ActiveScripts::Packages::Base contains code that is

shared between all package files.
[:install, :upgrade, :uninstall]
OPTIONS =
[:dry_run, :verbose]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command, options = {}) ⇒ Base

Returns a new instance of Base.



13
14
15
16
# File 'lib/active_scripts/packages/base.rb', line 13

def initialize(command, options={})
  @command = command
  @options = options
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



11
12
13
# File 'lib/active_scripts/packages/base.rb', line 11

def command
  @command
end

#optionsObject

Returns the value of attribute options.



11
12
13
# File 'lib/active_scripts/packages/base.rb', line 11

def options
  @options
end

Class Method Details

.execute(command, options = {}) ⇒ Object



18
19
20
# File 'lib/active_scripts/packages/base.rb', line 18

def self.execute(command, options={})
  new(command, options).execute
end

Instance Method Details

#executeObject



22
23
24
25
26
27
# File 'lib/active_scripts/packages/base.rb', line 22

def execute
  assert_valid_command!
  assert_valid_options!
  assert_valid_user!
  send(@command)
end