summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-01-23 15:25:49 -0800
committerdanielsdeleo <dan@opscode.com>2013-01-23 15:25:49 -0800
commit9c95cb722a44440830cfc4da1c57f4815dafe904 (patch)
treecba364d6a568a5d33baea3bbb6ee07d6f7f98ed4
parent53fa8088240f19a1dfc589d9ba07098cbdd9bba2 (diff)
downloadchef-9c95cb722a44440830cfc4da1c57f4815dafe904.tar.gz
remove cruft code.
In all of github there is not a single cookbook using this.
-rw-r--r--lib/chef/cookbook/metadata.rb2
-rw-r--r--lib/chef/mixin/check_helper.rb31
-rw-r--r--lib/chef/mixins.rb1
-rw-r--r--lib/chef/node.rb2
-rw-r--r--lib/chef/resource.rb8
-rw-r--r--spec/support/lib/chef/resource/cat.rb8
-rw-r--r--spec/support/lib/chef/resource/one_two_three_four.rb18
-rw-r--r--spec/support/lib/chef/resource/zen_master.rb18
8 files changed, 23 insertions, 65 deletions
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb
index 8398de442c..18368bd99f 100644
--- a/lib/chef/cookbook/metadata.rb
+++ b/lib/chef/cookbook/metadata.rb
@@ -21,7 +21,6 @@
require 'chef/mash'
require 'chef/mixin/from_file'
require 'chef/mixin/params_validate'
-require 'chef/mixin/check_helper'
require 'chef/log'
require 'chef/version_class'
require 'chef/version_constraint'
@@ -64,7 +63,6 @@ class Chef
:provides => PROVIDING,
:replaces => REPLACING }
- include Chef::Mixin::CheckHelper
include Chef::Mixin::ParamsValidate
include Chef::Mixin::FromFile
diff --git a/lib/chef/mixin/check_helper.rb b/lib/chef/mixin/check_helper.rb
deleted file mode 100644
index b3a7835e09..0000000000
--- a/lib/chef/mixin/check_helper.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# Author:: Adam Jacob (<adam@opscode.com>)
-# Copyright:: Copyright (c) 2008 Opscode, Inc.
-# License:: Apache License, Version 2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-class Chef
- module Mixin
- module CheckHelper
- def set_if_args(thing, arguments)
- raise ArgumentError, "Must call set_if_args with a block!" unless Kernel.block_given?
- if arguments != nil
- yield(arguments)
- else
- thing
- end
- end
- end
- end
-end
diff --git a/lib/chef/mixins.rb b/lib/chef/mixins.rb
index 8fa9c699e6..17be1622af 100644
--- a/lib/chef/mixins.rb
+++ b/lib/chef/mixins.rb
@@ -1,5 +1,4 @@
require 'chef/mixin/shell_out'
-require 'chef/mixin/check_helper'
require 'chef/mixin/checksum'
require 'chef/mixin/command'
require 'chef/mixin/convert_to_class_name'
diff --git a/lib/chef/node.rb b/lib/chef/node.rb
index a2bffcc172..0caf6602fe 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -22,7 +22,6 @@
require 'forwardable'
require 'chef/config'
require 'chef/nil_argument'
-require 'chef/mixin/check_helper'
require 'chef/mixin/params_validate'
require 'chef/mixin/from_file'
require 'chef/mixin/deep_merge'
@@ -57,7 +56,6 @@ class Chef
include Chef::DSL::IncludeAttribute
include Chef::DSL::PlatformIntrospection
- include Chef::Mixin::CheckHelper
include Chef::Mixin::ParamsValidate
# Create a new Chef::Node object.
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb
index f3dabc5b28..7ee61db04c 100644
--- a/lib/chef/resource.rb
+++ b/lib/chef/resource.rb
@@ -18,7 +18,6 @@
#
require 'chef/mixin/params_validate'
-require 'chef/mixin/check_helper'
require 'chef/dsl/platform_introspection'
require 'chef/dsl/registry_helper'
require 'chef/mixin/convert_to_class_name'
@@ -120,7 +119,6 @@ F
FORBIDDEN_IVARS = [:@run_context, :@node, :@not_if, :@only_if, :@enclosing_provider]
HIDDEN_IVARS = [:@allowed_actions, :@resource_name, :@source_line, :@run_context, :@name, :@node, :@not_if, :@only_if, :@elapsed_time, :@enclosing_provider]
- include Chef::Mixin::CheckHelper
include Chef::Mixin::ParamsValidate
include Chef::DSL::PlatformIntrospection
include Chef::DSL::RegistryHelper
@@ -324,17 +322,19 @@ F
end
def name(name=nil)
- set_if_args(@name, name) do
+ if !name.nil?
raise ArgumentError, "name must be a string!" unless name.kind_of?(String)
@name = name
end
+ @name
end
def noop(tf=nil)
- set_if_args(@noop, tf) do
+ if !tf.nil?
raise ArgumentError, "noop must be true or false!" unless tf == true || tf == false
@noop = tf
end
+ @noop
end
def ignore_failure(arg=nil)
diff --git a/spec/support/lib/chef/resource/cat.rb b/spec/support/lib/chef/resource/cat.rb
index 5809ad3275..83eb9f08a3 100644
--- a/spec/support/lib/chef/resource/cat.rb
+++ b/spec/support/lib/chef/resource/cat.rb
@@ -29,12 +29,10 @@ class Chef
end
def pretty_kitty(arg=nil)
- set_if_args(@pretty_kitty, arg) do
- case arg
- when true, false
- @pretty_kitty = arg
- end
+ if arg == true or arg == false
+ @pretty_kitty = arg
end
+ @pretty_kitty
end
end
end
diff --git a/spec/support/lib/chef/resource/one_two_three_four.rb b/spec/support/lib/chef/resource/one_two_three_four.rb
index 4f4b063eb6..296d2cd970 100644
--- a/spec/support/lib/chef/resource/one_two_three_four.rb
+++ b/spec/support/lib/chef/resource/one_two_three_four.rb
@@ -6,9 +6,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,23 +20,21 @@ class Chef
class Resource
class OneTwoThreeFour < Chef::Resource
attr_reader :i_can_count
-
+
def initialize(name, run_context)
@resource_name = :one_two_three_four
super
end
-
+
def i_can_count(tf)
@i_can_count = tf
end
-
+
def something(arg=nil)
- set_if_args(@something, arg) do
- case arg
- when true, false
- @something = arg
- end
+ if arg == true or arg == false
+ @something = arg
end
+ @something
end
end
end
diff --git a/spec/support/lib/chef/resource/zen_master.rb b/spec/support/lib/chef/resource/zen_master.rb
index 71842b74c0..7a7076ca4b 100644
--- a/spec/support/lib/chef/resource/zen_master.rb
+++ b/spec/support/lib/chef/resource/zen_master.rb
@@ -6,9 +6,9 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
-#
+#
# http://www.apache.org/licenses/LICENSE-2.0
-#
+#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,23 +23,21 @@ class Chef
class Resource
class ZenMaster < Chef::Resource
attr_reader :peace
-
+
def initialize(name, run_context=nil)
@resource_name = :zen_master
super
end
-
+
def peace(tf)
@peace = tf
end
-
+
def something(arg=nil)
- set_if_args(@something, arg) do
- case arg
- when true, false
- @something = arg
- end
+ if arg == true or arg == false
+ @something = arg
end
+ @something
end
end
end