summaryrefslogtreecommitdiffstats
path: root/lib/puppet/feature
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:12:17 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:12:17 -0700
commit3180b9d9b2c844dade1d361326600f7001ec66dd (patch)
tree98fe7c5ac7eb942aac9c39f019a17b0b3f5a57f4 /lib/puppet/feature
parent543225970225de5697734bfaf0a6eee996802c04 (diff)
downloadpuppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.gz
puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.tar.xz
puppet-3180b9d9b2c844dade1d361326600f7001ec66dd.zip
Code smell: Two space indentation
Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
Diffstat (limited to 'lib/puppet/feature')
-rw-r--r--lib/puppet/feature/base.rb4
-rw-r--r--lib/puppet/feature/pson.rb8
-rw-r--r--lib/puppet/feature/rack.rb28
-rw-r--r--lib/puppet/feature/rails.rb46
4 files changed, 43 insertions, 43 deletions
diff --git a/lib/puppet/feature/base.rb b/lib/puppet/feature/base.rb
index f11fb00d0..c153fba98 100644
--- a/lib/puppet/feature/base.rb
+++ b/lib/puppet/feature/base.rb
@@ -37,8 +37,8 @@ Puppet.features.add(:syslog, :libs => ["syslog"])
# We can use POSIX user functions
Puppet.features.add(:posix) do
- require 'etc'
- Etc.getpwuid(0) != nil && Puppet.features.syslog?
+ require 'etc'
+ Etc.getpwuid(0) != nil && Puppet.features.syslog?
end
# We can use Microsoft Windows functions
diff --git a/lib/puppet/feature/pson.rb b/lib/puppet/feature/pson.rb
index 21576c648..0ebb2806f 100644
--- a/lib/puppet/feature/pson.rb
+++ b/lib/puppet/feature/pson.rb
@@ -1,6 +1,6 @@
Puppet.features.add(:pson) do
- require 'puppet/external/pson/common'
- require 'puppet/external/pson/version'
- require 'puppet/external/pson/pure'
- true
+ require 'puppet/external/pson/common'
+ require 'puppet/external/pson/version'
+ require 'puppet/external/pson/pure'
+ true
end
diff --git a/lib/puppet/feature/rack.rb b/lib/puppet/feature/rack.rb
index b91aa13b7..8d101ffc5 100644
--- a/lib/puppet/feature/rack.rb
+++ b/lib/puppet/feature/rack.rb
@@ -3,22 +3,22 @@ require 'puppet/util/feature'
# See if we have rack available, an HTTP Application Stack
# Explicitly depend on rack library version >= 1.0.0
Puppet.features.add(:rack) do
- begin
- require 'rack'
- rescue LoadError => detail
- require 'rubygems'
- require 'rack'
- end
+ begin
+ require 'rack'
+ rescue LoadError => detail
+ require 'rubygems'
+ require 'rack'
+ end
- if ! (defined?(::Rack) and defined?(::Rack.release))
- false
+ if ! (defined?(::Rack) and defined?(::Rack.release))
+ false
+ else
+ major_version = ::Rack.release.split('.')[0].to_i
+ if major_version >= 1
+ true
else
- major_version = ::Rack.release.split('.')[0].to_i
- if major_version >= 1
- true
- else
- false
- end
+ false
end
+ end
end
diff --git a/lib/puppet/feature/rails.rb b/lib/puppet/feature/rails.rb
index 05d416edc..e0e14ebeb 100644
--- a/lib/puppet/feature/rails.rb
+++ b/lib/puppet/feature/rails.rb
@@ -6,30 +6,30 @@ require 'puppet/util/feature'
Puppet.features.rubygems?
Puppet.features.add(:rails) do
- begin
- require 'active_record'
- require 'active_record/version'
- rescue LoadError => detail
- if FileTest.exists?("/usr/share/rails")
- count = 0
- Dir.entries("/usr/share/rails").each do |dir|
- libdir = File.join("/usr/share/rails", dir, "lib")
- if FileTest.exists?(libdir) and ! $LOAD_PATH.include?(libdir)
- count += 1
- $LOAD_PATH << libdir
- end
- end
-
- retry if count > 0
+ begin
+ require 'active_record'
+ require 'active_record/version'
+ rescue LoadError => detail
+ if FileTest.exists?("/usr/share/rails")
+ count = 0
+ Dir.entries("/usr/share/rails").each do |dir|
+ libdir = File.join("/usr/share/rails", dir, "lib")
+ if FileTest.exists?(libdir) and ! $LOAD_PATH.include?(libdir)
+ count += 1
+ $LOAD_PATH << libdir
end
- end
+ end
- if ! (defined?(::ActiveRecord) and defined?(::ActiveRecord::VERSION) and defined?(::ActiveRecord::VERSION::MAJOR) and defined?(::ActiveRecord::VERSION::MINOR))
- false
- elsif ! (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR >= 1)
- Puppet.info "ActiveRecord 2.1 or later required for StoreConfigs"
- false
- else
- true
+ retry if count > 0
end
+ end
+
+ if ! (defined?(::ActiveRecord) and defined?(::ActiveRecord::VERSION) and defined?(::ActiveRecord::VERSION::MAJOR) and defined?(::ActiveRecord::VERSION::MINOR))
+ false
+ elsif ! (::ActiveRecord::VERSION::MAJOR == 2 and ::ActiveRecord::VERSION::MINOR >= 1)
+ Puppet.info "ActiveRecord 2.1 or later required for StoreConfigs"
+ false
+ else
+ true
+ end
end