Class: Slipsquare::Middleware::MakeDirectory
- Defined in:
- lib/slipsquare/middleware/make_directory.rb
Constant Summary
Constants inherited from Base
Base::CLEAR, Base::GREEN, Base::RED, Base::YELLOW
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Slipsquare::Middleware::Base
Instance Method Details
#call(env) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/slipsquare/middleware/make_directory.rb', line 6 def call(env) say "Creating directory on Dropbox..." friendly_path = env["mkdir_path"] if friendly_path =~ (/[\\\:\?\*\<\>\"\|]+/) friendly_path = friendly_path.gsub(/[\\\:\?\*\<\>\"\|]+/, '') say "Illegal character found! Escaping...", :yellow say "Escaped directory path: #{friendly_path}" end new_folder_response = env['dropbox-client'].mkdir(env["mkdir_path"]) say "Directory `#{friendly_path}` created successfully", :green @app.call(env) end |