diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..cf6add7 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--colour \ No newline at end of file diff --git a/Gemfile b/Gemfile index caa8242..d272462 100644 --- a/Gemfile +++ b/Gemfile @@ -1,8 +1,6 @@ source 'http://rubygems.org' group :test do - # without ffaker in test it wont init - # https://github.com/spree/spree/pull/833 gem 'ffaker' gem 'shoulda-matchers' gem 'guard-rspec' @@ -13,4 +11,6 @@ group :test do end end +gem 'spree', '~> 1.1.1' + gemspec diff --git a/README.textile b/README.textile index 9fe62d0..a6e7dfa 100644 --- a/README.textile +++ b/README.textile @@ -4,6 +4,8 @@ This is a spree extension to enable downloadable products. The design goal is to NOTE: This is still under development, but since things were falling into place, I thought I'd publish it. +The master branch may work with spree 1.0, but the latest confirmed working version if referenced in the Versionfile. + The idea is simple. You attach a file to a Product (or a Variant of this Product) and when people buy it, they will receive a link via email where they can download it once. There are a few assumptions that spree_digital (currently) makes and it's important to be aware of them. These might change, but since I programmed digital_spree over night, this is what you get ;) * The table structure of spree_core is not touched. Spree_digital lives parallel to spree_core and does not do any changes to your existing database, except adding two new tables. diff --git a/Versionfile b/Versionfile index 42e13a1..595dd62 100644 --- a/Versionfile +++ b/Versionfile @@ -1,2 +1,3 @@ "0.7.x" => { :ref => "eddaea63959586d123007cbca3be5bf9c5edb1a7" } -"1.0.x" => { :branch => "master" } +"1.0.x" => { :ref => "a8c27750ef1cf9d0ad1a2a6ebe33307da900a5c1" } +"1.1.x" => { :branch => "master" } diff --git a/app/models/spree/digital.rb b/app/models/spree/digital.rb index d1d4bd1..30282a4 100644 --- a/app/models/spree/digital.rb +++ b/app/models/spree/digital.rb @@ -6,6 +6,8 @@ module Spree has_attached_file :attachment, :path => ":rails_root/private/digitals/:id/:basename.:extension" # TODO: Limit the attachment to one single file. Paperclip supports many by default :/ + + attr_accessible :variant_id, :attachment end end \ No newline at end of file diff --git a/app/models/spree/digital_link.rb b/app/models/spree/digital_link.rb index 1b794bc..1bf1ee7 100644 --- a/app/models/spree/digital_link.rb +++ b/app/models/spree/digital_link.rb @@ -27,6 +27,8 @@ module Spree self.secret = SecureRandom.hex(15) self.access_counter = 0 end - + + attr_accessible :digital, :line_item, :secret + end end \ No newline at end of file diff --git a/app/overrides/modify_shipping_options_display.rb b/app/overrides/modify_shipping_options_display.rb index e05104a..69cf011 100644 --- a/app/overrides/modify_shipping_options_display.rb +++ b/app/overrides/modify_shipping_options_display.rb @@ -20,10 +20,9 @@ Deface::Override.new(:virtual_path => "spree/checkout/_delivery", <%== t 'digital_shipping', :email => @order.email %> (<%= number_to_currency @order.digital_shipping_method[:cost] %>) <% else %> -<% filtered_rate_hash = @order.rate_hash.select { |m| !(@order.digital_shipping_method && shipping_method[:id] == @order.digital_shipping_method[:id]) } %> +<% filtered_rate_hash = @order.rate_hash.select { |m| !(@order.digital_shipping_method && m[:id] == @order.digital_shipping_method[:id]) } %> <% if filtered_rate_hash.count > 0 %> <% filtered_rate_hash.each do |shipping_method| %> -<% next if @order.digital_shipping_method && shipping_method[:id] == @order.digital_shipping_method[:id] %>