Permalink
Browse files

style: spacing around commas

  • Loading branch information...
1 parent aa813ac commit fe51ec2a616a19aa549c04fd78fd0320a9520ddd @miketheman committed Dec 15, 2012
View
@@ -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}"
@@ -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
@@ -32,7 +32,7 @@ def define()
def load_veewee_config()
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"
@@ -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,13 +49,13 @@ def ui
@_ui
end
- def initialize(name,path,env)
+ def initialize(name, path, 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
end
@@ -111,26 +110,26 @@ 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
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)
@@ -142,25 +141,25 @@ def self.load(name,env)
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
@@ -15,7 +15,7 @@ def initialize(env)
def [](name)
begin
- definition=Veewee::Definition.load(name,env)
+ definition = Veewee::Definition.load(name, env)
return definition
rescue Veewee::DefinitionNotExist
return nil
@@ -33,7 +33,7 @@ def each(&block)
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
@@ -53,9 +53,7 @@ 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)
@@ -83,17 +81,17 @@ def define(definition_name,template_name,options = {})
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,11 +107,11 @@ 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
@@ -124,26 +122,26 @@ def define(definition_name,template_name,options = {})
# 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
@@ -61,15 +61,15 @@ def initialize(options={})
: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
@@ -99,7 +99,7 @@ def initialize(options={})
@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)
@@ -13,7 +13,7 @@ def [](name)
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
@@ -3,9 +3,9 @@ class Template
attr_accessor :env
- attr_reader :name,:path
+ attr_reader :name, :path
- def initialize(name,path,env)
+ def initialize(name, path, env)
@name=name
@path=path
@env=env
@@ -11,7 +11,7 @@ def initialize(env)
def [](name)
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
return result
View
@@ -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 }

0 comments on commit fe51ec2

Please sign in to comment.