Spree¶
El camino "más suave" es:
$ sudo gem install rails (si Rails 3)
Cree su proyecto nuevo:
$ rails new mystore ... $ cd mystore
Edite GemFile y agregue:
... $ gem 'spree'
Using the Gem
-------------
Start by adding the gem to your existing Rails 3.x application's Gemfile
gem 'spree'
Update your bundle
bundle install
Then use the install generator to do the basic setup (add Spree to Gemfile, etc.)
rails g spree:site
Now its time to install all of the necessary migrations, assets, etc.
rake spree:install
If you'd like to also install sample data and images you can follow up the above command with:
rake spree_sample:install
Now you just need to run the new migrations
rake db:migrate
rake db:seed
If you also want some sample products, orders, etc. to play with you can run the appropriate rake task.
rake db:sample
[gomix@fricky mystore]$ bundle install Fetching source index for http://rubygems.org/ Enter your password to install the bundled RubyGems to your system: Using rake (0.8.7) Using abstract (1.0.0) Using activesupport (3.0.5) Using builder (2.1.2) Installing i18n (0.5.0) Using activemodel (3.0.5) Using erubis (2.6.6) Installing rack (1.2.2) Installing rack-mount (0.6.14) Using rack-test (0.5.7) Installing tzinfo (0.3.25) Using actionpack (3.0.5) Using mime-types (1.16) Using polyglot (0.3.1) Using treetop (1.4.9) Using mail (2.2.15) Using actionmailer (3.0.5) Using braintree (2.9.1) Using activemerchant (1.12.0) Using arel (2.0.9) Using activerecord (3.0.5) Using activeresource (3.0.5) Using acts_as_list (0.1.2) Using bcrypt-ruby (2.1.4) Using bundler (1.0.10) Using cancan (1.5.1) Using orm_adapter (0.0.4) Using warden (1.0.3) Using devise (1.2.rc2) Using faker (0.9.5) Using highline (1.5.1) Using thor (0.14.6) Using railties (3.0.5) Using rails (3.0.5) Using jquery-rails (0.2.6) Using meta_search (1.0.1) Using nested_set (1.6.4) Using paperclip (2.3.8) Using rd_resource_controller (1.0.1) Using rd_unobtrusive_date_picker (0.1.0) Using state_machine (0.9.4) Using stringex (1.0.3) Using will_paginate (3.0.pre2) Using spree_core (0.50.0) Using spree_api (0.50.0) Using spree_auth (0.50.0) Using spree_dash (0.50.0) Using spree_promo (0.50.0) Using spree_sample (0.50.0) Using spree (0.50.0) Installing sqlite3 (1.3.3) with native extensions Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
[gomix@fricky mystore]$ rails g spree:site
create lib/spree_site.rb
remove public/index.html
append public/robots.txt
append db/seeds.rb
[gomix@fricky mystore]$ rake spree:install
(in /home/gomix/tmp/spree-tempo/mystore)
INFO: Mirroring assets from /usr/lib/ruby/gems/1.8/gems/spree_dash-0.50.0/lib/tasks/../../public to /home/gomix/tmp/spree-tempo/mystore/public
INFO: Mirroring assets from /usr/lib/ruby/gems/1.8/gems/spree_promo-0.50.0/lib/tasks/../../public to /home/gomix/tmp/spree-tempo/mystore/public
[gomix@fricky mystore]$ rake spree_sample:install
...
[gomix@fricky mystore]$ rake db:migrate
...
== AddPositionToOptionTypes: migrating =======================================
-- add_column(:option_types, :position, :integer, {:null=>false, :default=>0})
-> 0.0016s
== AddPositionToOptionTypes: migrated (0.0019s) ==============================
== RemoveTrailingSlashesInTaxonPermalinks: migrating =========================
== RemoveTrailingSlashesInTaxonPermalinks: migrated (0.0049s) ================
[gomix@fricky mystore]$ rake db:seed
(in /home/gomix/tmp/spree-tempo/mystore)
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/default/countries.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/default/roles.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/default/states.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/default/zone_members.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/default/zones.yml
Default data has been loaded
[gomix@fricky mystore]$ rake db:sample
(in /home/gomix/tmp/spree-tempo/mystore)
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/addresses.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/adjustments.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/assets.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/calculators.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/line_items.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/option_types.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/option_values.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/orders.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/payment_methods.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/preferences.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/product_groups.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/product_option_types.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/product_properties.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/product_scopes.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/products.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/properties.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/prototypes.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/shipments.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/shipping_categories.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/shipping_methods.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/tax_categories.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/taxonomies.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/taxons.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/users.yml
loading fixture /home/gomix/tmp/spree-tempo/mystore/db/sample/variants.yml
loading ruby /home/gomix/tmp/spree-tempo/mystore/db/sample/inventory_units.rb
loading ruby /home/gomix/tmp/spree-tempo/mystore/db/sample/payments.rb
Processing order 99
loading ruby /home/gomix/tmp/spree-tempo/mystore/db/sample/products.rb
-- Processing image: ror_tote.jpeg
-- Processing image: ror_tote_back.jpeg
-- Processing image: ror_bag.jpeg
-- Processing image: ror_baseball.jpeg
-- Processing image: ror_baseball_back.jpeg
-- Processing image: ror_jr_spaghetti.jpeg
-- Processing image: ror_mug.jpeg
-- Processing image: ror_mug_back.jpeg
-- Processing image: ror_ringer.jpeg
-- Processing image: ror_ringer_back.jpeg
-- Processing image: ror_stein.jpeg
-- Processing image: ror_stein_back.jpeg
-- Processing image: apache_baseball.png
-- Processing image: ruby_baseball.png
-- Processing image: ror_baseball_jersey_green.png
-- Processing image: ror_baseball_jersey_back_green.png
-- Processing image: ror_baseball_jersey_green.png
-- Processing image: ror_baseball_jersey_back_green.png
-- Processing image: ror_baseball_jersey_green.png
-- Processing image: ror_baseball_jersey_back_green.png
-- Processing image: ror_baseball_jersey_blue.png
-- Processing image: ror_baseball_jersey_back_blue.png
-- Processing image: ror_baseball_jersey_blue.png
-- Processing image: ror_baseball_jersey_back_blue.png
-- Processing image: ror_baseball_jersey_blue.png
-- Processing image: ror_baseball_jersey_back_blue.png
-- Processing image: ror_baseball_jersey_red.png
-- Processing image: ror_baseball_jersey_back_red.png
-- Processing image: ror_baseball_jersey_red.png
-- Processing image: ror_baseball_jersey_back_red.png
-- Processing image: ror_baseball_jersey_red.png
-- Processing image: ror_baseball_jersey_back_red.png
loading ruby /home/gomix/tmp/spree-tempo/mystore/db/sample/taxons.rb
loading ruby /home/gomix/tmp/spree-tempo/mystore/db/sample/update_memberships.rb
loading ruby /home/gomix/tmp/spree-tempo/mystore/db/sample/users.rb
Create the admin user (press enter for defaults).
Email [spree@example.com]:
Password [spree123]:
Sample data has been loaded
[gomix@fricky mystore]$ rails server
=> Booting WEBrick
=> Rails 3.0.5 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-03-28 18:34:45] INFO WEBrick 1.3.1
[2011-03-28 18:34:45] INFO ruby 1.8.7 (2010-08-16) [i386-linux]
[2011-03-28 18:34:45] INFO WEBrick::HTTPServer#start: pid=28655 port=3000
Started GET "/" for 127.0.0.1 at Mon Mar 28 18:34:46 -0430 2011
SQL (4.1ms) SELECT name
FROM sqlite_master
WHERE type = 'table' AND NOT name = 'sqlite_sequence'
...
Abajo un pantallazo:
