Author SHA1 Message Date
Michael Bianco 40bb298bc8 Updating documentation. Adding nginx send_file info 2012-11-06 11:35:30 -05:00
11 changed files with 19 additions and 46 deletions
+1 -1
View File
@@ -9,4 +9,4 @@ group :test do
end end
end end
gem 'spree', '~> 1.2.3' gem 'spree', '~> 1.1.3'
@@ -1,6 +1,6 @@
module Spree module Spree
class Admin::DigitalsController < Spree::Admin::ResourceController class Admin::DigitalsController < Spree::Admin::ResourceController
belongs_to "spree/product", :find_by => :permalink belongs_to "spree/product", find_by: :permalink
protected protected
def location_after_save def location_after_save
@@ -1,7 +0,0 @@
Spree::Admin::OrdersController.class_eval do
def reset_digitals
@order.reset_digital_links!
flash[:notice] = t(:downloads_reset)
redirect_to admin_order_url(@order)
end
end
+1 -7
View File
@@ -10,14 +10,8 @@ Spree::Order.class_eval do
false false
end end
def reset_digital_links! # UPGRADE_CHECK this works as of spree 1.1.1; make sure to check the original function on upgrade
line_items.select(&:digital?).map(&:digital_links).flatten.each do |digital_link|
digital_link.update_column :access_counter, 0
digital_link.update_column :created_at, Time.now
end
end
# UPGRADE_CHECK this works as of spree 1.2.0. check function for changes on upgrade
def available_shipping_methods(display_on = nil) def available_shipping_methods(display_on = nil)
return [] unless ship_address return [] unless ship_address
all_methods = Spree::ShippingMethod.all_available(self, display_on) all_methods = Spree::ShippingMethod.all_available(self, display_on)
@@ -1,7 +0,0 @@
Deface::Override.new(:virtual_path => "spree/admin/shared/_order_tabs",
:name => "add_reset_digitals_to_admin_orders",
:insert_after => ".sidebar",
:text => %q{
<%= content_tag(:p, button_link_to(t(:reset_downloads), reset_digitals_admin_order_url(@order)), class: 'clear') if @order.digital? or true %>
},
:disabled => false)
-2
View File
@@ -1,7 +1,5 @@
en: en:
digital_versions: Digital Versions digital_versions: Digital Versions
reset_downloads: Reset Digital Downloads
downloads_reset: Digital Downloads Reset
current_file: Current File current_file: Current File
new_file: New File new_file: New File
delete_file: Delete this file delete_file: Delete this file
+2 -7
View File
@@ -3,13 +3,8 @@ Spree::Core::Engine.routes.draw do
resources :products do resources :products do
resources :digitals resources :digitals
end end
resources :orders do
member do
get :reset_digitals
end
end
end end
get '/digital/:secret', :to => 'digitals#show', :via => :get, :as => 'digital', :constraints => { :secret => /[a-zA-Z0-9]{30}/ } get '/digital/:secret', :to => 'digitals#show', :via => :get, :as => 'digital', :constraints => { :secret => /[a-zA-Z0-9]{30}/ }
end
end
+8 -8
View File
@@ -24,13 +24,13 @@ The idea is simple. You attach a file to a Product (or a Variant of this Product
Add this line to your gemfile: Add this line to your gemfile:
```shell ```
gem 'spree_digital', :git => 'git://github.com/halo/spree_digital.git', :branch => 'master' gem 'spree_digital', :git => 'git://github.com/halo/spree_digital.git', :branch => 'master'
``` ```
The following terminal commands will copy the migration files to the corresponding directory in your Rails application and apply the migrations to your database. The following terminal commands will copy the migration files to the corresponding directory in your Rails application and apply the migrations to your database.
```shell ```
bundle exec rails g spree_digital:install bundle exec rails g spree_digital:install
bundle exec rake db:migrate bundle exec rake db:migrate
``` ```
@@ -104,14 +104,14 @@ References:
Get the spree framework and spree_digital extension for it: Get the spree framework and spree_digital extension for it:
```shell ```
git clone git://github.com/spree/spree.git git clone git://github.com/spree/spree.git
git clone git://github.com/halo/spree_digital.git git clone git://github.com/halo/spree_digital.git
``` ```
Go into the spree directory and run the bundle command: Go into the spree directory and run the bundle command:
```shell ```
cd spree cd spree
bundle install bundle install
``` ```
@@ -120,19 +120,19 @@ Go into the spree_digital directory and do the same:
NOTE: At this point you may need to uncomment the stuff in the `Gemfile` before you can start developing and testing! NOTE: At this point you may need to uncomment the stuff in the `Gemfile` before you can start developing and testing!
```shell ```
cd spree_digital cd spree_digital
bundle install bundle install
``` ```
Bring up the test application (you only need to do this whenever you fiddle around with the migrations) and then you can run the tests as you please. Bring up the test application (you only need to do this whenever you fiddle around with the migrations) and then you can run the tests as you please.
```shell ```
rake test_app rake test_app
rake spec rake spec
``` ```
This link may be very helpful to you: [http://github.com/spree/spree](http://github.com/spree/spree) This link may be very helpful to you: "http://github.com/spree/spree":http://github.com/spree/spree
### Authors ### Authors
@@ -143,4 +143,4 @@ This link may be very helpful to you: [http://github.com/spree/spree](http://git
Copyright (c) 2011 funkensturm. Copyright (c) 2011 funkensturm.
Released under the MIT License Released under the MIT License
See [LICENSE](http://github.com/funkensturm/spree_digital/blob/master/LICENSE) See [LICENSE](http://github.com/funkensturm/spree_digital/blob/master/LICENSE)
-3
View File
@@ -2,8 +2,5 @@ FactoryGirl.define do
factory :digital, :class => Spree::Digital do |f| factory :digital, :class => Spree::Digital do |f|
# TODO good to assign variant association if no association is manually defined # TODO good to assign variant association if no association is manually defined
# f.variant { |p| p.association(:variant) } # f.variant { |p| p.association(:variant) }
attachment_content_type 'application/octet-stream'
attachment_file_name 'a_great_book.epub'
end end
end end
+4 -1
View File
@@ -1,14 +1,16 @@
ENV["RAILS_ENV"] = "test" ENV["RAILS_ENV"] = "test"
require File.expand_path("../dummy/config/environment.rb", __FILE__) require File.expand_path("../dummy/config/environment.rb", __FILE__)
require 'rspec/rails' require 'rspec/rails'
require 'database_cleaner' require 'database_cleaner'
require 'ffaker' require 'ffaker'
require 'shoulda-matchers' require 'shoulda-matchers'
# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f } Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each {|f| require f }
require 'spree/core/testing_support/factories' require 'spree/core/testing_support/factories'
require 'spree/core/testing_support/env'
require 'spree/core/testing_support/controller_requests' require 'spree/core/testing_support/controller_requests'
require 'spree/core/url_helpers' require 'spree/core/url_helpers'
@@ -19,6 +21,7 @@ RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods config.include FactoryGirl::Syntax::Methods
config.include Spree::Core::UrlHelpers config.include Spree::Core::UrlHelpers
config.include Spree::Core::TestingSupport::ControllerRequests config.include Spree::Core::TestingSupport::ControllerRequests
config.include Devise::TestHelpers, :type => :controller
config.use_transactional_fixtures = false config.use_transactional_fixtures = false
config.before(:each) do config.before(:each) do
+2 -2
View File
@@ -3,7 +3,7 @@ Gem::Specification.new do |s|
s.name = 'spree_digital' s.name = 'spree_digital'
s.version = '1.1.1' s.version = '1.1.1'
s.summary = '' s.summary = ''
s.description = 'Digital download functionality for spree' s.description = 'Add digital download functionality to spree'
s.authors = ['funkensturm', 'Michael Bianco'] s.authors = ['funkensturm', 'Michael Bianco']
s.email = ['info@cliffsidedev.com'] s.email = ['info@cliffsidedev.com']
s.homepage = 'http://www.funkensturm.com' s.homepage = 'http://www.funkensturm.com'
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.require_path = 'lib' s.require_path = 'lib'
s.requirements << 'none' s.requirements << 'none'
s.required_ruby_version = '>= 1.8.7' s.required_ruby_version = '>= 1.8.7'
s.add_dependency 'spree_core', '~> 1.1' s.add_dependency 'spree_core', '>= 1.1.0'
# test suite # test suite
s.add_development_dependency 'shoulda-matchers' s.add_development_dependency 'shoulda-matchers'