Skip to content

Instantly share code, notes, and snippets.

@r3ap3r2004
Forked from iloveitaly/.gitattributes
Created October 4, 2012 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r3ap3r2004/3831084 to your computer and use it in GitHub Desktop.
Save r3ap3r2004/3831084 to your computer and use it in GitHub Desktop.
Snippets for Spree Commerce Development
# with my git configuration the spree repo was giving me issues with line endings
# this fixed the issue for me: marking a file as binary causes git to ignore it completely
core/vendor/assets/javascripts/jquery.alerts/jquery.alerts.css.erb binary
core/vendor/assets/javascripts/jquery.alerts/jquery.alerts.js binary
core/vendor/assets/javascripts/jquery.jstree/themes/apple/style.css binary
sample/db/sample/spree/line_items.yml binary
sample/db/sample/spree/products.yml binary
# create global zone containing everything but USA
global_zone = Spree::Zone.find_or_initialize_by_name 'Global Zone' do |z|
excluded_countries = ['US']
member_list = Spree::Country.find(:all, :conditions => ['iso not in (?)', excluded_countries.map { |c| "'#{c}'" }.join(',')])
puts "Creating Global Zone With Members: #{member_list.map(&:iso)}"
member_list.each do |member|
z.zone_members.build :zoneable_type => 'Spree::Country', :zoneable_id => member.id
end
z.description = "Global Zone (excluding US)"
z.save!
end
# for the whenever gem; fixes the rake execution issues
# be sure to create the /var/log/cron.log and `chown spree:spree`
# server is configured with spree deployment service
env :PATH, ENV['PATH']
set :output, "/var/log/cron.log"
# updates shipments with approximate shipped date
# manual DB migration for: https://github.com/spree/spree/commit/cc10ec3aa390b8581cddc343ae4409e89996e783
Spree::Shipment.where("state = 'shipped' and shipped_at IS NULL").select { |s| s.order.state == 'complete' }.each { |s| s.update_column(:shipped_at, s.order.completed_at) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment