Skip to content

Instantly share code, notes, and snippets.

@parasquid
Created February 26, 2020 08:37
Show Gist options
  • Save parasquid/402c619553aad5d0bc1447a1711e6c31 to your computer and use it in GitHub Desktop.
Save parasquid/402c619553aad5d0bc1447a1711e6c31 to your computer and use it in GitHub Desktop.
Do not run code during assets:precompile
# the condition checks if we're running inside rake assets:precompile
if !defined?(::Rake::SprocketsTask)
FOG_DIRECTORY = begin
# try and see if the directory exists
FOG_CONNECTION.directories.get(bucket_name)
rescue Excon::Error::Forbidden
# otherwise let's just create it
FOG_CONNECTION.directories.create(
key: bucket_name,
public: false,
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment