Permalink
Browse files

Autoload is nice. Let's use it

  • Loading branch information...
1 parent 64b29e6 commit 97936d54ebb7a829a7fd53e88dc87529f751fc25 Dominique Rose-Rosette committed Sep 5, 2012
Showing with 6 additions and 6 deletions.
  1. +1 −0 bin/desi
  2. +5 −1 lib/desi.rb
  3. +0 −5 lib/desi/runner.rb
View
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
# vim: se ft=ruby :
+require 'desi'
require 'desi/runner'
Desi::Runner.start
View
@@ -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
+
View
@@ -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}"
@@ -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
@@ -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

0 comments on commit 97936d5

Please sign in to comment.