Sha256: b38646e20fe70223db8de46ed0263c7d2438fd493438ac53a47184fa0160f4be

Contents?: true

Size: 799 Bytes

Versions: 1

Compression:

Stored size: 799 Bytes

Contents

module ZendeskAppsTools
  module Directory

    def app_dir
      @app_dir ||= Pathname.new(destination_root)
    end

    def tmp_dir
      @tmp_dir ||= Pathname.new(File.join(app_dir, "tmp")).tap do |dir|
        FileUtils.mkdir_p(dir)
      end
    end

    def get_new_app_directory
      prompt = "Enter a directory name to save the new app (will create the dir if it does not exist, default to current dir):\n"
      opts = { valid_regex: /^(\w|\/|\\)*$/, allow_empty: true }
      while @app_dir = get_value_from_stdin(prompt, opts) do
        @app_dir = './' and break if @app_dir.empty?
        if !File.exists?(@app_dir)
          break
        elsif !File.directory?(@app_dir)
          puts "Invalid dir, try again:"
        else
          break
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zendesk_apps_tools-1.21.1 lib/zendesk_apps_tools/directory.rb