Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

remove libxml

  • Loading branch information...
commit 5b59c478edda1491362d2de560758c3c95bd79eb 1 parent c6e5e5b
@danielsdeleo danielsdeleo authored
View
4 README.rdoc
@@ -35,8 +35,6 @@ Install these via your platform's preferred method; for example apt, yum, ports,
* Git
* CouchDB
* RabbitMQ
-* libxml2 development package (for webrat)
-* libxslt develoment package (for webrat)
Install the following RubyGems.
@@ -44,7 +42,6 @@ Install the following RubyGems.
* rake
* rspec
* cucumber
-* webrat
* merb-core
* merb-assets
* merb-haml
@@ -52,7 +49,6 @@ Install the following RubyGems.
* merb-param-protection
* merb_cucumber
* coderay
-* libxml-ruby
Ohai is also by Opscode and available on GitHub, http://github.com/opscode/ohai/tree/master.
View
3  chef-server-api/app/controllers/search.rb
@@ -41,9 +41,6 @@ def show
end
query = Chef::SolrQuery.new(Chef::Config[:solr_url])
- params[:sort] ||= nil
- params[:rows] ||= 20
-
params[:type] = params[:id]
objects, start, total = query.search(params)
View
4 chef-server-webui/README.rdoc
@@ -34,8 +34,6 @@ Install these via your platform's preferred method; for example apt, yum, ports,
* Git
* CouchDB
-* libxml2 development package (for webrat)
-* libxslt develoment package (for webrat)
Install the following RubyGems.
@@ -43,9 +41,7 @@ Install the following RubyGems.
* rake
* rspec
* cucumber
-* webrat
* merb-core
-* roman-merb_cucumber
Ohai is also by Opscode and available on GitHub, http://github.com/opscode/ohai/tree/master.
View
2  chef-solr/chef-solr.gemspec
@@ -7,8 +7,6 @@ Gem::Specification.new do |gem|
gem.email = "adam@opscode.com"
gem.homepage = "http://wiki.opscode.com/display/chef"
gem.authors = ["Adam Jacob"]
- gem.add_dependency "libxml-ruby", ">=1.1.3"
- gem.add_dependency "uuidtools", ">=2.0.0"
gem.add_dependency "chef", Chef::Solr::VERSION
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
gem.executables = [ 'chef-solr', 'chef-solr-indexer', 'chef-solr-rebuild' ]
View
2  chef/README.rdoc
@@ -38,7 +38,6 @@ Install these via your platform's preferred method; for example apt, yum, ports,
* RabbitMQ[http://www.rabbitmq.com/]
* GCC and C Standard Libraries, header files, etc. (i.e., build-essential on debian/ubuntu)
* Ruby development package
-* libxml2 development package
=== Runtime Rubygem Dependencies
==== Chef Client and Solo
@@ -61,7 +60,6 @@ Install these via your platform's preferred method; for example apt, yum, ports,
All of the above, plus the following:
* coderay
* haml
-* libxml-ruby
* merb-assets
* merb-core
* merb-haml
View
43 chef/lib/chef/solr_query.rb
@@ -21,7 +21,6 @@
require 'chef/config'
require 'chef/couchdb'
require 'net/http'
-require 'libxml'
require 'uri'
class Chef
@@ -191,23 +190,24 @@ def post_to_solr(doc)
http_request_handler(req, description)
end
- START_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<add><doc>"
- END_XML = "</doc></add>\n"
- FIELD_ATTR = '<field name="'
- FIELD_ATTR_END = '">'
- CLOSE_FIELD = "</field>"
+ START_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".freeze
+ START_DELETE_BY_QUERY = "<delete><query>".freeze
+ END_DELETE_BY_QUERY = "</query></delete>\n".freeze
+ COMMIT = "<commit/>\n".freeze
def solr_commit(opts={})
- post_to_solr(generate_single_element("commit", opts))
+ post_to_solr("#{START_XML}#{COMMIT}")
end
- def solr_delete_by_query(queries)
- post_to_solr(generate_delete_document("query", queries))
+ def delete_database(db)
+ query_data = xml_escape("X_CHEF_database_CHEF_X:#{db}")
+ xml = "#{START_XML}#{START_DELETE_BY_QUERY}#{query_data}#{END_DELETE_BY_QUERY}"
+ post_to_solr(xml)
+ solr_commit
end
def rebuild_index(url=Chef::Config[:couchdb_url], db=Chef::Config[:couchdb_database])
- solr_delete_by_query("X_CHEF_database_CHEF_X:#{db}")
- solr_commit
+ delete_database(db)
results = {}
[Chef::ApiClient, Chef::Node, Chef::Role].each do |klass|
@@ -242,27 +242,6 @@ def reindex_all(klass, metadata={})
true
end
- def generate_single_element(elem, opts={})
- xml_document = LibXML::XML::Document.new
- xml_elem = LibXML::XML::Node.new(elem)
- opts.each { |k,v| xml_elem[k.to_s] = xml_escape(v.to_s) }
- xml_document.root = xml_elem
- xml_document.to_s(:indent => false)
- end
-
- def generate_delete_document(type, list)
- list = [list] unless list.is_a?(Array)
- xml_document = LibXML::XML::Document.new
- xml_delete = LibXML::XML::Node.new("delete")
- xml_document.root = xml_delete
- list.each do |id|
- xml_id = LibXML::XML::Node.new(type)
- xml_id.content = id.to_s
- xml_delete << xml_id
- end
- xml_document.to_s(:indent => false)
- end
-
# Thanks to Merb!
def to_params(params_hash)
params = ''
View
15 chef/spec/unit/solr_query_spec.rb
@@ -153,19 +153,14 @@
end
end
- describe "solr_delete_by_query" do
+ describe "when deleting a database from Solr" do
before(:each) do
@solr.stub!(:post_to_solr).and_return(true)
end
- it "should send valid delete id xml to solr" do
- @solr.should_receive(:post_to_solr).with("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<delete><query>foo:bar</query></delete>\n")
- @solr.solr_delete_by_query("foo:bar")
- end
-
- it "should accept multiple ids" do
- @solr.should_receive(:post_to_solr).with("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<delete><query>foo:bar</query><query>baz:bum</query></delete>\n")
- @solr.solr_delete_by_query([ "foo:bar", "baz:bum" ])
+ it "should send a valid delete query to solr" do
+ @solr.should_receive(:post_to_solr).with("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<delete><query>X_CHEF_database_CHEF_X:chef</query></delete>\n")
+ @solr.delete_database("chef")
end
end
@@ -175,7 +170,7 @@
end
it "deletes the index and commits" do
- @solr.should_receive(:solr_delete_by_query).with("X_CHEF_database_CHEF_X:chunky_bacon")
+ @solr.should_receive(:post_to_solr).with("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<delete><query>X_CHEF_database_CHEF_X:chunky_bacon</query></delete>\n")
@solr.should_receive(:solr_commit)
@solr.stub!(:reindex_all)
Chef::DataBag.stub!(:cdb_list).and_return([])
Please sign in to comment.
Something went wrong with that request. Please try again.