Sha256: 61d70898d80c110c59483b31ed6b883ee66ce179b766ed0c7e92ecfb1f98476f

Contents?: true

Size: 964 Bytes

Versions: 6

Compression:

Stored size: 964 Bytes

Contents

module ConfigmonkeyCli
  class Application
    module ManifestAction
      class Mkdir < Base
        def init directory, *sub_directories
          @opts = sub_directories.extract_options!.reverse_merge({
            #_p: true
          })

          # assemble directories
          sub_directories.flatten!
          if sub_directories.any?
            @args = sub_directories.map {|d| File.join(directory, d) }
          else
            @args = [directory]
          end
        end

        def prepare
          @directories = @args.map{|dir| expand_dst(dir) }
        end

        def simulate
          if thor.options[:pretend]
            destructive
          else
            @directories.each do |dir|
              status :fake, :black, @args[0]
            end
          end
        end

        def destructive
          @directories.each do |dir|
            thor.empty_directory(dir, @opts)
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
configmonkey_cli-1.0.5 lib/configmonkey_cli/application/manifest_actions/mkdir.rb
configmonkey_cli-1.0.4 lib/configmonkey_cli/application/manifest_actions/mkdir.rb
configmonkey_cli-1.0.3 lib/configmonkey_cli/application/manifest_actions/mkdir.rb
configmonkey_cli-1.0.2 lib/configmonkey_cli/application/manifest_actions/mkdir.rb
configmonkey_cli-1.0.1 lib/configmonkey_cli/application/manifest_actions/mkdir.rb
configmonkey_cli-1.0.0 lib/configmonkey_cli/application/manifest_actions/mkdir.rb