Permalink
Browse files

style: indentations fixes

  • Loading branch information...
1 parent 0905025 commit f4790c4f53052b0c4f00fe9217a84bbf4b6c9ccd @miketheman miketheman committed Dec 15, 2012
Showing with 32 additions and 28 deletions.
  1. +18 −15 lib/veewee/error.rb
  2. +11 −10 lib/veewee/providers.rb
  3. +2 −2 lib/veewee/template.rb
  4. +1 −1 lib/veewee/templates.rb
View
@@ -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
@@ -7,20 +7,21 @@ def initialize(env, options = {})
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)
- @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
@@ -13,10 +13,10 @@ def initialize(name, path, env)
end
def exists?
- 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
@@ -34,7 +34,7 @@ def each(&block)
name = sub.sub(/#{template_dir}\//, '')
template = Veewee::Template.new(name, sub, @env)
if template.exists?
- env.logger.debug("[Template] template '#{name}' found")
+ env.logger.debug("[Template] template '#{name}' found")
templates[name] = template
end
end

0 comments on commit f4790c4

Please sign in to comment.