Skip to content

Instantly share code, notes, and snippets.

@catmando
catmando / gist:d283739ef34e9368518c
Created June 15, 2015 00:08
Changing opal-rspec directory (useful if you cannot upgrade to opal-rails > 7.0)

opal-rspec does not currently have a means to change the spec directory location, which you really need to do if you are going to have mixed opal and regular (server) ruby code testing.

The following assumes normal specs will go into the the spec directory, and opal specs will go into spec-opal directory.

To get this to work, you have to change the Opal::Server path to end with spec-opal instead of spec which is what opal-rspec normally does. Then you have to change the Opal::Server main file (the sprockets_runner.rb.erb) file to be a copy which pulls in your specs.

In your rake file do this:

require 'opal/rspec/rake_task'
@catmando
catmando / gist:096c29d0fb06873ad978
Last active September 27, 2017 07:13
Carrierwave Custom Version
class CustomUploader < CarrierWave::Uploader::Base
# complete example of custom carrierwave version generator that does not use manipulate with hopefully helpful comments
# in this case we are uploading a .psd (photoshop file) and then rendering to a png. We want to
# save the original psd, so we create a png version.
storage :file
version :png do # tells carrierwave to generate a new version of the upload in this case a "png"