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
# factories.rb | |
Factory.define :app do |i| | |
i.association :sku, :factory => :sku | |
i.base_vehicle_id BaseVehicle.last.id | |
end | |
# base_vehicle.rb | |
class BaseVehicle < ActiveRecord::Base | |
self.establish_connection :special_connection | |
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
require 'rubygems' | |
require 'spork' | |
require 'factory_girl' | |
Spork.prefork do | |
# Loading more in this block will cause your tests to run faster. However, | |
# if you change any configuration or code from libraries loaded here, you'll | |
# need to restart spork for it take effect. | |
unless defined? SPREE_ROOT |
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
require 'prawn/layout' | |
require 'prawn/format' | |
bill_address = @order.bill_address | |
ship_address = @order.ship_address | |
font "Helvetica" | |
image Spree::PrintInvoice::Config[:print_invoice_logo_path], :at => [0,720], :scale => 0.65 |
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
OFILES = main.o# type.o | |
LEX = flex | |
BISON = bison | |
CPATH = | |
CC = $(CPATH)llvm-g++ | |
LD = $(CPATH)llvm-g++ | |
CXXFLAGS = `$(CPATH)llvm-config --cppflags` | |
LDFLAGS = `$(CPATH)llvm-config --ldflags --libs core jit native` | |
all: typetest |
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
denis@h213h:~$ cd rails/vanilla-spree/ | |
denis@h213h:~/rails/vanilla-spree$ rake assets:precompile --trace | |
(in /home/denis/rails/vanilla-spree) | |
** Invoke assets:precompile (first_time) | |
** Execute assets:precompile | |
/home/denis/.rvm/rubies/ruby-1.9.2-p290/bin/ruby ./bundler_stubs/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace | |
(in /home/denis/rails/vanilla-spree) | |
** Invoke assets:precompile:all (first_time) | |
** Execute assets:precompile:all | |
** Invoke assets:precompile:primary (first_time) |
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
# rake | |
# Same as invoke, but explicitly pass a call chain to detect | |
# circular dependencies. | |
def invoke_with_call_chain(task_args, invocation_chain) # :nodoc: | |
new_chain = InvocationChain.append(self, invocation_chain) | |
@lock.synchronize do | |
if application.options.trace | |
$stderr.puts "** Invoke #{name} #{format_trace_flags}" | |
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
#this is what Order#rate_hash outputs, roughly | |
sample_rate_hash = [{:id => 4, :name => 'ShippingMethod', :price => 24.55}] | |
# we take the array of hashes and for each one we create an HTML <option>, we show the user the name and the price, for value we store the shipping_method_id | |
# then we join all the html options into one string | |
# then we mark the string as safe for frontend | |
options = sample_rate_hash.map{|rate| content_tag(:option, "#{rate[:name]} #{rate[:price]}", :value => rate[:shipping_method_id])}.join.html_safe | |
# then we simply give that to select | |
select_tag :order, options |
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
bundle | |
bundle show spree | |
# => /home/denis/.rvm/gems/ruby-1.9.2-p290/bundler/gems/spree-b58d645ac730/cmd | |
/home/denis/.rvm/gems/ruby-1.9.2-p290/bundler/gems/spree-b58d645ac730/cmd/bin/spree | |
# voila |
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
desc "Generates a dummy app for testing" | |
task :test_app do | |
ENV['LIB_NAME'] = 'spree_google_base' | |
puts 'Installing spree-multi-domain migrations [required for testing]' | |
dep_path = `bundle show spree_multi_domain`.chomp | |
migration_path = File.join(dep_path,'db','migrate') | |
dummy_path = File.join(FileUtils.pwd, 'spec', 'dummy', 'db') | |
FileUtils.mkdir_p(dummy_path) |
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
GRADES = ['A', 'B', 'C', 'D'] | |
def grade_formula(book_count, reads_books = true) | |
raise "One cannot have read a negative amount of books, you numbnuts." if book_count < 0 | |
index = case book_count | |
when 0..9 | |
3 | |
when 10..20 | |
2 |
OlderNewer