radiant-sitemap_search-extension 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -33,7 +33,7 @@ unless defined? RADIANT_ROOT
33
33
  end
34
34
 
35
35
  require 'rake'
36
- require 'rake/rdoctask'
36
+ require 'rdoc/task'
37
37
  require 'rake/testtask'
38
38
 
39
39
  rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -3,8 +3,8 @@ class Admin::SearchController < ApplicationController
3
3
  if params[:q]
4
4
  @pages = Page.search(params[:q]).uniq
5
5
  if current_user.designer? || current_user.admin?
6
- @snippets = Snippet.search(params[:q]).uniq
7
6
  @layouts = Layout.search(params[:q]).uniq
7
+ @snippets = Snippet.search(params[:q]).uniq if defined?(SnippetsExtension)
8
8
  @templates = Template.search(params[:q]).uniq if defined?(TemplatesExtension)
9
9
  @banners = Banner.search(params[:q]).uniq if defined?(BannerRotatorExtension)
10
10
  end
@@ -7,10 +7,10 @@ module SitemapSearch::Model
7
7
  base.search_fields = [:title, :slug, :breadcrumb, :content]
8
8
  base.search_fields << :draft_content if defined?(ConcurrentDraftExtension)
9
9
  base.includes = [:parts]
10
- elsif base == Snippet
10
+ elsif base == Layout
11
11
  base.search_fields = [:name, :content]
12
12
  base.search_fields << :draft_content if defined?(ConcurrentDraftExtension)
13
- elsif base == Layout
13
+ elsif defined?(SnippetsExtension) && base == Snippet
14
14
  base.search_fields = [:name, :content]
15
15
  base.search_fields << :draft_content if defined?(ConcurrentDraftExtension)
16
16
  elsif defined?(TemplatesExtension) && base == Template
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{radiant-sitemap_search-extension}
8
- s.version = "1.0.3"
7
+ s.name = "radiant-sitemap_search-extension"
8
+ s.version = "1.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew vonderLuft", "Sean Cribbs"]
12
- s.date = %q{2011-06-20}
13
- s.description = %q{Adds search feature for pages, snippets, layouts, et al.}
14
- s.email = %q{avonderluft@avlux.net}
12
+ s.date = "2013-01-30"
13
+ s.description = "Adds search feature for pages, snippets, layouts, et al."
14
+ s.email = "avonderluft@avlux.net"
15
15
  s.extra_rdoc_files = [
16
16
  "README.textile"
17
17
  ]
@@ -47,16 +47,10 @@ Gem::Specification.new do |s|
47
47
  "spec/spec.opts",
48
48
  "spec/spec_helper.rb"
49
49
  ]
50
- s.homepage = %q{https://github.com/avonderluft/radiant-sitemap_search-extension}
50
+ s.homepage = "https://github.com/avonderluft/radiant-sitemap_search-extension"
51
51
  s.require_paths = ["lib"]
52
- s.rubygems_version = %q{1.6.2}
53
- s.summary = %q{Sitemap Search Extension for Radiant CMS}
54
- s.test_files = [
55
- "spec/controllers/search_controller_spec.rb",
56
- "spec/models/page_extensions_spec.rb",
57
- "spec/models/snippet_extensions_spec.rb",
58
- "spec/spec_helper.rb"
59
- ]
52
+ s.rubygems_version = "1.8.24"
53
+ s.summary = "Sitemap Search Extension for Radiant CMS"
60
54
 
61
55
  if s.respond_to? :specification_version then
62
56
  s.specification_version = 3
@@ -13,13 +13,15 @@ class SitemapSearchExtension < Radiant::Extension
13
13
  tab "Content" do
14
14
  add_item "Search", '/admin/search'
15
15
  end
16
- [Page, Snippet, Layout].each do |klass|
17
- klass.send :include, SitemapSearch::Model
18
- end
19
- admin.snippet.index.bottom.delete 'new_button'
20
- admin.snippet.index.add :bottom, 'admin/search/snippet_index_bottom'
16
+ Page.send :include, SitemapSearch::Model
17
+ Layout.send :include, SitemapSearch::Model
21
18
  admin.layout.index.bottom.delete 'new_button'
22
- admin.layout.index.add :bottom, 'admin/search/layout_index_bottom'
19
+ admin.layout.index.add :bottom, 'admin/search/layout_index_bottom'
20
+ if defined?(SnippetsExtension)
21
+ Snippet.send :include, SitemapSearch::Model
22
+ admin.snippet.index.bottom.delete 'new_button'
23
+ admin.snippet.index.add :bottom, 'admin/search/snippet_index_bottom'
24
+ end
23
25
  if defined?(TemplatesExtension)
24
26
  Template.send :include, SitemapSearch::Model
25
27
  admin.template.index.bottom.delete 'new_button'
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ #require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'spec_helper'
2
3
 
3
4
  describe Admin::SearchController do
4
5
  dataset :users
@@ -6,9 +7,8 @@ describe Admin::SearchController do
6
7
  [:admin, :designer].each do |user|
7
8
  describe "search as user with #{user} privileges" do
8
9
  before :each do
9
- @page, @snippet, @layout = mock_model(Page), mock_model(Snippet), mock_model(Layout)
10
+ @page, @layout = mock_model(Page), mock_model(Layout)
10
11
  Page.stub!(:search).and_return([@page])
11
- Snippet.stub!(:search).and_return([@snippet])
12
12
  Layout.stub!(:search).and_return([@layout])
13
13
  login_as user
14
14
  end
@@ -20,14 +20,18 @@ describe Admin::SearchController do
20
20
  Page.should_receive(:search).with('radiant').and_return([@page])
21
21
  do_get
22
22
  end
23
- it "should search snippets" do
24
- Snippet.should_receive(:search).with('radiant').and_return([@snippet])
25
- do_get
26
- end
27
23
  it "should search layouts" do
28
24
  Layout.should_receive(:search).with('radiant').and_return([@layout])
29
25
  do_get
30
26
  end
27
+ if defined?(SnippetsExtension)
28
+ it "should search snippets" do
29
+ @snippet = mock_model(Snippet)
30
+ Snippet.stub!(:search).and_return([@snippet])
31
+ Snippet.should_receive(:search).with('radiant').and_return([@snippet])
32
+ do_get
33
+ end
34
+ end
31
35
  if defined?(TemplatesExtension)
32
36
  it "should search templates" do
33
37
  @banner = mock_model(Template)
@@ -58,9 +62,8 @@ describe Admin::SearchController do
58
62
  [:existing, :non_admin].each do |user|
59
63
  describe "search as user with #{user} privileges" do
60
64
  before :each do
61
- @page, @snippet, @layout = mock_model(Page), mock_model(Snippet), mock_model(Layout)
65
+ @page, @layout = mock_model(Page), mock_model(Layout)
62
66
  Page.stub!(:search).and_return([@page])
63
- Snippet.stub!(:search).and_return([@snippet])
64
67
  Layout.stub!(:search).and_return([@layout])
65
68
  login_as user
66
69
  end
@@ -73,17 +76,21 @@ describe Admin::SearchController do
73
76
  Page.should_receive(:search).with('radiant').and_return([@page])
74
77
  do_get
75
78
  end
76
- it "should not search snippets" do
77
- Snippet.should_not_receive(:search).with('radiant')
78
- do_get
79
- end
80
79
  it "should not search layouts" do
81
80
  Layout.should_not_receive(:search).with('radiant')
82
81
  do_get
83
82
  end
83
+ if defined?(SnippetsExtension)
84
+ it "should not search templates" do
85
+ @snippet = mock_model(Snippet)
86
+ Snippet.stub!(:search).and_return([@snippet])
87
+ Snippet.should_not_receive(:search).with('radiant')
88
+ do_get
89
+ end
90
+ end
84
91
  if defined?(TemplatesExtension)
85
92
  it "should not search templates" do
86
- @banner = mock_model(Template)
93
+ @template = mock_model(Template)
87
94
  Template.stub!(:search).and_return([@template])
88
95
  Template.should_not_receive(:search).with('radiant')
89
96
  do_get
@@ -1,4 +1,5 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ #require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'spec_helper'
2
3
 
3
4
  describe Page, "search" do
4
5
  dataset :pages
@@ -1,24 +1,27 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ #require File.dirname(__FILE__) + '/../spec_helper'
2
+ require 'spec_helper'
2
3
 
3
- describe Snippet, "search" do
4
- dataset :snippets
5
- before :each do
6
- if defined?(ConcurrentDraft)
7
- snippets(:first).update_attributes(:draft_content => "Special draft content")
8
- else
9
- snippets(:first).update_attributes(:content => "Special content")
4
+ if defined?(SnippetsExtension)
5
+ describe Snippet, "search" do
6
+ dataset :snippets
7
+ before :each do
8
+ if defined?(ConcurrentDraft)
9
+ snippets(:first).update_attributes(:draft_content => "Special draft content")
10
+ else
11
+ snippets(:first).update_attributes(:content => "Special content")
12
+ end
10
13
  end
11
- end
12
14
 
13
- it "should find snippets from words in the name" do
14
- Snippet.search('first').should include(snippets(:first))
15
- end
15
+ it "should find snippets from words in the name" do
16
+ Snippet.search('first').should include(snippets(:first))
17
+ end
16
18
 
17
- it "should find snippets from words in the content" do
18
- Snippet.search('Before').should include(snippets(:yielding))
19
- end
19
+ it "should find snippets from words in the content" do
20
+ Snippet.search('Before').should include(snippets(:yielding))
21
+ end
20
22
 
21
- it "should find snippets from words in the content" do
22
- Snippet.search('special').should include(snippets(:first))
23
+ it "should find snippets from words in the content" do
24
+ Snippet.search('special').should include(snippets(:first))
25
+ end
23
26
  end
24
27
  end
data/spec/spec_helper.rb CHANGED
@@ -11,6 +11,8 @@ unless defined? RADIANT_ROOT
11
11
  end
12
12
  require "#{RADIANT_ROOT}/spec/spec_helper"
13
13
 
14
+ Dataset::Resolver.default << (File.dirname(__FILE__) + "/datasets")
15
+ Dataset::Resolver.default << (SnippetsExtension.root + "/spec/datasets") if defined?(SnippetsExtension)
14
16
  if File.directory?(File.dirname(__FILE__) + "/scenarios")
15
17
  Scenario.load_paths.unshift File.dirname(__FILE__) + "/scenarios"
16
18
  end
metadata CHANGED
@@ -1,51 +1,40 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: radiant-sitemap_search-extension
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.4
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 0
9
- - 3
10
- version: 1.0.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Andrew vonderLuft
14
9
  - Sean Cribbs
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-06-20 00:00:00 -07:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
23
- prerelease: false
13
+ date: 2013-01-30 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: radiant
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0.rc2
24
23
  type: :runtime
25
- requirement: &id001 !ruby/object:Gem::Requirement
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
26
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 15424049
31
- segments:
32
- - 1
33
- - 0
34
- - 0
35
- - rc
36
- - 2
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
37
30
  version: 1.0.0.rc2
38
- name: radiant
39
- version_requirements: *id001
40
31
  description: Adds search feature for pages, snippets, layouts, et al.
41
32
  email: avonderluft@avlux.net
42
33
  executables: []
43
-
44
34
  extensions: []
45
-
46
- extra_rdoc_files:
35
+ extra_rdoc_files:
47
36
  - README.textile
48
- files:
37
+ files:
49
38
  - HELP.textile
50
39
  - README.textile
51
40
  - Rakefile
@@ -76,42 +65,31 @@ files:
76
65
  - spec/models/snippet_extensions_spec.rb
77
66
  - spec/spec.opts
78
67
  - spec/spec_helper.rb
79
- has_rdoc: true
80
68
  homepage: https://github.com/avonderluft/radiant-sitemap_search-extension
81
69
  licenses: []
82
-
83
70
  post_install_message:
84
71
  rdoc_options: []
85
-
86
- require_paths:
72
+ require_paths:
87
73
  - lib
88
- required_ruby_version: !ruby/object:Gem::Requirement
74
+ required_ruby_version: !ruby/object:Gem::Requirement
89
75
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ segments:
95
81
  - 0
96
- version: "0"
97
- required_rubygems_version: !ruby/object:Gem::Requirement
82
+ hash: 1656006514844971377
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
84
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
106
89
  requirements: []
107
-
108
90
  rubyforge_project:
109
- rubygems_version: 1.6.2
91
+ rubygems_version: 1.8.24
110
92
  signing_key:
111
93
  specification_version: 3
112
94
  summary: Sitemap Search Extension for Radiant CMS
113
- test_files:
114
- - spec/controllers/search_controller_spec.rb
115
- - spec/models/page_extensions_spec.rb
116
- - spec/models/snippet_extensions_spec.rb
117
- - spec/spec_helper.rb
95
+ test_files: []