Module: Update

Extended by:
RedGreen
Defined in:
lib/update/update.rb,
lib/update/options.rb,
lib/update/version.rb,
lib/update/commands.rb

Constant Summary collapse

VERSION =
"0.9.9"
COMMAND_GROUPS =
[
  {
    "brew update"          => "Checking for updated Brew packages...",
    "brew upgrade"         => "Installing updated Brew packages...",
    "brew cleanup --force" => "Cleaning up outdated packages..."
  },

 {
   "rvm get head --auto"  => "Getting the latest RVM..."
 },
  
  { 
    "gem update --system"  => "Getting the latest RubyGems...",
    "gem update"           => "Updating gems...",
    "gem cleanup --dryrun" => "Showing gem cleanup dry-run..."
  }
]

Class Method Summary collapse

Class Method Details

.parse_optionsObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/update/options.rb', line 2

def self.parse_options
  options = Slop.parse(help: true, 
                       banner: "Usage: update [options]") do
    on :v, :version, "Print version information" do
      puts "Version #{Update::VERSION} on Ruby #{RUBY_VERSION}."
      puts "<[email protected]>"
      exit
    end
    
    on :l, :list, "Print list of commands" do
      ap Update::COMMAND_GROUPS
      exit
    end

    on :e, :edit, "Edit list of commands" do
      puts "Edit the list of commands and descriptions. Usage:"
      puts
      puts "cd #{File.expand_path('../../update',__FILE__)}"
      puts
      puts "Then open 'commands.rb' with a text editor... and add your command and description to the list."
      puts "TODO: Better (read 'sane') way of doing this..."
      exit
    end
  end
end

.runObject



5
6
7
8
9
10
11
# File 'lib/update/update.rb', line 5

def run
  EM.synchrony do
    asynchronously_iterate_over_command_groups
  end
  
  report_final_status
end