Skip to content

Instantly share code, notes, and snippets.

@merlinstardust
Created March 4, 2016 21:10
Show Gist options
  • Save merlinstardust/5975659c4e7740eb9deb to your computer and use it in GitHub Desktop.
Save merlinstardust/5975659c4e7740eb9deb to your computer and use it in GitHub Desktop.
full_path = File.expand_path(File.dirname(__FILE__))
vm_directory = directory = File.basename(full_path)
parent_path_with_sep = full_path.gsub(Regexp.new(directory + "$"), '')
separator = parent_path_with_sep[-1]
parent_path = parent_path_with_sep.gsub(Regexp.new(separator + "$"), '')
i = parent_path.rindex(separator)
app_name = parent_directory = parent_path[i + 1..- 1]
puts app_name
puts vm_directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment