tinymce_spellcheck 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ gem "raspell", "~> 1.3"
9
+
10
+ group :development do
11
+ gem "shoulda", ">= 0"
12
+ gem "rdoc", "~> 3.12"
13
+ gem "bundler", "~> 1.0.0"
14
+ gem "jeweler", "~> 1.8.3"
15
+ gem "rcov", ">= 0"
16
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,31 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.8.3)
6
+ bundler (~> 1.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rdoc
10
+ json (1.7.3)
11
+ rake (0.9.2.2)
12
+ raspell (1.3)
13
+ rcov (1.0.0)
14
+ rdoc (3.12)
15
+ json (~> 1.4)
16
+ shoulda (3.0.1)
17
+ shoulda-context (~> 1.0.0)
18
+ shoulda-matchers (~> 1.0.0)
19
+ shoulda-context (1.0.0)
20
+ shoulda-matchers (1.0.0)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ bundler (~> 1.0.0)
27
+ jeweler (~> 1.8.3)
28
+ raspell (~> 1.3)
29
+ rcov
30
+ rdoc (~> 3.12)
31
+ shoulda
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Myles Eftos
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1,24 @@
1
+ h1. TinymceSpellcheck
2
+
3
+ Acts as an interface to the TinyMCE spell checker plugin. At the moment, it only supports ASpell (via the "raspell gem":http://github.com/fauna/raspell) but it has the ability to abstract engines away, so it can be extended in the future.
4
+
5
+ h2. Install
6
+
7
+ bc. % gem install tinymce_spellcheck
8
+
9
+ .h3 Via Bundler
10
+
11
+ gem 'tinymce_spellcheck'
12
+
13
+ h2. Example
14
+
15
+ bc. def spellcheck
16
+ data = ActiveSupport::JSON.decode(request.raw_post)
17
+ args = data['params'].to_a.first
18
+ spellcheck = TinymceSpellcheck::TinymceSpellcheck.new({}, :raspell)
19
+ result = spellcheck.send(data['method'].underscore, *args)
20
+ render :json => { :id => data['id'], :result => result, :error => nil }.to_json
21
+ end
22
+
23
+
24
+ Copyright (c) 2009-2012 "MadPilot Productions":http://www.madpilot.com.au, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "tinymce_spellcheck"
18
+ gem.homepage = "http://github.com/madpilot/tinymce_spellcheck"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Interface between raspell and TinyMCE}
21
+ gem.description = %Q{Interface between raspell and TinyMCE}
22
+ gem.email = "myles@madpilot.com.au"
23
+ gem.authors = ["Myles Eftos"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rdoc/task'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "tinymce_spellcheck #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,2 @@
1
+ require File.dirname(__FILE__) + '/tinymce_spellcheck/tinymce_spellcheck'
2
+ require File.dirname(__FILE__) + '/tinymce_spellcheck/engines/raspell'
@@ -0,0 +1,27 @@
1
+ require 'raspell'
2
+
3
+ module TinymceSpellcheck
4
+ module Engines
5
+ class Raspell
6
+ def initialize(options = {})
7
+ end
8
+
9
+ def check_words(lang, words)
10
+ @speller = Aspell.new(lang)
11
+ @speller.suggestion_mode = Aspell::NORMAL
12
+
13
+ misspelled = []
14
+ words.each do |word|
15
+ misspelled << word unless @speller.check(word)
16
+ end
17
+ misspelled
18
+ end
19
+
20
+ def get_suggestions(lang, word)
21
+ @speller = Aspell.new(lang)
22
+ @speller.suggestion_mode = Aspell::NORMAL
23
+ @speller.suggest(word)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,22 @@
1
+ module TinymceSpellcheck
2
+ class TinymceSpellcheck
3
+ def initialize(options = {}, engine = nil)
4
+ @@engines = [ :raspell ]
5
+ unless engine
6
+ engine = :raspell
7
+ end
8
+
9
+ raise Exception, "Unsupported engine" unless (engine && @@engines.include?(engine))
10
+
11
+ @engine = Engines.const_get(engine.to_s.classify).new(options)
12
+ end
13
+
14
+ def check_words(lang, words)
15
+ @engine.check_words(lang, words)
16
+ end
17
+
18
+ def get_suggestions(lang, word)
19
+ @engine.get_suggestions(lang, word)
20
+ end
21
+ end
22
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'tinymce_spellcheck'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestTinymceSpellcheck < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "tinymce_spellcheck"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Myles Eftos"]
12
+ s.date = "2012-06-05"
13
+ s.description = "Interface between raspell and TinyMCE"
14
+ s.email = "myles@madpilot.com.au"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.textile"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.textile",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/tinymce_spellcheck.rb",
28
+ "lib/tinymce_spellcheck/engines/raspell.rb",
29
+ "lib/tinymce_spellcheck/tinymce_spellcheck.rb",
30
+ "test/helper.rb",
31
+ "test/test_tinymce_spellcheck.rb",
32
+ "tinymce_spellcheck.gemspec"
33
+ ]
34
+ s.homepage = "http://github.com/madpilot/tinymce_spellcheck"
35
+ s.licenses = ["MIT"]
36
+ s.require_paths = ["lib"]
37
+ s.rubygems_version = "1.8.10"
38
+ s.summary = "Interface between raspell and TinyMCE"
39
+
40
+ if s.respond_to? :specification_version then
41
+ s.specification_version = 3
42
+
43
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<raspell>, ["~> 1.3"])
45
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
46
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
47
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
49
+ s.add_development_dependency(%q<rcov>, [">= 0"])
50
+ else
51
+ s.add_dependency(%q<raspell>, ["~> 1.3"])
52
+ s.add_dependency(%q<shoulda>, [">= 0"])
53
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
54
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
55
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
56
+ s.add_dependency(%q<rcov>, [">= 0"])
57
+ end
58
+ else
59
+ s.add_dependency(%q<raspell>, ["~> 1.3"])
60
+ s.add_dependency(%q<shoulda>, [">= 0"])
61
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
62
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
63
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
64
+ s.add_dependency(%q<rcov>, [">= 0"])
65
+ end
66
+ end
67
+
metadata ADDED
@@ -0,0 +1,167 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tinymce_spellcheck
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Myles Eftos
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-06-05 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ hash: 9
27
+ segments:
28
+ - 1
29
+ - 3
30
+ version: "1.3"
31
+ version_requirements: *id001
32
+ name: raspell
33
+ prerelease: false
34
+ type: :runtime
35
+ - !ruby/object:Gem::Dependency
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ hash: 3
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ version_requirements: *id002
46
+ name: shoulda
47
+ prerelease: false
48
+ type: :development
49
+ - !ruby/object:Gem::Dependency
50
+ requirement: &id003 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ hash: 31
56
+ segments:
57
+ - 3
58
+ - 12
59
+ version: "3.12"
60
+ version_requirements: *id003
61
+ name: rdoc
62
+ prerelease: false
63
+ type: :development
64
+ - !ruby/object:Gem::Dependency
65
+ requirement: &id004 !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ~>
69
+ - !ruby/object:Gem::Version
70
+ hash: 23
71
+ segments:
72
+ - 1
73
+ - 0
74
+ - 0
75
+ version: 1.0.0
76
+ version_requirements: *id004
77
+ name: bundler
78
+ prerelease: false
79
+ type: :development
80
+ - !ruby/object:Gem::Dependency
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ~>
85
+ - !ruby/object:Gem::Version
86
+ hash: 49
87
+ segments:
88
+ - 1
89
+ - 8
90
+ - 3
91
+ version: 1.8.3
92
+ version_requirements: *id005
93
+ name: jeweler
94
+ prerelease: false
95
+ type: :development
96
+ - !ruby/object:Gem::Dependency
97
+ requirement: &id006 !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ hash: 3
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ version_requirements: *id006
107
+ name: rcov
108
+ prerelease: false
109
+ type: :development
110
+ description: Interface between raspell and TinyMCE
111
+ email: myles@madpilot.com.au
112
+ executables: []
113
+
114
+ extensions: []
115
+
116
+ extra_rdoc_files:
117
+ - LICENSE.txt
118
+ - README.textile
119
+ files:
120
+ - .document
121
+ - Gemfile
122
+ - Gemfile.lock
123
+ - LICENSE.txt
124
+ - README.textile
125
+ - Rakefile
126
+ - VERSION
127
+ - lib/tinymce_spellcheck.rb
128
+ - lib/tinymce_spellcheck/engines/raspell.rb
129
+ - lib/tinymce_spellcheck/tinymce_spellcheck.rb
130
+ - test/helper.rb
131
+ - test/test_tinymce_spellcheck.rb
132
+ - tinymce_spellcheck.gemspec
133
+ homepage: http://github.com/madpilot/tinymce_spellcheck
134
+ licenses:
135
+ - MIT
136
+ post_install_message:
137
+ rdoc_options: []
138
+
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ none: false
143
+ requirements:
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ hash: 3
147
+ segments:
148
+ - 0
149
+ version: "0"
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ hash: 3
156
+ segments:
157
+ - 0
158
+ version: "0"
159
+ requirements: []
160
+
161
+ rubyforge_project:
162
+ rubygems_version: 1.8.10
163
+ signing_key:
164
+ specification_version: 3
165
+ summary: Interface between raspell and TinyMCE
166
+ test_files: []
167
+