Skip to content

Commit

Permalink
Decoupled Refinery from ActsAsIndexed, in terms of dependencies.
Browse files Browse the repository at this point in the history
There is still some work to go with crudify.

Changes:

* Removed gemspec dependencies on acts_as_indexed
* Clear out search partials so that refinerycms-acts-as-indexed can implement them.
* Added Gemfile dependency on refinerycms-acts-as-indexed
  • Loading branch information
parndt committed Jan 27, 2013
1 parent 09fb1f5 commit b25e2b6
Show file tree
Hide file tree
Showing 18 changed files with 7 additions and 136 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Expand Up @@ -5,6 +5,9 @@ gemspec
# Add i18n support.
gem 'refinerycms-i18n', '~> 2.1.0.dev', :git => 'git://github.com/refinery/refinerycms-i18n.git'

# Add support for refinerycms-acts-as-indexed
gem 'refinerycms-acts-as-indexed', :git => 'git://github.com/refinery/refinerycms-acts-as-indexed.git'

gem 'quiet_assets', :group => :development

# Database Configuration
Expand Down
4 changes: 0 additions & 4 deletions authentication/app/models/refinery/user.rb
@@ -1,6 +1,5 @@
require 'devise'
require 'friendly_id'
require 'acts_as_indexed'

module Refinery
class User < Refinery::Core::BaseModel
Expand All @@ -11,9 +10,6 @@ class User < Refinery::Core::BaseModel
has_many :plugins, :class_name => "UserPlugin", :order => "position ASC", :dependent => :destroy
friendly_id :username, :use => [:slugged]

# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:username, :email]

# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
if self.respond_to?(:devise)
Expand Down
1 change: 1 addition & 0 deletions changelog.md
Expand Up @@ -37,6 +37,7 @@
* Moved page preview functionality to its own controller and made it so that you need to be logged in to use it. [#2089](https://github.com/refinery/refinerycms/pull/2089). [Philip Arndt](https://github.com/parndt)
* Fixed issue which allowed identical slugs to exist after page reordering. [#2092](https://github.com/refinery/refinerycms/pull/2092). [Philip Arndt](https://github.com/parndt)
* Gave crudify's actions the ability to redirect to a particular page of results when `params[:page]` is supplied to the action. [#1861](https://github.com/refinery/refinerycms/issues/1861). [Philip Arndt](https://github.com/parndt)
* ActsAsIndexed is no longer a required dependency. Integration is achieved by [refinerycms-acts-as-indexed](https://github.com/refinery/refinerycms-acts-as-indexed) instead. [#2162](https://github.com/refinery/refinerycms/issues/2162). [Philip Arndt](https://github.com/parndt)

* [See full list](https://github.com/refinery/refinerycms/compare/2-0-stable...master)

Expand Down
8 changes: 1 addition & 7 deletions core/app/views/refinery/admin/_search.html.erb
@@ -1,7 +1 @@
<form method='GET' action='<%= url %>' class='search_form'>
<%= text_field :search, nil, :id => 'search', :type => 'search', :name => 'search', :value => params[:search], :title => t('search_input_notice', :scope => 'refinery.admin.search') %>
<%= hidden_field :wymeditor, nil, :name => 'wymeditor', :id => nil, :value => true if params[:wymeditor].presence %>
<%= hidden_field :dialog, nil, :name => 'dialog', :id => nil, :value => true if from_dialog? %>
<%= hidden_field :callback, nil, :name => 'callback', :id => nil, :value => @callback if @callback.presence %>
<%= submit_tag t('button_text', :scope => 'refinery.admin.search'), :name => nil %>
</form>
<%= render 'refinery/acts_as_indexed/admin/search', local_assigns if defined?(Refinery::ActsAsIndexed::Engine) %>
5 changes: 1 addition & 4 deletions core/app/views/refinery/admin/_search_header.html.erb
@@ -1,4 +1 @@
<% if searching? %>
<%= link_to t('cancel_search', :scope => 'refinery.admin.search'), url, :class => "cancel-search" %>
<h2><%= t('results_for_html', :scope => 'refinery.admin.search', :query => h(params[:search])).html_safe %></h2>
<% end %>
<%= render 'refinery/acts_as_indexed/admin/search_header', local_assigns if defined?(Refinery::ActsAsIndexed::Engine) %>
Expand Up @@ -15,8 +15,6 @@ module Refinery
<% end -%>
<% if string_attributes.any? -%>

acts_as_indexed :fields => <%= string_attributes.map {|s| s.name.to_sym }.inspect %>

validates <%= string_attributes.first.name.to_sym.inspect %>, :presence => true, :uniqueness => true
<% else -%>

Expand Down
Expand Up @@ -12,7 +12,6 @@ Gem::Specification.new do |s|

# Runtime dependencies
s.add_dependency 'refinerycms-core', '~> <%= Refinery::Version %>'
s.add_dependency 'acts_as_indexed', '~> 0.8'

# Development dependencies (usually used for testing)
s.add_development_dependency 'refinerycms-testing', '~> <%= Refinery::Version %>'
Expand Down
Expand Up @@ -6,10 +6,6 @@ module Refinery
<% end -%>

attr_accessible <%= names_for_attr_accessible.map { |a| ":#{a}" }.join(', ') %>, :position
<% if string_attributes.any? -%>

acts_as_indexed :fields => [<%= string_attributes.map { |a| ":#{a.name}" }.join(", ") %>]
<% end -%>
<% if (text_fields = attributes.map { |a| a.name if a.type == :text }.compact.uniq).any? && text_fields.detect{ |a| a.to_s == 'message' }.nil? -%>

alias_attribute :message, :<%= text_fields.first %>
Expand Down
Expand Up @@ -13,5 +13,4 @@ Gem::Specification.new do |s|
# Runtime dependencies
s.add_dependency 'refinerycms-core', '~> <%= Refinery::Version %>'
s.add_dependency 'refinerycms-settings', '~> <%= Refinery::Version %>'
s.add_dependency 'acts_as_indexed', '~> 0.8'
end
78 changes: 0 additions & 78 deletions core/spec/requests/refinery/admin/search_spec.rb

This file was deleted.

4 changes: 0 additions & 4 deletions images/app/models/refinery/image.rb
@@ -1,5 +1,4 @@
require 'dragonfly'
require 'acts_as_indexed'

module Refinery
class Image < Refinery::Core::BaseModel
Expand All @@ -17,9 +16,6 @@ class Image < Refinery::Core::BaseModel
:in => ::Refinery::Images.whitelisted_mime_types,
:message => :incorrect_format

# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:title]

# allows Mass-Assignment
attr_accessible :id, :image, :image_size

Expand Down
1 change: 0 additions & 1 deletion images/refinerycms-images.gemspec
Expand Up @@ -20,6 +20,5 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- spec/*`.split("\n")

s.add_dependency 'dragonfly', '~> 0.9.12'
s.add_dependency 'acts_as_indexed', '~> 0.8.0'
s.add_dependency 'refinerycms-core', version
end
10 changes: 0 additions & 10 deletions pages/app/models/refinery/page.rb
@@ -1,5 +1,4 @@
# Encoding: utf-8
require 'acts_as_indexed'
require 'friendly_id'
require 'refinery/core/base_model'

Expand Down Expand Up @@ -37,10 +36,6 @@ class Translation
:reserved_words => %w(index new session login logout users refinery admin images wymiframe),
:scope => :parent

# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:title, :meta_description,
:menu_title, :browser_title, :all_page_part_content]

has_many :parts,
:foreign_key => :refinery_page_id,
:class_name => '::Refinery::PagePart',
Expand Down Expand Up @@ -347,11 +342,6 @@ def part_with_title(part_title)
end
end

# Used to index all the content on this page so it can be easily searched.
def all_page_part_content
parts.map(&:body).join(" ")
end

private

# Make sures that a translation exists for this page.
Expand Down
11 changes: 0 additions & 11 deletions pages/lib/refinery/pages/engine.rb
Expand Up @@ -32,17 +32,6 @@ class Engine < ::Rails::Engine
end
end

initializer "refinery.pages acts_as_indexed" do
ActiveSupport.on_load(:active_record) do
require 'acts_as_indexed'
ActsAsIndexed.configure do |config|
config.index_file = Rails.root.join('tmp', 'index')
config.index_file_depth = 3
config.min_word_size = 3
end
end
end

initializer "refinery.pages append marketable routes", :after => :set_routes_reloader_hook do
append_marketable_routes if Refinery::Pages.marketable_urls
end
Expand Down
1 change: 0 additions & 1 deletion pages/refinerycms-pages.gemspec
Expand Up @@ -19,7 +19,6 @@ Gem::Specification.new do |s|
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- spec/*`.split("\n")

s.add_dependency 'acts_as_indexed', '~> 0.8.0'
s.add_dependency 'friendly_id', '~> 4.0.9'
s.add_dependency 'globalize3', '~> 0.3.0'
s.add_dependency 'awesome_nested_set', '~> 2.1.3'
Expand Down
4 changes: 0 additions & 4 deletions pages/spec/models/refinery/page_spec.rb
Expand Up @@ -261,10 +261,6 @@ def turn_on_marketable_urls

end

it 'return all page part content' do
page.all_page_part_content.should == "<p>I'm the first page part for this page.</p> <p>Closely followed by the second page part.</p>"
end

it 'reposition correctly' do
page.save

Expand Down
4 changes: 0 additions & 4 deletions resources/app/models/refinery/resource.rb
@@ -1,5 +1,4 @@
require 'dragonfly'
require 'acts_as_indexed'

module Refinery
class Resource < Refinery::Core::BaseModel
Expand All @@ -14,9 +13,6 @@ class Resource < Refinery::Core::BaseModel
validates :file, :presence => true
validates_with FileSizeValidator

# Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
acts_as_indexed :fields => [:file_name, :title, :type_of_content]

delegate :ext, :size, :mime_type, :url, :to => :file

# used for searching
Expand Down
1 change: 1 addition & 0 deletions templates/refinery/edge.rb
Expand Up @@ -24,6 +24,7 @@
# Specify additional Refinery CMS Engines here (all optional):
gem 'refinerycms-i18n', :git => 'git://github.com/refinery/refinerycms-i18n.git'
gem 'refinerycms-acts-as-indexed', :git => 'git://github.com/refinery/refinerycms-acts-as-indexed.git'
# gem 'refinerycms-blog', :git => 'git://github.com/refinery/refinerycms-blog.git'
# gem 'refinerycms-inquiries', :git => 'git://github.com/refinery/refinerycms-inquiries.git'
# gem 'refinerycms-search', :git => 'git://github.com/refinery/refinerycms-search.git'
Expand Down

0 comments on commit b25e2b6

Please sign in to comment.