<commit_before>#
# Author:: <NAME> (<<EMAIL>>)
# Author:: <NAME> (<<EMAIL>>)
# Copyright:: Copyright (c) 2009 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.
#

require 'chef/resource'

class Chef
  class Resource
    class Mount < Chef::Resource

      identity_attr :device

      state_attrs :mount_point, :device_type, :fstype, :username, :password, :domain

      def initialize(name, run_context=nil)
        super
        @resource_name = :mount
        @mount_point = name
        @device = nil
        @device_type = :device
        @fstype = "auto"
        @options = ["defaults"]
        @dump = 0
        @pass = 2
        @mounted = false
        @enabled = false
        @action = :mount
        @supports = { :remount => false }
        @allowed_actions.push(:mount, :umount, :remount, :enable, :disable)
        @username = nil
        @password = <PASSWORD>
        @domain = nil
      end

      def mount_point(arg=nil)
        set_or_return(
          :mount_point,
          arg,
          :kind_of => [ String ]
        )
      end

      def device(arg=nil)
        set_or_return(
          :device,
          arg,
          :kind_of => [ String ]
        )
      end

      def device_type(arg=nil)
        real_arg = arg.kind_of?(String) ? arg.to_sym : arg
        valid_devices = if RUBY_PLATFORM =~ /solaris/i
                          [ :device ]
                        else
                          [ :device, :label, :uuid ]
                        end
        set_or_return(
          :device_type,
          real_arg,
          :equal_to => valid_devices,
        )
      end

      def fstype(arg=nil)
        set_or_return(
          :fstype,
          arg,
          :kind_of => [ String ],
        )
      end

      def options(arg=nil)
        ret = set_or_return(
                            :options,
                            arg,
                            :kind_of => [ Array, String ]
                            )

        if ret.is_a? String
          ret.gsub(/,/, ' ').split(/ /)
        else
          ret
        end
      end

      def dump(arg=nil)
        set_or_return(
          :dump,
          arg,<commit_msg>srsly i hate ruby 1.8.7<commit_after>#
# Author:: <NAME> (<<EMAIL>>)
# Author:: <NAME> (<<EMAIL>>)
# Copyright:: Copyright (c) 2009 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.
#

require 'chef/resource'

class Chef
  class Resource
    class Mount < Chef::Resource

      identity_attr :device

      state_attrs :mount_point, :device_type, :fstype, :username, :password, :domain

      def initialize(name, run_context=nil)
        super
        @resource_name = :mount
        @mount_point = name
        @device = nil
        @device_type = :device
        @fstype = "auto"
        @options = ["defaults"]
        @dump = 0
        @pass = 2
        @mounted = false
        @enabled = false
        @action = :mount
        @supports = { :remount => false }
        @allowed_actions.push(:mount, :umount, :remount, :enable, :disable)
        @username = nil
        @password = <PASSWORD>
        @domain = nil
      end

      def mount_point(arg=nil)
        set_or_return(
          :mount_point,
          arg,
          :kind_of => [ String ]
        )
      end

      def device(arg=nil)
        set_or_return(
          :device,
          arg,
          :kind_of => [ String ]
        )
      end

      def device_type(arg=nil)
        real_arg = arg.kind_of?(String) ? arg.to_sym : arg
        valid_devices = if RUBY_PLATFORM =~ /solaris/i
                          [ :device ]
                        else
                          [ :device, :label, :uuid ]
                        end
        set_or_return(
          :device_type,
          real_arg,
          :equal_to => valid_devices
        )
      end

      def fstype(arg=nil)
        set_or_return(
          :fstype,
          arg,
          :kind_of => [ String ],
        )
      end

      def options(arg=nil)
        ret = set_or_return(
                            :options,
                            arg,
                            :kind_of => [ Array, String ]
                            )

        if ret.is_a? String
          ret.gsub(/,/, ' ').split(/ /)
        else
          ret
        end
      end

      def dump(arg=nil)
        set_or_return(
          :dump,
          arg,
{'fraction_non_alphanumeric': 0.09840571742715779, 'fraction_numerical': 0.004947773501924134, 'mean_word_length': 1.5781766650921114, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2070130', 'n_tokens_mistral': 1610, 'n_tokens_neox': 1561, 'n_words': 451}