diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f272b64..c7a8bfe 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,8 @@ on: pull_request: branches: - '*' + types: + - '*' jobs: test_sqlite: diff --git a/CHANGELOG.md b/CHANGELOG.md index aec5744..8aa52ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # CHANGELOG ### Unreleased - [View Diff](https://github.com/westonganger/rails_i18n_manager/compare/v1.0.0...master) +- [#12](https://github.com/westonganger/rails_i18n_manager/pull/12) - Fix for cleaning old tmp files created from the export_to method - [#11](https://github.com/westonganger/rails_i18n_manager/pull/11) - Fix google translate and add specs - [#10](https://github.com/westonganger/rails_i18n_manager/pull/10) - Add missing pagination links to index pages diff --git a/app/models/rails_i18n_manager/translation_key.rb b/app/models/rails_i18n_manager/translation_key.rb index 432f7ee..9350f9d 100644 --- a/app/models/rails_i18n_manager/translation_key.rb +++ b/app/models/rails_i18n_manager/translation_key.rb @@ -80,9 +80,8 @@ def self.export_to(app_name: nil, zip: false, format: :yaml) base_export_path = Rails.root.join("tmp/export/translations/") files_to_delete = Dir.glob("#{base_export_path}/*").each do |f| - if File.ctime(f) > 1.minutes.ago - `rm -rf #{f}` - #File.delete(f) + if File.ctime(f) < 1.minutes.ago + FileUtils.rm_r(f, force: true) end end diff --git a/spec/unit/models/translation_key_spec.rb b/spec/unit/models/translation_key_spec.rb index bea3da5..7ea2faa 100644 --- a/spec/unit/models/translation_key_spec.rb +++ b/spec/unit/models/translation_key_spec.rb @@ -106,6 +106,10 @@ module RailsI18nManager expect(files[1].end_with?("/fr.yml")).to eq(true) end + it "deletes old tmp files" do + fail "TODO" + end + context "yaml" do it "outputs content in yaml" do dirname = TranslationKey.export_to(app_name: nil, zip: false, format: "yaml")