Skip to content

Commit

Permalink
Moving models out of core into separate gem
Browse files Browse the repository at this point in the history
  • Loading branch information
radar committed Feb 7, 2013
1 parent a462eb9 commit 373f5c3
Show file tree
Hide file tree
Showing 232 changed files with 772 additions and 2,632 deletions.
16 changes: 8 additions & 8 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
require 'rake'
require 'rubygems/package_task'
require 'thor/group'
require File.expand_path('../core/lib/generators/spree/install/install_generator', __FILE__)
begin
require 'spree/core/testing_support/common_rake'
require 'spree/testing_support/common_rake'
rescue LoadError
raise "Could not find spree/core/testing_support/common_rake. You need to run this command using Bundler."
raise "Could not find spree/testing_support/common_rake. You need to run this command using Bundler."
exit
end

Expand All @@ -16,7 +15,8 @@ end

desc "Generates a dummy app for testing for every Spree engine"
task :test_app do
%w(api core dash promo).each do |engine|
require File.expand_path('../models/lib/generators/spree/install/install_generator', __FILE__)
%w(api core dash promo models).each do |engine|
ENV['LIB_NAME'] = File.join('spree', engine)
ENV['DUMMY_PATH'] = File.expand_path("../#{engine}/spec/dummy", __FILE__)
Rake::Task['common:test_app'].execute
Expand All @@ -30,7 +30,7 @@ task :clean do
puts "Deleting pkg directory.."
FileUtils.rm_rf("pkg")

%w(api cmd core dash promo).each do |gem_name|
%w(api cmd core dash promo models).each do |gem_name|
puts "Cleaning #{gem_name}:"
puts " Deleting #{gem_name}/Gemfile"
FileUtils.rm_f("#{gem_name}/Gemfile")
Expand All @@ -46,7 +46,7 @@ end
namespace :gem do
desc "run rake gem for all gems"
task :build do
%w(core api dash promo sample cmd).each do |gem_name|
%w(core api dash promo sample cmd models testing_support).each do |gem_name|
puts "########################### #{gem_name} #########################"
puts "Deleting #{gem_name}/pkg"
FileUtils.rm_rf("#{gem_name}/pkg")
Expand All @@ -63,7 +63,7 @@ namespace :gem do
task :install do
version = File.read(File.expand_path("../SPREE_VERSION", __FILE__)).strip

%w(core api dash promo sample cmd).each do |gem_name|
%w(core api dash promo sample cmd models testing_support).each do |gem_name|
puts "########################### #{gem_name} #########################"
puts "Deleting #{gem_name}/pkg"
FileUtils.rm_rf("#{gem_name}/pkg")
Expand All @@ -82,7 +82,7 @@ namespace :gem do
task :release do
version = File.read(File.expand_path("../SPREE_VERSION", __FILE__)).strip

%w(core api dash promo sample cmd).each do |gem_name|
%w(core api dash promo sample cmd models testing_support).each do |gem_name|
puts "########################### #{gem_name} #########################"
cmd = "cd #{gem_name}/pkg && gem push spree_#{gem_name}-#{version}.gem"; puts cmd; system cmd
end
Expand Down
1 change: 1 addition & 0 deletions api/Gemfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
eval(File.read(File.dirname(__FILE__) + '/../common_spree_dependencies.rb'))

gem 'spree_models', :path => "../models"
gem 'spree_core', :path => "../core"

gemspec
5 changes: 3 additions & 2 deletions api/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# in spec/support/ and its subdirectories.
Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f}

require 'spree/core/testing_support/factories'
require 'spree/models/testing_support/factories'
require 'spree/models/testing_support/preferences'

require 'spree/api/testing_support/helpers'
require 'spree/api/testing_support/setup'
Expand All @@ -19,7 +20,7 @@
config.include FactoryGirl::Syntax::Methods
config.include Spree::Api::TestingSupport::Helpers, :type => :controller
config.extend Spree::Api::TestingSupport::Setup, :type => :controller
config.include Spree::Core::TestingSupport::Preferences, :type => :controller
config.include Spree::Models::TestingSupport::Preferences, :type => :controller

config.before do
Spree::Api::Config[:requires_authentication] = true
Expand Down
8 changes: 8 additions & 0 deletions common_spree_dependencies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@
# gem 'debugger'
end

if Dir.pwd =~ /spree$/
testing_support_path = 'testing_support'
else
testing_support_path = '../testing_support'
end

gem 'spree_testing_support', :path => testing_support_path

gemspec


3 changes: 3 additions & 0 deletions core/Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
eval(File.read(File.dirname(__FILE__) + '/../common_spree_dependencies.rb'))

gem 'spree_models', :path => '../models'
gem 'spree_api', :path => '../api'

gemspec
5 changes: 0 additions & 5 deletions core/app/models/spree.rb

This file was deleted.

2 changes: 1 addition & 1 deletion core/app/views/spree/shared/_filters.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% filters = @taxon ? @taxon.applicable_filters : [Spree::ProductFilters.all_taxons] %>
<% filters = @taxon ? @taxon.applicable_filters : [Spree::Models::ProductFilters.all_taxons] %>
<% unless filters.empty? %>
<%= form_tag '', :method => :get, :id => 'sidebar_products_search' do %>
<% params[:search] ||= {} %>
Expand Down
Loading

0 comments on commit 373f5c3

Please sign in to comment.