yard 0.8.7 → 0.8.7.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of yard might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5a75a0de55c021ca90c4b39745a2eaadf856a42
4
- data.tar.gz: 097ff460e4d225578721e043e22ea8fe3591fc2f
3
+ metadata.gz: 208c73915b432a5fabd54f533ca824a1c3b2e26d
4
+ data.tar.gz: 120c523ff3ca0f0fcdcc42f8981730004d091cde
5
5
  SHA512:
6
- metadata.gz: 625943ad3908f4ba36764219b7c4ea50ae48ea29fa3bc7779a277871f809013d491157d682f1818a9f7b4d255ed0a4ef2146aaca7eaa1af2e168fac3b60160af
7
- data.tar.gz: ba9d09f74bcdd0042af46807c78b3b702248bd57d507c6e14c3db4c8336328178b2ed383469bb1fef0e8ec3616250ea5319a86219c7a9b67acbdcf73817d83e7
6
+ metadata.gz: dc1f452675e2a7cdd91605ce36c294748d4d427d712e63cea8f157fbb35f5b8425546b0d8cb37dc10b330cb619618e9942ffa86a38f3b832bd423936883675fb
7
+ data.tar.gz: 1c513dd64c24b5d84aae04ce57c889daf552896f3cf62f243114297b388f68e01abbd9d33c3343078b22bd386df4a52730cdabce2eeeb62ff79836393b08207a
data/README.md CHANGED
@@ -7,8 +7,8 @@
7
7
  **Contributors**: http://github.com/lsegal/yard/contributors
8
8
  **Copyright**: 2007-2013
9
9
  **License**: MIT License
10
- **Latest Version**: 0.8.7
11
- **Release Date**: July 26th 2013
10
+ **Latest Version**: 0.8.7.1
11
+ **Release Date**: September 11th 2013
12
12
 
13
13
  ## Synopsis
14
14
 
@@ -48,7 +48,7 @@ following method documented with YARD formatting:
48
48
  # @param [String, #read] contents the contents to reverse
49
49
  # @return [String] the contents reversed lexically
50
50
  def reverse(contents)
51
- contents = contents.read if respond_to? :read
51
+ contents = contents.read if contents.respond_to? :read
52
52
  contents.reverse
53
53
  end
54
54
 
@@ -283,6 +283,10 @@ More options can be seen by typing `yard graph --help`, but here is an example:
283
283
 
284
284
  ## Changelog
285
285
 
286
+ - **September.11.13**: 0.8.7.1 release
287
+ - Fix potential XSS issue with frame anchor support.
288
+ - Add support for gettext 3.x gem.
289
+
286
290
  - **July.26.13**: 0.8.7 release
287
291
  - Added `--hide-api API` option to hide objects with a given `@api` tag (#685).
288
292
  - Added "Returns ...." prefix to summary when a lone @return tag is used.
@@ -46,20 +46,12 @@ module YARD
46
46
  po_file = File.join(locale_directory, "#{@name}.po")
47
47
  return false unless File.exist?(po_file)
48
48
 
49
- begin
50
- require "gettext/tools/poparser"
51
- require "gettext/runtime/mofile"
52
- rescue LoadError
53
- log.warn "Need gettext gem for i18n feature:"
54
- log.warn " gem install gettext"
55
- return false
56
- end
49
+ require "yard/i18n/po_parser"
50
+ return false unless POParser.available?
51
+
52
+ po_parser = POParser.new
53
+ @messages.merge!(po_parser.parse(po_file))
57
54
 
58
- parser = GetText::PoParser.new
59
- parser.report_warning = false
60
- data = GetText::MoFile.new
61
- parser.parse_file(po_file, data)
62
- @messages.merge!(data)
63
55
  true
64
56
  end
65
57
 
@@ -0,0 +1,60 @@
1
+ module YARD
2
+ module I18n
3
+ # +Locale+ is a wrapper for gettext's PO parsing feature. It hides
4
+ # gettext API difference from YARD.
5
+ #
6
+ # @since 0.8.8
7
+ class POParser
8
+ if RUBY_VERSION < "1.9"
9
+ begin
10
+ require "gettext/tools/poparser"
11
+ require "gettext/runtime/mofile"
12
+ @@gettext_version = 2
13
+ rescue LoadError
14
+ log.warn "Need gettext gem 2.x for i18n feature:"
15
+ log.warn " gem install gettext -v 2.3.9"
16
+ end
17
+ else
18
+ begin
19
+ require "gettext/po_parser"
20
+ require "gettext/mo"
21
+ @@gettext_version = 3
22
+ rescue LoadError
23
+ begin
24
+ require "gettext/tools/poparser"
25
+ require "gettext/runtime/mofile"
26
+ @@gettext_version = 2
27
+ rescue LoadError
28
+ log.warn "Need gettext gem for i18n feature:"
29
+ log.warn " gem install gettext"
30
+ end
31
+ end
32
+ end
33
+
34
+ class << self
35
+ # @return [Boolean] true if gettext is available, false otherwise.
36
+ def available?
37
+ !@@gettext_version.nil?
38
+ end
39
+ end
40
+
41
+ # Parses PO file.
42
+ #
43
+ # @param [String] file path of PO file to be parsed.
44
+ # @return [Hash<String, String>] parsed messages.
45
+ def parse(file)
46
+ case @@gettext_version
47
+ when 2
48
+ parser = GetText::PoParser.new
49
+ data = GetText::MoFile.new
50
+ when 3
51
+ parser = GetText::POParser.new
52
+ data = GetText::MO.new
53
+ end
54
+ parser.report_warning = false
55
+ parser.parse_file(file, data)
56
+ data
57
+ end
58
+ end
59
+ end
60
+ end
data/lib/yard/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module YARD
2
- VERSION = "0.8.7"
2
+ VERSION = "0.8.7.1"
3
3
  end
@@ -22,11 +22,24 @@ describe YARD::I18n::Locale do
22
22
  end
23
23
 
24
24
  have_gettext_gem = true
25
- begin
26
- require "gettext/tools/poparser"
27
- rescue LoadError
28
- have_gettext_gem = false
25
+ if RUBY_VERSION < "1.9"
26
+ begin
27
+ require "gettext/tools/poparser"
28
+ rescue LoadError
29
+ have_gettext_gem = false
30
+ end
31
+ else
32
+ begin
33
+ require "gettext/po_parser"
34
+ rescue LoadError
35
+ begin
36
+ require "gettext/tools/poparser"
37
+ rescue LoadError
38
+ have_gettext_gem = false
39
+ end
40
+ end
29
41
  end
42
+
30
43
  it "should return true for existent PO", :if => have_gettext_gem do
31
44
  data = <<-eop
32
45
  msgid ""
@@ -39,9 +52,9 @@ msgstr ""
39
52
  msgid "Hello"
40
53
  msgstr "Bonjour"
41
54
  eop
42
- parser = GetText::PoParser.new
55
+ parser = GetText::POParser.new
43
56
  File.should_receive(:exist?).with('foo/fr.po').and_return(true)
44
- GetText::PoParser.should_receive(:new).and_return(parser)
57
+ GetText::POParser.should_receive(:new).and_return(parser)
45
58
  parser.should_receive(:parse_file) do |file, hash|
46
59
  file.should == 'foo/fr.po'
47
60
  parser.parse(data, hash)
@@ -8,14 +8,11 @@
8
8
  </head>
9
9
  <script type="text/javascript" charset="utf-8">
10
10
  window.onload = function() {
11
- var match = window.location.hash.match(/^#!(.+)/);
12
- var name = '<%= url_for_main %>';
13
- if (match) {
14
- name = unescape(match[1]);
15
- }
11
+ var match = unescape(window.location.hash).match(/^#!(.+)/);
12
+ var name = match ? match[1] : '<%= url_for_main %>';
16
13
  document.writeln('<frameset cols="20%,*">' +
17
14
  '<frame name="list" src="<%= url_for_list('class') %>" />' +
18
- '<frame name="main" src="' + name + '" />' +
15
+ '<frame name="main" src="' + escape(name) + '" />' +
19
16
  '</frameset>');
20
17
  }
21
18
  </script>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Loren Segal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-26 00:00:00.000000000 Z
11
+ date: 2013-09-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  YARD is a documentation generation tool for the Ruby programming language.
@@ -146,6 +146,7 @@ files:
146
146
  - lib/yard/i18n/locale.rb
147
147
  - lib/yard/i18n/message.rb
148
148
  - lib/yard/i18n/messages.rb
149
+ - lib/yard/i18n/po_parser.rb
149
150
  - lib/yard/i18n/pot_generator.rb
150
151
  - lib/yard/i18n/text.rb
151
152
  - lib/yard/logging.rb