From 9be9d75cb51421c1f4e720e19c725becc3bad7ae Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 17 Oct 2012 15:10:04 +1100 Subject: [PATCH 1/9] Update version of spree_paypal_express for debugging --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5f8bef40fa..3e9d488152 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GIT remote: git://github.com/RohanM/spree_paypal_express.git - revision: ab580fde06d6b2b607db74a7eb4e5ef52a313862 + revision: 8e81e30b0177c178144136e2075ede05a44e45df branch: 1-1-stable specs: spree_paypal_express (1.1.0) From 41dcc85ad120175607d51c1150ba609085d74555 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Wed, 17 Oct 2012 15:26:06 +1100 Subject: [PATCH 2/9] Update version of spree_paypal_express for debugging --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3e9d488152..4f360e5dba 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,7 +8,7 @@ GIT GIT remote: git://github.com/RohanM/spree_paypal_express.git - revision: 8e81e30b0177c178144136e2075ede05a44e45df + revision: 5c00485cce420967ab6b7ef372949dda64d3a6a7 branch: 1-1-stable specs: spree_paypal_express (1.1.0) From 394a269df2f9411dcbd970a7d035b4522a18533b Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 18 Oct 2012 10:17:52 +1100 Subject: [PATCH 3/9] Update Spree, fixes paypal password blanking bug. Update spree_paypal_express, fixes nil state error on checkout. --- Gemfile | 2 +- Gemfile.lock | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Gemfile b/Gemfile index 1345267977..e1983b6ee1 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ gem 'rails', '3.2.8' gem 'pg' gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-1-stable' gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git' -gem 'spree_paypal_express', :git => 'git://github.com/RohanM/spree_paypal_express.git', :branch => '1-1-stable' +gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git', :branch => '1-1-stable' gem 'spree_last_address', :git => 'git://github.com/dancinglightning/spree-last-address.git' gem 'comfortable_mexican_sofa' diff --git a/Gemfile.lock b/Gemfile.lock index 4f360e5dba..67ec6d1663 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,15 +6,6 @@ GIT actionpack (~> 3.0) activemodel (~> 3.0) -GIT - remote: git://github.com/RohanM/spree_paypal_express.git - revision: 5c00485cce420967ab6b7ef372949dda64d3a6a7 - branch: 1-1-stable - specs: - spree_paypal_express (1.1.0) - spree_auth (>= 1.0.0) - spree_core (>= 1.0.0) - GIT remote: git://github.com/dancinglightning/spree-last-address.git revision: f5ed71a5482fbc16da559737903bb46fe032c150 @@ -32,7 +23,7 @@ GIT GIT remote: git://github.com/spree/spree.git - revision: d66ffac9088d0d5d0b0d146f305044ce619f0464 + revision: 46691e075129fd3d7b59e296d73149a9066c1b9d branch: 1-1-stable specs: spree (1.1.3) @@ -63,7 +54,7 @@ GIT jquery-rails (~> 2.0) kaminari (= 0.13.0) nested_set (= 1.7.0) - paperclip (~> 2.7) + paperclip (~> 2.8) rails (~> 3.2.8) ransack (~> 0.6.0) state_machine (= 1.1.2) @@ -86,6 +77,15 @@ GIT i18n (~> 0.5) spree (~> 1.1) +GIT + remote: git://github.com/spree/spree_paypal_express.git + revision: 267be504e4affd7866a5e31e80565126f9db7cc3 + branch: 1-1-stable + specs: + spree_paypal_express (1.1.0) + spree_auth (>= 1.0.0) + spree_core (>= 1.0.0) + GEM remote: http://rubygems.org/ specs: From f4f250675c6ead2856d5747140b8a08c836a069a Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 18 Oct 2012 10:30:35 +1100 Subject: [PATCH 4/9] Use eaterprises spree_paypal_express with Bugsnag notification of paypal gateway errors --- Gemfile | 2 +- Gemfile.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index e1983b6ee1..2f87854203 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ gem 'rails', '3.2.8' gem 'pg' gem 'spree', :git => 'git://github.com/spree/spree.git', :branch => '1-1-stable' gem 'spree_i18n', :git => 'git://github.com/spree/spree_i18n.git' -gem 'spree_paypal_express', :git => 'git://github.com/spree/spree_paypal_express.git', :branch => '1-1-stable' +gem 'spree_paypal_express', :git => 'git://github.com/eaterprises/spree_paypal_express.git', :branch => '1-1-stable' gem 'spree_last_address', :git => 'git://github.com/dancinglightning/spree-last-address.git' gem 'comfortable_mexican_sofa' diff --git a/Gemfile.lock b/Gemfile.lock index 67ec6d1663..1fa9f631e0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -13,6 +13,15 @@ GIT spree_last_address (1.1.0) spree_core (>= 1.1) +GIT + remote: git://github.com/eaterprises/spree_paypal_express.git + revision: 63963fd3377a41debbf0f12a4cc78122145b0387 + branch: 1-1-stable + specs: + spree_paypal_express (1.1.0) + spree_auth (>= 1.0.0) + spree_core (>= 1.0.0) + GIT remote: git://github.com/joneslee85/spree-heroku.git revision: 63f0cfa47089cae50365e226ec7dd1eccde0ac05 @@ -77,15 +86,6 @@ GIT i18n (~> 0.5) spree (~> 1.1) -GIT - remote: git://github.com/spree/spree_paypal_express.git - revision: 267be504e4affd7866a5e31e80565126f9db7cc3 - branch: 1-1-stable - specs: - spree_paypal_express (1.1.0) - spree_auth (>= 1.0.0) - spree_core (>= 1.0.0) - GEM remote: http://rubygems.org/ specs: From 8c7a02ec102963f2bac2b320ea79df9fec1fcf9a Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 18 Oct 2012 11:13:40 +1100 Subject: [PATCH 5/9] Fix image uploads with CMS --- Gemfile | 2 +- Gemfile.lock | 7 +------ config/initializers/comfortable_mexican_sofa.rb | 5 ++++- config/s3.yml | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 2f87854203..f8f0559a71 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'unicorn' gem 'bugsnag' gem 'spree_heroku', :git => 'git://github.com/joneslee85/spree-heroku.git' gem 'haml' -gem 'aws-s3' +gem 'aws-sdk' gem 'andand' gem 'truncate_html' diff --git a/Gemfile.lock b/Gemfile.lock index 1fa9f631e0..941717651e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -134,10 +134,6 @@ GEM ansi (1.4.2) arel (3.0.2) awesome_print (1.0.2) - aws-s3 (0.6.3) - builder - mime-types - xml-simple aws-sdk (1.3.9) httparty (~> 0.7) json (~> 1.4) @@ -342,7 +338,6 @@ GEM uuidtools (2.1.3) warden (1.1.1) rack (>= 1.0) - xml-simple (1.1.1) xpath (0.1.4) nokogiri (~> 1.3) @@ -352,7 +347,7 @@ PLATFORMS DEPENDENCIES andand awesome_print - aws-s3 + aws-sdk bugsnag capybara coffee-rails (~> 3.2.1) diff --git a/config/initializers/comfortable_mexican_sofa.rb b/config/initializers/comfortable_mexican_sofa.rb index 900178b0cb..67872b3276 100644 --- a/config/initializers/comfortable_mexican_sofa.rb +++ b/config/initializers/comfortable_mexican_sofa.rb @@ -34,7 +34,10 @@ ComfortableMexicanSofa.configure do |config| # the upload method and appropriate settings based on Paperclip. For S3 see: # http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/S3, and for # filesystem see: http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/Filesystem - # config.upload_file_options = {:url => '/system/:class/:id/:attachment/:style/:filename'} + config.upload_file_options = { + :storage => 's3', + :s3_credentials => Rails.root.join('config', 's3.yml') + } # Sofa allows you to setup entire site from files. Database is updated with each # request (if necessary). Please note that database entries are destroyed if there's diff --git a/config/s3.yml b/config/s3.yml index 6b6b8bf42a..55742d4434 100644 --- a/config/s3.yml +++ b/config/s3.yml @@ -1,4 +1,4 @@ -developement: +development: bucket: openfoodweb_test access_key_id: AKIAJ3EE2EKGP36D4PUA secret_access_key: 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 From 9166829930c61e00b61ff343808badacf2e335e9 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 18 Oct 2012 11:56:21 +1100 Subject: [PATCH 6/9] Add group buy unit size field --- app/views/spree/admin/products/_group_buy_form.html.haml | 5 +++++ .../20121018002907_add_group_buy_unit_size_to_products.rb | 5 +++++ db/schema.rb | 3 ++- spec/requests/admin/product_spec.rb | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20121018002907_add_group_buy_unit_size_to_products.rb diff --git a/app/views/spree/admin/products/_group_buy_form.html.haml b/app/views/spree/admin/products/_group_buy_form.html.haml index 7d7bc8cd88..9ede3f8bf8 100644 --- a/app/views/spree/admin/products/_group_buy_form.html.haml +++ b/app/views/spree/admin/products/_group_buy_form.html.haml @@ -5,3 +5,8 @@ = f.label :group_buy_1, 'Yes' = f.radio_button :group_buy, '0', :checked => !f.object.group_buy = f.label :group_buy_0, 'No' + += f.field_container :group_buy_unit_size do + = f.label :group_buy_unit_size + %br + = f.text_field :group_buy_unit_size diff --git a/db/migrate/20121018002907_add_group_buy_unit_size_to_products.rb b/db/migrate/20121018002907_add_group_buy_unit_size_to_products.rb new file mode 100644 index 0000000000..4abc9e5923 --- /dev/null +++ b/db/migrate/20121018002907_add_group_buy_unit_size_to_products.rb @@ -0,0 +1,5 @@ +class AddGroupBuyUnitSizeToProducts < ActiveRecord::Migration + def change + add_column :spree_products, :group_buy_unit_size, :string + end +end diff --git a/db/schema.rb b/db/schema.rb index 71f1204896..e23f9e59a8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20121010004400) do +ActiveRecord::Schema.define(:version => 20121018002907) do create_table "cms_blocks", :force => true do |t| t.integer "page_id", :null => false @@ -487,6 +487,7 @@ ActiveRecord::Schema.define(:version => 20121010004400) do t.integer "count_on_hand", :default => 0, :null => false t.integer "supplier_id" t.boolean "group_buy" + t.string "group_buy_unit_size" end add_index "spree_products", ["available_on"], :name => "index_products_on_available_on" diff --git a/spec/requests/admin/product_spec.rb b/spec/requests/admin/product_spec.rb index 7661587d11..c10d9f410b 100644 --- a/spec/requests/admin/product_spec.rb +++ b/spec/requests/admin/product_spec.rb @@ -49,6 +49,7 @@ feature %q{ fill_in 'product_price', :with => '19.99' select 'New supplier', :from => 'product_supplier_id' choose 'product_group_buy_1' + fill_in 'Group buy unit size', :with => '10 kg' click_button 'Create' From 5b025a6cbad92335acf5c5ced27e5201afe6e500 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Thu, 18 Oct 2012 15:15:54 +1100 Subject: [PATCH 7/9] Make group_buy_unit_size accessible --- app/models/spree/product_decorator.rb | 2 +- spec/requests/admin/product_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/spree/product_decorator.rb b/app/models/spree/product_decorator.rb index 470f92e77c..e97b5f4662 100644 --- a/app/models/spree/product_decorator.rb +++ b/app/models/spree/product_decorator.rb @@ -6,7 +6,7 @@ Spree::Product.class_eval do accepts_nested_attributes_for :product_distributions, :allow_destroy => true - attr_accessible :supplier_id, :distributor_ids, :product_distributions_attributes, :group_buy + attr_accessible :supplier_id, :distributor_ids, :product_distributions_attributes, :group_buy, :group_buy_unit_size validates_presence_of :supplier diff --git a/spec/requests/admin/product_spec.rb b/spec/requests/admin/product_spec.rb index c10d9f410b..37d9935dd2 100644 --- a/spec/requests/admin/product_spec.rb +++ b/spec/requests/admin/product_spec.rb @@ -56,6 +56,7 @@ feature %q{ flash_message.should == 'Product "A new product !!!" has been successfully created!' product = Spree::Product.find_by_name('A new product !!!') product.group_buy.should be_true + product.group_buy_unit_size.should == '10 kg' end end From 4fc7295b97af24f55958ede8ae2f729c69f7a3a5 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Fri, 19 Oct 2012 16:40:18 +1100 Subject: [PATCH 8/9] Use S3 configuration from environment vars instead of s3.yml --- .gitignore | 1 + config/environments/development.rb | 5 +++++ config/initializers/comfortable_mexican_sofa.rb | 8 ++++++-- config/s3.yml | 8 -------- 4 files changed, 12 insertions(+), 10 deletions(-) delete mode 100644 config/s3.yml diff --git a/.gitignore b/.gitignore index 1b7e28ae3e..4996ff5ddf 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,5 @@ public/stylesheets public/images public/spree config/abr.yml +config/heroku_env.rb NERD_tree* diff --git a/config/environments/development.rb b/config/environments/development.rb index 173f84b9da..349ffc0a72 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -28,3 +28,8 @@ Openfoodweb::Application.configure do # Expands the lines which load the assets config.assets.debug = true end + + +# Load heroku vars from local file +heroku_env = File.join(Rails.root, 'config', 'heroku_env.rb') +load(heroku_env) if File.exists?(heroku_env) diff --git a/config/initializers/comfortable_mexican_sofa.rb b/config/initializers/comfortable_mexican_sofa.rb index 67872b3276..ee69720dac 100644 --- a/config/initializers/comfortable_mexican_sofa.rb +++ b/config/initializers/comfortable_mexican_sofa.rb @@ -36,9 +36,13 @@ ComfortableMexicanSofa.configure do |config| # filesystem see: http://rdoc.info/gems/paperclip/2.3.8/Paperclip/Storage/Filesystem config.upload_file_options = { :storage => 's3', - :s3_credentials => Rails.root.join('config', 's3.yml') + :s3_credentials => { + :bucket => ENV['S3_BUCKET'], + :access_key_id => ENV['S3_KEY'], + :secret_access_key => ENV['S3_SECRET'] + } } - + # Sofa allows you to setup entire site from files. Database is updated with each # request (if necessary). Please note that database entries are destroyed if there's # no corresponding file. Fixtures are disabled by default. diff --git a/config/s3.yml b/config/s3.yml deleted file mode 100644 index 55742d4434..0000000000 --- a/config/s3.yml +++ /dev/null @@ -1,8 +0,0 @@ -development: - bucket: openfoodweb_test - access_key_id: AKIAJ3EE2EKGP36D4PUA - secret_access_key: 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 -production: - bucket: openfoodweb_production - access_key_id: AKIAJ3EE2EKGP36D4PUA - secret_access_key: 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 \ No newline at end of file From 87a89324d9acdde6856968c53f9ffe6737a83586 Mon Sep 17 00:00:00 2001 From: Rohan Mitchell Date: Fri, 19 Oct 2012 17:02:09 +1100 Subject: [PATCH 9/9] Update repo in readme, add Rob to creds --- README.markdown | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 5b92159cf9..7d45121b9e 100644 --- a/README.markdown +++ b/README.markdown @@ -20,11 +20,11 @@ hosted at GitHub. You can view the code at: - https://github.com/andrewspinks/openfoodweb + https://github.com/eaterprises/openfoodweb You can download the source with the command: - git clone git@github.com:andrewspinks/openfoodweb + git clone git@github.com:eaterprises/openfoodweb ## Get it running @@ -80,6 +80,7 @@ speak to Andrew Spinks. * Andrew Spinks (http://github.com/andrewspinks) * Rohan Mitchell (http://github.com/rohanm) +* Rob Harrington (http://github.com/oeoeaio) ## Licence