forked from paxer/spree-heroku
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove deprecated and actualize current code
- Loading branch information
Showing
26 changed files
with
93 additions
and
394 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
haml-edge --version '2.3.51' | ||
json_pure --version '1.1.9' | ||
rubyforge --version '2.0.3' | ||
highline --version '>=1.4.0' | ||
authlogic --version '>=2.0.11' | ||
activemerchant --version '>=1.4.1' | ||
tlsmail --version '0.0.1' | ||
activerecord-tableless --version '>=0.1.0' | ||
haml --version '2.2.0' | ||
chriseppstein-compass --source gems.github.com --version '0.8.17' | ||
calendar_date_select --version '1.15' | ||
rsl-stringex --source gems.github.com | ||
chronic | ||
javan-whenever --source gems.github.com | ||
searchlogic --version '>= 2.3.5' | ||
mislav-will_paginate --version '~> 2.3.11' --source gems.github.com | ||
rspec-rails --version '>= 1.2.0' | ||
rspec --version '>= 1.2.0' | ||
right_http_connection --version '1.2.4' | ||
right_aws --version '1.10.0' | ||
compass --version '>= 0.8.17' --source gems.rubyforge.org | ||
spree --version '0.9.4' | ||
rails -v 2.3.5 | ||
highline -v '1.5.1' | ||
authlogic -v '>=2.1.2' | ||
authlogic-oid -v '1.0.4' | ||
activemerchant -v '1.5.1' | ||
activerecord-tableless -v '0.1.0' | ||
less -v '1.2.20' | ||
stringex -v '1.0.3' | ||
chronic -v '0.2.3' | ||
whenever -v '0.3.7' | ||
searchlogic -v '2.3.5' | ||
will_paginate -v '2.3.11' | ||
faker -v '0.3.1' | ||
paperclip -v '>=2.3.1.1' | ||
state_machine -v '0.8.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
*~ | ||
config/aws_s3.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,36 @@ | ||
# encoding: utf-8 | ||
class Image < Asset | ||
has_attached_file :attachment, | ||
:styles => { :mini => '48x48>', :small => '100x100>', :product => '240x240>', :large => '600x600>' }, | ||
:default_style => :product, | ||
:path => "assets/products/:id/:style/:basename.:extension", | ||
:storage => :s3, | ||
:bucket => Spree::Heroku::Config['bucket'], | ||
:url => "/assets/products/:id/:style/:basename.:extension", | ||
:path => ":rails_root/public/assets/products/:id/:style/:basename.:extension", | ||
:storage => "s3", | ||
:s3_credentials => { | ||
:access_key_id => Spree::Heroku::Config['access_key_id'], | ||
:secret_access_key => Spree::Heroku::Config['secret_access_key'] | ||
} | ||
end | ||
:access_key_id => HEROKU_AWS_S3['access_key_id'], | ||
:secret_access_key => HEROKU_AWS_S3['secret_access_key'] | ||
}, # "#{HerokuExtension}/config/aws_s3.yml" | ||
:bucket => HEROKU_AWS_S3['bucket'] | ||
|
||
# save the w,h of the original image (from which others can be calculated) | ||
# we need to look at the write-queue for images which have not been saved yet | ||
after_post_process :find_dimensions | ||
def find_dimensions | ||
temporary = attachment.queued_for_write[:original] | ||
filename = temporary.path unless temporary.nil? | ||
filename = attachment.path if filename.blank? | ||
geometry = Paperclip::Geometry.from_file(filename) | ||
self.attachment_width = geometry.width | ||
self.attachment_height = geometry.height | ||
end | ||
|
||
# if there are errors from the plugin, then add a more meaningful message | ||
def validate | ||
unless attachment.errors.empty? | ||
# uncomment this to get rid of the less-than-useful interrim messages | ||
# errors.clear | ||
errors.add :attachment, "Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file." | ||
false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
common: &common | ||
access_key_id: your_access_key | ||
secret_access_key: secret_access_key | ||
|
||
development: | ||
bucket: spree_development | ||
<<: *common | ||
|
||
production: | ||
bucket: spree_production | ||
<<: *common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# encoding: utf-8 | ||
begin | ||
HEROKU_AWS_S3 = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'aws_s3.yml'))[Rails.env] | ||
rescue | ||
HEROKU_AWS_S3 = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'aws_s3.yml.example'))[Rails.env] | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,16 @@ | ||
# encoding: utf-8 | ||
# Uncomment this if you reference any of your controllers in activate | ||
# require_dependency 'application' | ||
|
||
class HerokuExtension < Spree::Extension | ||
version "0.1" | ||
version "0.2" | ||
description "Allows Spree to run on Heroku" | ||
url "http://casperfabricius.com" | ||
|
||
# Please use heroku/config/routes.rb instead for extension routes. | ||
|
||
# def self.require_gems(config) | ||
# config.gem "gemname-goes-here", :version => '1.2.3' | ||
# end | ||
url "http://github.com/chipiga/spree-heroku" | ||
|
||
def activate | ||
|
||
# Patch up for strange error in a call to javascript include tag | ||
require File.expand_path(File.dirname(__FILE__) + '/lib/javascript_include_tag_patch.rb') | ||
|
||
# Disable caching in the production environment | ||
ActionController::Base.perform_caching = false if RAILS_ENV == 'production' | ||
Spree::BaseController.perform_caching = false if RAILS_ENV == 'production' | ||
|
||
# Add your extension tab to the admin. | ||
# Requires that you have defined an admin controller: | ||
# app/controllers/admin/yourextension_controller | ||
# and that you mapped your admin in config/routes | ||
|
||
#Admin::BaseController.class_eval do | ||
# before_filter :add_yourextension_tab | ||
# | ||
# def add_yourextension_tab | ||
# # add_extension_admin_tab takes an array containing the same arguments expected | ||
# # by the tab helper method: | ||
# # [ :extension_name, { :label => "Your Extension", :route => "/some/non/standard/route" } ] | ||
# add_extension_admin_tab [ :yourextension ] | ||
# end | ||
#end | ||
|
||
# make your helper avaliable in all views | ||
# Spree::BaseController.class_eval do | ||
# helper YourHelper | ||
# end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# encoding: utf-8 | ||
Spree::FileUtilz.class_eval do | ||
class << self | ||
# Patch mirror_files method to be silent when using r/o Heroku FS | ||
alias_method :mirror_files_old, :mirror_files | ||
def mirror_files(source, destination, create_backups = false) | ||
return mirror_files_old(source, destination, create_backups) unless Rails.env == 'production' | ||
mirror_files_old(source, destination, create_backups) rescue true | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.