opensearchkick 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +17 -0
- data/.gitignore +16 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +42 -0
- data/Rakefile +2 -0
- data/app/controllers/opensearchkick/opensearch_controller.rb +16 -0
- data/app/views/opensearchkick/opensearch/opensearch.xml.builder +13 -0
- data/config/routes.rb +4 -0
- data/lib/generators/opensearchkick/install_generator.rb +14 -0
- data/lib/generators/templates/opensearchkick_initializer.rb +16 -0
- data/lib/opensearchkick.rb +11 -0
- data/lib/opensearchkick/engine.rb +3 -0
- data/lib/opensearchkick/version.rb +3 -0
- data/opensearchkick.gemspec +25 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bcc6e246526ed9d767bcf1c617c0d653554cd21b
|
4
|
+
data.tar.gz: 2df603d246a87eafde008b60730fe377277ebd58
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5e2f07c0265c3e1f5a8631a94360464e086c8acfb6f0cf7cc00bfc37feb58d6bb0c815bab6d4b5512ba271d1e995044bdee2f51fcca583d3f8ffe97bf6c692ff
|
7
|
+
data.tar.gz: 22dc3bda7db863a2fab204861ed610fcfb08427179219a74c10d9af3daa039af1e34661e8782f30378a7b590d7d404310b0a78b22abc7b0860e54a6a7029973d
|
data/.gitattributes
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Auto detect text files and perform LF normalization
|
2
|
+
* text=auto
|
3
|
+
|
4
|
+
# Custom for Visual Studio
|
5
|
+
*.cs diff=csharp
|
6
|
+
|
7
|
+
# Standard to msysgit
|
8
|
+
*.doc diff=astextplain
|
9
|
+
*.DOC diff=astextplain
|
10
|
+
*.docx diff=astextplain
|
11
|
+
*.DOCX diff=astextplain
|
12
|
+
*.dot diff=astextplain
|
13
|
+
*.DOT diff=astextplain
|
14
|
+
*.pdf diff=astextplain
|
15
|
+
*.PDF diff=astextplain
|
16
|
+
*.rtf diff=astextplain
|
17
|
+
*.RTF diff=astextplain
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Håkan Nylén
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Opensearchkick
|
2
|
+
|
3
|
+
Adding opensearch fuinctionality to your Application. Right now untested opensearch-functionality. Soon with suggestion support.
|
4
|
+
|
5
|
+
## Dependency
|
6
|
+
|
7
|
+
opensearchkick will use `searchkick` for the suggestion functionality.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'opensearchkick'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle install
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install opensearchkick
|
24
|
+
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
You config everything with the initializer, create it by running the following command:
|
29
|
+
|
30
|
+
$ rails g opensearchkick:install
|
31
|
+
|
32
|
+
And you will have opensearchkick.rb in your initializer directory. After that you just need to add following line to your header:
|
33
|
+
|
34
|
+
<link rel="search" type="application/opensearchdescription+xml" href="opensearch.xml" title="Your Application name" />
|
35
|
+
|
36
|
+
## Contributing
|
37
|
+
|
38
|
+
1. Fork it ( https://github.com/dirble/opensearchkick/fork )
|
39
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
41
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Opensearchkick
|
2
|
+
class OpensearchController < ApplicationController
|
3
|
+
def opensearch
|
4
|
+
response.headers['Content-Type'] = 'application/opensearchdescription+xml; charset=utf-8'
|
5
|
+
@description = Configuration.description
|
6
|
+
@contact_email = Configuration.contact_email
|
7
|
+
@title = Configuration.default_title
|
8
|
+
@url = Configuration.search_url
|
9
|
+
@image_path = Configuration.image_path
|
10
|
+
respond_to :xml
|
11
|
+
end
|
12
|
+
def suggestions
|
13
|
+
# TODO: add suggestion support
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
xml.instruct!
|
2
|
+
xml.OpenSearchDescription(:xmlns => 'http://a9.com/-/spec/opensearch/1.1/', 'xmlns:moz' => 'http://www.mozilla.org/2006/browser/search/') do
|
3
|
+
xml.ShortName(@title)
|
4
|
+
xml.InputEncoding('UTF-8')
|
5
|
+
xml.Description(@description)
|
6
|
+
xml.Contact(@contact_email)
|
7
|
+
if @image_path.present?
|
8
|
+
xml.Image(@image_path, height: 16, width: 16, type: 'image/png')
|
9
|
+
end
|
10
|
+
# escape route helper or else it escapes the '{' '}' characters. then search doesn't work
|
11
|
+
xml.Url(type: 'text/html', method: 'get', template: CGI::unescape(@url))
|
12
|
+
xml.moz(:SearchForm, root_url)
|
13
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
module Opensearchkick
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../../templates", __FILE__)
|
5
|
+
desc "Creates Opensearchkick initializer for your application"
|
6
|
+
|
7
|
+
def copy_initializer
|
8
|
+
template "opensearchkick_initializer.rb", "config/initializers/opensearchkick.rb"
|
9
|
+
|
10
|
+
puts "Install complete! Truly Outrageous!"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Opensearchkick::Configuration.configure do |config|
|
2
|
+
# the most important thing, the url to the search, {searchTerms} is where the query will be.
|
3
|
+
config.search_url = 'http://localhost/search?q={searchTerms}'
|
4
|
+
|
5
|
+
# the title of the search
|
6
|
+
# config.default_title = 'Opensearch'
|
7
|
+
|
8
|
+
# The description shown in opensearch to describe your website/search
|
9
|
+
# config.description = 'Opensearch to search in your browser.'
|
10
|
+
|
11
|
+
# set contact email for people wanna contact you
|
12
|
+
# config.contact_email = 'opensearch@test.org'
|
13
|
+
|
14
|
+
# set a image you want to show for opensearch (like a logo)
|
15
|
+
# config.image_path = '/public/logo.png'
|
16
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "opensearchkick/version"
|
2
|
+
require 'opensearchkick/engine'
|
3
|
+
require "confiture"
|
4
|
+
module Opensearchkick
|
5
|
+
class Configuration
|
6
|
+
include Confiture::Configuration
|
7
|
+
|
8
|
+
confiture_allowed_keys(:description, :contact_email, :default_title, :search_url, :image_path)
|
9
|
+
confiture_defaults(description: 'A opensearch', contact_email: 'opensearch@test.org', default_title:'Opensearch for your application', search_url: 'http://localhost/search?q={searchTerms}', image_path: nil)
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'opensearchkick/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "opensearchkick"
|
8
|
+
spec.version = Opensearchkick::VERSION
|
9
|
+
spec.authors = ["Håkan Nylén"]
|
10
|
+
spec.email = ["hakan@dun.se"]
|
11
|
+
spec.summary = %q{Opensearch for your Rails Application}
|
12
|
+
spec.description = %q{adding opensearch functionality to your application with suggestions and more.}
|
13
|
+
spec.homepage = "http://github.com/dirble/opensearchkick/"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency('confiture', '>= 0.1')
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: opensearchkick
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Håkan Nylén
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: confiture
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: adding opensearch functionality to your application with suggestions
|
56
|
+
and more.
|
57
|
+
email:
|
58
|
+
- hakan@dun.se
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitattributes
|
64
|
+
- .gitignore
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- app/controllers/opensearchkick/opensearch_controller.rb
|
70
|
+
- app/views/opensearchkick/opensearch/opensearch.xml.builder
|
71
|
+
- config/routes.rb
|
72
|
+
- lib/generators/opensearchkick/install_generator.rb
|
73
|
+
- lib/generators/templates/opensearchkick_initializer.rb
|
74
|
+
- lib/opensearchkick.rb
|
75
|
+
- lib/opensearchkick/engine.rb
|
76
|
+
- lib/opensearchkick/version.rb
|
77
|
+
- opensearchkick.gemspec
|
78
|
+
homepage: http://github.com/dirble/opensearchkick/
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata: {}
|
82
|
+
post_install_message:
|
83
|
+
rdoc_options: []
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 2.2.2
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: Opensearch for your Rails Application
|
102
|
+
test_files: []
|