Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BGBUILD-147: Allow to list installed plugins and version information
  • Loading branch information
goldmann committed Feb 3, 2011
1 parent 03d0986 commit 0499e27
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -9,6 +9,7 @@ v0.8.0
* [BGBUILD-79] Allow to use BoxGrinder Build as a library
* [BGBUILD-127] Use appliance definition object instead of a file when using BG as a library
* [BGBUILD-72] Add support for growing (not pre-allocated) disks for KVM/Xen
* [BGBUILD-147] Allow to list installed plugins and version information

v0.7.1

Expand Down
54 changes: 51 additions & 3 deletions bin/boxgrinder
Expand Up @@ -31,7 +31,7 @@ end

module BoxGrinder
class App < ThorHelper
desc "build [appliance definition file] [options]", "Create an image from selected appliance definition for selected platform and deliver it using selected method."
desc "build [appliance definition file] [options]", "Create an image from selected appliance definition for selected platform and deliver it using selected method"
method_option :platform, :type => :string, :default => :none, :aliases => '-p', :desc => "The name of platform you want to convert to."
method_option :delivery, :type => :string, :default => :none, :aliases => '-d', :desc => "The delivery method for selected appliance."
method_option :os_config, :type => :hash, :default => {}, :desc => "Operating system plugin options."
Expand All @@ -45,7 +45,7 @@ module BoxGrinder
def build(appliance_definition_file)
log_level = :debug if options.debug?
log_level = :trace if options.trace?

config = Config.new(options.merge(:platform => options.platform.to_sym, :delivery => options.delivery.to_sym))
config.merge!(:log_level => log_level) unless log_level.nil?

Expand All @@ -57,11 +57,59 @@ module BoxGrinder
end

begin
Appliance.new(appliance_definition_file, config, :log => log ).create
Appliance.new(appliance_definition_file, config, :log => log).create
rescue Exception => e
log.fatal e
end
end

desc 'info', "Prints out the program details"
method_option :plugins, :type => :boolean, :default => false, :aliases => '-p', :desc => "List also available plugins. Default: false."

def info
PluginHelper.new(Config.new).load_plugins if options.plugins

shell.say
shell.say "BoxGrinder Build #{File.read("#{File.dirname(__FILE__)}/../CHANGELOG").match(/^v(.*)/)[1]}"

if options.plugins

shell.say
shell.say "Plugin summary:"

[:os, :platform, :delivery].each do |type|
shell.say

if PluginManager.instance.plugins[type].empty?
shell.say "No #{type} plugins available"
else
shell.say "Available #{type} plugins:"
PluginManager.instance.plugins[type].each do |name, plugin_info|
shell.say " - #{name} plugin for #{plugin_info[:full_name]}."
end
end
end
end

shell.say
end

class << self
def build_help(shell)
examples = {
"$ boxgrinder build jeos.appl" => "# Build KVM image for jeos.appl",
"$ boxgrinder build jeos.appl -f" => "# Build KVM image for jeos.appl with removing previous build for this image",
"$ boxgrinder build jeos.appl --os-config format:qcow2" => "# Build KVM image for jeos.appl with a qcow2 disk",
"$ boxgrinder build jeos.appl -p vmware --platform-config type:personal thin_disk:true" => "# Build VMware image for VMware Server, Player, Fusion using thin (growing) disk",
"$ boxgrinder build jeos.appl -p ec2 -d ami" => "# Build and register AMI for jeos.appl",
"$ boxgrinder build jeos.appl -p vmware -d local" => "# Build VMware image for jeos.appl and deliver it to local directory"
}.sort { |a, b| a[0] <=> b[0] }

shell.say "Examples:"
shell.print_table(examples, :ident => 2, :truncate => true)
shell.say
end
end
end
end

Expand Down
15 changes: 3 additions & 12 deletions lib/boxgrinder-build/helpers/thor-helper.rb
Expand Up @@ -61,20 +61,11 @@ def help(shell)
def task_help(shell, task_name)
boxgrinder_header(shell)

examples = {
"$ boxgrinder build jeos.appl" => "# Build KVM image for jeos.appl",
"$ boxgrinder build jeos.appl -f" => "# Build KVM image for jeos.appl with removing previous build for this image",
"$ boxgrinder build jeos.appl --os-config format:qcow2" => "# Build KVM image for jeos.appl with a qcow2 disk",
"$ boxgrinder build jeos.appl -p vmware --platform-config type:personal thin_disk:true" => "# Build VMware image for VMware Server, Player, Fusion using thin (growing) disk",
"$ boxgrinder build jeos.appl -p ec2 -d ami" => "# Build and register AMI for jeos.appl",
"$ boxgrinder build jeos.appl -p vmware -d local" => "# Build VMware image for jeos.appl and deliver it to local directory"
}.sort { |a, b| a[0] <=> b[0] }
help_method = "#{task_name}_help".to_sym
send(help_method, shell) if respond_to?(help_method) and method(help_method).arity == 1
super(shell, task_name)

shell.say "Examples:"
shell.print_table(examples, :ident => 2, :truncate => true)
shell.say

super(shell, task_name)
end

def boxgrinder_header(shell)
Expand Down
1 change: 1 addition & 0 deletions rubygem-boxgrinder-build.spec
Expand Up @@ -98,6 +98,7 @@ popd
- [BGBUILD-72] Add support for growing (not pre-allocated) disks for KVM/Xen
- [BGBUILD-133] Support a consolidated configuration file
- [BGBUILD-138] enablerepo path is not escaped when calling repoquery
- [BGBUILD-147] Allow to list installed plugins and version information

* Mon Dec 20 2010 <mgoldman@redhat.com> - 0.7.1-1
- Upstream release: 0.7.1
Expand Down

0 comments on commit 0499e27

Please sign in to comment.