muck-services 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/controllers/muck/recommendations_controller.rb +21 -6
- data/app/models/entry.rb +7 -10
- data/app/views/recommendations/get_button.html.erb +5 -0
- data/app/views/recommendations/index.pjs.erb +1 -1
- data/app/views/recommendations/index.xml.builder +4 -6
- data/app/views/recommendations/real_time.html.erb +13 -0
- data/app/views/recommendations/{index_real_time.pjs.erb → real_time.pjs.erb} +0 -0
- data/app/views/recommendations/{index_real_time.xml.builder → real_time.xml.builder} +1 -1
- data/config/muck_services_routes.rb +3 -0
- data/locales/en.yml +2 -1
- data/muck-services.gemspec +8 -52
- data/public/images/folksemantic/logo-folksemantic-gm.gif +0 -0
- data/public/javascripts/recommenderextension.user.js +392 -0
- data/test/rails_root/config/environment.rb +7 -6
- data/test/rails_root/config/environments/test.rb +0 -10
- data/test/rails_root/db/migrate/20090602191243_create_muck_raker.rb +4 -19
- data/test/rails_root/db/migrate/20090703175825_denormalize_entries_subjects.rb +3 -29
- data/test/rails_root/db/migrate/20090717175825_normalize_entries_subjects.rb +3 -32
- data/test/rails_root/test/factories.rb +0 -145
- data/test/rails_root/test/functional/topics_controller_test.rb +4 -0
- data/test/rails_root/test/test_helper.rb +5 -40
- data/test/rails_root/test/unit/share_test.rb +3 -0
- data/test/rails_root/test/unit/user_test.rb +3 -0
- metadata +8 -52
- data/app/views/recommendations/index_js.pjs.erb +0 -39
- data/config/solr/README.txt +0 -0
- data/config/solr/cores/de/conf/protwords.txt +0 -21
- data/config/solr/cores/de/conf/schema.xml +0 -81
- data/config/solr/cores/de/conf/solrconfig.xml +0 -311
- data/config/solr/cores/de/conf/stopwords.txt +0 -341
- data/config/solr/cores/de/conf/synonyms.txt +0 -31
- data/config/solr/cores/en/conf/protwords.txt +0 -21
- data/config/solr/cores/en/conf/schema.xml +0 -83
- data/config/solr/cores/en/conf/solrconfig.xml +0 -311
- data/config/solr/cores/en/conf/stopwords.txt +0 -341
- data/config/solr/cores/en/conf/synonyms.txt +0 -31
- data/config/solr/cores/es/conf/protwords.txt +0 -21
- data/config/solr/cores/es/conf/schema.xml +0 -81
- data/config/solr/cores/es/conf/solrconfig.xml +0 -311
- data/config/solr/cores/es/conf/stopwords.txt +0 -206
- data/config/solr/cores/es/conf/synonyms.txt +0 -31
- data/config/solr/cores/fr/conf/protwords.txt +0 -21
- data/config/solr/cores/fr/conf/schema.xml +0 -82
- data/config/solr/cores/fr/conf/solrconfig.xml +0 -311
- data/config/solr/cores/fr/conf/stopwords.txt +0 -57
- data/config/solr/cores/fr/conf/synonyms.txt +0 -31
- data/config/solr/cores/ja/conf/protwords.txt +0 -21
- data/config/solr/cores/ja/conf/schema.xml +0 -69
- data/config/solr/cores/ja/conf/solrconfig.xml +0 -311
- data/config/solr/cores/ja/conf/stopwords.txt +0 -341
- data/config/solr/cores/ja/conf/synonyms.txt +0 -31
- data/config/solr/cores/nl/conf/protwords.txt +0 -21
- data/config/solr/cores/nl/conf/schema.xml +0 -78
- data/config/solr/cores/nl/conf/solrconfig.xml +0 -311
- data/config/solr/cores/nl/conf/stopwords.txt +0 -45691
- data/config/solr/cores/nl/conf/synonyms.txt +0 -31
- data/config/solr/cores/ru/conf/protwords.txt +0 -21
- data/config/solr/cores/ru/conf/schema.xml +0 -78
- data/config/solr/cores/ru/conf/solrconfig.xml +0 -311
- data/config/solr/cores/ru/conf/stopwords.txt +0 -341
- data/config/solr/cores/ru/conf/synonyms.txt +0 -31
- data/config/solr/cores/zh/conf/protwords.txt +0 -21
- data/config/solr/cores/zh/conf/schema.xml +0 -72
- data/config/solr/cores/zh/conf/solrconfig.xml +0 -311
- data/config/solr/cores/zh/conf/stopwords.txt +0 -341
- data/config/solr/cores/zh/conf/synonyms.txt +0 -31
- data/config/solr/solr.xml +0 -50
- data/test/rails_root/test/shoulda_macros/controller.rb +0 -49
- data/test/rails_root/test/shoulda_macros/forms.rb +0 -32
- data/test/rails_root/test/shoulda_macros/models.rb +0 -50
- data/test/rails_root/test/shoulda_macros/pagination.rb +0 -53
- data/test/rails_root/test/shoulda_macros/plugins.rb +0 -34
@@ -1,31 +0,0 @@
|
|
1
|
-
# The ASF licenses this file to You under the Apache License, Version 2.0
|
2
|
-
# (the "License"); you may not use this file except in compliance with
|
3
|
-
# the License. You may obtain a copy of the License at
|
4
|
-
#
|
5
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
6
|
-
#
|
7
|
-
# Unless required by applicable law or agreed to in writing, software
|
8
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
9
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
10
|
-
# See the License for the specific language governing permissions and
|
11
|
-
# limitations under the License.
|
12
|
-
|
13
|
-
#-----------------------------------------------------------------------
|
14
|
-
#some test synonym mappings unlikely to appear in real input text
|
15
|
-
aaa => aaaa
|
16
|
-
bbb => bbbb1 bbbb2
|
17
|
-
ccc => cccc1,cccc2
|
18
|
-
a\=>a => b\=>b
|
19
|
-
a\,a => b\,b
|
20
|
-
fooaaa,baraaa,bazaaa
|
21
|
-
|
22
|
-
# Some synonym groups specific to this example
|
23
|
-
GB,gib,gigabyte,gigabytes
|
24
|
-
MB,mib,megabyte,megabytes
|
25
|
-
Television, Televisions, TV, TVs
|
26
|
-
#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
|
27
|
-
#after us won't split it into two words.
|
28
|
-
|
29
|
-
# Synonym mappings can be used for spelling correction too
|
30
|
-
pixima => pixma
|
31
|
-
|
data/config/solr/solr.xml
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!--
|
3
|
-
Licensed to the Apache Software Foundation (ASF) under one or more
|
4
|
-
contributor license agreements. See the NOTICE file distributed with
|
5
|
-
this work for additional information regarding copyright ownership.
|
6
|
-
The ASF licenses this file to You under the Apache License, Version 2.0
|
7
|
-
(the "License"); you may not use this file except in compliance with
|
8
|
-
the License. You may obtain a copy of the License at
|
9
|
-
|
10
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
11
|
-
|
12
|
-
Unless required by applicable law or agreed to in writing, software
|
13
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
-
See the License for the specific language governing permissions and
|
16
|
-
limitations under the License.
|
17
|
-
-->
|
18
|
-
|
19
|
-
<!--
|
20
|
-
All (relative) paths are relative to the installation path
|
21
|
-
|
22
|
-
adminPath: RequestHandler path to manage multicores.
|
23
|
-
If 'null', cores will not be managable via REST
|
24
|
-
|
25
|
-
persistent: Save changes made via the API to this file
|
26
|
-
sharedLib: path to a lib directory that will be shared across all cores
|
27
|
-
-->
|
28
|
-
<solr persistent="true">
|
29
|
-
<cores adminPath="/admin/cores">
|
30
|
-
<core name="en" instanceDir="cores/en" default="true"/>
|
31
|
-
<core name="es" instanceDir="cores/es"/>
|
32
|
-
<core name="fr" instanceDir="cores/fr"/>
|
33
|
-
<core name="de" instanceDir="cores/de"/>
|
34
|
-
<core name="ru" instanceDir="cores/ru"/>
|
35
|
-
<core name="ja" instanceDir="cores/ja"/>
|
36
|
-
<core name="zh" instanceDir="cores/zh"/>
|
37
|
-
<core name="nl" instanceDir="cores/nl"/>
|
38
|
-
<!--
|
39
|
-
<core name="it" instanceDir="cores/it"/>
|
40
|
-
<core name="el" instanceDir="cores/el"/>
|
41
|
-
<core name="ko" instanceDir="cores/ko"/>
|
42
|
-
<core name="pt" instanceDir="cores/pt"/>
|
43
|
-
<core name="th" instanceDir="cores/th"/>
|
44
|
-
<core name="da" instanceDir="cores/da"/>
|
45
|
-
<core name="fi" instanceDir="cores/fi"/>
|
46
|
-
<core name="sv" instanceDir="cores/sv"/>
|
47
|
-
<core name="pt" instanceDir="cores/pt"/>
|
48
|
-
-->
|
49
|
-
</cores>
|
50
|
-
</solr>
|
@@ -1,49 +0,0 @@
|
|
1
|
-
module MuckControllerMacros
|
2
|
-
|
3
|
-
def should_require_login(*args)
|
4
|
-
args = Hash[*args]
|
5
|
-
login_url = args.delete :login_url
|
6
|
-
args.each do |action, verb|
|
7
|
-
should "Require login for '#{action}' action" do
|
8
|
-
if [:put, :delete].include?(verb) # put and delete require an id even if it is a bogus one
|
9
|
-
send(verb, action, :id => 1)
|
10
|
-
else
|
11
|
-
send(verb, action)
|
12
|
-
end
|
13
|
-
assert_redirected_to(login_url)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def should_require_role(role, redirect_url, *actions)
|
19
|
-
actions.each do |action|
|
20
|
-
should "require role for '#{action}' action" do
|
21
|
-
get(action)
|
22
|
-
ensure_flash(/permission/i)
|
23
|
-
assert_response :redirect
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
#from: http://blog.internautdesign.com/2008/9/11/more-on-custom-shoulda-macros-scoping-of-instance-variables
|
29
|
-
def should_not_allow action, object, url= "/login", msg=nil
|
30
|
-
msg ||= "a #{object.class.to_s.downcase}"
|
31
|
-
should "not be able to #{action} #{msg}" do
|
32
|
-
object = eval(object, self.send(:binding), __FILE__, __LINE__)
|
33
|
-
get action, :id => object.id
|
34
|
-
assert_redirected_to url
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def should_allow action, object, msg=nil
|
39
|
-
msg ||= "a #{object.class.to_s.downcase}"
|
40
|
-
should "be able to #{action} #{msg}" do
|
41
|
-
object = eval(object, self.send(:binding), __FILE__, __LINE__)
|
42
|
-
get action, :id => object.id
|
43
|
-
assert_response :success
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
ActionController::TestCase.extend(MuckControllerMacros)
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module ShouldaFormMacros
|
2
|
-
def self.should_have_form(opts)
|
3
|
-
model = self.name.gsub(/ControllerTest$/, '').singularize.downcase
|
4
|
-
model = model[model.rindex('::')+2..model.size] if model.include?('::')
|
5
|
-
http_method, hidden_http_method = form_http_method opts[:method]
|
6
|
-
should "have a #{model} form" do
|
7
|
-
assert_select "form[action=?][method=#{http_method}]", eval(opts[:action]) do
|
8
|
-
if hidden_http_method
|
9
|
-
assert_select "input[type=hidden][name=_method][value=#{hidden_http_method}]"
|
10
|
-
end
|
11
|
-
opts[:fields].each do |attribute, type|
|
12
|
-
attribute = attribute.is_a?(Symbol) ? "#{model}[#{attribute.to_s}]" : attribute
|
13
|
-
assert_select "input[type=#{type.to_s}][name=?]", attribute
|
14
|
-
end
|
15
|
-
assert_select "input[type=submit]"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.form_http_method(http_method)
|
21
|
-
http_method = http_method.nil? ? 'post' : http_method.to_s
|
22
|
-
if http_method == "post" || http_method == "get"
|
23
|
-
return http_method, nil
|
24
|
-
else
|
25
|
-
return "post", http_method
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
class ActiveSupport::TestCase
|
31
|
-
extend ShouldaFormMacros
|
32
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module ShouldaModelMacros
|
2
|
-
|
3
|
-
def should_sanitize(*attributes)
|
4
|
-
bad_scripts = [
|
5
|
-
%|';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//--></SCRIPT>">'><SCRIPT>alert(String.fromCharCode(88,83,83))</SCRIPT>|,
|
6
|
-
%|'';!--"<XSS>=&{()}|,
|
7
|
-
%|<SCRIPT SRC=http://ha.ckers.org/xss.js></SCRIPT>|,
|
8
|
-
%|<IMG SRC="javascript:alert('XSS');">|,
|
9
|
-
%|<IMG SRC=javascript:alert('XSS')>|,
|
10
|
-
%|<IMG SRC=JaVaScRiPt:alert('XSS')>|,
|
11
|
-
%|<IMG SRC=JaVaScRiPt:alert('XSS')>|,
|
12
|
-
%|<IMG SRC=`javascript:alert("RSnake says, 'XSS'")`>|,
|
13
|
-
%|<IMG """><SCRIPT>alert("XSS")</SCRIPT>">|,
|
14
|
-
%|<IMG SRC=javascript:alert(String.fromCharCode(88,83,83))>|,
|
15
|
-
%|<A HREF="h
|
16
|
-
tt p://6	6.000146.0x7.147/">XSS</A>|,
|
17
|
-
%|<script>alert('message');</script>| ]
|
18
|
-
|
19
|
-
klass = model_class
|
20
|
-
attributes.each do |attribute|
|
21
|
-
attribute = attribute.to_sym
|
22
|
-
should "white list #{attribute}" do
|
23
|
-
assert object = klass.find(:first), "Can't find first #{klass}"
|
24
|
-
bad_scripts.each do |bad_value|
|
25
|
-
object.send("#{attribute}=", bad_value)
|
26
|
-
object.save
|
27
|
-
clean_value = object.send("#{attribute}")
|
28
|
-
assert !clean_value.include?(bad_value), "#{attribute} is not white listed. #{bad_value} made it through"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def should_accept_nested_attributes_for(*attr_names)
|
35
|
-
klass = self.name.gsub(/Test$/, '').constantize
|
36
|
-
|
37
|
-
context "#{klass}" do
|
38
|
-
attr_names.each do |association_name|
|
39
|
-
should "accept nested attrs for #{association_name}" do
|
40
|
-
assert klass.instance_methods.include?("#{association_name}_attributes="),
|
41
|
-
"#{klass} does not accept nested attributes for #{association_name}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
class ActiveSupport::TestCase
|
49
|
-
extend ShouldaModelMacros
|
50
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
module ShouldaPaginationMacros
|
2
|
-
# Example:
|
3
|
-
# context "a GET to index logged in as admin" do
|
4
|
-
# setup do
|
5
|
-
# login_as_admin
|
6
|
-
# get :index
|
7
|
-
# end
|
8
|
-
# should_paginate_collection :users
|
9
|
-
# should_display_pagination
|
10
|
-
# end
|
11
|
-
def self.should_paginate_collection(collection_name)
|
12
|
-
should "paginate #{collection_name}" do
|
13
|
-
assert collection = assigns(collection_name),
|
14
|
-
"Controller isn't assigning to @#{collection_name.to_s}."
|
15
|
-
assert_kind_of WillPaginate::Collection, collection,
|
16
|
-
"@#{collection_name.to_s} isn't a WillPaginate collection."
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.should_display_pagination
|
21
|
-
should "display pagination" do
|
22
|
-
assert_select "div.pagination", { :minimum => 1 },
|
23
|
-
"View isn't displaying pagination. Add <%= will_paginate @collection %>."
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Example:
|
28
|
-
# context "a GET to index not logged in as admin" do
|
29
|
-
# setup { get :index }
|
30
|
-
# should_not_paginate_collection :users
|
31
|
-
# should_not_display_pagination
|
32
|
-
# end
|
33
|
-
def self.should_not_paginate_collection(collection_name)
|
34
|
-
should "not paginate #{collection_name}" do
|
35
|
-
assert collection = assigns(collection_name),
|
36
|
-
"Controller isn't assigning to @#{collection_name.to_s}."
|
37
|
-
assert_not_equal WillPaginate::Collection, collection.class,
|
38
|
-
"@#{collection_name.to_s} is a WillPaginate collection."
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.should_not_display_pagination
|
43
|
-
should "not display pagination" do
|
44
|
-
assert_select "div.pagination", { :count => 0 },
|
45
|
-
"View is displaying pagination. Check your logic."
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
|
51
|
-
class ActiveSupport::TestCase
|
52
|
-
extend ShouldaPaginationMacros
|
53
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module ShouldaPluginMacros
|
2
|
-
|
3
|
-
def self.should_act_as_taggable_on_steroids
|
4
|
-
klass = self.name.gsub(/Test$/, '').constantize
|
5
|
-
|
6
|
-
should "include ActsAsTaggableOnSteroids methods" do
|
7
|
-
assert klass.extended_by.include?(ActiveRecord::Acts::Taggable::ClassMethods)
|
8
|
-
assert klass.extended_by.include?(ActiveRecord::Acts::Taggable::SingletonMethods)
|
9
|
-
assert klass.include?(ActiveRecord::Acts::Taggable::InstanceMethods)
|
10
|
-
end
|
11
|
-
|
12
|
-
should_have_many :taggings, :tags
|
13
|
-
end
|
14
|
-
|
15
|
-
|
16
|
-
def self.should_act_as_list
|
17
|
-
klass = self.name.gsub(/Test$/, '').constantize
|
18
|
-
|
19
|
-
context "To support acts_as_list" do
|
20
|
-
should_have_db_column('position', :type => :integer)
|
21
|
-
end
|
22
|
-
|
23
|
-
should "include ActsAsList methods" do
|
24
|
-
assert klass.include?(ActiveRecord::Acts::List::InstanceMethods)
|
25
|
-
end
|
26
|
-
|
27
|
-
should_have_instance_methods :acts_as_list_class, :position_column, :scope_condition
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
ActiveSupport::TestCase.extend(ShouldaPluginMacros)
|
33
|
-
Test::Unit::TestCase.extend(ShouldaPluginMacros)
|
34
|
-
ActionController::TestCase.extend(ShouldaPluginMacros)
|