diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..30e2f6b --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,11 @@ +{ + "extends": [ + "config:base", + ":semanticCommits", + ":semanticCommitType(deps)", + ":automergePatch" + ], + "labels": [ + "renovate" + ] +} \ No newline at end of file diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000..7858cd1 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,66 @@ +--- +repository: + name: gettext_i18n_rails_js + description: Extends gettext_i18n_rails making your .PO files available to client side javascript as JSON + homepage: https://github.com/webhippie/gettext_i18n_rails_js + topics: ruby, rubygem, gettext, i18n, rails + + private: false + has_issues: true + has_projects: false + has_wiki: false + has_downloads: false + + default_branch: master + + allow_squash_merge: true + allow_merge_commit: true + allow_rebase_merge: true + +labels: + - name: bug + color: d73a4a + description: Something isn't working + - name: documentation + color: 0075ca + description: Improvements or additions to documentation + - name: duplicate + color: cfd3d7 + description: This issue or pull request already exists + - name: enhancement + color: a2eeef + description: New feature or request + - name: good first issue + color: 7057ff + description: Good for newcomers + - name: help wanted + color: 008672 + description: Extra attention is needed + - name: invalid + color: e4e669 + description: This doesn't seem right + - name: question + color: d876e3 + description: Further information is requested + - name: wontfix + color: ffffff + description: This will not be worked on + - name: hacktoberfest-accepted + color: cccccc + description: Accepted as a Hacktoberfest submission + - name: renovate + color: e99695 + description: Automated action from Renovate + +branches: + - name: master + protection: + required_status_checks: + strict: true + contexts: [] + enforce_admins: false + restrictions: + users: [] + teams: [] + +... diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml deleted file mode 100644 index d6e983a..0000000 --- a/.github/workflows/CI.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: CI -on: - pull_request: - push: - branches: - - master -jobs: - rubocop: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 2.1 - bundler-cache: true - - name: Run rubocop - if: github.event_name != 'push' - run: bundle exec rubocop - test_ruby: - runs-on: ubuntu-latest - needs: rubocop - timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - ruby: [2.1, 2.5, 2.7] - rails: ['3.2', '4.2', '5.2', '6.1'] - exclude: - # excludes new rails on old ruby - - rails: '5.2' - ruby: 2.1 - - rails: '6.1' - ruby: 2.1 - # excludes old rails on new ruby - - rails: '3.2' - ruby: 2.7 - - rails: '4.2' - ruby: 2.7 - steps: - - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler: 1.17 - bundler-cache: true - env: - RAILS_VERSION: ${{ matrix.rails }} - - name: Run tests - run: | - bundle exec rspec diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6cd217e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +--- +name: release + +"on": + push: + tags: + - v* + +jobs: + release: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Release gem + uses: dawidd6/action-publish-gem@v1 + with: + api_key: ${{ secrets.RUBYGEMS_API_KEY }} + +... diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml new file mode 100644 index 0000000..548fcf4 --- /dev/null +++ b/.github/workflows/testing.yml @@ -0,0 +1,73 @@ +--- +name: testing + +"on": + pull_request: + push: + branches: + - master + +jobs: + rubocop: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.1 + bundler: 1.17 + bundler-cache: true + + - name: Run rubocop + run: bundle exec rubocop + + spec: + runs-on: ubuntu-20.04 + needs: rubocop + + strategy: + fail-fast: false + + matrix: + ruby: + - 2.1 + - 2.5 + - 2.7 + rails: + - 3.2 + - 4.2 + - 5.2 + - 6.1 + exclude: + # excludes new rails on old ruby + - rails: 5.2 + ruby: 2.1 + - rails: 6.1 + ruby: 2.1 + # excludes old rails on new ruby + - rails: 3.2 + ruby: 2.7 + - rails: 4.2 + ruby: 2.7 + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Setup ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler: 1.17 + bundler-cache: true + env: + RAILS_VERSION: ${{ matrix.rails }} + + - name: Run rspec + run: bundle exec rspec + +... diff --git a/.rubocop.yml b/.rubocop.yml index ebf5b06..0c6f7d4 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,9 @@ -inherit_from: .rubocop_todo.yml +--- +Gemspec/RequiredRubyVersion: + Enabled: false + +Naming/HeredocDelimiterNaming: + Enabled: false Layout/ElseAlignment: Enabled: false @@ -30,19 +35,29 @@ Style/Next: Style/RegexpLiteral: Enabled: false +Style/SymbolArray: + EnforcedStyle: brackets + Metrics/MethodLength: CountComments: false Max: 30 -Style/SymbolArray: - EnforcedStyle: brackets - Metrics/ClassLength: Max: 300 +Metrics/AbcSize: + Max: 25 + +Metrics/PerceivedComplexity: + Max: 10 + Metrics/BlockLength: + Max: 35 Exclude: - - "gettext_i18n_rails_js.gemspec" - "**/*_spec.rb" - ExcludedMethods: - - namespace + +Metrics/LineLength: + Exclude: + - "**/*_spec.rb" + +... diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index 89032cc..0000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -1,30 +0,0 @@ -Gemspec/OrderedDependencies: - Enabled: false - -Gemspec/RequiredRubyVersion: - Enabled: false - -Lint/DuplicateMethods: - Enabled: false - -Metrics/AbcSize: - Max: 22 - -Metrics/LineLength: - Exclude: - - spec/gettext_i18n_rails_js/parser/javascript_spec.rb - -Naming/HeredocDelimiterNaming: - Enabled: false - -Style/Encoding: - Enabled: false - -Style/ExpandPathArguments: - Enabled: false - -Style/FormatStringToken: - Enabled: false - -Style/TrailingCommaInArrayLiteral: - Enabled: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b94c54..acc20aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,42 +1,48 @@ # Changelog +## [1.3.1](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.4.0) - 2021-12-08 + +* Fixed multiline translation strings (@delxen) +* Switched to Codacy for coverage reports (@tboerger) +* Switched to GitHub actions for CI (@ezr-ondrej) + ## [1.3.0](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.3.0) - 2017-03-16 -* Fixed Handlebars translations with options (@mikezaby) -* Fixed latest Rubocop offenses (@mikezaby) -* Dropped failing coveralls, fixed codeclimate (@tboerger) +* Fixed Handlebars translations with options (@mikezaby) +* Fixed latest Rubocop offenses (@mikezaby) +* Dropped failing coveralls, fixed codeclimate (@tboerger) ## [1.2.0](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.2.0) - 2016-06-02 -* Support for JSX files (@artemv) -* Fixed test suite, reduced test matrix (@tboerger) +* Support for JSX files (@artemv) +* Fixed test suite, reduced test matrix (@tboerger) ## [1.1.0](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.1.0) - 2016-06-02 -* Replace hyphens with underscores in locale var from DOM (@filib) +* Replace hyphens with underscores in locale var from DOM (@filib) ## [1.0.4](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.4) - 2016-05-31 -* Support ES2015 template strings (@bradbarrow) +* Support ES2015 template strings (@bradbarrow) ## [1.0.3](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.3) - 2015-11-03 -* Stop using bundler within the core lib (@domcleal) +* Stop using bundler within the core lib (@domcleal) ## [1.0.2](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.2) - 2015-03-30 -* Fixes exception when parsing empty js/coffee files (@tboerger) -* Avoid methods defined in rake task exposing globally (@tboerger) -* Added better configuration options (@tboerger) +* Fixes exception when parsing empty js/coffee files (@tboerger) +* Avoid methods defined in rake task exposing globally (@tboerger) +* Added better configuration options (@tboerger) ## [1.0.1](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.1) - 2015-02-24 -* Added missing javascripts to the gemspec (@tboerger) +* Added missing javascripts to the gemspec (@tboerger) ## [1.0.0](https://github.com/webhippie/gettext_i18n_rails_js/releases/tag/v1.0.0) - 2015-02-24 -* Transfer from github.com/nubis/gettext_i18n_rails_js (@tboerger) -* Added TravisCI, Rubocop and Coveralls (@tboerger) -* Updated structure to my opinionated gem style (@tboerger) -* Changed default handlebars function to ```__``` (@tboerger) -* Added extended ```gettext_i18n_rails_js.yml``` (@tboerger) +* Transfer from github.com/nubis/gettext_i18n_rails_js (@tboerger) +* Added TravisCI, Rubocop and Coveralls (@tboerger) +* Updated structure to my opinionated gem style (@tboerger) +* Changed default handlebars function to ```__``` (@tboerger) +* Added extended ```gettext_i18n_rails_js.yml``` (@tboerger) diff --git a/Gemfile b/Gemfile index 06ae5c7..da1bff1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/README.md b/README.md index 7206c3a..a04b971 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,9 @@ -# GettextI18nRailsJs +# gettext_i18n_rails_js -[![Gem Version](http://img.shields.io/gem/v/gettext_i18n_rails_js.svg)](https://rubygems.org/gems/gettext_i18n_rails_js) -[![Build Status](https://secure.travis-ci.org/webhippie/gettext_i18n_rails_js.svg)](https://travis-ci.org/webhippie/gettext_i18n_rails_js) -[![Code Climate](https://codeclimate.com/github/webhippie/gettext_i18n_rails_js.svg)](https://codeclimate.com/github/webhippie/gettext_i18n_rails_js) -[![Test Coverage](https://codeclimate.com/github/webhippie/gettext_i18n_rails_js/badges/coverage.svg)](https://codeclimate.com/github/webhippie/gettext_i18n_rails_js) -[![Dependency Status](https://gemnasium.com/webhippie/gettext_i18n_rails_js.svg)](https://gemnasium.com/webhippie/gettext_i18n_rails_js) +[![Test Status](https://github.com/webhippie/gettext_i18n_rails_js/actions/workflows/testing.yml/badge.svg)](https://github.com/webhippie/gettext_i18n_rails_js/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/51f241a0f0d7490cae0bdc04387f9d13)](https://www.codacy.com/gh/webhippie/gettext_i18n_rails_js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=webhippie/gettext_i18n_rails_js&utm_campaign=Badge_Grade) +[![Gem Version](https://badge.fury.io/rb/gettext_i18n_rails_js.svg)](https://badge.fury.io/rb/gettext_i18n_rails_js) Extends [gettext_i18n_rails](https://github.com/grosser/gettext_i18n_rails), making your .PO files available to client side javascript as JSON. It will find @@ -13,22 +12,10 @@ will create JSON versions of your .PO files so you can serve them with the rest of your assets, thus letting you access all your translations offline from client side javascript. - ## Versions -This gem is tested on the following versions, it's also possible that it works -with older versions, but because of version bumps at `gettext_i18n_rails` and -`fast_gettext` we have dropped the older versions from the testing matrix: - -* Ruby - * 2.1.0 - * 2.2.0 -* Rails - * 3.2.21 - * 4.0.13 - * 4.1.16 - * 4.2.7 - +For a list of the tested and supported Ruby and Rails versions please take a +look at the [wokflow][workflow]. ## Installation @@ -38,28 +25,24 @@ gem "gettext_i18n_rails_js", "~> 1.2" ## Versioning -This library aims to adhere to [Semantic Versioning 2.0.0][semver]. -Violations of this scheme should be reported as bugs. Specifically, -if a minor or patch version is released that breaks backward -compatibility, a new version should be immediately released that -restores compatibility. Breaking changes to the public API will -only be introduced with new major versions. +This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations +of this scheme should be reported as bugs. Specifically, if a minor or patch +version is released that breaks backward compatibility, a new version should be +immediately released that restores compatibility. Breaking changes to the public +API will only be introduced with new major versions. -As a result of this policy, you can (and should) specify a -dependency on this gem using the [Pessimistic Version Constraint][pvc] with two digits of precision. +As a result of this policy, you can (and should) specify a dependency on this +gem using the [Pessimistic Version Constraint][pvc] with two digits of precision. For example: ```ruby -spec.add_dependency 'gettext_i18n_rails_js', '~> 1.2' +spec.add_dependency "gettext_i18n_rails_js", "~> 1.2" ``` -[semver]: http://semver.org/ -[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint - ## Usage -set up you rails application with gettext support as usual, afterwards just +Set up you rails application with gettext support as usual, afterwards just execute the following rake task to export your translations to JSON: ```bash @@ -119,33 +102,32 @@ GettextI18nRailsJs.config do |config| end ``` - ## Todo -* More deep testing against multiple Rails versions -* Extend the current test suite, especially handlebars - +* More deep testing against multiple Rails versions +* Extend the current test suite, especially handlebars ## Contributing Fork -> Patch -> Spec -> Push -> Pull Request - ## Authors -* [Thomas Boerger](https://github.com/tboerger) -* [Nubis](https://github.com/nubis) -* [Other contributors](https://github.com/webhippie/gettext_i18n_rails_js/graphs/contributors) - +* [Thomas Boerger](https://github.com/tboerger) +* [Nubis](https://github.com/nubis) +* [Other contributors](https://github.com/webhippie/gettext_i18n_rails_js/graphs/contributors) ## License MIT - ## Copyright ``` Copyright (c) 2012-2015 Dropmysite.com Copyright (c) 2015 Webhippie ``` + +[workflow]: https://github.com/webhippie/gettext_i18n_rails_js/blob/master/.github/workflows/testing.yml +[semver]: http://semver.org +[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint diff --git a/Rakefile b/Rakefile index e3139e2..dd6f059 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/gettext_i18n_rails_js.gemspec b/gettext_i18n_rails_js.gemspec index 2fd4dd3..c4c92ce 100644 --- a/gettext_i18n_rails_js.gemspec +++ b/gettext_i18n_rails_js.gemspec @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie @@ -23,7 +24,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -$LOAD_PATH.push File.expand_path("../lib", __FILE__) +$LOAD_PATH.push File.expand_path("lib", __dir__) require "gettext_i18n_rails_js/version" Gem::Specification.new do |s| @@ -62,11 +63,11 @@ Gem::Specification.new do |s| s.add_development_dependency "bundler" s.add_development_dependency "rake" - s.add_development_dependency "yard" s.add_development_dependency "rspec" + s.add_development_dependency "yard" - s.add_dependency "rails", ">= 3.2.0" s.add_dependency "gettext", ">= 3.0.2" s.add_dependency "gettext_i18n_rails", ">= 0.7.1" s.add_dependency "po_to_json", ">= 1.0.0" + s.add_dependency "rails", ">= 3.2.0" end diff --git a/lib/gettext_i18n_rails_js.rb b/lib/gettext_i18n_rails_js.rb index d07fd0f..fe3f273 100644 --- a/lib/gettext_i18n_rails_js.rb +++ b/lib/gettext_i18n_rails_js.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/lib/gettext_i18n_rails_js/config.rb b/lib/gettext_i18n_rails_js/config.rb index e35e730..7456ce2 100644 --- a/lib/gettext_i18n_rails_js/config.rb +++ b/lib/gettext_i18n_rails_js/config.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie @@ -25,10 +26,10 @@ module GettextI18nRailsJs class Config - attr_accessor :output_path - attr_accessor :handlebars_function - attr_accessor :javascript_function - attr_accessor :jed_options + attr_accessor :output_path, + :handlebars_function, + :javascript_function, + :jed_options def initialize(&block) @output_path = defaults[:output_path] diff --git a/lib/gettext_i18n_rails_js/engine.rb b/lib/gettext_i18n_rails_js/engine.rb index 1656f64..fdd8cbb 100644 --- a/lib/gettext_i18n_rails_js/engine.rb +++ b/lib/gettext_i18n_rails_js/engine.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/lib/gettext_i18n_rails_js/parser.rb b/lib/gettext_i18n_rails_js/parser.rb index bb92949..dcacefe 100644 --- a/lib/gettext_i18n_rails_js/parser.rb +++ b/lib/gettext_i18n_rails_js/parser.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/lib/gettext_i18n_rails_js/parser/base.rb b/lib/gettext_i18n_rails_js/parser/base.rb index b7df35e..b88ff6f 100644 --- a/lib/gettext_i18n_rails_js/parser/base.rb +++ b/lib/gettext_i18n_rails_js/parser/base.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie @@ -36,7 +37,7 @@ module Base # conflicts with other javascript libraries. You only need to define # the base function name to replace "_" and all the other variants # (s_, n_, N_) will be deduced automatically. - attr_accessor :gettext_function + attr_writer :gettext_function def gettext_function @gettext_function ||= "__" @@ -79,6 +80,7 @@ def parse(file, _msgids = []) end.join(separator_for(function)) next if key == "" + results_for(key, file, line) end end diff --git a/lib/gettext_i18n_rails_js/parser/handlebars.rb b/lib/gettext_i18n_rails_js/parser/handlebars.rb index 851616c..74a56b2 100644 --- a/lib/gettext_i18n_rails_js/parser/handlebars.rb +++ b/lib/gettext_i18n_rails_js/parser/handlebars.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/lib/gettext_i18n_rails_js/parser/javascript.rb b/lib/gettext_i18n_rails_js/parser/javascript.rb index 98cbaec..77a3724 100644 --- a/lib/gettext_i18n_rails_js/parser/javascript.rb +++ b/lib/gettext_i18n_rails_js/parser/javascript.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie @@ -121,7 +122,7 @@ def arg_regex '(?:[^'\\]|\\.)*?'| "(?:[^"\\]|\\.)*?"| `(?:[^`\\]|\\.)*?`| - [a-zA-Z0-9_\.()]*? + [a-zA-Z0-9_.()]*? ) \s* /xm diff --git a/lib/gettext_i18n_rails_js/task.rb b/lib/gettext_i18n_rails_js/task.rb index ee631b0..3b5cb44 100644 --- a/lib/gettext_i18n_rails_js/task.rb +++ b/lib/gettext_i18n_rails_js/task.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/lib/gettext_i18n_rails_js/version.rb b/lib/gettext_i18n_rails_js/version.rb index be424fd..5504dd4 100644 --- a/lib/gettext_i18n_rails_js/version.rb +++ b/lib/gettext_i18n_rails_js/version.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie @@ -27,7 +28,7 @@ module GettextI18nRailsJs class Version MAJOR = 1 MINOR = 3 - PATCH = 0 + PATCH = 1 PRE = nil diff --git a/lib/tasks/gettext_i18n_rails_js_tasks.rake b/lib/tasks/gettext_i18n_rails_js_tasks.rake index 235f248..d09883e 100644 --- a/lib/tasks/gettext_i18n_rails_js_tasks.rake +++ b/lib/tasks/gettext_i18n_rails_js_tasks.rake @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/spec/gettext_i18n_rails_js/parser/handlebars_spec.rb b/spec/gettext_i18n_rails_js/parser/handlebars_spec.rb index 29df3f0..ff4b14a 100644 --- a/spec/gettext_i18n_rails_js/parser/handlebars_spec.rb +++ b/spec/gettext_i18n_rails_js/parser/handlebars_spec.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie @@ -150,6 +151,7 @@ # end # end + # rubocop:disable Style/TrailingCommaInArrayLiteral it "finds interpolated multi-line messages" do content = <<-EOF
{{{__ 'Hello, my name is John Doe @@ -166,6 +168,7 @@ ) end end + # rubocop:enable Style/TrailingCommaInArrayLiteral # with_file content do |path| # expect(parser.parse(path, [])).to( @@ -260,6 +263,7 @@ end end + # rubocop:disable Style/FormatStringToken it "does not parse options" do content = <<-EOF
@@ -277,6 +281,7 @@ ) end end + # rubocop:enable Style/FormatStringToken # it "does not parse internal functions" do # content = <<-EOF @@ -295,8 +300,8 @@ describe "parses handlebars files" do let(:example) do File.expand_path( - "../../../fixtures/example.handlebars", - __FILE__ + "../../fixtures/example.handlebars", + __dir__ ) end diff --git a/spec/gettext_i18n_rails_js/parser/javascript_spec.rb b/spec/gettext_i18n_rails_js/parser/javascript_spec.rb index d0d6643..d85a62c 100644 --- a/spec/gettext_i18n_rails_js/parser/javascript_spec.rb +++ b/spec/gettext_i18n_rails_js/parser/javascript_spec.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie @@ -294,8 +295,8 @@ describe "parses vue files" do let(:example) do File.expand_path( - "../../../fixtures/example.vue", - __FILE__ + "../../fixtures/example.vue", + __dir__ ) end @@ -339,8 +340,8 @@ describe "parses javascript files" do let(:example) do File.expand_path( - "../../../fixtures/example.js", - __FILE__ + "../../fixtures/example.js", + __dir__ ) end @@ -389,8 +390,8 @@ describe "parses coffee files" do let(:example) do File.expand_path( - "../../../fixtures/example.coffee", - __FILE__ + "../../fixtures/example.coffee", + __dir__ ) end diff --git a/spec/gettext_i18n_rails_js_spec.rb b/spec/gettext_i18n_rails_js_spec.rb index cb363e8..df52852 100644 --- a/spec/gettext_i18n_rails_js_spec.rb +++ b/spec/gettext_i18n_rails_js_spec.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 71d6e26..d2b5fe0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie @@ -23,17 +24,19 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -require "simplecov" -require "codeclimate-test-reporter" if ENV["CODECLIMATE_REPO_TOKEN"] - -SimpleCov.start do - add_filter "/spec" +if ENV.key? "CODACY_PROJECT_TOKEN" + begin + require "codacy-coverage" + Codacy::Reporter.start + rescue StandardError + puts "Failed to load codacy-coverage gem" + end end require "gettext_i18n_rails_js" require "rspec" -Dir[File.expand_path("../support/**/*.rb", __FILE__)].each do |file| +Dir[File.expand_path("support/**/*.rb", __dir__)].sort.each do |file| require file end diff --git a/spec/support/with_file.rb b/spec/support/with_file.rb index 120cbe6..e66b422 100644 --- a/spec/support/with_file.rb +++ b/spec/support/with_file.rb @@ -1,4 +1,5 @@ -# -*- coding: UTF-8 -*- +# frozen_string_literal: true + # # Copyright (c) 2012-2015 Dropmysite.com # Copyright (c) 2015 Webhippie