po_to_json 1.0.1 → 1.1.0

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
- SHA1:
3
- metadata.gz: fd2c6fd8c413ae56d551b03417cb9d101ff7d87f
4
- data.tar.gz: 9a33165a6803adbd2b7a357ea5d6b2f014d4b50e
2
+ SHA256:
3
+ metadata.gz: 580672c796de4ad6759584e1ed20fde3a4bea5016067ecbad6ba08367e512363
4
+ data.tar.gz: 7508945b8c57ca22fd291dd11cc1950791d06360c75ef9fd65f91e61db3b53a7
5
5
  SHA512:
6
- metadata.gz: a75ee9649a3d3a487096a7ad214393b74603ade47c90bd94d76345794f80be566600b66d80048646d35d4cfe7c3374095abd2990bf99e38399cbabdf7a91b1b0
7
- data.tar.gz: fedeaf80475556806c69354034575ad441bf6f22e8197f45fe5381d392e727489da41e3991e14218488cce52e6a28cbd32aa91a7337f87816d1ebe5a1a4828dc
6
+ metadata.gz: 46ec013b340a9f79c31cd35b15578b6ab248ccbb6d75121f01104cc403e209a6d9117e60b3f0b44f1988029039cd542ac365573e2273249fd37215664edd5ec2
7
+ data.tar.gz: 3f08e94fe99a9a42cec783fdd1c3b39e994de47285dbb0bfe2b9252144acdbeda69f20ee9cace55c125acc1b9c627d8ce677c4c5d89e6b89e71f78726f426202
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.0](https://github.com/webhippie/po_to_json/releases/tag/v1.0.1) - 2023-04-28
4
+
5
+ * Optionally remove var keyword to use a global (@illiatdesdindes)
6
+
3
7
  ## [1.0.1](https://github.com/webhippie/po_to_json/releases/tag/v1.0.1) - 2015-11-03
4
8
 
5
9
  * Stop using bundler within the core lib (@tboerger)
data/README.md CHANGED
@@ -1,10 +1,6 @@
1
- # PoToJson
1
+ # po_to_json
2
2
 
3
- [![Gem Version](http://img.shields.io/gem/v/po_to_json.svg)](https://rubygems.org/gems/po_to_json)
4
- [![Build Status](https://secure.travis-ci.org/webhippie/po_to_json.svg)](https://travis-ci.org/webhippie/po_to_json)
5
- [![Code Climate](https://codeclimate.com/github/webhippie/po_to_json.svg)](https://codeclimate.com/github/webhippie/po_to_json)
6
- [![Test Coverage](https://codeclimate.com/github/webhippie/po_to_json/badges/coverage.svg)](https://codeclimate.com/github/webhippie/po_to_json)
7
- [![Dependency Status](https://gemnasium.com/webhippie/po_to_json.svg)](https://gemnasium.com/webhippie/po_to_json)
3
+ [![Test Status](https://github.com/webhippie/po_to_json/actions/workflows/testing.yml/badge.svg)](https://github.com/webhippie/po_to_json/actions/workflows/testing.yaml) [![Join the Matrix chat at https://matrix.to/#/#webhippie:matrix.org](https://img.shields.io/badge/matrix-%23webhippie%3Amatrix.org-7bc9a4.svg)](https://matrix.to/#/#webhippie:matrix.org) [![Codacy Badge](https://app.codacy.com/project/badge/Grade/6e015952f83d42d4bfc7e335d856554a)](https://app.codacy.com/gh/webhippie/po_to_json/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) [![Gem Version](https://badge.fury.io/rb/po_to_json.svg)](https://badge.fury.io/rb/po_to_json)
8
4
 
9
5
  Convert gettext PO files to JSON to use in your javascript app, based on
10
6
  po2json.pl by [DuckDuckGo, Inc.](http://duckduckgo.com/). Ideally you'll use
@@ -14,24 +10,31 @@ later be used from javascript with [Jed](http://slexaxton.github.io/Jed/)
14
10
 
15
11
  ## Versions
16
12
 
17
- This gem is tested on the following versions automated through TravisCI:
18
-
19
- * Ruby
20
- * 1.9.3
21
- * 2.0.0
22
- * 2.1.0
23
- * Json
24
- * 1.6.8
25
- * 1.7.7
26
- * 1.8.2
27
-
13
+ For a list of the tested and supported Ruby and JSON versions please take a
14
+ look at the [wokflow][workflow].
28
15
 
29
16
  ## Installation
30
17
 
31
18
  ```ruby
32
- gem "po_to_json", "~> 0.1.0"
19
+ gem "po_to_json", "~> 0.2"
33
20
  ```
34
21
 
22
+ ## Versioning
23
+
24
+ This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations
25
+ of this scheme should be reported as bugs. Specifically, if a minor or patch
26
+ version is released that breaks backward compatibility, a new version should be
27
+ immediately released that restores compatibility. Breaking changes to the public
28
+ API will only be introduced with new major versions.
29
+
30
+ As a result of this policy, you can (and should) specify a dependency on this
31
+ gem using the [Pessimistic Version Constraint][pvc] with two digits of precision.
32
+
33
+ For example:
34
+
35
+ ```ruby
36
+ spec.add_dependency "po_to_json", "~> 0.2"
37
+ ```
35
38
 
36
39
  ## Usage
37
40
 
@@ -45,7 +48,14 @@ json = PoToJson.new(
45
48
  Rails.root.join("locale", "de", "app.po")
46
49
  ).generate_for_jed("de")
47
50
 
48
- Rails.root.join("app", "assets", "javascripts", "locale", "de", "app.js").write(json)
51
+ Rails.root.join(
52
+ "app",
53
+ "assets",
54
+ "javascripts",
55
+ "locale",
56
+ "de",
57
+ "app.js"
58
+ ).write(json)
49
59
  ```
50
60
 
51
61
  If you need a pretty json, add `pretty: true` to `generate_for_jed`, like the
@@ -58,7 +68,14 @@ json = PoToJson.new(
58
68
  Rails.root.join("locale", "de", "app.po")
59
69
  ).generate_for_jed("de", pretty: true)
60
70
 
61
- Rails.root.join("app", "assets", "javascripts", "locale", "de", "app.js").write(json)
71
+ Rails.root.join(
72
+ "app",
73
+ "assets",
74
+ "javascripts",
75
+ "locale",
76
+ "de",
77
+ "app.js"
78
+ ).write(json)
62
79
  ```
63
80
 
64
81
  The javascript file generated has a global "locales" object with an attribute
@@ -69,27 +86,27 @@ i18n = new Jed(locales["de"])
69
86
  i18n.gettext("Hello World") // Should evaluate to "Hallo Welt"
70
87
  ```
71
88
 
72
-
73
89
  ## Contributing
74
90
 
75
91
  Fork -> Patch -> Spec -> Push -> Pull Request
76
92
 
77
-
78
93
  ## Authors
79
94
 
80
- * [Thomas Boerger](https://github.com/tboerger)
81
- * [Nubis](https://github.com/nubis)
82
- * [Other contributors](https://github.com/webhippie/po_to_json/graphs/contributors)
83
-
95
+ * [Thomas Boerger](https://github.com/tboerger)
96
+ * [Nubis](https://github.com/nubis)
97
+ * [Other contributors](https://github.com/webhippie/po_to_json/graphs/contributors)
84
98
 
85
99
  ## License
86
100
 
87
101
  MIT
88
102
 
89
-
90
103
  ## Copyright
91
104
 
92
105
  ```
93
106
  Copyright (c) 2012-2015 Dropmysite.com <https://dropmyemail.com>
94
107
  Copyright (c) 2015 Webhippie <http://www.webhippie.de>
95
108
  ```
109
+
110
+ [workflow]: https://github.com/webhippie/po_to_json/blob/master/.github/workflows/testing.yml
111
+ [semver]: http://semver.org
112
+ [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
@@ -1,4 +1,3 @@
1
- # -*- coding: UTF-8 -*-
2
1
  #
3
2
  # Copyright (c) 2012-2015 Dropmysite.com <https://dropmyemail.com>
4
3
  # Copyright (c) 2015 Webhippie <http://www.webhippie.de>
@@ -26,8 +25,8 @@
26
25
  class PoToJson
27
26
  class Version
28
27
  MAJOR = 1
29
- MINOR = 0
30
- PATCH = 1
28
+ MINOR = 1
29
+ PATCH = 0
31
30
 
32
31
  PRE = nil
33
32
 
data/lib/po_to_json.rb CHANGED
@@ -1,4 +1,3 @@
1
- # -*- coding: UTF-8 -*-
2
1
  #
3
2
  # Copyright (c) 2012-2015 Dropmysite.com <https://dropmyemail.com>
4
3
  # Copyright (c) 2015 Webhippie <http://www.webhippie.de>
@@ -27,16 +26,9 @@ gem "json", version: ">= 1.6.0"
27
26
  require "json"
28
27
 
29
28
  class PoToJson
30
- autoload :Version, File.expand_path("../po_to_json/version", __FILE__)
29
+ autoload :Version, File.expand_path("po_to_json/version", __dir__)
31
30
 
32
- attr_accessor :files
33
- attr_accessor :glue
34
- attr_accessor :options
35
- attr_accessor :errors
36
- attr_accessor :values
37
- attr_accessor :buffer
38
- attr_accessor :lastkey
39
- attr_accessor :trans
31
+ attr_accessor :files, :glue, :options
40
32
 
41
33
  def initialize(files, glue = "|")
42
34
  @files = files
@@ -50,7 +42,8 @@ class PoToJson
50
42
  generated = build_json_for(build_jed_for(@parsed))
51
43
 
52
44
  [
53
- "var #{@options[:variable]} = #{@options[:variable]} || {};",
45
+ @options[:variable_locale_scope] ? "var" : "",
46
+ "#{@options[:variable]} = #{@options[:variable]} || {};",
54
47
  "#{@options[:variable]}['#{@options[:language]}'] = #{generated};"
55
48
  ].join(" ")
56
49
  end
@@ -61,7 +54,7 @@ class PoToJson
61
54
 
62
55
  generated = build_json_for(build_json_for(@parsed))
63
56
 
64
- fail "Not implemented yet, current value is #{generated}!"
57
+ raise "Not implemented yet, current value is #{generated}!"
65
58
  end
66
59
 
67
60
  def parse_document
@@ -92,6 +85,7 @@ class PoToJson
92
85
 
93
86
  values[""][0].split("\\n").each do |line|
94
87
  next if line.empty?
88
+
95
89
  build_header_for(line)
96
90
  end
97
91
 
@@ -148,7 +142,7 @@ class PoToJson
148
142
  msgctxt = buffer[:msgctxt]
149
143
  msgid = buffer[:msgid]
150
144
 
151
- if msgctxt && msgctxt.size > 0
145
+ if msgctxt && !msgctxt.empty?
152
146
  [msgctxt, glue, msgid].join("")
153
147
  else
154
148
  msgid
@@ -157,19 +151,19 @@ class PoToJson
157
151
 
158
152
  def detect_plural
159
153
  plural = buffer[:msgid_plural]
160
- plural if plural && plural.size > 0
154
+ plural if plural && !plural.empty?
161
155
  end
162
156
 
163
157
  def build_trans
164
158
  buffer.each do |key, string|
165
- trans[$1.to_i] = string if key.to_s.match(/^msgstr_(\d+)/)
159
+ trans[$1.to_i] = string if key.to_s =~ /^msgstr_(\d+)/
166
160
  end
167
161
 
168
162
  # trans.unshift(detect_plural) if detect_plural
169
163
  end
170
164
 
171
165
  def assign_trans
172
- values[detect_ctxt] = trans if trans.size > 0
166
+ values[detect_ctxt] = trans unless trans.empty?
173
167
  end
174
168
 
175
169
  def push_buffer(value, key = nil)
@@ -191,7 +185,8 @@ class PoToJson
191
185
  defaults = {
192
186
  pretty: false,
193
187
  domain: "app",
194
- variable: "locales"
188
+ variable: "locales",
189
+ variable_locale_scope: true
195
190
  }
196
191
 
197
192
  defaults.merge(options)
@@ -207,7 +202,8 @@ class PoToJson
207
202
 
208
203
  def build_header_for(line)
209
204
  if line =~ /(.*?):(.*)/
210
- key, value = $1, $2
205
+ key = $1
206
+ value = $2
211
207
 
212
208
  if headers.key? key
213
209
  errors.push "Duplicate header: #{line}"
@@ -266,7 +262,7 @@ class PoToJson
266
262
  end
267
263
 
268
264
  def generic_rejects?(line)
269
- if line.match(/^$/) || line.match(/^(#[^~]|[#]$)/)
265
+ if line.match(/^$/) || line.match(/^(#[^~]|\#$)/)
270
266
  flush_buffer && true
271
267
  else
272
268
  false
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: po_to_json
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Boerger
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-03 00:00:00.000000000 Z
12
+ date: 2023-04-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -40,7 +40,7 @@ dependencies:
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: yard
43
+ name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - ">="
@@ -54,7 +54,7 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: rspec
57
+ name: yard
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ">="
@@ -96,9 +96,6 @@ files:
96
96
  - README.md
97
97
  - lib/po_to_json.rb
98
98
  - lib/po_to_json/version.rb
99
- - spec/fixtures/test.po
100
- - spec/po_to_json_spec.rb
101
- - spec/spec_helper.rb
102
99
  homepage: https://github.com/webhippie/po_to_json
103
100
  licenses:
104
101
  - MIT
@@ -118,13 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
115
  - !ruby/object:Gem::Version
119
116
  version: '0'
120
117
  requirements: []
121
- rubyforge_project:
122
- rubygems_version: 2.4.5.1
118
+ rubygems_version: 3.1.2
123
119
  signing_key:
124
120
  specification_version: 4
125
121
  summary: Convert gettext PO files to JSON
126
- test_files:
127
- - spec/fixtures/test.po
128
- - spec/po_to_json_spec.rb
129
- - spec/spec_helper.rb
130
- has_rdoc:
122
+ test_files: []
@@ -1,69 +0,0 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- msgid ""
6
- msgstr ""
7
- "Project-Id-Version: version 0.0.1\n"
8
- "POT-Creation-Date: 2009-02-26 19:50+0100\n"
9
- "PO-Revision-Date: 2011-12-04 18:54+0900\n"
10
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
- "Language-Team: LANGUAGE <LL@li.org>\n"
12
- "MIME-Version: 1.0\n"
13
- "Content-Type: text/plain; charset=UTF-8\n"
14
- "Content-Transfer-Encoding: 8bit\n"
15
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
-
17
- #: app/helpers/translation_helper.rb:3
18
- msgid "%{relative_time} ago"
19
- msgstr "vor %{relative_time}"
20
-
21
- #: app/views/cars/show.html.erb:5
22
- msgid "1 Axis"
23
- msgid_plural "%{num} Axis"
24
- msgstr[0] "1 Achse"
25
- msgstr[1] "%{num} Achsen"
26
-
27
- #: app/controllers/cars_controller.rb:47
28
- msgid "Car was successfully created."
29
- msgstr "Auto wurde erfolgreich gespeichert"
30
-
31
- #: app/controllers/cars_controller.rb:64
32
- msgid "Car was successfully updated."
33
- msgstr "Auto wurde erfolgreich aktualisiert"
34
-
35
- #: app/views/cars/show.html.erb:1 locale/model_attributes.rb:3
36
- msgid "Car|Model"
37
- msgstr "Modell"
38
-
39
- msgid "Untranslated"
40
- msgstr ""
41
-
42
- #: app/views/cars/show.html.erb:3 locale/model_attributes.rb:4
43
- msgid "Car|Wheels count"
44
- msgstr "Räderzahl"
45
-
46
- #: app/views/cars/show.html.erb:7
47
- msgid "Created"
48
- msgstr "Erstellt"
49
-
50
- #: app/views/cars/show.html.erb:9
51
- msgid "Month"
52
- msgstr "Monat"
53
-
54
- #: locale/model_attributes.rb:2
55
- msgid "car"
56
- msgstr "Auto"
57
-
58
- #: locale/testlog_phrases.rb:2
59
- msgid "this is a dynamic translation which was found!"
60
- msgstr ""
61
- "Dies ist eine dynamische Übersetzung, die "
62
- "gefunden wurde!"
63
-
64
- #: locale/test_escape.rb:2
65
- msgid "You should escape '\\' as '\\\\'."
66
- msgstr "Du solltest '\\' als '\\\\' escapen."
67
-
68
- msgid "Umläüte"
69
- msgstr "Umlaute"
@@ -1,196 +0,0 @@
1
- # -*- coding: UTF-8 -*-
2
- #
3
- # Copyright (c) 2012-2015 Dropmysite.com <https://dropmyemail.com>
4
- # Copyright (c) 2015 Webhippie <http://www.webhippie.de>
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining
7
- # a copy of this software and associated documentation files (the
8
- # "Software"), to deal in the Software without restriction, including
9
- # without limitation the rights to use, copy, modify, merge, publish,
10
- # distribute, sublicense, and/or sell copies of the Software, and to
11
- # permit persons to whom the Software is furnished to do so, subject to
12
- # the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be
15
- # included in all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
- #
25
-
26
- require "spec_helper"
27
-
28
- describe PoToJson do
29
- let(:po_to_json) do
30
- @subject = PoToJson.new(
31
- File.expand_path("../fixtures/test.po", __FILE__)
32
- )
33
- end
34
-
35
- describe "parsing" do
36
- subject do
37
- po_to_json.parse_document
38
- end
39
-
40
- it "should find the last author" do
41
- expect(subject[""]["Last-Translator"]).to(
42
- eq("FULL NAME <EMAIL@ADDRESS>")
43
- )
44
- end
45
-
46
- it "should parse embedded variables" do
47
- expect(subject["%{relative_time} ago"]).to(
48
- eq(["vor %{relative_time}"])
49
- )
50
- end
51
-
52
- it "should match pluralizations" do
53
- expect(subject["1 Axis"]).to(
54
- eq(["1 Achse", "%{num} Achsen"])
55
- )
56
- end
57
-
58
- it "should match glued values" do
59
- expect(subject["Car|Model"]).to(
60
- eq(["Modell"])
61
- )
62
- end
63
-
64
- it "should match embedded glue" do
65
- expect(subject["Car|Wheels count"]).to(
66
- eq(["Räderzahl"])
67
- )
68
- end
69
-
70
- it "should return empty strings as well" do
71
- expect(subject["Untranslated"]).to(
72
- eq([""])
73
- )
74
- end
75
-
76
- it "should match german umlauts" do
77
- expect(subject["Umläüte"]).to(
78
- eq(["Umlaute"])
79
- )
80
- end
81
-
82
- it "should match escaped values" do
83
- expect(subject["You should escape '\\\\' as '\\\\\\\\'."]).to(
84
- eq(["Du solltest '\\\\' als '\\\\\\\\' escapen."])
85
- )
86
- end
87
-
88
- it "should match multiline translations" do
89
- expect(subject["this is a dynamic translation which was found!"]).to(
90
- eq(["Dies ist eine dynamische Übersetzung, die gefunden wurde!"])
91
- )
92
- end
93
-
94
- it "should match simple strings" do
95
- expect(subject["Car was successfully created."]).to(
96
- eq(["Auto wurde erfolgreich gespeichert"])
97
- )
98
-
99
- expect(subject["Car was successfully updated."]).to(
100
- eq(["Auto wurde erfolgreich aktualisiert"])
101
- )
102
-
103
- expect(subject["Created"]).to(
104
- eq(["Erstellt"])
105
- )
106
-
107
- expect(subject["Month"]).to(
108
- eq(["Monat"])
109
- )
110
-
111
- expect(subject["car"]).to(
112
- eq(["Auto"])
113
- )
114
- end
115
- end
116
-
117
- describe "generate jed compatible" do
118
- describe "with minified output" do
119
- subject do
120
- po_to_json.generate_for_jed("de")
121
- end
122
-
123
- it "should output the var definition" do
124
- expect(
125
- subject.include?("var locales = locales || {}; locales['de'] = ")
126
- ).to be_truthy
127
- end
128
-
129
- it "should include domain string" do
130
- expect(
131
- subject.include?('"domain":"app"')
132
- ).to be_truthy
133
- end
134
-
135
- it "should include lang string" do
136
- expect(
137
- subject.include?('"lang":"de"')
138
- ).to be_truthy
139
- end
140
-
141
- it "should include pluralization" do
142
- val = '"plural_forms":"nplurals=2; plural=(n != 1);"'
143
- expect(
144
- subject.include? val
145
- ).to be_truthy
146
- end
147
-
148
- it "should include a single line break" do
149
- expect(
150
- subject.count("\n")
151
- ).to be < 1
152
- end
153
- end
154
-
155
- context "with pretty output" do
156
- subject do
157
- po_to_json.generate_for_jed("de", pretty: true)
158
- end
159
-
160
- it "should output the var definition" do
161
- expect(
162
- subject.include?("var locales = locales || {}; locales['de'] = ")
163
- ).to be_truthy
164
- end
165
-
166
- it "should include domain string" do
167
- expect(
168
- subject.include?('"domain": "app"')
169
- ).to be_truthy
170
- end
171
-
172
- it "should include lang string" do
173
- expect(
174
- subject.include?('"lang": "de"')
175
- ).to be_truthy
176
- end
177
-
178
- it "should include pluralization" do
179
- val = '"plural_forms": "nplurals=2; plural=(n != 1);"'
180
- expect(
181
- subject.include? val
182
- ).to be_truthy
183
- end
184
-
185
- it "should include multiple line breaks" do
186
- expect(
187
- subject.count("\n")
188
- ).to be > 0
189
- end
190
- end
191
- end
192
-
193
- # describe "generate simple hashes" do
194
- # pending "have to be implemented"
195
- # end
196
- end
data/spec/spec_helper.rb DELETED
@@ -1,54 +0,0 @@
1
- # -*- coding: UTF-8 -*-
2
- #
3
- # Copyright (c) 2012-2015 Dropmysite.com <https://dropmyemail.com>
4
- # Copyright (c) 2015 Webhippie <http://www.webhippie.de>
5
- #
6
- # Permission is hereby granted, free of charge, to any person obtaining
7
- # a copy of this software and associated documentation files (the
8
- # "Software"), to deal in the Software without restriction, including
9
- # without limitation the rights to use, copy, modify, merge, publish,
10
- # distribute, sublicense, and/or sell copies of the Software, and to
11
- # permit persons to whom the Software is furnished to do so, subject to
12
- # the following conditions:
13
- #
14
- # The above copyright notice and this permission notice shall be
15
- # included in all copies or substantial portions of the Software.
16
- #
17
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
- #
25
-
26
- require "simplecov"
27
-
28
- if ENV["CODECLIMATE_REPO_TOKEN"]
29
- require "coveralls"
30
- require "codeclimate-test-reporter"
31
-
32
- Coveralls.wear!
33
- CodeClimate::TestReporter.start
34
-
35
- SimpleCov.start do
36
- add_filter "/spec"
37
-
38
- formatter SimpleCov::Formatter::MultiFormatter[
39
- SimpleCov::Formatter::HTMLFormatter,
40
- CodeClimate::TestReporter::Formatter
41
- ]
42
- end
43
- else
44
- SimpleCov.start do
45
- add_filter "/spec"
46
- end
47
- end
48
-
49
- require "po_to_json"
50
- require "rspec"
51
-
52
- RSpec.configure do |config|
53
- config.mock_with :rspec
54
- end