Class: Cejo::Distro::Main
- Inherits:
-
Object
- Object
- Cejo::Distro::Main
- Defined in:
- lib/cejo/distro/main.rb
Overview
Main
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#arguments ⇒ Object
Returns the value of attribute arguments.
-
#folder ⇒ Object
readonly
Returns the value of attribute folder.
-
#utils ⇒ Object
readonly
Returns the value of attribute utils.
Instance Method Summary collapse
- #commands ⇒ Object
- #final_command ⇒ Object
-
#initialize(folder, utils) ⇒ Main
constructor
A new instance of Main.
- #need ⇒ Object
- #packager ⇒ Object
- #real_action ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(folder, utils) ⇒ Main
11 12 13 14 15 |
# File 'lib/cejo/distro/main.rb', line 11 def initialize(folder, utils) @folder = folder @utils = utils @action = action end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
9 10 11 |
# File 'lib/cejo/distro/main.rb', line 9 def action @action end |
#arguments ⇒ Object
Returns the value of attribute arguments.
9 10 11 |
# File 'lib/cejo/distro/main.rb', line 9 def arguments @arguments end |
#folder ⇒ Object (readonly)
Returns the value of attribute folder.
8 9 10 |
# File 'lib/cejo/distro/main.rb', line 8 def folder @folder end |
#utils ⇒ Object (readonly)
Returns the value of attribute utils.
8 9 10 |
# File 'lib/cejo/distro/main.rb', line 8 def utils @utils end |
Instance Method Details
#commands ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/cejo/distro/main.rb', line 17 def commands parsed_commands = ParsedCommands.new(utils, folder).found commands = Commands.new parsed_commands exit unless commands.any? commands.all end |
#final_command ⇒ Object
39 40 41 42 43 44 |
# File 'lib/cejo/distro/main.rb', line 39 def final_command result = packager, real_action result.append arguments result.prepend 'sudo' if need.admin? result.join ' ' end |
#need ⇒ Object
35 36 37 |
# File 'lib/cejo/distro/main.rb', line 35 def need Need.new action end |
#packager ⇒ Object
25 26 27 28 |
# File 'lib/cejo/distro/main.rb', line 25 def packager current_packager = CurrentPackager.new utils current_packager.packager commands.keys end |
#real_action ⇒ Object
30 31 32 33 |
# File 'lib/cejo/distro/main.rb', line 30 def real_action result = TranslateAction.new result.real_action commands, packager, action end |
#run ⇒ Object
46 47 48 |
# File 'lib/cejo/distro/main.rb', line 46 def run system final_command end |