-
-
Save r3ap3r2004/3831084 to your computer and use it in GitHub Desktop.
Snippets for Spree Commerce Development
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
# 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 |
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
# 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 |
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
# 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" |
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
# 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