fast_gettext 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ script: "bundle exec rake"
2
+ rvm:
3
+ - ree
4
+ - 1.9.2
5
+ - 1.9.3
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  task :default do
2
- sh "AR='~>2' bundle && bundle exec rspec spec" # ActiveRecord 2
3
- sh "AR='~>3' bundle && bundle exec rspec spec" # ActiveRecord 3
2
+ sh "AR='~>2' && (bundle || bundle install) && bundle exec rspec spec" # ActiveRecord 2
3
+ sh "AR='~>3' && (bundle || bundle install) && bundle exec rspec spec" # ActiveRecord 3
4
4
  end
5
5
 
6
6
  task :benchmark do
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.0
1
+ 0.6.1
data/fast_gettext.gemspec CHANGED
@@ -4,14 +4,15 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{fast_gettext}
8
- s.version = "0.6.0"
7
+ s.name = "fast_gettext"
8
+ s.version = "0.6.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2011-10-03}
13
- s.email = %q{michael@grosser.it}
12
+ s.date = "2011-10-08"
13
+ s.email = "michael@grosser.it"
14
14
  s.files = [
15
+ ".travis.yml",
15
16
  "CHANGELOG",
16
17
  "Gemfile",
17
18
  "Gemfile.lock",
@@ -55,6 +56,8 @@ Gem::Specification.new do |s|
55
56
  "lib/fast_gettext/vendor/poparser.rb",
56
57
  "lib/fast_gettext/vendor/string.rb",
57
58
  "spec/aa_unconfigued_spec.rb",
59
+ "spec/cases/fake_load_path/iconv.rb",
60
+ "spec/cases/iconv_fallback.rb",
58
61
  "spec/cases/interpolate_i18n_after_fast_gettext.rb",
59
62
  "spec/cases/interpolate_i18n_before_fast_gettext.rb",
60
63
  "spec/fast_gettext/mo_file_spec.rb",
@@ -68,7 +71,6 @@ Gem::Specification.new do |s|
68
71
  "spec/fast_gettext/translation_repository/yaml_spec.rb",
69
72
  "spec/fast_gettext/translation_repository_spec.rb",
70
73
  "spec/fast_gettext/translation_spec.rb",
71
- "spec/fast_gettext/vendor/fake_load_path/iconv.rb",
72
74
  "spec/fast_gettext/vendor/iconv_spec.rb",
73
75
  "spec/fast_gettext/vendor/string_spec.rb",
74
76
  "spec/fast_gettext_spec.rb",
@@ -87,10 +89,10 @@ Gem::Specification.new do |s|
87
89
  "spec/obsolete_locale/de/test.po",
88
90
  "spec/spec_helper.rb"
89
91
  ]
90
- s.homepage = %q{http://github.com/grosser/fast_gettext}
92
+ s.homepage = "http://github.com/grosser/fast_gettext"
91
93
  s.require_paths = ["lib"]
92
- s.rubygems_version = %q{1.6.2}
93
- s.summary = %q{A simple, fast, memory-efficient and threadsafe implementation of GetText}
94
+ s.rubygems_version = "1.8.10"
95
+ s.summary = "A simple, fast, memory-efficient and threadsafe implementation of GetText"
94
96
 
95
97
  if s.respond_to? :specification_version then
96
98
  s.specification_version = 3
@@ -18,8 +18,12 @@
18
18
  #Modifications
19
19
  #wrapped inside FastGettext namespace to reduce conflic
20
20
 
21
+ module FastGettext; end
22
+
21
23
  begin
24
+ old_verbose, $VERBOSE = $VERBOSE, nil # hide deprecation on 1.9.3
22
25
  require 'iconv'
26
+ FastGettext::Iconv = Iconv
23
27
  rescue LoadError
24
28
  # Provides Iconv.iconv which normally is provided through Ruby/GLib(1) functions.
25
29
  # This library is required for 'gettext'.
@@ -34,7 +38,7 @@ rescue LoadError
34
38
  # You can get binaries for Win32(One-Click Ruby Installer).
35
39
  # <URL: http://ruby-gnome2.sourceforge.jp/>
36
40
  module FastGettext
37
- class Iconv2
41
+ class Iconv
38
42
  module Failure; end
39
43
  class InvalidEncoding < ArgumentError; include Failure; end
40
44
  class IllegalSequence < ArgumentError; include Failure; end
@@ -104,4 +108,6 @@ rescue LoadError
104
108
  end
105
109
  end
106
110
  end
107
- end
111
+ ensure
112
+ $VERBOSE = old_verbose
113
+ end
@@ -15,7 +15,7 @@
15
15
  $Id: mo.rb,v 1.10 2008/06/17 16:40:52 mutoh Exp $
16
16
  =end
17
17
 
18
- require 'iconv'
18
+ require 'fast_gettext/vendor/iconv'
19
19
  require 'stringio'
20
20
 
21
21
  #Modifications:
@@ -151,9 +151,8 @@ module FastGettext
151
151
  else
152
152
  if @output_charset
153
153
  begin
154
- iconv = Iconv || FastGettext::Iconv
155
- str = iconv.conv(@output_charset, @charset, str) if @charset
156
- rescue iconv::Failure
154
+ str = FastGettext::Iconv.conv(@output_charset, @charset, str) if @charset
155
+ rescue FastGettext::Iconv::Failure
157
156
  if $DEBUG
158
157
  warn "@charset = ", @charset
159
158
  warn"@output_charset = ", @output_charset
@@ -293,4 +292,4 @@ module FastGettext
293
292
  attr_reader :charset, :nplurals, :plural
294
293
  end
295
294
  end
296
- end
295
+ end
@@ -0,0 +1,22 @@
1
+ $LOAD_PATH.unshift 'lib'
2
+ $LOAD_PATH.unshift File.join('spec','cases','fake_load_path')
3
+
4
+ # test that iconv cannot be found
5
+ test = 1
6
+ begin
7
+ require 'iconv'
8
+ rescue LoadError
9
+ test = 2
10
+ end
11
+ raise unless test == 2
12
+
13
+ # use FastGettext like normal and see if it fails
14
+ require 'fast_gettext'
15
+
16
+ FastGettext.add_text_domain('test',:path=>File.join('spec','locale'))
17
+ FastGettext.text_domain = 'test'
18
+ FastGettext.available_locales = ['en','de']
19
+ FastGettext.locale = 'de'
20
+
21
+ #translate
22
+ raise unless FastGettext._('car') == 'Auto'
@@ -1,34 +1,7 @@
1
1
  require File.expand_path('spec/spec_helper')
2
2
 
3
3
  describe 'Iconv' do
4
- before do
5
- @fake_load_path = File.join('spec','fast_gettext','vendor','fake_load_path')
6
- end
7
-
8
- after do
9
- $LOAD_PATH.delete @fake_load_path
10
- end
11
-
12
4
  it "also works when Iconv was not found locally" do
13
- #prepare load path
14
- $LOAD_PATH.unshift @fake_load_path
15
- test = 1
16
- begin
17
- require 'iconv'
18
- rescue LoadError
19
- test = 2
20
- end
21
- test.should == 2
22
-
23
- #load fast_gettext
24
- require 'fast_gettext'
25
-
26
- FastGettext.add_text_domain('test',:path=>File.join('spec','locale'))
27
- FastGettext.text_domain = 'test'
28
- FastGettext.available_locales = ['en','de']
29
- FastGettext.locale = 'de'
30
-
31
- #translate
32
- FastGettext._('car').should == 'Auto'
5
+ system("bundle exec ruby spec/cases/iconv_fallback.rb").should == true
33
6
  end
34
- end
7
+ end
@@ -1,6 +1,16 @@
1
1
  require File.expand_path('spec/spec_helper')
2
2
 
3
3
  describe String do
4
+ def pending_18
5
+ if RUBY_VERSION > '1.9'
6
+ yield
7
+ else
8
+ pending do
9
+ yield
10
+ end
11
+ end
12
+ end
13
+
4
14
  before :all do
5
15
  if "i18n gem overwrites % method".respond_to?(:interpolate_without_ruby_19_syntax)
6
16
  class String
@@ -85,13 +95,13 @@ describe String do
85
95
 
86
96
  describe 'with i18n loaded' do
87
97
  it "interpolates if i18n is loaded before" do
88
- pending do
98
+ pending_18 do
89
99
  system("bundle exec ruby spec/cases/interpolate_i18n_before_fast_gettext.rb > /dev/null 2>&1").should == true
90
100
  end
91
101
  end
92
102
 
93
103
  it "interpolates if i18n is loaded before" do
94
- pending do
104
+ pending_18 do
95
105
  system("bundle exec ruby spec/cases/interpolate_i18n_after_fast_gettext.rb > /dev/null 2>&1").should == true
96
106
  end
97
107
  end
metadata CHANGED
@@ -1,33 +1,23 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: fast_gettext
3
- version: !ruby/object:Gem::Version
4
- hash: 7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 6
9
- - 0
10
- version: 0.6.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Michael Grosser
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-10-03 00:00:00 +02:00
19
- default_executable:
12
+ date: 2011-10-08 00:00:00.000000000 Z
20
13
  dependencies: []
21
-
22
14
  description:
23
15
  email: michael@grosser.it
24
16
  executables: []
25
-
26
17
  extensions: []
27
-
28
18
  extra_rdoc_files: []
29
-
30
- files:
19
+ files:
20
+ - .travis.yml
31
21
  - CHANGELOG
32
22
  - Gemfile
33
23
  - Gemfile.lock
@@ -71,6 +61,8 @@ files:
71
61
  - lib/fast_gettext/vendor/poparser.rb
72
62
  - lib/fast_gettext/vendor/string.rb
73
63
  - spec/aa_unconfigued_spec.rb
64
+ - spec/cases/fake_load_path/iconv.rb
65
+ - spec/cases/iconv_fallback.rb
74
66
  - spec/cases/interpolate_i18n_after_fast_gettext.rb
75
67
  - spec/cases/interpolate_i18n_before_fast_gettext.rb
76
68
  - spec/fast_gettext/mo_file_spec.rb
@@ -84,7 +76,6 @@ files:
84
76
  - spec/fast_gettext/translation_repository/yaml_spec.rb
85
77
  - spec/fast_gettext/translation_repository_spec.rb
86
78
  - spec/fast_gettext/translation_spec.rb
87
- - spec/fast_gettext/vendor/fake_load_path/iconv.rb
88
79
  - spec/fast_gettext/vendor/iconv_spec.rb
89
80
  - spec/fast_gettext/vendor/string_spec.rb
90
81
  - spec/fast_gettext_spec.rb
@@ -102,39 +93,31 @@ files:
102
93
  - spec/locale/yaml/notfound.yml
103
94
  - spec/obsolete_locale/de/test.po
104
95
  - spec/spec_helper.rb
105
- has_rdoc: true
106
96
  homepage: http://github.com/grosser/fast_gettext
107
97
  licenses: []
108
-
109
98
  post_install_message:
110
99
  rdoc_options: []
111
-
112
- require_paths:
100
+ require_paths:
113
101
  - lib
114
- required_ruby_version: !ruby/object:Gem::Requirement
102
+ required_ruby_version: !ruby/object:Gem::Requirement
115
103
  none: false
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- hash: 3
120
- segments:
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ segments:
121
109
  - 0
122
- version: "0"
123
- required_rubygems_version: !ruby/object:Gem::Requirement
110
+ hash: 726899407
111
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
112
  none: false
125
- requirements:
126
- - - ">="
127
- - !ruby/object:Gem::Version
128
- hash: 3
129
- segments:
130
- - 0
131
- version: "0"
113
+ requirements:
114
+ - - ! '>='
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
132
117
  requirements: []
133
-
134
118
  rubyforge_project:
135
- rubygems_version: 1.6.2
119
+ rubygems_version: 1.8.10
136
120
  signing_key:
137
121
  specification_version: 3
138
122
  summary: A simple, fast, memory-efficient and threadsafe implementation of GetText
139
123
  test_files: []
140
-