get_pomo 0.6.0 → 0.6.1

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/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ rvm:
2
+ - ree
3
+ - 1.9.2
4
+ - 1.9.3
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source :rubygems
2
+ gemspec
3
+
4
+ gem 'bump'
5
+ gem 'rake'
6
+ gem 'rspec', '~>2'
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ get_pomo (0.6.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ bump (0.3.9)
10
+ diff-lcs (1.1.3)
11
+ rake (10.0.3)
12
+ rspec (2.12.0)
13
+ rspec-core (~> 2.12.0)
14
+ rspec-expectations (~> 2.12.0)
15
+ rspec-mocks (~> 2.12.0)
16
+ rspec-core (2.12.2)
17
+ rspec-expectations (2.12.1)
18
+ diff-lcs (~> 1.1.3)
19
+ rspec-mocks (2.12.2)
20
+
21
+ PLATFORMS
22
+ ruby
23
+
24
+ DEPENDENCIES
25
+ bump
26
+ get_pomo!
27
+ rake
28
+ rspec (~> 2)
data/Rakefile CHANGED
@@ -1,19 +1,7 @@
1
- task :default => :spec
2
- require 'spec/rake/spectask'
3
- Spec::Rake::SpecTask.new {|t| t.spec_opts = ['--color']}
1
+ require 'bundler/setup'
2
+ require 'bundler/gem_tasks'
3
+ require 'bump/tasks'
4
4
 
5
- begin
6
- project_name = 'get_pomo'
7
- require 'jeweler'
8
- Jeweler::Tasks.new do |gem|
9
- gem.name = project_name
10
- gem.summary = "Ruby/Gettext: A .po and .mo file parser/generator"
11
- gem.email = "grosser.michael@gmail.com"
12
- gem.homepage = "http://github.com/grosser/#{project_name}"
13
- gem.authors = ["Michael Grosser"]
14
- end
15
-
16
- Jeweler::GemcutterTasks.new
17
- rescue LoadError
18
- puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
19
- end
5
+ task :default do
6
+ sh "rspec spec/"
7
+ end
@@ -13,7 +13,7 @@ Advanteges over original [mo](http://github.com/mutoh/gettext/blob/abf96713327cc
13
13
 
14
14
  Setup
15
15
  =====
16
- sudo gem install get_pomo -s http://gemcutter.org
16
+ sudo gem install get_pomo
17
17
 
18
18
  ###Static interface
19
19
  #parse po files
data/get_pomo.gemspec CHANGED
@@ -1,66 +1,12 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
1
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
2
+ name = "get_pomo"
3
+ require "#{name}/version"
5
4
 
6
- Gem::Specification.new do |s|
7
- s.name = %q{get_pomo}
8
- s.version = "0.6.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
5
+ Gem::Specification.new name, GetPomo::VERSION do |s|
6
+ s.summary = "Ruby/Gettext: A .po and .mo file parser/generator"
11
7
  s.authors = ["Michael Grosser"]
12
- s.date = %q{2009-11-20}
13
- s.email = %q{grosser.michael@gmail.com}
14
- s.extra_rdoc_files = [
15
- "README.markdown"
16
- ]
17
- s.files = [
18
- ".gitignore",
19
- "README.markdown",
20
- "Rakefile",
21
- "VERSION",
22
- "get_pomo.gemspec",
23
- "lib/get_pomo.rb",
24
- "lib/get_pomo/mo_file.rb",
25
- "lib/get_pomo/po_file.rb",
26
- "lib/get_pomo/translation.rb",
27
- "prototype_treetop/po.treetop",
28
- "prototype_treetop/test.rb",
29
- "spec/files/complex.mo",
30
- "spec/files/empty.mo",
31
- "spec/files/plural.mo",
32
- "spec/files/singular.mo",
33
- "spec/files/singular_2.mo",
34
- "spec/pomo/mo_file_spec.rb",
35
- "spec/pomo/po_file_spec.rb",
36
- "spec/pomo/translation_spec.rb",
37
- "spec/pomo_spec.rb",
38
- "spec/spec_helper.rb",
39
- "vendor/README.rdoc",
40
- "vendor/iconv.rb",
41
- "vendor/mofile.rb"
42
- ]
43
- s.homepage = %q{http://github.com/grosser/get_pomo}
44
- s.rdoc_options = ["--charset=UTF-8"]
45
- s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.3.5}
47
- s.summary = %q{Ruby/Gettext: A .po and .mo file parser/generator}
48
- s.test_files = [
49
- "spec/spec_helper.rb",
50
- "spec/pomo_spec.rb",
51
- "spec/pomo/translation_spec.rb",
52
- "spec/pomo/mo_file_spec.rb",
53
- "spec/pomo/po_file_spec.rb"
54
- ]
55
-
56
- if s.respond_to? :specification_version then
57
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
58
- s.specification_version = 3
59
-
60
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
61
- else
62
- end
63
- else
64
- end
8
+ s.email = "michael@grosser.it"
9
+ s.homepage = "https://github.com/grosser/#{name}"
10
+ s.files = `git ls-files`.split("\n")
11
+ s.license = "MIT"
65
12
  end
66
-
@@ -0,0 +1,3 @@
1
+ module GetPomo
2
+ VERSION = "0.6.1"
3
+ end
data/lib/get_pomo.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'get_pomo/po_file'
2
2
  module GetPomo
3
- VERSION = File.read( File.join(File.dirname(__FILE__),'..','VERSION') ).strip
3
+ autoload :VERSION, "get_pomo/version"
4
4
 
5
5
  extend self
6
6
 
@@ -9,4 +9,4 @@ module GetPomo
9
9
  translations.each_with_index {|translation,index|last_seen_at_index[translation.msgid]=index}
10
10
  last_seen_at_index.values.sort.map{|index| translations[index]}
11
11
  end
12
- end
12
+ end
@@ -1,29 +1,29 @@
1
- require File.expand_path("../spec_helper", File.dirname(__FILE__))
1
+ # encoding: utf-8
2
+ require 'spec_helper'
2
3
  require 'get_pomo/mo_file'
3
4
 
4
- include GetPomo
5
5
  describe GetPomo::MoFile do
6
6
  it "parses empty mo file" do
7
- MoFile.parse(File.read('spec/files/empty.mo')).should == []
7
+ GetPomo::MoFile.parse(File.read('spec/files/empty.mo')).should == []
8
8
  end
9
9
 
10
10
  it "parses empty strings" do
11
- MoFile.parse(File.read('spec/files/empty.mo')).should == []
11
+ GetPomo::MoFile.parse(File.read('spec/files/empty.mo')).should == []
12
12
  end
13
13
 
14
14
  it "reads singulars" do
15
- t = MoFile.parse(File.read('spec/files/singular.mo'))[0]
15
+ t = GetPomo::MoFile.parse(File.read('spec/files/singular.mo'))[0]
16
16
  t.to_hash.should == {:msgid=>'Back',:msgstr=>'Zurück'}
17
17
  end
18
18
 
19
19
  it "reads plurals" do
20
- t = MoFile.parse(File.read('spec/files/plural.mo'))[0]
20
+ t = GetPomo::MoFile.parse(File.read('spec/files/plural.mo'))[0]
21
21
  t.to_hash.should == {:msgid=>['Axis','Axis'],:msgstr=>['Achse','Achsen']}
22
22
  end
23
23
 
24
24
  describe 'instance methods' do
25
25
  it "combines multiple translations" do
26
- m = MoFile.new
26
+ m = GetPomo::MoFile.new
27
27
  m.add_translations_from_text(File.read('spec/files/plural.mo'))
28
28
  m.add_translations_from_text(File.read('spec/files/singular.mo'))
29
29
  m.should have(2).translations
@@ -31,13 +31,13 @@ describe GetPomo::MoFile do
31
31
  end
32
32
 
33
33
  it "can be initialized with translations" do
34
- m = MoFile.new(:translations=>['x'])
34
+ m = GetPomo::MoFile.new(:translations=>['x'])
35
35
  m.translations.should == ['x']
36
36
  end
37
37
 
38
38
  it "does not generate duplicate translations" do
39
39
  second_version = File.read('spec/files/singular_2.mo')
40
- m = MoFile.new
40
+ m = GetPomo::MoFile.new
41
41
  m.add_translations_from_text(File.read('spec/files/singular.mo'))
42
42
  m.add_translations_from_text(second_version)
43
43
  m.to_text.should == second_version
@@ -45,14 +45,14 @@ describe GetPomo::MoFile do
45
45
  end
46
46
 
47
47
  it "reads metadata" do
48
- meta = MoFile.parse(File.read('spec/files/complex.mo')).detect {|t|t.msgid == ''}
48
+ meta = GetPomo::MoFile.parse(File.read('spec/files/complex.mo')).detect {|t|t.msgid == ''}
49
49
  meta.msgstr.should_not be_empty
50
50
  end
51
51
 
52
52
  describe :to_text do
53
53
  it "writes singulars" do
54
54
  text = File.read('spec/files/singular.mo')
55
- MoFile.to_text(MoFile.parse(text)).should == text
55
+ GetPomo::MoFile.to_text(GetPomo::MoFile.parse(text)).should == text
56
56
  end
57
57
  end
58
- end
58
+ end
@@ -1,66 +1,65 @@
1
- require File.expand_path("../spec_helper", File.dirname(__FILE__))
1
+ require "spec_helper"
2
2
 
3
- include GetPomo
4
3
  describe GetPomo::PoFile do
5
4
  describe :parse do
6
5
  it "parses nothing" do
7
- PoFile.parse("").should be_empty
6
+ GetPomo::PoFile.parse("").should be_empty
8
7
  end
9
8
 
10
9
  it "parses a simple msgid and msgstr" do
11
- t = PoFile.parse(%Q(msgid "xxx"\nmsgstr "yyy"))
10
+ t = GetPomo::PoFile.parse(%Q(msgid "xxx"\nmsgstr "yyy"))
12
11
  t[0].to_hash.should == {:msgid=>'xxx',:msgstr=>'yyy'}
13
12
  end
14
13
 
15
14
  it "parses a simple msgid and msg with additional whitespace" do
16
- t = PoFile.parse(%Q( msgid "xxx" \n msgstr "yyy" ))
15
+ t = GetPomo::PoFile.parse(%Q( msgid "xxx" \n msgstr "yyy" ))
17
16
  t[0].to_hash.should == {:msgid=>'xxx',:msgstr=>'yyy'}
18
17
  end
19
18
 
20
19
  it "parses an empty msgid with text (gettext meta data)" do
21
- t = PoFile.parse(%Q(msgid ""\nmsgstr "PLURAL FORMS"))
20
+ t = GetPomo::PoFile.parse(%Q(msgid ""\nmsgstr "PLURAL FORMS"))
22
21
  t[0].to_hash.should == {:msgid=>'',:msgstr=>'PLURAL FORMS'}
23
22
  end
24
23
 
25
24
  it "parses a multiline msgid/msgstr" do
26
- t = PoFile.parse(%Q(msgid "xxx"\n"aaa"\n\n\nmsgstr ""\n"bbb"))
25
+ t = GetPomo::PoFile.parse(%Q(msgid "xxx"\n"aaa"\n\n\nmsgstr ""\n"bbb"))
27
26
  t[0].to_hash.should == {:msgid=>'xxxaaa',:msgstr=>'bbb'}
28
27
  end
29
28
 
30
29
  it "parses simple comments" do
31
- t = PoFile.parse(%Q(#test\nmsgid "xxx"\nmsgstr "yyy"))
30
+ t = GetPomo::PoFile.parse(%Q(#test\nmsgid "xxx"\nmsgstr "yyy"))
32
31
  t[0].to_hash.should == {:msgid=>'xxx',:msgstr=>'yyy',:comment=>"test\n"}
33
32
  end
34
33
 
35
34
  it "parses comments above msgstr" do
36
- t = PoFile.parse(%Q(#test\nmsgid "xxx"\n#another\nmsgstr "yyy"))
35
+ t = GetPomo::PoFile.parse(%Q(#test\nmsgid "xxx"\n#another\nmsgstr "yyy"))
37
36
  t[0].to_hash.should == {:msgid=>'xxx',:msgstr=>'yyy',:comment=>"test\nanother\n"}
38
37
  end
39
38
  end
40
39
 
41
40
  describe "instance interface" do
42
41
  it "adds two different translations" do
43
- p = PoFile.new
42
+ p = GetPomo::PoFile.new
44
43
  p.add_translations_from_text(%Q(msgid "xxx"\nmsgstr "yyy"))
45
44
  p.add_translations_from_text(%Q(msgid "aaa"\nmsgstr "yyy"))
46
45
  p.translations[1].to_hash.should == {:msgid=>'aaa',:msgstr=>'yyy'}
47
46
  end
48
47
 
49
48
  it "can be initialized with translations" do
50
- p = PoFile.new(:translations=>['xxx'])
49
+ p = GetPomo::PoFile.new(:translations=>['xxx'])
51
50
  p.translations[0].should == 'xxx'
52
51
  end
53
52
 
54
53
  it "can be converted to text" do
55
54
  text = %Q(msgid "xxx"\nmsgstr "aaa")
56
- p = PoFile.new
55
+ p = GetPomo::PoFile.new
57
56
  p.add_translations_from_text(text)
58
57
  p.to_text.should == text
59
58
  end
60
59
 
61
60
  it "keeps uniqueness when converting to_text" do
62
61
  text = %Q(msgid "xxx"\nmsgstr "aaa")
63
- p = PoFile.new
62
+ p = GetPomo::PoFile.new
64
63
  p.add_translations_from_text(%Q(msgid "xxx"\nmsgstr "yyy"))
65
64
  p.add_translations_from_text(text)
66
65
  p.to_text.should == text
@@ -68,17 +67,17 @@ describe GetPomo::PoFile do
68
67
  end
69
68
 
70
69
  it "adds plural translations" do
71
- t = PoFile.parse(%Q(msgid "singular"\nmsgid_plural "plural"\nmsgstr[0] "one"\nmsgstr[1] "many"))
70
+ t = GetPomo::PoFile.parse(%Q(msgid "singular"\nmsgid_plural "plural"\nmsgstr[0] "one"\nmsgstr[1] "many"))
72
71
  t[0].to_hash.should == {:msgid=>['singular','plural'],:msgstr=>['one','many']}
73
72
  end
74
73
 
75
74
  it "does not fail on empty string" do
76
- PoFile.parse(%Q(\n\n\n\n\n))
75
+ GetPomo::PoFile.parse(%Q(\n\n\n\n\n))
77
76
  end
78
77
 
79
78
  it "shows line number for invalid strings" do
80
79
  begin
81
- PoFile.parse(%Q(\n\n\n\n\nmsgstr "))
80
+ GetPomo::PoFile.parse(%Q(\n\n\n\n\nmsgstr "))
82
81
  flunk
83
82
  rescue Exception => e
84
83
  e.to_s.should =~ /line 5/
@@ -87,12 +86,12 @@ describe GetPomo::PoFile do
87
86
 
88
87
  describe :to_text do
89
88
  it "is empty when not translations where added" do
90
- PoFile.to_text([]).should == ""
89
+ GetPomo::PoFile.to_text([]).should == ""
91
90
  end
92
-
91
+
93
92
  it "preserves simple syntax" do
94
93
  text = %Q(msgid "x"\nmsgstr "y")
95
- PoFile.to_text(PoFile.parse(text)).should == text
94
+ GetPomo::PoFile.to_text(GetPomo::PoFile.parse(text)).should == text
96
95
  end
97
96
 
98
97
  it "adds comments" do
@@ -101,17 +100,17 @@ describe GetPomo::PoFile do
101
100
  t.msgstr = 'b'
102
101
  t.add_text("c\n",:to=>:comment)
103
102
  t.add_text("d\n",:to=>:comment)
104
- PoFile.to_text([t]).should == %Q(#c\n#d\nmsgid "a"\nmsgstr "b")
103
+ GetPomo::PoFile.to_text([t]).should == %Q(#c\n#d\nmsgid "a"\nmsgstr "b")
105
104
  end
106
105
 
107
106
  it "uses plural notation" do
108
107
  text = %Q(#awesome\nmsgid "one"\nmsgid_plural "many"\nmsgstr[0] "1"\nmsgstr[1] "n")
109
- PoFile.to_text(PoFile.parse(text)).should == text
108
+ GetPomo::PoFile.to_text(GetPomo::PoFile.parse(text)).should == text
110
109
  end
111
110
 
112
111
  it "only uses the latest of identicals msgids" do
113
112
  text = %Q(msgid "one"\nmsgstr "1"\nmsgid "one"\nmsgstr "001")
114
- PoFile.to_text(PoFile.parse(text)).should == %Q(msgid "one"\nmsgstr "001")
113
+ GetPomo::PoFile.to_text(GetPomo::PoFile.parse(text)).should == %Q(msgid "one"\nmsgstr "001")
115
114
  end
116
115
  end
117
- end
116
+ end
@@ -1,10 +1,9 @@
1
- require File.expand_path("../spec_helper", File.dirname(__FILE__))
2
-
1
+ require 'spec_helper'
3
2
  require 'get_pomo/translation'
4
3
 
5
4
  describe GetPomo::Translation do
6
5
  describe :complete? do
7
- it{should_not be_complete}
6
+ it { should_not be_complete }
8
7
 
9
8
  it "is complete if it has a msgid and a msgstr" do
10
9
  subject.msgid="x"
@@ -116,4 +115,4 @@ describe GetPomo::Translation do
116
115
  subject.comment.should == "hello"
117
116
  end
118
117
  end
119
- end
118
+ end
data/spec/pomo_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
- require 'spec/spec_helper'
1
+ require 'spec_helper'
2
2
 
3
3
  describe GetPomo do
4
4
  it "has a VERSION" do
5
5
  GetPomo::VERSION.should =~ /^\d+\.\d+\.\d+$/
6
6
  end
7
- end
7
+ end
metadata CHANGED
@@ -1,36 +1,34 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: get_pomo
3
- version: !ruby/object:Gem::Version
4
- version: 0.6.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.6.1
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Michael Grosser
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2009-11-20 00:00:00 +01:00
13
- default_executable:
12
+ date: 2013-02-19 00:00:00.000000000 Z
14
13
  dependencies: []
15
-
16
14
  description:
17
- email: grosser.michael@gmail.com
15
+ email: michael@grosser.it
18
16
  executables: []
19
-
20
17
  extensions: []
21
-
22
- extra_rdoc_files:
23
- - README.markdown
24
- files:
18
+ extra_rdoc_files: []
19
+ files:
25
20
  - .gitignore
26
- - README.markdown
21
+ - .travis.yml
22
+ - Gemfile
23
+ - Gemfile.lock
27
24
  - Rakefile
28
- - VERSION
25
+ - Readme.md
29
26
  - get_pomo.gemspec
30
27
  - lib/get_pomo.rb
31
28
  - lib/get_pomo/mo_file.rb
32
29
  - lib/get_pomo/po_file.rb
33
30
  - lib/get_pomo/translation.rb
31
+ - lib/get_pomo/version.rb
34
32
  - prototype_treetop/po.treetop
35
33
  - prototype_treetop/test.rb
36
34
  - spec/files/complex.mo
@@ -46,37 +44,35 @@ files:
46
44
  - vendor/README.rdoc
47
45
  - vendor/iconv.rb
48
46
  - vendor/mofile.rb
49
- has_rdoc: true
50
- homepage: http://github.com/grosser/get_pomo
51
- licenses: []
52
-
47
+ homepage: https://github.com/grosser/get_pomo
48
+ licenses:
49
+ - MIT
53
50
  post_install_message:
54
- rdoc_options:
55
- - --charset=UTF-8
56
- require_paths:
51
+ rdoc_options: []
52
+ require_paths:
57
53
  - lib
58
- required_ruby_version: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- version: "0"
63
- version:
64
- required_rubygems_version: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: "0"
69
- version:
54
+ required_ruby_version: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ! '>='
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ segments:
61
+ - 0
62
+ hash: 3196374221407086229
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ segments:
70
+ - 0
71
+ hash: 3196374221407086229
70
72
  requirements: []
71
-
72
73
  rubyforge_project:
73
- rubygems_version: 1.3.5
74
+ rubygems_version: 1.8.24
74
75
  signing_key:
75
76
  specification_version: 3
76
- summary: "Ruby/Gettext: A .po and .mo file parser/generator"
77
- test_files:
78
- - spec/spec_helper.rb
79
- - spec/pomo_spec.rb
80
- - spec/pomo/translation_spec.rb
81
- - spec/pomo/mo_file_spec.rb
82
- - spec/pomo/po_file_spec.rb
77
+ summary: ! 'Ruby/Gettext: A .po and .mo file parser/generator'
78
+ test_files: []
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.6.0