Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
techranch committed Mar 17, 2012
1 parent 079b74c commit 652c569
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 0 deletions.
Binary file not shown.
27 changes: 27 additions & 0 deletions lib/generators/spree_reviews/install/install_generator.rb
@@ -0,0 +1,27 @@
module SpreeReviews
module Generators
class InstallGenerator < Rails::Generators::Base
# source_root File.expand_path("../../../../", __FILE__)
def copy_locale
Dir.glob(File.join(ReviewsExtension.root, "db", 'sample', '*.{yml,csv}')).each do |resource_file|
say_status("copying", "#{resource_file} --->> db/sample/#{File.basename(resource_file)}", :green)
copy_file resource_file, "db/sample/#{File.basename(resource_file)}"
end
end

def add_migrations
run 'rake railties:install:migrations FROM=<%= file_name %>'
end

def run_migrations
res = ask "Would you like to run the migrations now? [Y/n]"
if res == "" || res.downcase == "y"
run 'rake db:migrate'
else
puts "Skiping rake db:migrate, don't forget to run it!"
end
end

end
end
end
59 changes: 59 additions & 0 deletions lib/spree-reviews.rb~
@@ -0,0 +1,59 @@
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'


module SpreeReviews

class Engine < Rails::Engine
engine_name 'spree-reviews'

config.autoload_paths += %W(#{config.root}/lib)

def self.activate
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


#class ReviewsExtension < Spree::Extension
# version "1.0"
# description "Support for reviews and ratings within Spree"
# url "git://github.com/paulcc/spree-reviews.git"
#
# def activate
# # admin.tabs.add "Reviews", "/admin/reviews", :after => "Layouts", :visibility => [:all]
#
# Admin::ConfigurationsController.class_eval do
# before_filter :add_review_links, :only => :index
#
# def add_review_links
# @extension_links << {:link => admin_reviews_path, :link_text => t('review_management'), :description => t('review_management_description')}
# @extension_links << {:link => admin_review_settings_path, :link_text => t('reviews.review_settings'), :description => t('reviews.manage_review_settings') }
# end
# end
#
# # Add access to reviews/ratings to the product model
# Product.class_eval do
# has_one :rating
# has_many :reviews
#
# def get_stars
# if rating.nil?
# [0,0]
# else
# [rating.get_stars, rating.count]
# end
# end
# end
# end
#
# def deactivate
# # admin.tabs.remove "Reviews"
# end
#
#end
59 changes: 59 additions & 0 deletions lib/spree_reviews.rb
@@ -0,0 +1,59 @@
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'


module SpreeReviews

class Engine < Rails::Engine
engine_name 'spree_reviews'

config.autoload_paths += %W(#{config.root}/lib)

def self.activate
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


#class ReviewsExtension < Spree::Extension
# version "1.0"
# description "Support for reviews and ratings within Spree"
# url "git://github.com/paulcc/spree-reviews.git"
#
# def activate
# # admin.tabs.add "Reviews", "/admin/reviews", :after => "Layouts", :visibility => [:all]
#
# Admin::ConfigurationsController.class_eval do
# before_filter :add_review_links, :only => :index
#
# def add_review_links
# @extension_links << {:link => admin_reviews_path, :link_text => t('review_management'), :description => t('review_management_description')}
# @extension_links << {:link => admin_review_settings_path, :link_text => t('reviews.review_settings'), :description => t('reviews.manage_review_settings') }
# end
# end
#
# # Add access to reviews/ratings to the product model
# Product.class_eval do
# has_one :rating
# has_many :reviews
#
# def get_stars
# if rating.nil?
# [0,0]
# else
# [rating.get_stars, rating.count]
# end
# end
# end
# end
#
# def deactivate
# # admin.tabs.remove "Reviews"
# end
#
#end

0 comments on commit 652c569

Please sign in to comment.