Skip to content
Browse files

Remove sandbox_generator, replace with Rails template

The rails template's code is much simpler and allows us to enforce specific gem requirements that the dummy application should never have.

This fixes the sandbox's requirement of spree_signup_path as pointed out by BDQ here: #1512 (comment)
  • Loading branch information...
1 parent a8edc5c commit 948f0baf48257f365803e32d221c2efad2d909c6 @radar radar committed May 22, 2012
View
9 Rakefile
@@ -98,10 +98,7 @@ end
desc "Creates a sandbox application for simulating the Spree code in a deployed Rails app"
task :sandbox do
- require 'spree_core'
-
- Spree::SandboxGenerator.start ["--lib_name=spree"]
- Spree::InstallGenerator.start ["--auto-accept"]
-
- cmd = "bundle exec rake assets:precompile:nondigest"; puts cmd; system cmd
+ FileUtils.rm_r("sandbox")
+ puts "Running Sandbox generator..."
+ exec("rails new sandbox -m sandbox.rb")
@parndt
parndt added a note May 22, 2012

What about invoking it?

@radar
Spree Commerce member
radar added a note May 22, 2012

What difference does it make?

@parndt
parndt added a note May 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
end
View
45 core/lib/generators/spree/sandbox/sandbox_generator.rb
@@ -1,45 +0,0 @@
-require "rails/generators/rails/app/app_generator"
-
-module Spree
- class SandboxGenerator < Spree::DummyGenerator
- desc "Creates blank Rails application, installs Spree and all sample data"
-
- def self.source_paths
- paths = self.superclass.source_paths
- paths.unshift File.expand_path('../templates', __FILE__)
- paths.flatten
- end
-
- def drop_database
- say "dropping database"
- inside dummy_path do
- quietly do
- rake 'db:drop -f sandbox/Rakefile'
- end
- end
- end
-
- def use_spree_auth_devise
- inside dummy_path do
- File.open("Gemfile", "a+") do |f|
- f.write %Q{gem 'spree_auth_devise', :git => "git://github.com/radar/spree_auth_devise"}
- end
- end
- run 'bundle install'
- end
-
- protected
- def dummy_path
- 'sandbox'
- end
-
- def gemfile_path
- '../../../Gemfile'
- end
-
- def module_name
- 'Sandbox'
- end
-
- end
-end
View
3 core/lib/generators/spree/sandbox/templates/rails/routes.rb
@@ -1,3 +0,0 @@
-Rails.application.routes.draw do
- mount Spree::Core::Engine => "/"
-end
View
1 core/lib/spree/core.rb
@@ -95,7 +95,6 @@ def self.config(&block)
require 'spree/core/engine'
require 'generators/spree/dummy/dummy_generator'
-require 'generators/spree/sandbox/sandbox_generator'
ActiveRecord::Base.class_eval do
include Spree::Core::CalculatedAdjustments
View
10 sandbox.rb
@@ -0,0 +1,10 @@
+# Used in the sandbox rake task in Rakefile
+gem('spree', :path => "..")
+gem('spree_auth_devise', :path => "~/Sites/gems/spree_auth_devise")
+gem('devise-encryptable', '0.1.1')
+puts "Running Spree installer..."
+generate("spree:install --auto-accept")
+puts "Precompilign assets..."
+rake("assets:precompile:nondigest")
+puts "Done!"
+

0 comments on commit 948f0ba

Please sign in to comment.
Something went wrong with that request. Please try again.