summaryrefslogtreecommitdiff
path: root/lib/chef/resource/scm.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-03-05 10:19:27 -0800
committerTim Smith <tsmith@chef.io>2018-03-05 20:55:05 -0800
commitdc4b862b11365f7cb71a58c8f48aa9e1b1921b27 (patch)
tree465f0a74a0be62bd9b228d43e13f78abe61879f9 /lib/chef/resource/scm.rb
parent86a8e51cf16d87cbc57c2635324ab8a8a04a49d9 (diff)
downloadchef-dc4b862b11365f7cb71a58c8f48aa9e1b1921b27.tar.gz
Convert more set_or_returns to proper propertiesmore_properties
Just modernizing our resources so we can start to add descriptions to them for the documentation Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource/scm.rb')
-rw-r--r--lib/chef/resource/scm.rb58
1 files changed, 6 insertions, 52 deletions
diff --git a/lib/chef/resource/scm.rb b/lib/chef/resource/scm.rb
index 533723c2c4..178dcca640 100644
--- a/lib/chef/resource/scm.rb
+++ b/lib/chef/resource/scm.rb
@@ -21,8 +21,6 @@ require "chef/resource"
class Chef
class Resource
class Scm < Chef::Resource
- identity_attr :destination
-
state_attrs :revision
default_action :sync
@@ -30,10 +28,8 @@ class Chef
def initialize(name, run_context = nil)
super
- @destination = name
@enable_submodules = false
@enable_checkout = true
- @revision = "HEAD"
@remote = "origin"
@ssh_wrapper = nil
@depth = nil
@@ -41,54 +37,12 @@ class Chef
@environment = nil
end
- def destination(arg = nil)
- set_or_return(
- :destination,
- arg,
- :kind_of => String
- )
- end
-
- def repository(arg = nil)
- set_or_return(
- :repository,
- arg,
- :kind_of => String
- )
- end
-
- def revision(arg = nil)
- set_or_return(
- :revision,
- arg,
- :kind_of => String
- )
- end
-
- def user(arg = nil)
- set_or_return(
- :user,
- arg,
- :kind_of => [String, Integer]
- )
- end
-
- def group(arg = nil)
- set_or_return(
- :group,
- arg,
- :kind_of => [String, Integer]
- )
- end
-
- def svn_username(arg = nil)
- set_or_return(
- :svn_username,
- arg,
- :kind_of => String
- )
- end
-
+ property :destination, String, name_property: true, identity: true
+ property :repository, String
+ property :revision, String, default: "HEAD"
+ property :user, [String, Integer]
+ property :group, [String, Integer]
+ property :svn_username, String
property :svn_password, String, sensitive: true, desired_state: false
def svn_arguments(arg = nil)