spree-contrib / spree_digital

A Spree extension to enable downloadable products
http://spreecommerce.org
MIT License
117 stars 97 forks source link

Support for S3 #1

Closed dwradcliffe closed 11 years ago

dwradcliffe commented 13 years ago

It would be great to see support for storing files in S3 instead of locally. Looks like it shouldn't be too hard since you're using paperclip. Probably need to adjust the following:

app/controllers/digitals_controller.rb app/models/digital.rb

I might give it a try if I have a chance but I thought I'd ask you first.

halo commented 13 years ago

Hi! Very kind of you to ask :) I have to admit that I never used S3. If you can implement it, please go ahead and send a pull request. Thanks indeed. I'm still trying to make this whole thing a little bit more configurable and stable, but so far it works pretty smooth I'd say :)

sammyd commented 13 years ago

I have added S3 support in a way that's compatible with running spree on heroku in my fork. However, since I only wanted S3 I haven't thought about how you might offer users the choice between S3 storage and file storage. Any ideas on this? I'm happy to implement it and put in a pull request.

halo commented 13 years ago

Hi, sorry dude I didn't answer in such long time. I think my next step will be to make this whole thing work with the spree_edge, in the light of Rails 3.1 coming up. Your Amazon changes are not on github, are they? Greets.

sammyd commented 13 years ago

Hiya. The S3 changes are on github at https://github.com/sammyd/spree_digital but it replaces the filesystem store with S3 - I don't really know what the best way would be to choose either filesystem or S3. Happy to do it - just wanted some direction. I'm currently testing my setup on the rails3-1 branch of spree so am happy to help out there too if I can.

halo commented 13 years ago

I think there should be a preference pane for spree_digital in the spree admin section to choose between file system and S3.

You could basically look at any other extension that uses that and type of pane and just apply the way it is done there to spree_digital. I know that paypal_express has it for example. And spree_social.

As for Rails 3.1, that should be just minor changes. E.g. using Deface in spree_digital_hooks.rb (you could google "deface spree") to find out more. Something like

Deface::Override.new(:virtual_path => "admin/shared/_product_tabs",
                     :name => "admin_product_tabs",
                     :insert_after => "[data-hook='footer_left'] > p:first-child",
                     :text => <<-END
                     >
                       <%= link_to t("digital_versions"), admin_product_digitals_path(@product) %>
                     
                     END
                     ,
                     :disabled => false)

That's pretty much it, I think :)

iloveitaly commented 11 years ago

@sammyd this is an old thread, but if you want to go ahead and create a PR for S3 support, that would be great.