Hi all,
For the benefit of others, here are my steps, the errors I came
across, and the solutions, when migrating my site from 0.70 to
1.00.0rc2.
These steps have taken me to an updated site that has a working front
end. I hadn't set up the order/cart processing on 0.70, so there may
be more to do there. There also appears to be one issue left with the
CSS (I'll update later).
Hope it saves someone some time.
Steve
Notes from going from Spree 0.70.3 to Edge (1.0.0.rc2)
1)
Add the version of the Gem in Gemfile
was:
gem 'spree'
(Note to self: Probably not a good idea not to have the spree version)
Now:
gem 'spree', :git => 'git://
github.com/spree/spree.git'
Activated change by: bundle update // bundle install
2)
rails s
generates error:
uninitialized constant RedirectLegacyProductUrl (NameError)
Fix
https://github.com/spree/spree/issues/848
Radar says
This error would happen if you generated the application initially
using:
rails g spree:site
This inserts lines beginning with config.middleware into config/
application.rb that aren't compatible with the edge version of Spree.
To fix this, remove these two lines and try again.
3)
rails s
generates error:
Missing helper file helpers/products_helper.rb (LoadError)
Issue was I had spree_static_content selecting the 0.70 branch. Change
Gemfile to:
gem 'spree_static_content',
:git => '
http://github.com/spree/spree_static_content',
:branch => 'master'
Activated change by: bundle update // bundle install
4)
rails s
generates error:
/Users/steve/Documents/ruby/spree1/app/models/image_decorator.rb:1:in
`<top (required)>': uninitialized constant Image (NameError)
That's a decorator i added.
Changes from 0.70 to 1.00 on github show the only change was the
removal of the first line "module spree".. before "class Image <
Asset"
Need to put "Spree::" before the model, so a line like:
Image.attachment_definitions[:attachment][:styles] = { :mini =>
'48x48>', :small => '150x120>', :product => '240x240>', :large =>
'600x600>' }
becomes:
Spree::Image.attachment_definitions[:attachment][:styles] = { :mini =>
'48x48>', :small => '150x120>', :product => '240x240>', :large =>
'600x600>' }
5)
rails s works!
open site - RoutingError (no route matches / or /admin)
Fix described in:
http://groups.google.com/group/spree-user/browse_thread/thread/cd65247f5dece15d/9910355c8b034934?lnk=gst&q=no+route+matches#9910355c8b034934
The new approach needs spree to be mounted in the routes, which allows
the spree site to be somewhere like
mydomain.com/shop . In routes.rb,
add the following for spree to be the default site.
mount Spree::Auth::Engine, :at => '/'
mount Spree::Core::Engine, :at => '/'
order of above is important.
### probably worked, got a new error! ###
6) Error when opening site
http://localhost:3000
Mysql2::Error: Table 'spree1_development.spree_product_groups' doesn't
exist: SHOW FIELDS FROM `spree_product_groups`
Engines don't automatically copy their migrations, do just 'rake
db:migrate' isn't sufficient.
See
http://guides.spreecommerce.com/getting_started.html 4.5
Installing the migrations
I assume the 'rails g spree:site' needs to be the same as the original
rails g command used. I've forgotten, but I probably used it exactly
as the manual said…
So in directory, run:
rails g spree:site
###HINDSIGHT###
Could have run: rails g spree:install --migrate=true --sample=false --
seed=false
###############
There are some conflicts to think on: (nb: d = show diff - useful!)
6a)
conflict config/spree.yml
#This contains the spree version… Allowing (Y)
6b)
conflict app/assets/javascripts/store/all.js
# said yes
6c)
conflict app/assets/javascripts/admin/all.js
# said yes
6d)
conflict app/assets/stylesheets/store/all.css
# said yes… may need to revisit this if my styles aren't working
6e)
conflict app/assets/stylesheets/admin/all.css
# said yes.. new require of formtastic (might be notable later..)
6f) Some interesting output, that may relate to problems I'm just
about to discover:
###############
rake db:seed
rake aborted!
No such file or directory - (/Users/steve/Documents/ruby/spree1/tmp/
cache/00020120121-28142-third1, /Users/steve/Documents/ruby/spree1/tmp/
cache/001/000/)
Tasks: TOP => db:seed => db:abort_if_pending_migrations => environment
(See full trace by running task with --trace)
loading sample data
insert config/routes.rb
**************************************************
We added the following line to your application's config/routes.rb
file:
mount Spree::Core::Engine, :at => '/'
**************************************************
Spree has been installed successfully. You're all ready to go!
Enjoy!
DEPRECATION WARNING: rails g spree:site has been deprecated and will
be removed in the future, use rails g spree:install instead. (called
from run_install_generator at /Users/steve/.rvm/gems/ruby-1.9.2-
p290@spreerc/bundler/gems/spree-7d213829038c/lib/generators/spree/site/
site_generator.rb:15)
####################
SO… i've removed the "mount Spree::Core::Engine, :at => '/'" and
"mount Spree::Auth::Engine, :at => '/'" as the Core was duplicated and
the Auth wasn't added (so I'm assuming it wasn't necessary).
SO… db:seed failed, but I already have content… maybe it was smart
enough not to overwrite my data, though I'm not sure what the missing
cache comes from.
SO…. rails g spree:install - is something for the future, but is a
warning only.
SO… migrations appear to run automatically…
but running "rails s" results in error: No such file or directory - (/
Users/steve/Documents/ruby/spree1/tmp/cache/00020120121-44273-9sketb, /
Users/steve/Documents/ruby/spree1/tmp/cache/001/000/) (Errno::ENOENT),
same error when running rake db:migrate
Idea: Cache should be created on demand. Maybe the rake is checking
things are up to date but they've not been created yet. in tmp/cache:
rm -rf * (to delete the contents)
Didn't help. Tried: rails g spree:install --migrate=true --
sample=false --seed=false
- didn't help (same error)
Noticed: running rake db:migrate creates a directory 001 in the tmp/
cache directory then errors. Every error is for a different directory,
e.g. this one for: /Users/steve/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/
1.9.1/fileutils.rb:515:in `rename': No such file or directory - (/
Users/steve/Documents/ruby/spree1/tmp/cache/00020120121-51147-ncl84k, /
Users/steve/Documents/ruby/spree1/tmp/cache/001/000/)
It errors on rename. Suggests cache 00020….etc didn't get created.
What migration would create a tmp file?
Made the sub directory tmp/001/000
(tmp/001 was created. I guess spree didn't want to create 000)
Migrations run OK, same message about Spree::Core::Engine, but it's
not been duplicated.
7) localhost:3000/admin works, but localhost:3000 errors with: 'no
such file to load -- aws-skd (You may need to install the aws-sdk gem)
From Gemfile, removed:gem 'aws-s3'
Added: gem 'aws-sdk'
8) Deface customisations to footer and sidebar not working.
Virtual Paths need to change, e.g. from:
:virtual_path => "layouts/spree_application",
to:
:virtual_path => "spree/layouts/spree_application",
9) New Error
uninitialized constant ActionView::CompiledTemplates::Page
Extracted source (around line #3):
1: <li id="home-link" data-hook><%= link_to t(:home), root_path %></
li>
2: <li id="link-to-cart" data-hook><%= link_to_cart %></li>
3: <% for page in Page.header_links do %>
4: <li><%= link_to page.title, page.link %></li>
5: <% end %>
This comes from one of my Deface overrides, adding pages from the
spree_static_page
First guess: Need to get migrations for namespacing,
rails g spree_static_content:install
Nope, appears they already run.
(Hindsight: I could have checked if the database had table:spree_pages
instead of table:pages)
Second Guess: The object is no longer called 'page', perhaps it's
spree::page or similar…
Solved, replace things like:
<% for page in Page.sidebar_links do %>
with
<% for page in Spree::Page.sidebar_links do %>
10) CSS issue?
Menu on left, headings are black and not yellow...