Skip to content

Commit

Permalink
Convert promotions extension to engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
romul authored and schof committed Jul 12, 2010
1 parent 008809b commit 9cd73a2
Show file tree
Hide file tree
Showing 51 changed files with 42 additions and 14 deletions.
3 changes: 2 additions & 1 deletion core/lib/spree_core/all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
spree_payment_gateway
spree_api
spree_dashboard
spree_promotions
).each do |extension|
begin
require "#{extension}/engine"
#require "#{framework}/railtie"
rescue LoadError
end
end
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions promotions/config/routes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Rails.application.routes.draw do |map|
namespace :admin do
resources :promotions do
resources :promotion_rules
end
end
end
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'
require 'spree_core'

class PromotionsExtension < Spree::Extension
version "1.0"
description "Describe your extension here"
url "http://yourwebsite.com/promotions"

def activate
ActiveSupport.on_load(:after_initialize) do

Order.class_eval do
has_many :promotion_credits, :extend => Order::Totaling, :order => :position
Expand Down Expand Up @@ -76,5 +70,4 @@ def possible_promotions

[Calculator::FreeShipping].each(&:register)

end
end
6 changes: 6 additions & 0 deletions promotions/lib/spree_promotions/engine.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require "spree_promotions"

module SpreePromotions
class Engine < Rails::Engine
end
end
23 changes: 23 additions & 0 deletions promotions/spree_promotions.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version = File.read(File.expand_path("../../SPREE_VERSION", __FILE__)).strip

Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'spree_promotions'
s.version = version
s.summary = 'Adds promotions to Spree'
#s.description = 'Email on Rails. Compose, deliver, receive, and test emails using the familiar controller/view pattern. First-class support for multipart email and attachments.'
s.required_ruby_version = '>= 1.8.7'

# s.author = 'David Heinemeier Hansson'
# s.email = '[email protected]'
# s.homepage = 'http://www.rubyonrails.org'
# s.rubyforge_project = 'actionmailer'

s.files = Dir['CHANGELOG', 'README', 'MIT-LICENSE', 'lib/**/*']
s.require_path = 'lib'
s.requirements << 'none'

s.has_rdoc = true

s.add_dependency('spree_core', version)
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion spree.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Gem::Specification.new do |s|
s.add_dependency('spree_api', version)
s.add_dependency('spree_dashboard', version)
s.add_dependency('spree_sample', version)
s.add_dependency('spree_promotions', version)
# RAILS3 TODO - add more of the core extensions, etc.
s.add_dependency('bundler', '>= 0.9.26')
s.add_dependency('rails', '= 3.0.0.beta4')
Expand All @@ -39,4 +40,4 @@ Gem::Specification.new do |s|
s.add_dependency('paperclip', '>= 2.3.1.1')
s.add_dependency('resource_controller')

end
end
3 changes: 0 additions & 3 deletions vendor/extensions/promotions/config/routes.rb

This file was deleted.

0 comments on commit 9cd73a2

Please sign in to comment.