Skip to content

Commit

Permalink
Autoload is nice. Let's use it
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominique Rose-Rosette committed Sep 5, 2012
1 parent 64b29e6 commit 97936d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions bin/desi
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# vim: se ft=ruby :

require 'desi'
require 'desi/runner'

Desi::Runner.start
6 changes: 5 additions & 1 deletion lib/desi.rb
@@ -1,5 +1,9 @@
require "desi/version"

module Desi
# Your code goes here...
autoload :Downloader, 'desi/downloader'
autoload :HttpClient, 'desi/http_client'
autoload :LocalInstall, 'desi/local_install'
autoload :Registry, 'desi/registry'
end

5 changes: 0 additions & 5 deletions lib/desi/runner.rb
@@ -1,14 +1,12 @@
# encoding: utf-8

require 'boson/runner'
require "pp"

module Desi
class Runner < Boson::Runner

desc "List locally installed Elastic Search versions"
def list
require 'desi/local_install'
puts "Local ES installs:"
Desi::LocalInstall.new.versions.each do |v|
puts "* #{v}"
Expand All @@ -17,7 +15,6 @@ def list

desc "List all available ElasticSearch versions"
def list_all
require 'desi/registry'
Desi::Registry.new.releases.each do |v|
puts " * #{v.name} -- #{v.description} (#{v.release_date})"
end
Expand All @@ -27,8 +24,6 @@ def list_all
desc "Install ES (to latest stable version by default)"
def install
puts " * fetching latest version"
require 'desi/registry'
require 'desi/downloader'
release = Desi::Registry.new.latest_release
Desi::Downloader.new.download!(release)
end
Expand Down

0 comments on commit 97936d5

Please sign in to comment.