Style2 #450

Merged
merged 4 commits into from Dec 15, 2012
View
2 bin/veewee
@@ -20,7 +20,7 @@ begin
env.load!
# Start the CLI
- ::Veewee::CLI.start(ARGV,:env => env)
+ ::Veewee::CLI.start(ARGV, :env => env)
rescue Veewee::Error => e
env.ui.error "#{e}"
View
1 lib/vagrant_init.rb
@@ -5,5 +5,4 @@
require 'rubygems'
require 'veewee/command/vagrant'
require 'veewee/command/kvm'
-
end
View
2 lib/veewee/cli.rb
@@ -30,7 +30,7 @@ class CLI < Thor
# command listing.
# @param [Hash] opts Other options (not gone into detail here, look at
# the source instead).
- def self.register(klass, name, usage, description, opts=nil)
+ def self.register(klass, name, usage, description, opts = nil)
opts ||= {}
if klass <= Command::GroupBase
View
4 lib/veewee/command.rb
@@ -1,8 +1,8 @@
module Veewee
module Command
- autoload :Base, 'veewee/command/base'
+ autoload :Base, 'veewee/command/base'
autoload :GroupBase, 'veewee/command/group_base'
- autoload :Helpers, 'veewee/command/helpers'
+ autoload :Helpers, 'veewee/command/helpers'
autoload :NamedBase, 'veewee/command/named_base'
end
end
View
18 lib/veewee/config.rb
@@ -10,18 +10,18 @@ class Config
attr_reader :env
def initialize(options)
- @env=options[:env]
+ @env = options[:env]
# Initialize with defaults
- @veewee=::Veewee::Config::Veewee.new(self)
+ @veewee = ::Veewee::Config::Veewee.new(self)
end
def define()
- config=OpenStruct.new
+ config = OpenStruct.new
# Expose the veewee config
- config.veewee=@veewee
+ config.veewee = @veewee
# Process config file
yield config
@@ -30,12 +30,12 @@ def define()
# We put a long name to not clash with any function in the Veewee file itself
def load_veewee_config()
- veewee_configurator=self
+ veewee_configurator = self
begin
- filename=File.join(Dir.pwd,"Veeweefile")
+ filename = File.join(Dir.pwd, "Veeweefile")
if File.exists?(filename)
- veeweefile=File.read(filename)
- veeweefile["Veewee::Config.run"]="veewee_configurator.define"
+ veeweefile = File.read(filename)
+ veeweefile["Veewee::Config.run"] = "veewee_configurator.define"
# http://www.dan-manges.com/blog/ruby-dsls-instance-eval-with-delegation
instance_eval(veeweefile)
else
@@ -57,7 +57,5 @@ def load_veewee_config()
return self
end
-
-
end #End Class
end #End Module
View
80 lib/veewee/definition.rb
@@ -10,18 +10,18 @@ class Definition
attr_accessor :env
attr_accessor :path
- attr_accessor :cpu_count,:memory_size,:video_memory_size,:iso_file
+ attr_accessor :cpu_count, :memory_size, :video_memory_size, :iso_file
attr_accessor :disk_size, :disk_format, :disk_variant
attr_accessor :os_type_id
- attr_accessor :boot_wait,:boot_cmd_sequence
+ attr_accessor :boot_wait, :boot_cmd_sequence
- attr_accessor :kickstart_port,:kickstart_ip,:kickstart_timeout, :kickstart_file
+ attr_accessor :kickstart_port, :kickstart_ip, :kickstart_timeout, :kickstart_file
- attr_accessor :ssh_login_timeout, :ssh_user , :ssh_password, :ssh_key, :ssh_host_port, :ssh_guest_port
+ attr_accessor :ssh_login_timeout, :ssh_user, :ssh_password, :ssh_key, :ssh_host_port, :ssh_guest_port
- attr_accessor :winrm_login_timeout, :winrm_user , :winrm_password, :winrm_host_port, :winrm_guest_port
+ attr_accessor :winrm_login_timeout, :winrm_user, :winrm_password, :winrm_host_port, :winrm_guest_port
attr_accessor :sudo_cmd
attr_accessor :shutdown_cmd
@@ -32,10 +32,9 @@ class Definition
attr_accessor :floppy_files
+ attr_accessor :use_hw_virt_ext, :use_pae, :hostiocache, :use_sata
- attr_accessor :use_hw_virt_ext,:use_pae,:hostiocache, :use_sata
-
- attr_accessor :iso_dowload_timeout, :iso_src,:iso_md5 ,:iso_download_instructions
+ attr_accessor :iso_dowload_timeout, :iso_src, :iso_md5, :iso_download_instructions
attr_accessor :virtualbox
attr_accessor :vmfusion
@@ -50,22 +49,22 @@ def ui
@_ui
end
- def initialize(name,path,env)
+ def initialize(name, path, env)
- @name=name
- @env=env
+ @name = name
+ @env = env
- if path.nil?
- @path=File.join(env.definition_dir,name)
+ if path.nil?
+ @path = File.join(env.definition_dir, name)
else
- @path=path
+ @path = path
end
# Default is 1 CPU + 256 Mem of memory + 8 Mem of video memory
- @cpu_count='1' ; @memory_size='256'; @video_memory_size='8'
+ @cpu_count = '1' ; @memory_size = '256'; @video_memory_size = '8'
# Default there is no ISO file mounted
- @iso_file = nil, @iso_src = nil ; @iso_md5 = nil ; @iso_download_timeout=1000 ; @iso_download_instructions = nil
+ @iso_file = nil, @iso_src = nil ; @iso_md5 = nil ; @iso_download_timeout = 1000 ; @iso_download_instructions = nil
# Shares to add
@add_shares = []
@@ -75,28 +74,28 @@ def initialize(name,path,env)
# Default there are no post install files
@pre_postinstall_file = nil
- @postinstall_files=[]; @postinstall_timeout = 10000;
+ @postinstall_files = [] ; @postinstall_timeout = 10000 ;
- @iso_file=""
- @disk_size = '10240'; @disk_format = 'VDI'; @disk_variant = 'Standard'
+ @iso_file = ""
+ @disk_size = '10240' ; @disk_format = 'VDI' ; @disk_variant = 'Standard'
@use_sata = true
# :hostiocache => 'off' ,
# :os_type_id => 'Ubuntu',
# :boot_wait => "10", :boot_cmd_sequence => [ "boot"],
# :kickstart_port => "7122", :kickstart_ip => "127.0.0.1", :kickstart_timeout => 10000,#
# :ssh_login_timeout => "10000", :ssh_user => "vagrant", :ssh_password => "vagrant",:ssh_key => "",
- @ssh_host_port = "2222"; @ssh_guest_port = "22"
+ @ssh_host_port = "2222" ; @ssh_guest_port = "22"
# :ssh_host_port => "2222", :ssh_guest_port => "22", :sudo_cmd => "echo '%p'|sudo -S sh '%f'",
# :shutdown_cmd => "shutdown -h now",
# :kickstart_file => nil,
- @winrm_host_port = "5985"; @winrm_guest_port = "5985"
+ @winrm_host_port = "5985" ; @winrm_guest_port = "5985"
@winrm_login_timeout = "10000"
@boot_cmd_sequence = [] # Empty list by default
- @virtualbox={:vm_options => {}}
- @vmfusion={:vm_options => {}}
- @kvm={:vm_options => {}}
+ @virtualbox = { :vm_options => {} }
+ @vmfusion = { :vm_options => {} }
+ @kvm = { :vm_options => {} }
end
@@ -111,56 +110,56 @@ def declare(options)
end
# Class method to loading a definition
- def self.load(name,env)
+ def self.load(name, env)
# Construct the path to the definition
- path=File.join(env.definition_dir,name)
- definition=Veewee::Definition.new(name,path,env)
+ path = File.join(env.definition_dir, name)
+ definition = Veewee::Definition.new(name, path, env)
env.logger.info "Loading definition directory #{definition.path}"
unless definition.exists?
- raise Veewee::DefinitionNotExist,"Error: Definition #{name} does not seem to exist"
+ raise Veewee::DefinitionNotExist, "Error: Definition #{name} does not seem to exist"
end
# We create this longer name to avoid clashes
- veewee_definition=definition
+ veewee_definition = definition
if definition.exists?
- definition_file=File.join(definition.path,"definition.rb")
- content=File.read(definition_file)
+ definition_file = File.join(definition.path, "definition.rb")
+ content = File.read(definition_file)
- content.gsub!("Veewee::Session.declare","veewee_definition.declare")
- content.gsub!("Veewee::Definition.declare","veewee_definition.declare")
+ content.gsub!("Veewee::Session.declare", "veewee_definition.declare")
+ content.gsub!("Veewee::Definition.declare", "veewee_definition.declare")
env.logger.info(content)
begin
- cwd=FileUtils.pwd
+ cwd = FileUtils.pwd
env.logger.info("Entering path #{definition.path}")
FileUtils.cd(definition.path)
self.instance_eval(content)
- env.logger.info("Returning to path #{cwd}")
+ env.logger.info("Returning to path #{cwd}")
FileUtils.cd(cwd)
rescue NameError => ex
- raise Veewee::DefinitionError,"NameError reading definition from file #{definition_file} #{ex}"
+ raise Veewee::DefinitionError, "NameError reading definition from file #{definition_file} #{ex}"
rescue Exception => ex
- raise Veewee::DefinitionError,"Error in the definition from file #{definition_file}\n#{ex}"
+ raise Veewee::DefinitionError, "Error in the definition from file #{definition_file}\n#{ex}"
end
else
env.logger.fatal("#{definition_file} not found")
- raise Veewee::DefinitionNotExist,"#{definition_file} not found"
+ raise Veewee::DefinitionNotExist, "#{definition_file} not found"
end
if definition.valid?
return definition
else
env.logger.fatal("Invalid Definition")
- raise Veewee::DefinitionError,"Invalid Definition"
+ raise Veewee::DefinitionError, "Invalid Definition"
end
end
def exists?
- filename=File.join(path,"definition.rb")
+ filename = File.join(path, "definition.rb")
unless File.exists?(filename)
return false
end
@@ -190,6 +189,7 @@ def valid?
end
private
+
def ostype_valid?
unless env.ostypes.has_key?(@os_type_id)
env.ui.info("The ostype: #{@os_type_id} is not available")
View
57 lib/veewee/definitions.rb
@@ -9,13 +9,13 @@ class Definitions
attr_accessor :env
def initialize(env)
- @env=env
+ @env = env
return self
end
def [](name)
begin
- definition=Veewee::Definition.load(name,env)
+ definition = Veewee::Definition.load(name, env)
return definition
rescue Veewee::DefinitionNotExist
return nil
@@ -24,22 +24,22 @@ def [](name)
# Fetch all definitions
def each(&block)
- definitions=Hash.new
+ definitions = Hash.new
env.logger.debug("[Definition] Searching #{env.definition_dir} for definitions:")
- subdirs=Dir.glob("#{env.definition_dir}/*")
+ subdirs = Dir.glob("#{env.definition_dir}/*")
subdirs.each do |sub|
- name=File.basename(sub)
+ name = File.basename(sub)
env.logger.debug("[Definition] possible definition '#{name}' found")
begin
- definitions[name]=Veewee::Definition.load(name,env)
+ definitions[name] = Veewee::Definition.load(name, env)
rescue Veewee::DefinitionError => ex
env.logger.debug("[Definition] failed to load definition from directory '#{name}' #{ex}")
end
end
- if definitions.length==0
+ if definitions.length == 0
env.logger.debug("[Definition] no definitions found")
end
@@ -53,23 +53,21 @@ def each(&block)
# Options are : :force => true to overwrite an existing definition
#
# Returns definition object
-
-
- def define(definition_name,template_name,options = {})
+ def define(definition_name, template_name, options = {})
# Default is not to overwrite
- options = {'force' => false}.merge(options)
+ options = { 'force' => false }.merge(options)
env.logger.debug("Forceflag : #{options['force']}")
- git_template=false
+ git_template = false
# Check if the template is a git repo
if template_name.start_with?("git://")
- git_template=true
+ git_template = true
end
# Check if template exists
- template=env.templates[template_name]
+ template = env.templates[template_name]
if template.nil? and ! git_template
env.logger.fatal("Template '#{template_name}' does not exist")
raise Veewee::TemplateError, "Template '#{template_name}' does not exist"
@@ -80,20 +78,20 @@ def define(definition_name,template_name,options = {})
create_definition_dir_if_needed
# Check if definition does not exist
- definition=env.definitions[definition_name]
+ definition = env.definitions[definition_name]
unless definition.nil?
env.logger.debug("Definition '#{definition_name}' exists")
- if options['force']==true
- self.undefine(definition_name,options)
+ if options['force'] == true
+ self.undefine(definition_name, options)
else
- raise Veewee::DefinitionError,"Definition #{definition_name} already exists and no force option was given"
+ raise Veewee::DefinitionError, "Definition #{definition_name} already exists and no force option was given"
end
end
env.logger.info("Creating definition #{definition_name} in directory '#{env.definition_dir}' ")
- dst_dir="#{File.join(env.definition_dir,definition_name)}"
+ dst_dir = "#{File.join(env.definition_dir, definition_name)}"
FileUtils.mkdir(dst_dir)
- env.logger.debug("Definition Directory '#{File.join(env.definition_dir,definition_name)}' succesfuly created")
+ env.logger.debug("Definition Directory '#{File.join(env.definition_dir, definition_name)}' succesfuly created")
# Start copying/cloning the directory of the template to the definition directory
if (git_template)
@@ -109,41 +107,41 @@ def define(definition_name,template_name,options = {})
else
begin
env.logger.debug("Starting copy '#{template.path}' to '#{dst_dir}'")
- FileUtils.cp_r(template.path+"/.",dst_dir)
- env.logger.debug("Copy '#{template.path}' to '#{dst_dir}' succesfull")
+ FileUtils.cp_r(template.path + "/.", dst_dir)
+ env.logger.debug("Copy '#{template.path}' to '#{dst_dir}' succesful")
rescue Exception => ex
env.logger.fatal("Copy '#{template.path}' to #{dst_dir}' failed: #{ex}")
- raise Veewee::Error , "Copy '#{template.path}' to #{dst_dir}' failed: #{ex}"
+ raise Veewee::Error, "Copy '#{template.path}' to #{dst_dir}' failed: #{ex}"
end
end
- definition=env.definitions[definition_name]
+ definition = env.definitions[definition_name]
return definition
end
# This function undefines/removes the definition by removing the directoy with definition_name
# under env.definition_dir
- def undefine(definition_name,options = {})
- definition=env.definitions[definition_name]
+ def undefine(definition_name, options = {})
+ definition = env.definitions[definition_name]
unless definition.nil?
#TODO: Needs to be more defensive!!
env.logger.debug("[Undefine] About to remove '#{definition.path} for '#{definition_name}'")
begin
- if File.exists?(File.join(definition.path,"definition.rb"))
+ if File.exists?(File.join(definition.path, "definition.rb"))
FileUtils.rm_rf(definition.path)
else
env.logger.fatal("Aborting delete: The directory definition.path does not contain a definition.rb file")
- raise Veewee::DefinitionError,"Aborting delete: The directory definition.path does not contain a definition.rb file"
+ raise Veewee::DefinitionError, "Aborting delete: The directory definition.path does not contain a definition.rb file"
end
rescue Exception => ex
env.logger.fatal("Removing '#{definition.path} for '#{definition_name}' failed: #{ex}")
raise Veewee::Error, "Removing '#{definition.path }for '#{definition_name}' failed: #{ex}"
end
env.logger.debug("Removing '#{definition.path} for '#{definition_name}' succesful")
else
- raise Veewee::DefinitionError,"Definition '#{definition_name}' does not exist"
+ raise Veewee::DefinitionError, "Definition '#{definition_name}' does not exist"
end
end
@@ -170,6 +168,5 @@ def create_definition_dir_if_needed
end
end
-
end
end
View
32 lib/veewee/environment.rb
@@ -51,25 +51,25 @@ class Environment
# Hash elelement of all OStypes
attr_reader :ostypes
- def initialize(options={})
+ def initialize(options = {})
cwd = ENV['VEEWEE_DIR'] || Dir.pwd
# If a cwd was provided as option it overrules the default
cwd = options[:cwd] if options.has_key?(:cwd)
- defaults={
+ defaults = {
:cwd => cwd,
:veewee_filename => "Veeweefile",
:loglevel => :info,
- :definition_dir => File.join(cwd,"definitions"),
- :template_path => [File.expand_path(File.join(File.dirname(__FILE__),"..","..",'templates')),"templates"],
- :iso_dir => File.join(cwd,"iso"),
- :validation_dir => File.join(File.expand_path(File.join(File.dirname(__FILE__),"..","..")),"validation"),
- :tmp_dir => File.join(cwd,"tmp")
+ :definition_dir => File.join(cwd, "definitions"),
+ :template_path => [File.expand_path(File.join(File.dirname(__FILE__), "..", "..", 'templates')), "templates"],
+ :iso_dir => File.join(cwd, "iso"),
+ :validation_dir => File.join(File.expand_path(File.join(File.dirname(__FILE__), "..", "..")), "validation"),
+ :tmp_dir => File.join(cwd, "tmp")
}
options = defaults.merge(options)
- veeweefile_config = defaults.keys.inject({}) do |memo,obj|
+ veeweefile_config = defaults.keys.inject({}) do |memo, obj|
if config.env.methods.include?(obj) && !config.env.send(obj).nil?
memo.merge({ obj => config.env.send(obj) })
else
@@ -81,7 +81,7 @@ def initialize(options={})
# We need to set this variable before the first call to the logger object
if options.has_key?("debug")
if options["debug"] == true
- ENV['VEEWEE_LOG']="STDOUT"
+ ENV['VEEWEE_LOG'] = "STDOUT"
end
end
@@ -94,14 +94,14 @@ def initialize(options={})
end
# Definitions
- @definitions=Veewee::Definitions.new(self)
- @templates=Veewee::Templates.new(self)
- @providers=Veewee::Providers.new(self,options)
+ @definitions = Veewee::Definitions.new(self)
+ @templates = Veewee::Templates.new(self)
+ @providers = Veewee::Providers.new(self, options)
# Read ostypes
- yamlfile=File.join(File.dirname(__FILE__),"config","ostypes.yml")
+ yamlfile = File.join(File.dirname(__FILE__), "config", "ostypes.yml")
logger.info "Reading ostype yamlfile #{yamlfile}"
- @ostypes=YAML.load_file(yamlfile)
+ @ostypes = YAML.load_file(yamlfile)
return self
end
@@ -125,7 +125,7 @@ def config
#
# @return [UI]
def ui
- @ui ||= UI.new(self)
+ @ui ||= UI.new(self)
end
#---------------------------------------------------------------
@@ -155,7 +155,7 @@ def load!
end
def load_config!
- @config=Config.new({:env => self}).load_veewee_config()
+ @config = Config.new({ :env => self }).load_veewee_config()
return self
end
View
33 lib/veewee/error.rb
@@ -1,25 +1,28 @@
module Veewee
- class Error < StandardError
- attr_reader :orginal
- def initialize(msg, original=$!)
- super(msg)
- @original = original; end
- end
+ class Error < StandardError
+ attr_reader :orginal
- class DefinitionError < Error
+ def initialize(msg, original = $!)
+ super(msg)
+ @original = original
end
- class DefinitionNotExist < DefinitionError
- end
+ end
- class TemplateError < Error
- end
+ class DefinitionError < Error
+ end
- class SshError < Error
- end
+ class DefinitionNotExist < DefinitionError
+ end
- class WinrmError < Error
- end
+ class TemplateError < Error
+ end
+
+ class SshError < Error
+ end
+
+ class WinrmError < Error
+ end
end
#Usage (from the exceptional ruby book)
View
29 lib/veewee/providers.rb
@@ -1,26 +1,27 @@
module Veewee
class Providers
def initialize(env, options = {})
- @env=env
- @options=options
- @providers=Hash.new
+ @env = env
+ @options = options
+ @providers = Hash.new
end
def [](name)
- return @providers[name] if @providers.has_key?(name)
+ return @providers[name] if @providers.has_key?(name)
- begin
- require_path='veewee/provider/'+name.to_s.downcase+"/provider"
- require require_path
+ begin
+ require_path = 'veewee/provider/' + name.to_s.downcase + "/provider"
+ require require_path
- provider=Object.const_get("Veewee").const_get("Provider").const_get(name.to_s.capitalize).const_get("Provider").new(name,@options,@env)
+ provider = Object.const_get("Veewee").const_get("Provider").const_get(name.to_s.capitalize).const_get("Provider").new(name, @options, @env)
+
+ @providers[name] = provider
+ rescue ::Veewee::Error => e
+ raise
+ rescue Error => e
+ env.ui.error "Error loading provider with #{name}, #{$!}", :prefix => false
+ end
- @providers[name]=provider
- rescue ::Veewee::Error => e
- raise
- rescue Error => e
- env.ui.error "Error loading provider with #{name},#{$!}",:prefix => false
- end
end
def length
View
18 lib/veewee/template.rb
@@ -3,20 +3,20 @@ class Template
attr_accessor :env
- attr_reader :name,:path
+ attr_reader :name, :path
- def initialize(name,path,env)
- @name=name
- @path=path
- @env=env
+ def initialize(name, path, env)
+ @name = name
+ @path = path
+ @env = env
return self
end
def exists?
- filename=Dir.glob("#{path}/definition.rb")
- if filename.length!=0
- env.logger.debug("[Template] template '#{name}' is valid")
- return true
+ filename = Dir.glob("#{path}/definition.rb")
+ if filename.length != 0
+ env.logger.debug("[Template] template '#{name}' is valid")
+ return true
else
return false
end
View
29 lib/veewee/templates.rb
@@ -4,16 +4,16 @@ class Templates
attr_accessor :env
def initialize(env)
- @env=env
+ @env = env
return self
end
def [](name)
- result=nil
+ result = nil
valid_paths(env.template_path).each do |template_dir|
- template=Veewee::Template.new(name,File.join(template_dir,name),@env)
+ template = Veewee::Template.new(name, File.join(template_dir, name), @env)
if template.exists?
- result=template
+ result = template
return result
end
end
@@ -22,37 +22,38 @@ def [](name)
# Fetch all Templates
def each(&block)
- templates=Hash.new
+ templates = Hash.new
valid_paths(env.template_path).each do |template_dir|
env.logger.debug("[Template] Searching #{template_dir} for templates")
- subdirs=Dir.glob("#{template_dir}/*")
+ subdirs = Dir.glob("#{template_dir}/*")
subdirs.each do |sub|
if File.directory?("#{sub}")
- name=sub.sub(/#{template_dir}\//,'')
- template=Veewee::Template.new(name,sub,@env)
+ name = sub.sub(/#{template_dir}\//, '')
+ template = Veewee::Template.new(name, sub, @env)
if template.exists?
- env.logger.debug("[Template] template '#{name}' found")
- templates[name]=template
+ env.logger.debug("[Template] template '#{name}' found")
+ templates[name] = template
end
end
end
end
- if templates.length==0
- env.logger.debug("[Template] no templates found")
+ if templates.length == 0
+ env.logger.debug("[Template] no templates found")
end
Hash[templates.sort].each(&block)
end
private
+
# Traverses path to see which exist or not
# and checks if available
def valid_paths(paths)
- valid_paths=paths.collect { |path|
+ valid_paths = paths.collect { |path|
if File.exists?(path) && File.directory?(path)
env.logger.info "Path #{path} exists"
File.expand_path(path)
@@ -64,7 +65,5 @@ def valid_paths(paths)
return valid_paths.compact
end
-
-
end
end
View
14 lib/veewee/ui.rb
@@ -13,7 +13,7 @@ def initialize(env)
[:warn, :error, :info, :success].each do |method|
define_method(method) do |message, *argv|
- opts , *argv = argv
+ opts, *argv = argv
opts ||= {}
# Log normal console messages
env.logger.info("ui") { message }
@@ -36,7 +36,7 @@ def initialize(env, shell)
[[:warn, :yellow], [:error, :red], [:info, nil], [:success, :green]].each do |method, color|
class_eval <<-CODE
- def #{method}(message, opts=nil)
+ def #{method}(message, opts = nil)
super(message)
opts ||= {}
opts[:new_line] = true if !opts.has_key?(:new_line)
@@ -47,15 +47,15 @@ def #{method}(message, opts=nil)
[:ask, :no?, :yes?].each do |method|
class_eval <<-CODE
- def #{method}(message, opts=nil)
+ def #{method}(message, opts = nil)
super(message)
opts ||= {}
@shell.send(#{method.inspect}, format_message(message, opts), opts[:color])
end
CODE
end
- def report_progress(progress, total, show_parts=true)
+ def report_progress(progress, total, show_parts = true)
percent = (progress.to_f / total.to_f) * 100
line = "Progress: #{percent.to_i}%"
line << " (#{progress} / #{total})" if show_parts
@@ -69,10 +69,10 @@ def clear_line
protected
- def format_message(message, opts=nil)
+ def format_message(message, opts = nil)
opts = { :prefix => true }.merge(opts || {})
- opts[:prefix]=false if env.resource=="veewee"
- opts[:prefix]=false if env.resource=="vagrant"
+ opts[:prefix] = false if env.resource == "veewee"
+ opts[:prefix] = false if env.resource == "vagrant"
message = "[#{env.resource}] #{message}" if opts[:prefix]
message
end