PoParser 3.2.4 → 3.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e36380b141ce56c37c114c687239e223b695d74330c57c58bd635d086f4e497
4
- data.tar.gz: 1a13046889c0d4a78a140468810ee42ce52375470469792b11ed31107b8e882c
3
+ metadata.gz: 392d8f812cf03d26f88eb36e87a7123cdec137c5858e516b236c02890a987c7d
4
+ data.tar.gz: 1fc9a420db5ec1074f0a214d272d8863c390fccab25c18af6c5b423967a88f38
5
5
  SHA512:
6
- metadata.gz: 8802f166720bb4d4c6718837f5e18c2baa1223d56c690a85631a51ad328524234f5d41f2e1231f8652f1625ce84f70b5690f54cbef5f6bd18f0e8792a7c4f73b
7
- data.tar.gz: 179ccf8927a9f39f1bd79acd464cc302029829add6eaca6518392516536f815e728f7099005f3f511faceff0f0e044b0f94ad58c45311e6f2567ff519b4a687d
6
+ metadata.gz: 3c03f5ced1b5a31b785b32edc91b7a9f1979a0132e469adf7422de5124947feca04e5aaab4a32fa7b8d41663ff517db012f4a56f918f6cc37b8eb12fcd94703c
7
+ data.tar.gz: b50ec41094db0f27066a3b7482e7a0b7e307e7f9afbf54b81c07f97190f3419bc32d8c53e02767dfbaea95e75c6b8878952720ff847b566af73a928222a23ca6
@@ -0,0 +1,41 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ master ]
13
+ pull_request:
14
+ branches: [ master ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.5', '2.6', '2.7', '3.0']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ # uses: ruby/setup-ruby@v1
30
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
+ - name: Run tests
35
+ run: bundle exec rake
36
+
37
+ - name: Coveralls
38
+ uses: coverallsapp/github-action@master
39
+ with:
40
+ github-token: ${{ secrets.GITHUB_TOKEN }}
41
+ path-to-lcov: "./coverage/lcov.info"
data/Gemfile CHANGED
@@ -3,13 +3,13 @@
3
3
  source 'https://rubygems.org'
4
4
 
5
5
  group :test do
6
- gem 'coveralls', require: false
7
- gem 'rspec', '~> 3.8'
6
+ gem 'simplecov', require: false
7
+ gem 'simplecov-lcov', require: false
8
+ gem 'rspec', '~> 3.9'
8
9
  gem 'awesome_print'
9
10
  end
10
11
 
11
12
  group :development do
12
- gem 'guard-rspec'
13
13
  gem 'ruby-prof'
14
14
  end
15
15
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # PoParser
2
2
 
3
- [![Build Status](https://travis-ci.org/arashm/PoParser.svg?branch=master)](https://travis-ci.org/arashm/PoParser)
4
- [![Coverage Status](https://img.shields.io/coveralls/arashm/PoParser.svg)](https://coveralls.io/r/arashm/PoParser)
3
+ ![Build Status](https://github.com/arashm/poparser/workflows/Ruby/badge.svg?branch=master)
4
+ [![Coverage Status](https://coveralls.io/repos/github/arashm/PoParser/badge.svg)](https://coveralls.io/github/arashm/PoParser)
5
5
  [![Code Climate](https://codeclimate.com/github/arashm/PoParser.png)](https://codeclimate.com/github/arashm/PoParser)
6
6
  [![Gem Version](https://badge.fury.io/rb/PoParser.svg)](http://badge.fury.io/rb/PoParser)
7
7
 
@@ -9,7 +9,7 @@ module PoParser
9
9
 
10
10
  def initialize(args = {})
11
11
  @entries = []
12
- @path = args.fetch(:path, nil)
12
+ @path = args[:path]
13
13
  end
14
14
 
15
15
  # add new entries to po file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PoParser
4
- VERSION = '3.2.4'
4
+ VERSION = '3.2.5'
5
5
  end
@@ -6,18 +6,24 @@
6
6
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
7
 
8
8
  require 'simplecov'
9
- require 'coveralls'
9
+ require 'simplecov-lcov'
10
10
  require 'awesome_print'
11
- require 'pry'
12
11
 
13
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
14
- [SimpleCov::Formatter::HTMLFormatter,
15
- Coveralls::SimpleCov::Formatter]
16
- )
12
+ SimpleCov::Formatter::LcovFormatter.config do |c|
13
+ c.report_with_single_file = true
14
+ c.single_report_path = 'coverage/lcov.info'
15
+ end
16
+
17
+ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
18
+ [
19
+ SimpleCov::Formatter::HTMLFormatter,
20
+ SimpleCov::Formatter::LcovFormatter,
21
+ ]
22
+ )
17
23
 
18
24
  SimpleCov.start do
19
- add_group "gem", "lib"
20
- add_group "spec", "spec"
25
+ add_group "gem", "lib"
26
+ add_group "spec", "spec"
21
27
  end
22
28
 
23
29
  require 'poparser'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: PoParser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.4
4
+ version: 3.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arash Mousavi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-12 00:00:00.000000000 Z
11
+ date: 2021-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simple_po_parser
@@ -60,14 +60,13 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - ".github/workflows/ruby.yml"
63
64
  - ".gitignore"
64
65
  - ".rspec"
65
66
  - ".rubocop.yml"
66
- - ".travis.yml"
67
67
  - CHANGELOG.md
68
68
  - CODE_OF_CONDUCT.md
69
69
  - Gemfile
70
- - Guardfile
71
70
  - LICENSE.txt
72
71
  - README.md
73
72
  - Rakefile
@@ -97,7 +96,6 @@ files:
97
96
  - spec/poparser/poparser_spec.rb
98
97
  - spec/poparser/tokenizer_spec.rb
99
98
  - spec/spec_helper.rb
100
- - spec/utils/random_pofile_generator.rb
101
99
  - test/benchmark.po
102
100
  - test/benchmark_small.po
103
101
  - test/complex_entry.po
@@ -106,7 +104,7 @@ homepage: http://github.com/arashm/poparser
106
104
  licenses:
107
105
  - MIT
108
106
  metadata: {}
109
- post_install_message:
107
+ post_install_message:
110
108
  rdoc_options: []
111
109
  require_paths:
112
110
  - lib
@@ -121,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
119
  - !ruby/object:Gem::Version
122
120
  version: '0'
123
121
  requirements: []
124
- rubygems_version: 3.0.6
125
- signing_key:
122
+ rubygems_version: 3.2.5
123
+ signing_key:
126
124
  specification_version: 4
127
125
  summary: A PO file parser, editor and generator.
128
126
  test_files:
@@ -142,4 +140,3 @@ test_files:
142
140
  - spec/poparser/poparser_spec.rb
143
141
  - spec/poparser/tokenizer_spec.rb
144
142
  - spec/spec_helper.rb
145
- - spec/utils/random_pofile_generator.rb
@@ -1,8 +0,0 @@
1
- bundler_args: --without development
2
- language: ruby
3
- sudo: false
4
- rvm:
5
- - 2.4.5
6
- - 2.5.3
7
- - 2.6.2
8
- script: bundle exec rspec spec
data/Guardfile DELETED
@@ -1,9 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard :rspec, cmd: 'bundle exec rspec' do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
9
-
@@ -1,175 +0,0 @@
1
- module PoParser
2
- module RandomPoFileGenerator
3
- require 'securerandom'
4
- def self.generate_file(file_path, length = 1000, obsoletes = 10)
5
- header = "# PO benchmark file header
6
- #
7
- #, fuzzy
8
- msgid \"\"
9
- msgstr \"\"
10
- \"Project-Id-Version: somehwat master\\n\"
11
- \"Report-Msgid-Bugs-To: \\n\"
12
- \"Last-Translator: last t <last.transh@e.mail>\\n\"
13
- \"Language-Team: team\\n\"
14
- \"Content-Type: text/plain; charset=UTF-8\\n\"
15
- \"MIME-Version: 1.0\\n\"
16
- \"Content-Transfer-Encoding: 8bit\\n\"
17
- \"Plural-Forms: nplurals=1; plural=0;\\n\""
18
-
19
- @random = Random.new
20
- File.open(file_path, 'w+') do |file|
21
- file.write header
22
- file.write "\n\n"
23
- for i in 0..length-obsoletes do
24
- file.write generate_random_message
25
- end
26
-
27
- for i in 0...obsoletes do
28
- file.write generate_random_message(true)
29
- end
30
- end
31
-
32
- end
33
-
34
- private
35
-
36
- def self.generate_random_message(obsolete = false)
37
- random_message = ""
38
-
39
- untranslated_chance = 0.05
40
- fuzzy_chance = 0.1
41
- plural_chance = 0.1
42
- multiline_chance = 0.1
43
- translator_comment_chance = 0.2
44
- extracted_comment_chance = 0.05
45
- msgctxt_chance = 0.9
46
- reference_chance = 0.9
47
- multiple_reference_chance = 0.1
48
-
49
- plural = @random.rand < plural_chance ? true : false
50
- untranslated = @random.rand < untranslated_chance ? true : false
51
- fuzzy = !untranslated && @random.rand < fuzzy_chance ? true : false
52
- multiline = @random.rand < multiline_chance ? true : false
53
- translator_comment = @random.rand < translator_comment_chance ? true : false
54
- extracted_comment = @random.rand < extracted_comment_chance ? true : false
55
- reference = @random.rand < reference_chance ? true : false
56
- multiple_reference = @random.rand < multiple_reference_chance ? true : false
57
- with_msgctxt = @random.rand < msgctxt_chance ? true : false
58
-
59
- msgctxt = with_msgctxt ? SecureRandom.base64((@random.rand*70.0).ceil) : nil
60
- if multiline
61
- lines = (@random.rand*4.0).ceil
62
- msgid = []
63
- msgstr = []
64
- for i in 0..lines
65
- msgid[i] = SecureRandom.base64((@random.rand*70.0).ceil)
66
- msgstr[i] = SecureRandom.base64((@random.rand*70.0).ceil)
67
- end
68
- else
69
- msgid = SecureRandom.base64((@random.rand*150.0).ceil)
70
- msgstr = SecureRandom.base64((@random.rand*150.0).ceil)
71
- end
72
- if plural
73
- if multiline
74
- msgid_plural = []
75
- msgstr_plural = []
76
- for i in 0..lines
77
- msgid_plural[i] = SecureRandom.base64((@random.rand*70.0).ceil)
78
- msgstr_plural[i] = SecureRandom.base64((@random.rand*70.0).ceil)
79
- end
80
- else
81
- msgid_plural = SecureRandom.base64((@random.rand*150.0).ceil)
82
- msgstr_plural = SecureRandom.base64((@random.rand*70.0).ceil)
83
- end
84
- end
85
-
86
- random_message += "# #{SecureRandom.base64((@random.rand*50.0).to_i)}\n" if translator_comment
87
- random_message += "#. #{SecureRandom.base64((@random.rand*50.0).to_i)}\n" if extracted_comment
88
- random_message += "#: #{SecureRandom.base64((@random.rand*50.0).to_i)}\n" if reference
89
- if multiple_reference
90
- references = (@random.rand*3.0).ceil
91
- for i in 0..references
92
- random_message += "#: #{SecureRandom.base64((@random.rand*50.0).to_i)}\n"
93
- end
94
- end
95
- if fuzzy
96
- random_message += "#, fuzzy\n"
97
- random_message += "##{"~" if obsolete}| msgctxt \"#{msgctxt}\"\n" if msgctxt
98
- if msgid.is_a?(Array)
99
- random_message += "##{"~" if obsolete}| msgid \"\"\n"
100
- msgid.each do |line|
101
- random_message += "##{"~" if obsolete}| \"#{line}\\n\"\n"
102
- end
103
- else
104
- random_message += "##{"~" if obsolete}| msgid \"#{msgid}\"\n"
105
- end
106
- if plural
107
- if msgid_plural.is_a?(Array)
108
- random_message += "##{"~" if obsolete}| msgid_plural \"\"\n"
109
- msgid_plural.each do |line|
110
- random_message += "##{"~" if obsolete}| \"#{line}\\n\"\n"
111
- end
112
- else
113
- random_message += "##{"~" if obsolete}| msgid_plural \"#{msgid_plural}\"\n"
114
- end
115
- end
116
- end
117
- random_message += "#{"#~ " if obsolete}msgctxt \"#{msgctxt}\"\n" if msgctxt
118
- if msgid.is_a?(Array)
119
- random_message += "#{"#~ " if obsolete}msgid \"\"\n"
120
- msgid.each do |line|
121
- random_message += "#{"#~ " if obsolete}\"#{line}\\n\"\n"
122
- end
123
- else
124
- random_message += "#{"#~ " if obsolete}msgid \"#{msgid}\"\n"
125
- end
126
- if plural
127
- if msgid_plural.is_a?(Array)
128
- random_message += "#{"#~ " if obsolete}msgid_plural \"\"\n"
129
- msgid_plural.each do |line|
130
- random_message += "#{"#~ " if obsolete}\"#{line}\\n\"\n"
131
- end
132
- else
133
- random_message += "#{"#~ " if obsolete}msgid_plural \"#{msgid_plural}\"\n"
134
- end
135
- if untranslated
136
- random_message += "#{"#~ " if obsolete}msgstr[0] \"\"\n"
137
- random_message += "#{"#~ " if obsolete}msgstr[1] \"\"\n"
138
- else
139
- if msgstr.is_a?(Array)
140
- random_message += "#{"#~ " if obsolete}msgstr[0] \"\"\n"
141
- msgstr.each do |line|
142
- random_message += "#{"#~ " if obsolete}\"#{line}\\n\"\n"
143
- end
144
- else
145
- random_message += "#{"#~ " if obsolete}msgstr[0] \"#{msgstr}\"\n"
146
- end
147
- if msgstr_plural.is_a?(Array)
148
- random_message += "#{"#~ " if obsolete}msgstr[1] \"\"\n"
149
- msgstr_plural.each do |line|
150
- random_message += "#{"#~ " if obsolete}\"#{line}\\n\"\n"
151
- end
152
- else
153
- random_message += "#{"#~ " if obsolete}msgstr[1] \"#{msgstr}\"\n"
154
- end
155
- end
156
- else
157
- if untranslated
158
- random_message += "#{"#~ " if obsolete}msgstr \"\"\n"
159
- else
160
- if msgstr.is_a?(Array)
161
- random_message += "#{"#~ " if obsolete}msgstr \"\"\n"
162
- msgstr.each do |line|
163
- random_message += "#{"#~ " if obsolete}\"#{line}\\n\"\n"
164
- end
165
- else
166
- random_message += "#{"#~ " if obsolete}msgstr \"#{msgstr}\"\n"
167
- end
168
- end
169
- end
170
- random_message += "\n"
171
- random_message
172
- end
173
-
174
- end
175
- end