Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ported to work with Spree 0.70.x

  • Loading branch information...
commit 1c1e6ca58ed8c2c09b37e6a826c9c323165fcf2c 1 parent deee959
@joneslee85 joneslee85 authored
View
26 LICENSE
@@ -0,0 +1,26 @@
+Copyright (c) 2011 Jorge Calás Lozano, Roman Smirnov, Trung Lê
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name Spree nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
16 README.markdown → README.md
@@ -1,13 +1,17 @@
-# Spree Email to Friend extension
+Spree Email to Friend
+=====================
The Spree Email to Friend extension enables you to send the product reference to your friend via email.
-## Installation
+Installation
+------------
-1. Add the following to your Gemfile
+Add the following to your <code>Gemfile</code>
-<pre>
gem 'spree_email_to_friend', :git => 'git://github.com/spree/spree_email_to_friend.git'
-</pre>
-2. Run `bundle install`
+Run
+
+ bundle install
+
+
View
58 Rakefile
@@ -1,49 +1,31 @@
-require 'rubygems'
require 'rake'
require 'rake/testtask'
-
-desc "Default Task"
-task :default => [ :spec ]
-
+require 'rake/packagetask'
+require 'rubygems/package_task'
require 'rspec/core/rake_task'
+require 'cucumber/rake/task'
+require 'spree_core/testing_support/common_rake'
+
RSpec::Core::RakeTask.new
+Cucumber::Rake::Task.new
-require 'cucumber/rake/task'
-Cucumber::Rake::Task.new do |t|
- t.cucumber_opts = %w{--format pretty}
-end
+task :default => [:spec, :cucumber ]
-desc "Regenerates a rails 3 app for testing"
-task :test_app do
- SPREE_PATH = ENV['SPREE_PATH']
- raise "SPREE_PATH should be specified" unless SPREE_PATH
- require File.join(SPREE_PATH, 'lib/generators/spree/test_app_generator')
- class AuthTestAppGenerator < Spree::Generators::TestAppGenerator
- def tweak_gemfile
- append_file 'Gemfile' do
-<<-gems
-gem 'spree_core', :path => '#{File.join(SPREE_PATH, 'core')}'
-gem 'spree_auth', :path => '#{File.join(SPREE_PATH, 'auth')}'
-gem 'spree_email_to_friend', :path => '#{File.dirname(__FILE__)}'
-gems
- end
- end
+spec = eval(File.read('spree_email_to_friend.gemspec'))
- def install_gems
- system("cd spec/test_app && rake spree_core:install")
- system("cd spec/test_app && rake spree_auth:install")
- end
+Gem::PackageTask.new(spec) do |p|
+ p.gem_spec = spec
+end
- def migrate_db
- run_migrations
- end
- end
- AuthTestAppGenerator.start
+desc "Release to gemcutter"
+task :release => :package do
+ require 'rake/gemcutter'
+ Rake::Gemcutter::Tasks.new(spec).define
+ Rake::Task['gem:push'].invoke
end
-namespace :test_app do
- desc 'Rebuild test and cucumber databases'
- task :rebuild_dbs do
- system("cd spec/test_app && rake db:drop db:migrate RAILS_ENV=test && rake db:drop db:migrate RAILS_ENV=cucumber")
- end
+desc "Generates a dummy app for testing"
+task :test_app do
+ ENV['LIB_NAME'] = 'spree_email_to_friend'
+ Rake::Task['common:test_app'].invoke
end
View
1  Versionfile
@@ -1,3 +1,4 @@
+"0.70.x" => { :branch => 'master' }
"0.60.x" => { :version => '1.1', :ref => '34e52d987be882f6cba783144a9ebfff30b90e15' }
"0.50.x" => { :version => '1.1', :ref => '34e52d987be882f6cba783144a9ebfff30b90e15' }
"0.40.x" => { :tag => "v1.0.0", :version => "1.0.0" }
View
2  app/overrides/add_email_to_friend_link_to_products.rb
@@ -2,6 +2,6 @@
:name => "converted_product_description_351026984",
:insert_bottom => "[data-hook='product_description'], #product_description[data-hook]",
:text => "<p class=\"email_to_friend\">
- <%= link_to(t('email_to_friend.send_to_friend'), email_to_friend_url('product', @product)) %>
+ <%= link_to t('email_to_friend.send_to_friend'), email_to_friend_url('product', @product) %>
</p>",
:disabled => false)
View
8 app/views/email_sender/send_mail.html.erb
@@ -1,7 +1,7 @@
<h1><%= t('email_to_friend.tell_about', :product => @object.name) %></h1>
-<%= form_for(@mail_to_friend, :url => "") do |f| -%>
- <%= render "shared/error_messages", :target => @mail_to_friend %>
+<%= form_for(@mail_to_friend, :url => '') do |f| -%>
+ <%= render 'shared/error_messages', :target => @mail_to_friend %>
<%= hook :send_mail_fields, {:f => f} do %>
<p>
<%= f.label(:sender_name, t('email_to_friend.sender_name')) %><br/>
@@ -28,6 +28,6 @@
<%= recaptcha_tags :public_key => Spree::Captcha::Config[:public_key], :display => {:theme => Spree::Captcha::Config[:theme]} %>
<% end %>
<p>
- <%= f.submit(t('email_to_friend.send_message')) %>
+ <%= f.submit t('email_to_friend.send_message') %>
</p>
-<% end -%>
+<% end -%>
View
4 lib/spree/captcha/config.rb
@@ -3,8 +3,8 @@ class Config < Spree::Config
class << self
def instance
return nil unless ActiveRecord::Base.connection.tables.include?('configurations')
- CaptchaConfiguration.find_or_create_by_name("Captcha configuration")
+ CaptchaConfiguration.find_or_create_by_name('Captcha configuration')
end
end
end
-end
+end
View
22 lib/spree_email_to_friend.rb
@@ -1,22 +1,2 @@
require 'spree_core'
-require 'recaptcha/rails'
-
-module SpreeEmailToFriend
- class Engine < Rails::Engine
- engine_name 'spree_email_to_friend'
-
- config.autoload_paths += %W(#{config.root}/lib)
-
- def self.activate
- Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
- Rails.application.config.cache_classes ? require(c) : load(c)
- end
-
- Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/**/*.rb")) do |c|
- Rails.application.config.cache_classes ? require(c) : load(c)
- end
- end
-
- config.to_prepare &method(:activate).to_proc
- end
-end
+require 'spree_email_to_friend/engine'
View
21 lib/spree_email_to_friend/engine.rb
@@ -0,0 +1,21 @@
+require 'recaptcha/rails'
+
+module SpreeEmailToFriend
+ class Engine < Rails::Engine
+ engine_name 'spree_email_to_friend'
+
+ config.autoload_paths += %W(#{config.root}/lib)
+
+ def self.activate
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
+ Rails.application.config.cache_classes ? require(c) : load(c)
+ end
+
+ Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
+ Rails.application.config.cache_classes ? require(c) : load(c)
+ end
+ end
+
+ config.to_prepare &method(:activate).to_proc
+ end
+end
View
9 script/rails
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
+
+
+ENGINE_PATH = File.expand_path('../..', __FILE__)
+APP_PATH = File.expand_path('../../../config/application', __FILE__)
+require File.expand_path('../../../config/boot', __FILE__)
+require 'rails/commands'
+
View
1  spec/controllers/email_sender_controller_spec.rb
@@ -2,7 +2,6 @@
describe EmailSenderController do
- #Delete this example and add some real ones
it "should use EmailSenderController" do
controller.should be_an_instance_of(EmailSenderController)
end
View
21 spec/spec_helper.rb
@@ -1,12 +1,15 @@
-# This file is copied to ~/spec when you run 'ruby script/generate rspec'
-# from the project root directory.
-ENV["RAILS_ENV"] ||= 'test'
-require File.expand_path("../test_app/config/environment", __FILE__)
+# Configure Rails Environment
+ENV["RAILS_ENV"] = "test"
+
+
+require File.expand_path("../../../config/environment.rb", __FILE__)
+
+
require 'rspec/rails'
-# Requires supporting files with custom matchers and macros, etc,
-# in ./support/ and its subdirectories.
-Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
+# Requires supporting ruby files with custom matchers and macros, etc,
+# in spec/support/ and its subdirectories.
+Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
RSpec.configure do |config|
# == Mock Framework
@@ -18,11 +21,11 @@
# config.mock_with :rr
config.mock_with :rspec
+ # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, comment the following line or assign false
+ # examples within a transaction, remove the following line or assign false
# instead of true.
config.use_transactional_fixtures = true
end
-
View
13 spree_email_to_friend.gemspec
@@ -4,18 +4,19 @@ Gem::Specification.new do |s|
s.name = 'spree_email_to_friend'
s.version = '1.2'
s.summary = 'Spree extension to send product recommendations to friends'
- s.homepage = 'https://github.com/spree/spree_email_to_friend'
+ s.description = 'Spree extension to send product recommendations to friends'
s.required_ruby_version = '>= 1.8.7'
s.author = 'Jorge Calás Lozano, Roman Smirnov, Trung Lê'
- s.required_ruby_version = '>= 1.8.7'
- s.rubygems_version = '1.3.6'
+ s.homepage = 'https://github.com/spree/spree_email_to_friend'
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ["lib"]
+ s.requirements << 'none'
- s.add_dependency('spree_core', '>= 0.30.1')
- s.add_dependency('spree_auth', '>= 0.30.1')
- s.add_dependency('recaptcha', '>= 0.3.1')
+ s.add_dependency 'spree_core', '>= 0.70.RC1'
+ s.add_dependency 'spree_auth', '>= 0.70.RC1'
+ s.add_dependency 'recaptcha', '>= 0.3.1'
+ s.add_development_dependency 'rspec-rails'
end
Please sign in to comment.
Something went wrong with that request. Please try again.