ffi-hunspell 0.2.0 → 0.2.2

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/ChangeLog.md CHANGED
@@ -1,3 +1,17 @@
1
+ ### 0.2.2 / 2011-01-25
2
+
3
+ * Added {FFI::Hunspell::USER_DIR}.
4
+ * Added {FFI::Hunspell::KNOWN_DIRECTORIES}, containing known dictionary
5
+ directories used by Debian, Fedora and Mac Ports.
6
+ * Have {FFI::Hunspell.directories} return the dictionary directories found
7
+ on the system.
8
+
9
+ ### 0.2.1 / 2011-01-23
10
+
11
+ * Require env ~> 0.1.2.
12
+ * Use `Env.lang` to get the default language.
13
+ * Updated the Copyright years.
14
+
1
15
  ### 0.2.0 / 2011-01-22
2
16
 
3
17
  * Added {FFI::Hunspell.lang}.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Hal Brodigan
1
+ Copyright (c) 2010-2011 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -49,6 +49,7 @@ Suggest alternate spellings for a word:
49
49
 
50
50
  * [libhunspell](http://hunspell.sourceforge.net/) >= 1.2.0
51
51
  * [ffi](http://github.com/ffi/ffi) ~> 0.6.0
52
+ * [env](http://github.com/postmodern/env) ~> 0.1.2
52
53
 
53
54
  ## Install
54
55
 
@@ -65,5 +66,6 @@ so that {FFI::Hunspell} can find the library:
65
66
 
66
67
  ## License
67
68
 
68
- See {file:LICENSE.txt} for license information.
69
+ Copyright (c) 2010-2011 Hal Brodigan
69
70
 
71
+ See {file:LICENSE.txt} for license information.
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
 
4
4
  begin
5
- gem 'ore-tasks', '~> 0.2.0'
5
+ gem 'ore-tasks', '~> 0.3.0'
6
6
  require 'ore/tasks'
7
7
 
8
8
  Ore::Tasks.new
@@ -12,7 +12,7 @@ rescue LoadError => e
12
12
  end
13
13
 
14
14
  begin
15
- gem 'rspec', '~> 2.0.0'
15
+ gem 'rspec', '~> 2.4.0'
16
16
  require 'rspec/core/rake_task'
17
17
 
18
18
  RSpec::Core::RakeTask.new
data/gemspec.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: ffi-hunspell
2
- version: 0.2.0
2
+ version: 0.2.2
3
3
  summary: FFI bindings for Hunspell
4
4
  description: Ruby FFI bindings for Hunspell spell checker.
5
5
  license: MIT
@@ -12,8 +12,9 @@ requirements: libhunspell >= 1.2.0
12
12
 
13
13
  dependencies:
14
14
  ffi: ~> 0.6.0
15
+ env: ~> 0.1.2
15
16
 
16
17
  development_dependencies:
17
- ore-tasks: ~> 0.2.0
18
- rspec: ~> 2.0.0
18
+ ore-tasks: ~> 0.3.0
19
+ rspec: ~> 2.4.0
19
20
  yard: ~> 0.6.0
@@ -26,7 +26,7 @@ module FFI
26
26
  # The optional key for encrypted dictionary files.
27
27
  #
28
28
  # @raise [RuntimeError]
29
- # Either the affix or dic files did not exist.
29
+ # Either the `.aff` or `.dic` files did not exist.
30
30
  #
31
31
  def initialize(affix_path,dic_path,key=nil)
32
32
  unless File.file?(affix_path)
@@ -1,4 +1,5 @@
1
1
  require 'ffi'
2
+ require 'env'
2
3
 
3
4
  module FFI
4
5
  module Hunspell
@@ -39,11 +40,7 @@ module FFI
39
40
  # @since 0.2.0
40
41
  #
41
42
  def Hunspell.lang
42
- @lang ||= if ENV['LANG']
43
- ENV['LANG'].split('.',2).first
44
- else
45
- DEFAULT_LANG
46
- end
43
+ @lang ||= (Env.lang[0] || DEFAULT_LANG)
47
44
  end
48
45
 
49
46
  #
@@ -61,24 +58,36 @@ module FFI
61
58
  @lang = new_lang.to_s
62
59
  end
63
60
 
61
+ # The directory name used to store user installed dictionaries.
62
+ USER_DIR = '.hunspell_default'
63
+
64
+ # Known directories to search within for dictionaries.
65
+ KNOWN_DIRECTORIES = [
66
+ # User
67
+ Env.home.join(USER_DIR),
68
+ # Debian
69
+ '/usr/local/share/myspell/dicts',
70
+ '/usr/share/myspell/dicts',
71
+ # Fedora
72
+ '/usr/local/share/myspell',
73
+ '/usr/share/myspell',
74
+ # Mac Ports
75
+ '/opt/local/share/hunspell',
76
+ '/opt/share/hunspell'
77
+ ]
78
+
64
79
  #
65
- # The directories to search for dictionary files.
80
+ # The dictionary directories to search for dictionary files.
66
81
  #
67
- # @return [Array]
82
+ # @return [Array<String, Pathname>]
68
83
  # The directory paths.
69
84
  #
70
85
  # @since 0.2.0
71
86
  #
72
87
  def Hunspell.directories
73
- @directories ||= [
74
- '/usr/local/share/myspell',
75
- '/usr/share/myspell'
76
- ]
77
- end
78
-
79
- # prepend the ~/.hunspell_default directory to DIRS
80
- if (home = (ENV['HOME'] || ENV['HOMEPATH']))
81
- directories.unshift(File.join(home,'.hunspell_default'))
88
+ @directories ||= KNOWN_DIRECTORIES.select do |path|
89
+ File.directory?(path)
90
+ end
82
91
  end
83
92
 
84
93
  #
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,6 @@
1
+ gem 'rspec', '~> 2.4.0'
1
2
  require 'rspec'
3
+
2
4
  require 'ffi/hunspell'
3
5
 
4
6
  include FFI
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 0
9
- version: 0.2.0
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Postmodern
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-01-22 00:00:00 -08:00
17
+ date: 2011-01-25 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- name: ore-tasks
36
+ name: env
37
37
  prerelease: false
38
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
@@ -42,13 +42,13 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  segments:
44
44
  - 0
45
+ - 1
45
46
  - 2
46
- - 0
47
- version: 0.2.0
48
- type: :development
47
+ version: 0.1.2
48
+ type: :runtime
49
49
  version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
51
- name: rspec
51
+ name: ore-tasks
52
52
  prerelease: false
53
53
  requirement: &id003 !ruby/object:Gem::Requirement
54
54
  none: false
@@ -56,16 +56,31 @@ dependencies:
56
56
  - - ~>
57
57
  - !ruby/object:Gem::Version
58
58
  segments:
59
- - 2
60
59
  - 0
60
+ - 3
61
61
  - 0
62
- version: 2.0.0
62
+ version: 0.3.0
63
63
  type: :development
64
64
  version_requirements: *id003
65
65
  - !ruby/object:Gem::Dependency
66
- name: yard
66
+ name: rspec
67
67
  prerelease: false
68
68
  requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ~>
72
+ - !ruby/object:Gem::Version
73
+ segments:
74
+ - 2
75
+ - 4
76
+ - 0
77
+ version: 2.4.0
78
+ type: :development
79
+ version_requirements: *id004
80
+ - !ruby/object:Gem::Dependency
81
+ name: yard
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
69
84
  none: false
70
85
  requirements:
71
86
  - - ~>
@@ -76,7 +91,7 @@ dependencies:
76
91
  - 0
77
92
  version: 0.6.0
78
93
  type: :development
79
- version_requirements: *id004
94
+ version_requirements: *id005
80
95
  description: Ruby FFI bindings for Hunspell spell checker.
81
96
  email: postmodern.mod3@gmail.com
82
97
  executables: []