packnga 0.9.9 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b05ec18741a6dfceaa316807fec0f7211ac4a78b
4
+ data.tar.gz: bf7a8bd5e6eb35413b692d457c945c98213a2dd4
5
+ SHA512:
6
+ metadata.gz: 08dda12570dc67d47113dc7c550f353279e6a5fa0b37a8c0e514582da6d8b125cf7f448ce2087e1c1c15d9b9eb8bddc8754cffd8632e7b3bda1cd7b3b7f66e81
7
+ data.tar.gz: 256a250040561c94db01f4b64c0cad6a23f362fe3f1cadd98da789936be93e432150063421376b2f2933deae6a5b2bed1cb106e3d377107f29d7831f4dec4bfe
data/Rakefile CHANGED
@@ -49,8 +49,9 @@ Packnga::DocumentTask.new(spec) do |task|
49
49
  task.translate_language = "ja"
50
50
  end
51
51
 
52
+ ranguba_org_dir = Dir.glob("{..,../../www}/ranguba.org").first
52
53
  Packnga::ReleaseTask.new(spec) do |task|
53
- task.index_html_dir = "../ranguba.org"
54
+ task.index_html_dir = ranguba_org_dir
54
55
  end
55
56
 
56
57
  desc "Run tests."
@@ -1,6 +1,18 @@
1
1
  h1. NEWS
2
2
 
3
- h2. 0.9.9: 2013-08-29
3
+ h2(#1-0-0). 1.0.0: 2014-07-13
4
+
5
+ h3. Improvements
6
+
7
+ * Required gettext 3.1.3.
8
+ * Migrated to "edit.po" style.
9
+
10
+ h3. Fixes
11
+
12
+ * Fixed a bug that README parameter value is reset when README file
13
+ doesn't exist.
14
+
15
+ h2(#0-9-9). 0.9.9: 2013-08-29
4
16
 
5
17
  h3. Improvements
6
18
 
@@ -133,6 +133,8 @@ module Packnga
133
133
  readme = @spec.files.find do |file|
134
134
  file.include?("README")
135
135
  end
136
+ return if readme.nil?
137
+
136
138
  @yard_task.readme = readme
137
139
  @reference_task.readme = readme
138
140
  end
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "erb"
20
20
  require "gettext/tools"
21
+ require "gettext/tools/task"
21
22
  require "tempfile"
22
23
  require "tmpdir"
23
24
  require "rake/clean"
@@ -82,7 +83,6 @@ module Packnga
82
83
  @extra_files = nil
83
84
  @files = nil
84
85
  @po_dir = nil
85
- @pot_file = nil
86
86
  end
87
87
 
88
88
  # @private
@@ -102,7 +102,6 @@ module Packnga
102
102
  end
103
103
  @supported_languages = [@original_language, *@translate_languages]
104
104
  @po_dir = "#{@base_dir}/po"
105
- @pot_file = "#{@po_dir}/#{@spec.name}.pot"
106
105
  @extra_files = @text_files
107
106
  @extra_files += [@readme] if @readme
108
107
  @files = @source_files + @extra_files
@@ -122,6 +121,7 @@ module Packnga
122
121
 
123
122
  def define_tasks
124
123
  namespace :reference do
124
+ define_gettext_tasks
125
125
  define_pot_tasks
126
126
  define_po_tasks
127
127
  define_translate_task
@@ -131,51 +131,17 @@ module Packnga
131
131
  task html_reference_dir.to_s => "reference:publication:generate"
132
132
  end
133
133
 
134
- def define_pot_tasks
135
- namespace :pot do
136
- directory @po_dir
137
- file @pot_file => [@po_dir, *@files] do |t|
138
- create_pot_file(@pot_file)
139
- end
140
- desc "Generates pot file."
141
- task :generate => @pot_file do |t|
142
- end
143
- end
144
- end
145
-
146
- def define_po_tasks
147
- namespace :po do
148
- namespace :update do
149
- @translate_languages.each do |language|
150
- po_file = "#{@po_dir}/#{language}.po"
151
-
152
- if File.exist?(po_file)
153
- file po_file => @files do
154
- current_pot_file = "#{@po_dir}/tmp.pot"
155
- create_pot_file(current_pot_file)
156
- GetText::Tools::MsgMerge.run(po_file, current_pot_file,
157
- "-o", po_file)
158
- FileUtils.rm_f(current_pot_file)
159
- end
160
- else
161
- file po_file => @pot_file do |t|
162
- GetText::Tools::MsgInit.run("--input", @pot_file,
163
- "--output", t.name,
164
- "--locale", language.to_s)
165
- end
166
- end
167
-
168
- desc "Updates po file for #{language}."
169
- task language => po_file
170
- end
171
- end
172
-
173
- desc "Updates po files."
174
- task :update do
175
- Rake::Task["clobber"].invoke
176
- @translate_languages.each do |language|
177
- Rake::Task["reference:po:update:#{language}"].invoke
178
- end
134
+ def define_gettext_tasks
135
+ return if @files.empty?
136
+
137
+ GetText::Tools::Task.define do |task|
138
+ task.spec = @spec
139
+ task.locales = @translate_languages
140
+ task.po_base_directory = @po_dir
141
+ task.files = @files
142
+ task.enable_description = false
143
+ task.pot_creator = lambda do |pot_file_path|
144
+ create_pot_file(pot_file_path.to_s)
179
145
  end
180
146
  end
181
147
  end
@@ -188,6 +154,31 @@ module Packnga
188
154
  YARD::CLI::I18n.run(*options)
189
155
  end
190
156
 
157
+ def define_pot_tasks
158
+ namespace :pot do
159
+ desc "Generates POT file."
160
+ task :generate => "gettext:pot:create"
161
+ end
162
+ end
163
+
164
+ def define_po_tasks
165
+ yard_po_files = []
166
+
167
+ @translate_languages.each do |language|
168
+ po_file = "#{@po_dir}/#{language}/#{@spec.name}.po"
169
+ yard_po_file = "#{@po_dir}/#{language}.po"
170
+ yard_po_files << yard_po_file
171
+ file yard_po_file => po_file do
172
+ cp(po_file, yard_po_file)
173
+ end
174
+ end
175
+
176
+ namespace :po do
177
+ desc "Updates PO files."
178
+ task :update => yard_po_files
179
+ end
180
+ end
181
+
191
182
  def define_translate_task
192
183
  directory reference_base_dir.to_s
193
184
  namespace :translate do
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2011 Haruka Yoshihara <yoshihara@clear-code.com>
4
- # Copyright (C) 2011 Kouhei Sutou <kou@clear-code.com>
4
+ # Copyright (C) 2011-2013 Kouhei Sutou <kou@clear-code.com>
5
5
  #
6
6
  # This library is free software; you can redistribute it and/or
7
7
  # modify it under the terms of the GNU Lesser General Public
@@ -18,5 +18,5 @@
18
18
 
19
19
  module Packnga
20
20
  # Packnga version.
21
- VERSION = "0.9.9"
21
+ VERSION = "1.0.0"
22
22
  end
@@ -65,7 +65,7 @@ Gem::Specification.new do |spec|
65
65
 
66
66
  spec.add_runtime_dependency("rake")
67
67
  spec.add_runtime_dependency("yard", ">= 0.8.6.1")
68
- spec.add_runtime_dependency("gettext", ">= 2.3.6")
68
+ spec.add_runtime_dependency("gettext", ">= 3.1.3")
69
69
  spec.add_development_dependency("test-unit")
70
70
  spec.add_development_dependency("test-unit-notify")
71
71
  spec.add_development_dependency("test-unit-rr")
@@ -26,6 +26,10 @@ class DocumentTaskTest < Test::Unit::TestCase
26
26
  base_dir = Pathname("base_directory")
27
27
  document_task = Packnga::DocumentTask.new(spec) do |task|
28
28
  task.base_dir = base_dir.to_s
29
+ task.reference do |reference|
30
+ reference.translate_languages = ["ja"]
31
+ reference.readme = "README.md"
32
+ end
29
33
  end
30
34
 
31
35
  document_task.yard do |yard_task|
@@ -70,6 +74,9 @@ class DocumentTaskTest < Test::Unit::TestCase
70
74
  else
71
75
  task.translate_languages = translate_languages
72
76
  end
77
+ task.reference do |reference|
78
+ reference.readme = "README.md"
79
+ end
73
80
  end
74
81
  end
75
82
  end
@@ -79,6 +86,9 @@ class DocumentTaskTest < Test::Unit::TestCase
79
86
  spec = Gem::Specification.new("test")
80
87
  document_task = Packnga::DocumentTask.new(spec) do |task|
81
88
  task.original_language = original_language
89
+ task.reference do |reference|
90
+ reference.readme = "README.md"
91
+ end
82
92
  end
83
93
 
84
94
  document_task.reference do |reference_task|
@@ -92,7 +102,9 @@ class DocumentTaskTest < Test::Unit::TestCase
92
102
  spec = Gem::Specification.new("test") do |_spec|
93
103
  _spec.files = [@readme]
94
104
  end
95
- document_task = Packnga::DocumentTask.new(spec)
105
+ document_task = Packnga::DocumentTask.new(spec) do |task|
106
+ task.translate_languages = ["ja"]
107
+ end
96
108
  @yard_task = extract_yard_task(document_task)
97
109
  @reference_task = extract_reference_task(document_task)
98
110
  end
@@ -129,7 +141,9 @@ class DocumentTaskTest < Test::Unit::TestCase
129
141
  other_c_files,
130
142
  ]
131
143
  end
132
- document_task = Packnga::DocumentTask.new(spec)
144
+ document_task = Packnga::DocumentTask.new(spec) do |task|
145
+ task.translate_languages = ["ja"]
146
+ end
133
147
  @yard_task = extract_yard_task(document_task)
134
148
  @reference_task = extract_reference_task(document_task)
135
149
 
@@ -142,8 +156,8 @@ class DocumentTaskTest < Test::Unit::TestCase
142
156
  end
143
157
 
144
158
  def test_source_files
145
- assert_equal(@source_files, @yard_task.source_files)
146
- assert_equal(@source_files, @reference_task.source_files)
159
+ assert_equal(@source_files.sort, @yard_task.source_files.sort)
160
+ assert_equal(@source_files.sort, @reference_task.source_files.sort)
147
161
  end
148
162
 
149
163
  def test_text_files
@@ -163,7 +177,9 @@ class DocumentTaskTest < Test::Unit::TestCase
163
177
  other_text_files,
164
178
  ]
165
179
  end
166
- document_task = Packnga::DocumentTask.new(spec)
180
+ document_task = Packnga::DocumentTask.new(spec) do |task|
181
+ task.translate_languages = ["ja"]
182
+ end
167
183
  @yard_task = extract_yard_task(document_task)
168
184
  @reference_task = extract_reference_task(document_task)
169
185
  end
@@ -179,8 +195,8 @@ class DocumentTaskTest < Test::Unit::TestCase
179
195
  end
180
196
 
181
197
  def test_text_files
182
- assert_equal(@source_text_files, @yard_task.text_files)
183
- assert_equal(@source_text_files, @reference_task.text_files)
198
+ assert_equal(@source_text_files.sort, @yard_task.text_files.sort)
199
+ assert_equal(@source_text_files.sort, @reference_task.text_files.sort)
184
200
  end
185
201
  end
186
202
 
@@ -23,32 +23,6 @@ class ReferenceTaskTest < Test::Unit::TestCase
23
23
  Rake::Task.clear
24
24
  end
25
25
 
26
- def test_po_update_no_po_file_exists
27
- Dir.mktmpdir do |base_dir|
28
- package_name = "packnga"
29
- language = "ja"
30
-
31
- spec = Gem::Specification.new do |_spec|
32
- _spec.name = package_name
33
- end
34
-
35
- Packnga::DocumentTask.new(spec) do |task|
36
- task.translate_language = language
37
- task.base_dir = base_dir
38
- end
39
-
40
- po_dir = "#{base_dir}/po"
41
- pot_file = "#{po_dir}/#{package_name}.pot"
42
- po_file = "#{po_dir}/#{language}.po"
43
-
44
- mock(GetText::Tools::MsgInit).run("--input", pot_file,
45
- "--output", po_file,
46
- "--locale", language)
47
-
48
- Rake::Task["reference:po:update:ja"].invoke
49
- end
50
- end
51
-
52
26
  def test_reference_publication_prepare
53
27
  Dir.mktmpdir do |base_dir|
54
28
  package_name = "packnga"
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packnga
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Haruka Yoshihara
@@ -10,139 +9,122 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-08-29 00:00:00.000000000 Z
12
+ date: 2014-07-13 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rake
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - ">="
29
26
  - !ruby/object:Gem::Version
30
27
  version: '0'
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: yard
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
- - - ! '>='
32
+ - - ">="
37
33
  - !ruby/object:Gem::Version
38
34
  version: 0.8.6.1
39
35
  type: :runtime
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
- - - ! '>='
39
+ - - ">="
45
40
  - !ruby/object:Gem::Version
46
41
  version: 0.8.6.1
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: gettext
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
- - - ! '>='
46
+ - - ">="
53
47
  - !ruby/object:Gem::Version
54
- version: 2.3.6
48
+ version: 3.1.3
55
49
  type: :runtime
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
- - - ! '>='
53
+ - - ">="
61
54
  - !ruby/object:Gem::Version
62
- version: 2.3.6
55
+ version: 3.1.3
63
56
  - !ruby/object:Gem::Dependency
64
57
  name: test-unit
65
58
  requirement: !ruby/object:Gem::Requirement
66
- none: false
67
59
  requirements:
68
- - - ! '>='
60
+ - - ">="
69
61
  - !ruby/object:Gem::Version
70
62
  version: '0'
71
63
  type: :development
72
64
  prerelease: false
73
65
  version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
66
  requirements:
76
- - - ! '>='
67
+ - - ">="
77
68
  - !ruby/object:Gem::Version
78
69
  version: '0'
79
70
  - !ruby/object:Gem::Dependency
80
71
  name: test-unit-notify
81
72
  requirement: !ruby/object:Gem::Requirement
82
- none: false
83
73
  requirements:
84
- - - ! '>='
74
+ - - ">="
85
75
  - !ruby/object:Gem::Version
86
76
  version: '0'
87
77
  type: :development
88
78
  prerelease: false
89
79
  version_requirements: !ruby/object:Gem::Requirement
90
- none: false
91
80
  requirements:
92
- - - ! '>='
81
+ - - ">="
93
82
  - !ruby/object:Gem::Version
94
83
  version: '0'
95
84
  - !ruby/object:Gem::Dependency
96
85
  name: test-unit-rr
97
86
  requirement: !ruby/object:Gem::Requirement
98
- none: false
99
87
  requirements:
100
- - - ! '>='
88
+ - - ">="
101
89
  - !ruby/object:Gem::Version
102
90
  version: '0'
103
91
  type: :development
104
92
  prerelease: false
105
93
  version_requirements: !ruby/object:Gem::Requirement
106
- none: false
107
94
  requirements:
108
- - - ! '>='
95
+ - - ">="
109
96
  - !ruby/object:Gem::Version
110
97
  version: '0'
111
98
  - !ruby/object:Gem::Dependency
112
99
  name: bundler
113
100
  requirement: !ruby/object:Gem::Requirement
114
- none: false
115
101
  requirements:
116
- - - ! '>='
102
+ - - ">="
117
103
  - !ruby/object:Gem::Version
118
104
  version: '0'
119
105
  type: :development
120
106
  prerelease: false
121
107
  version_requirements: !ruby/object:Gem::Requirement
122
- none: false
123
108
  requirements:
124
- - - ! '>='
109
+ - - ">="
125
110
  - !ruby/object:Gem::Version
126
111
  version: '0'
127
112
  - !ruby/object:Gem::Dependency
128
113
  name: RedCloth
129
114
  requirement: !ruby/object:Gem::Requirement
130
- none: false
131
115
  requirements:
132
- - - ! '>='
116
+ - - ">="
133
117
  - !ruby/object:Gem::Version
134
118
  version: '0'
135
119
  type: :development
136
120
  prerelease: false
137
121
  version_requirements: !ruby/object:Gem::Requirement
138
- none: false
139
122
  requirements:
140
- - - ! '>='
123
+ - - ">="
141
124
  - !ruby/object:Gem::Version
142
125
  version: '0'
143
- description: ! 'Packnga is a library to translate to many languages by YARD.
144
-
145
- '
126
+ description: |
127
+ Packnga is a library to translate to many languages by YARD.
146
128
  email:
147
129
  - yshr04hrk@gmail.com
148
130
  - kou@clear-code.com
@@ -151,53 +133,52 @@ extensions: []
151
133
  extra_rdoc_files:
152
134
  - README.textile
153
135
  files:
136
+ - ".yardopts"
137
+ - Gemfile
154
138
  - README.textile
155
139
  - Rakefile
156
- - Gemfile
157
- - .yardopts
158
- - packnga.gemspec
159
- - lib/packnga/version.rb
160
- - lib/packnga/release-task.rb
161
- - lib/packnga/reference-task.rb
162
- - lib/packnga/document-task.rb
163
- - lib/packnga/yard-task.rb
164
- - lib/packnga.rb
165
- - doc/text/tutorial.textile
166
140
  - doc/text/lgpl.txt
167
141
  - doc/text/news.textile
168
142
  - doc/text/release.textile
143
+ - doc/text/tutorial.textile
144
+ - lib/packnga.rb
145
+ - lib/packnga/document-task.rb
146
+ - lib/packnga/reference-task.rb
147
+ - lib/packnga/release-task.rb
148
+ - lib/packnga/version.rb
149
+ - lib/packnga/yard-task.rb
150
+ - packnga.gemspec
151
+ - test/run-test.rb
169
152
  - test/test-document-task.rb
170
153
  - test/test-reference-task.rb
171
154
  - test/test-release-task.rb
172
- - test/run-test.rb
173
155
  homepage: http://ranguba.org/packnga/en/
174
156
  licenses:
175
157
  - LGPLv2
158
+ metadata: {}
176
159
  post_install_message:
177
160
  rdoc_options: []
178
161
  require_paths:
179
162
  - lib
180
163
  required_ruby_version: !ruby/object:Gem::Requirement
181
- none: false
182
164
  requirements:
183
- - - ! '>='
165
+ - - ">="
184
166
  - !ruby/object:Gem::Version
185
167
  version: '0'
186
168
  required_rubygems_version: !ruby/object:Gem::Requirement
187
- none: false
188
169
  requirements:
189
- - - ! '>='
170
+ - - ">="
190
171
  - !ruby/object:Gem::Version
191
172
  version: '0'
192
173
  requirements: []
193
174
  rubyforge_project:
194
- rubygems_version: 1.8.23
175
+ rubygems_version: 2.2.2
195
176
  signing_key:
196
- specification_version: 3
177
+ specification_version: 4
197
178
  summary: An utility library to package i18n-ed library.
198
179
  test_files:
199
180
  - test/test-document-task.rb
181
+ - test/run-test.rb
200
182
  - test/test-reference-task.rb
201
183
  - test/test-release-task.rb
202
- - test/run-test.rb
203
184
  has_rdoc: