Permalink
Browse files

first UNTESTED-no-chance-it-will-work step towards spree 1.0 support

  • Loading branch information...
1 parent 639ffc7 commit 7f9a68d43029c3e7733c1e982b02fbc5008d6072 @jsqu99 committed Feb 19, 2012
Showing with 1,156 additions and 856 deletions.
  1. +13 −0 Gemfile
  2. +215 −0 Gemfile.lock
  3. +10 −20 README.md
  4. +12 −33 Rakefile
  5. +2 −1 Versionfile
  6. +0 −29 app/controllers/admin/ad_hoc_option_types_controller.rb
  7. +0 −11 app/controllers/admin/ad_hoc_option_values_controller.rb
  8. +0 −44 app/controllers/admin/ad_hoc_variant_exclusions_controller.rb
  9. +0 −16 app/controllers/admin/line_items_controller_decorator.rb
  10. +0 −33 app/controllers/admin/option_types_controller_decorator.rb
  11. +0 −79 app/controllers/admin/product_customization_types_controller.rb
  12. +0 −10 app/controllers/admin/variant_configurations_controller.rb
  13. +0 −29 app/controllers/orders_controller_decorator.rb
  14. +0 −16 app/controllers/product_customizations_controller.rb
  15. +0 −22 app/controllers/products_controller_decorator.rb
  16. +31 −0 app/controllers/spree/admin/ad_hoc_option_types_controller.rb
  17. +13 −0 app/controllers/spree/admin/ad_hoc_option_values_controller.rb
  18. +46 −0 app/controllers/spree/admin/ad_hoc_variant_exclusions_controller.rb
  19. +18 −0 app/controllers/spree/admin/line_items_controller_decorator.rb
  20. +35 −0 app/controllers/spree/admin/option_types_controller_decorator.rb
  21. +81 −0 app/controllers/spree/admin/product_customization_types_controller.rb
  22. +12 −0 app/controllers/spree/admin/variant_configurations_controller.rb
  23. +30 −0 app/controllers/spree/orders_controller_decorator.rb
  24. +18 −0 app/controllers/spree/product_customizations_controller.rb
  25. +24 −0 app/controllers/spree/products_controller_decorator.rb
  26. +0 −83 app/helpers/products_helper_decorator.rb
  27. +85 −0 app/helpers/spree/products_helper_decorator.rb
  28. +0 −18 app/models/ad_hoc_option_type.rb
  29. +0 −18 app/models/ad_hoc_option_value.rb
  30. +0 −4 app/models/ad_hoc_option_values_line_item.rb
  31. +0 −4 app/models/ad_hoc_variant_exclusion.rb
  32. +0 −38 app/models/calculator/amount_times_constant.rb
  33. +0 −36 app/models/calculator/customization_image.rb
  34. +0 −31 app/models/calculator/engraving.rb
  35. +0 −78 app/models/calculator/product_area.rb
  36. +0 −4 app/models/customizable_product_option.rb
  37. +0 −12 app/models/customized_product_option.rb
  38. +0 −4 app/models/excluded_ad_hoc_option_value.rb
  39. +0 −5 app/models/line_item_decorator.rb
  40. +0 −3 app/models/option_type_decorator.rb
  41. +0 −3 app/models/option_value_decorator.rb
  42. +0 −86 app/models/order_decorator.rb
  43. +0 −16 app/models/product_customization.rb
  44. +0 −6 app/models/product_customization_type.rb
  45. +0 −19 app/models/product_decorator.rb
  46. +20 −0 app/models/spree/ad_hoc_option_type.rb
  47. +20 −0 app/models/spree/ad_hoc_option_value.rb
  48. +6 −0 app/models/spree/ad_hoc_option_values_line_item.rb
  49. +6 −0 app/models/spree/ad_hoc_variant_exclusion.rb
  50. +36 −0 app/models/spree/calculator/amount_times_constant.rb
  51. +38 −0 app/models/spree/calculator/customization_image.rb
  52. +33 −0 app/models/spree/calculator/engraving.rb
  53. +70 −0 app/models/spree/calculator/product_area.rb
  54. +6 −0 app/models/spree/customizable_product_option.rb
  55. +14 −0 app/models/spree/customized_product_option.rb
  56. +6 −0 app/models/spree/excluded_ad_hoc_option_value.rb
  57. +7 −0 app/models/spree/line_item_decorator.rb
  58. +5 −0 app/models/spree/option_type_decorator.rb
  59. +5 −0 app/models/spree/option_value_decorator.rb
  60. +88 −0 app/models/spree/order_decorator.rb
  61. +18 −0 app/models/spree/product_customization.rb
  62. +8 −0 app/models/spree/product_customization_type.rb
  63. +21 −0 app/models/spree/product_decorator.rb
  64. +2 −0 app/uploaders/{ → spree}/customization_image_uploader.rb
  65. 0 app/views/{ → spree}/admin/ad_hoc_option_types/_form.html.erb
  66. 0 app/views/{ → spree}/admin/ad_hoc_option_types/_option_value_fields.html.erb
  67. 0 app/views/{ → spree}/admin/ad_hoc_option_types/_selected.html.erb
  68. 0 app/views/{ → spree}/admin/ad_hoc_option_types/_selected_edit.html.erb
  69. 0 app/views/{ → spree}/admin/ad_hoc_option_types/edit.html.erb
  70. 0 app/views/{ → spree}/admin/ad_hoc_option_types/selected.html.erb
  71. 0 app/views/{ → spree}/admin/ad_hoc_variant_exclusions/_form.html.erb
  72. 0 app/views/{ → spree}/admin/ad_hoc_variant_exclusions/index.html.erb
  73. 0 app/views/{ → spree}/admin/ad_hoc_variant_exclusions/new.html.erb
  74. 0 app/views/{ → spree}/admin/ad_hoc_variant_exclusions/new.js.erb
  75. 0 app/views/{ → spree}/admin/option_types/_available_ad_hoc.html.erb
  76. 0 app/views/{ → spree}/admin/option_types/_option_value_price.html.erb
  77. 0 app/views/{ → spree}/admin/option_types/available_ad_hoc.js.erb
  78. 0 app/views/{ → spree}/admin/option_types/select_ad_hoc.js.erb
  79. 0 app/views/{ → spree}/admin/orders/_add_product.html.erb
  80. 0 app/views/{ → spree}/admin/orders/_admin_order_form_line_item_row.html.erb
  81. 0 app/views/{ → spree}/admin/product_customization_types/_available.html.erb
  82. 0 app/views/{ → spree}/admin/product_customization_types/_customizable_product_option_fields.html.erb
  83. 0 app/views/{ → spree}/admin/product_customization_types/_form.html.erb
  84. 0 app/views/{ → spree}/admin/product_customization_types/_selected.html.erb
  85. 0 app/views/{ → spree}/admin/product_customization_types/available.js.erb
  86. 0 app/views/{ → spree}/admin/product_customization_types/edit.html.erb
  87. 0 app/views/{ → spree}/admin/product_customization_types/index.html.erb
  88. 0 app/views/{ → spree}/admin/product_customization_types/new.html.erb
  89. 0 app/views/{ → spree}/admin/product_customization_types/select.js.erb
  90. 0 app/views/{ → spree}/admin/product_customization_types/selected.html.erb
  91. 0 app/views/{ → spree}/admin/products/_additional_product_tabs.html.erb
  92. 0 app/views/{ → spree}/admin/shared/_tabs.html.erb
  93. 0 app/views/{ → spree}/order_mailer/cancel_email.text.erb
  94. 0 app/views/{ → spree}/order_mailer/confirm_email.text.erb
  95. 0 app/views/{ → spree}/orders/_cart_item_description.html.erb
  96. 0 app/views/{ → spree}/orders/custom_fields/_fancy_height.html.erb
  97. 0 app/views/{ → spree}/products/_ad_hoc_option_types.html.erb
  98. 0 app/views/{ → spree}/products/_content_for_head.html.erb
  99. 0 app/views/{ → spree}/products/_customizations.html.erb
  100. 0 app/views/{ → spree}/products/_pricing.html.erb
  101. 0 app/views/{ → spree}/products/ad_hoc_options/_toppings.html.erb
  102. 0 app/views/{ → spree}/products/customizations/README.txt
  103. 0 app/views/{ → spree}/products/customizations/calculator/_amount_times_constant.html.erb
  104. 0 app/views/{ → spree}/products/customizations/calculator/_customization_image.html.erb
  105. 0 app/views/{ → spree}/products/customizations/calculator/_engraving.html.erb
  106. 0 app/views/{ → spree}/products/customizations/calculator/_product_area.html.erb
  107. 0 app/views/{ → spree}/products/customizations/calculator_type/_amount_times_constant.html.erb
  108. 0 app/views/{ → spree}/products/customizations/calculator_type/_customization_image.html.erb
  109. 0 app/views/{ → spree}/products/customizations/calculator_type/_engraving.html.erb
  110. 0 app/views/{ → spree}/products/customizations/calculator_type/_product_area.html.erb
  111. 0 app/views/{ → spree}/products/customize.html.erb
  112. 0 app/views/{ → spree}/products/show.html.erb
  113. 0 app/views/{ → spree}/shared/_additional_line_item_fields.html.erb
  114. 0 app/views/{ → spree}/shared/_additional_line_item_fields.text.erb
  115. 0 app/views/{ → spree}/shared/_order_details_line_item_row.html.erb
  116. 0 app/views/{ → spree}/shared/variant_configurations/_ad_hoc_option_types.html.erb
  117. 0 app/views/{ → spree}/shared/variant_configurations/_configure.html.erb
  118. 0 app/views/{ → spree}/shared/variant_configurations/_customizations.html.erb
  119. 0 app/views/{ → spree}/shared/variant_configurations/configure.js.erb
  120. 0 ...spree}/shared/variant_configurations/customizations/calculator_type/_customization_image.html.erb
  121. +2 −4 config/routes.rb
  122. +27 −0 db/migrate/20120219033555_namespace_flexi_variants_tables.rb
  123. +13 −0 lib/generators/spree_flexi_variants/install/install_generator.rb
  124. +1 −37 lib/spree_flexi_variants.rb
  125. +40 −0 lib/spree_flexi_variants/engine.rb
  126. +5 −0 script/rails
  127. +5 −4 spec/spec_helper.rb
  128. +9 −0 spree_flexi_variants.gemspec
View
13 Gemfile
@@ -0,0 +1,13 @@
+source 'http://rubygems.org'
+
+group :test do
+ gem 'ffaker'
+end
+
+if RUBY_VERSION < "1.9"
+ gem "ruby-debug"
+else
+ gem "ruby-debug19"
+end
+
+gemspec
View
@@ -0,0 +1,215 @@
+PATH
+ remote: .
+ specs:
+ spree_flexi_variants (1.0.0)
+ carrierwave
+ json
+ rmagick
+ spree_core (~> 1.0.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.3)
+ actionpack (= 3.1.3)
+ mail (~> 2.3.0)
+ actionpack (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.5)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.3)
+ active_utils (1.0.2)
+ activesupport (>= 2.3.11)
+ i18n
+ activemerchant (1.20.1)
+ active_utils (>= 1.0.1)
+ activesupport (>= 2.3.11)
+ braintree (>= 2.0.0)
+ builder (>= 2.0.0)
+ i18n
+ json (>= 1.5.1)
+ money (<= 3.7.1)
+ activemodel (3.1.3)
+ activesupport (= 3.1.3)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ arel (~> 2.2.1)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.3)
+ activemodel (= 3.1.3)
+ activesupport (= 3.1.3)
+ activesupport (3.1.3)
+ multi_json (~> 1.0)
+ acts_as_list (0.1.4)
+ archive-tar-minitar (0.5.2)
+ arel (2.2.1)
+ braintree (2.13.4)
+ builder (>= 2.0.0)
+ builder (3.0.0)
+ capybara (1.0.1)
+ mime-types (>= 1.16)
+ nokogiri (>= 1.3.3)
+ rack (>= 1.0.0)
+ rack-test (>= 0.5.4)
+ selenium-webdriver (~> 2.0)
+ xpath (~> 0.1.4)
+ carrierwave (0.5.8)
+ activesupport (~> 3.0)
+ childprocess (0.3.1)
+ ffi (~> 1.0.6)
+ cocaine (0.2.1)
+ columnize (0.3.6)
+ deface (0.7.2)
+ nokogiri (~> 1.5.0)
+ rails (>= 3.0.9)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ factory_girl (2.4.2)
+ activesupport
+ ffaker (1.12.1)
+ ffi (1.0.11)
+ highline (1.6.8)
+ hike (1.2.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.19)
+ railties (~> 3.0)
+ thor (~> 0.14)
+ json (1.6.5)
+ kaminari (0.13.0)
+ actionpack (>= 3.0.0)
+ activesupport (>= 3.0.0)
+ railties (>= 3.0.0)
+ linecache19 (0.5.13)
+ ruby_core_source (>= 0.1.4)
+ mail (2.3.0)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ meta_search (1.1.1)
+ actionpack (~> 3.1.0)
+ activerecord (~> 3.1.0)
+ activesupport (~> 3.1.0)
+ polyamorous (~> 0.5.0)
+ mime-types (1.17.2)
+ money (3.7.1)
+ i18n (~> 0.4)
+ multi_json (1.0.4)
+ nested_set (1.6.8)
+ activerecord (>= 3.0.0)
+ railties (>= 3.0.0)
+ nokogiri (1.5.0)
+ paperclip (2.5.0)
+ activerecord (>= 2.3.0)
+ activesupport (>= 2.3.2)
+ cocaine (>= 0.0.2)
+ mime-types
+ polyamorous (0.5.0)
+ activerecord (~> 3.0)
+ polyglot (0.3.3)
+ rack (1.3.6)
+ rack-cache (1.1)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.3)
+ actionmailer (= 3.1.3)
+ actionpack (= 3.1.3)
+ activerecord (= 3.1.3)
+ activeresource (= 3.1.3)
+ activesupport (= 3.1.3)
+ bundler (~> 1.0)
+ railties (= 3.1.3)
+ railties (3.1.3)
+ actionpack (= 3.1.3)
+ activesupport (= 3.1.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rmagick (2.13.1)
+ rspec (2.8.0)
+ rspec-core (~> 2.8.0)
+ rspec-expectations (~> 2.8.0)
+ rspec-mocks (~> 2.8.0)
+ rspec-core (2.8.0)
+ rspec-expectations (2.8.0)
+ diff-lcs (~> 1.1.2)
+ rspec-mocks (2.8.0)
+ rspec-rails (2.8.1)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ railties (>= 3.0)
+ rspec (~> 2.8.0)
+ ruby-debug-base19 (0.11.26)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby_core_source (>= 0.1.4)
+ ruby-debug19 (0.11.6)
+ columnize (>= 0.3.1)
+ linecache19 (>= 0.5.11)
+ ruby-debug-base19 (>= 0.11.19)
+ ruby_core_source (0.1.5)
+ archive-tar-minitar (>= 0.5.2)
+ rubyzip (0.9.5)
+ selenium-webdriver (2.16.0)
+ childprocess (>= 0.2.5)
+ ffi (~> 1.0.9)
+ multi_json (~> 1.0.4)
+ rubyzip
+ spree_core (1.0.0)
+ activemerchant (= 1.20.1)
+ acts_as_list (= 0.1.4)
+ deface (>= 0.7.2)
+ ffaker (~> 1.12.0)
+ highline (= 1.6.8)
+ jquery-rails (>= 1.0.18, <= 1.0.19)
+ kaminari (>= 0.13.0)
+ meta_search (= 1.1.1)
+ nested_set (= 1.6.8)
+ paperclip (= 2.5.0)
+ rails (>= 3.1.1, <= 3.1.3)
+ state_machine (= 1.1.1)
+ stringex (~> 1.3.0)
+ sprockets (2.0.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sqlite3 (1.3.5)
+ state_machine (1.1.1)
+ stringex (1.3.0)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.31)
+ xpath (0.1.4)
+ nokogiri (~> 1.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ capybara (= 1.0.1)
+ factory_girl
+ ffaker
+ rspec-rails (~> 2.7)
+ ruby-debug19
+ spree_flexi_variants!
+ sqlite3
View
@@ -3,6 +3,11 @@ SpreeFlexiVariants
This is a [spree](http://spreecommerce.com) extension that solves two use cases related to variants. I call them **Ad Hoc Options** and **Product Customizations**.
+
+The branch you are currently on (master) is an upgrade-in-progress to spree 1.0. It does _not_ yet work
+-------------------------------------------------------------------------------------------------------
+Please see the Versionfile for working spree 0.70 spree spree 0.60 versions
+
Ad Hoc Options
--------------
@@ -20,8 +25,12 @@ Use these when you want the ability to provide a highly customized product e.g.
Version Notes
=============
-This is the rails 3.1-compatible version. It is bleeding edge, but there are no known issues at this point.
+The branch you are currently on (master) is an upgrade-in-progress to spree 1.0. It does _not_ yet work.
+Please see the Versionfile for working spree 0.70 spree spree 0.60 versions
+
+Version 2
+----------
I'm excited to announce that I'm working feverishly on a complete rewrite (currently in the v2 branch (and highly pre-alpha), if you are curious).
After using this extension in a few projects, I discovered some areas for improvement.
@@ -47,25 +56,6 @@ The current version does not allow you to later look up the variant and be able
* Fewer new models!
-Installation
-------------
- rails new myapp
- cd myapp
-
-Add to Gemfile (NOTE: spree master is currently unsupported! The namespace changes are not yet reflected in this extension).
-
- # see the notes in Versionfile if you are using an older version of spree
- gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '0-70-stable'
- gem 'rmagick'
- gem 'carrierwave'
- gem 'spree_flexi_variants', :git=>'git@github.com:jsqu99/spree_flexi_variants.git'
-
- bundle install
-
- bundle exec rails g spree:site # this installs flexi's migrations as well!, via railties:install:migrations
- bundle exec rails g spree_flexi_variants:install # copies the assets
- bundle exec rake db:bootstrap
-
## Examples
View
@@ -1,9 +1,9 @@
-# encoding: utf-8
-require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/packagetask'
require 'rubygems/package_task'
+require 'rspec/core/rake_task'
+require 'spree/core/testing_support/common_rake'
gemfile = File.expand_path('../spec/test_app/Gemfile', __FILE__)
if File.exists?(gemfile) && (%w(spec cucumber).include?(ARGV.first.to_s) || ARGV.size == 0)
@@ -25,38 +25,17 @@ Gem::PackageTask.new(spec) do |p|
p.gem_spec = spec
end
-desc "Regenerates a rails 3 app for testing"
-task :test_app do
- SPREE_PATH = ENV['SPREE_PATH']
- raise "SPREE_PATH should be specified (where is your source code for spree?)" unless SPREE_PATH
-
- require File.join(SPREE_PATH, 'lib/generators/spree/test_app_generator')
-
- class SpreeFlexiVariantsTestAppGenerator < Spree::Generators::TestAppGenerator
-
- def install_gems
- inside "test_app" do
- run 'bundle exec rake spree:install'
- run 'bundle exec rake spree_flexi_variants:install:migrations'
- end
- end
-
- def migrate_db
- run_migrations
- end
-
- protected
- def full_path_for_local_gems
- <<-gems
-gem 'spree', :path => \'#{SPREE_PATH}\'
-gem 'carrierwave'
-gem 'rmagick'
-gem 'spree_flexi_variants', :path => \'#{File.expand_path('..', __FILE__)}\'
- gems
- end
+desc "Release to gemcutter"
+task :release => :package do
+ require 'rake/gemcutter'
+ Rake::Gemcutter::Tasks.new(spec).define
+ Rake::Task['gem:push'].invoke
+end
- end
- SpreeFlexiVariantsTestAppGenerator.start
+desc "Generates a dummy app for testing"
+task :test_app do
+ ENV['LIB_NAME'] = 'spree_flexi_variants'
+ Rake::Task['common:test_app'].invoke
end
namespace :test_app do
View
@@ -13,4 +13,5 @@
#
#
"0.60.x" => { :branch => "spree-0-60-stable" }
-"0.70.x" => { :branch => "master" }
+"0.70.x" => { :branch => "spree-0-70-stable" }
+"1.0.x" => { :branch => "master" }
@@ -1,29 +0,0 @@
-class Admin::AdHocOptionTypesController < Admin::ResourceController
-
- before_filter :load_product, :only => [:selected]
-
- def selected
- @option_types = @product.ad_hoc_option_types
- end
-
- def remove
- # TODO: when removing an option type, we need to check if removing the option type from an
- # associated exclusion causes the exclusion to only have one member. If so, we'll need to
- # remove the entire exclusion
- @product=@ad_hoc_option_type.product
- @ad_hoc_option_type.destroy
- flash.notice = I18n.t("notice_messages.option_type_removed")
- redirect_to selected_admin_product_ad_hoc_option_types_url(@product)
- end
-
- protected
- def location_after_save
- selected_admin_product_ad_hoc_option_types_url(@ad_hoc_option_type.product)
- end
-
- private
- def load_product
- @product = Product.find_by_param!(params[:product_id])
- end
-
-end
@@ -1,11 +0,0 @@
-class Admin::AdHocOptionValuesController < Admin::ResourceController
- def update_positions
- params[:positions].each do |id, index|
- AdHocOptionValue.update_all(['position=?', index], ['id=?', id])
- end
-
- respond_to do |format|
- format.js { render :text => 'Ok' }
- end
- end
-end
Oops, something went wrong.

0 comments on commit 7f9a68d

Please sign in to comment.