Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deface gem to latest version 1.8.1 #9

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6886ff5
Update deface gem to latest version 1.8.1
liaham May 28, 2021
e2e14a1
Down-grade deface version
liaham Jul 1, 2021
06a31a6
Update gitignore
liaham Oct 14, 2021
2c285ab
Merge branch 'update_gitignore' into develop
liaham Oct 14, 2021
8bee7b3
Merge branch 'master' of https://github.com/jbbarth/redmine_base_defa…
liaham Nov 26, 2022
5685e1d
Prepares for version 1.81-xmr-1
liaham Jan 3, 2023
436fa6b
Merge branch 'release-1.8.1-xmr-1' into develop
liaham Jan 5, 2023
e50ca55
Merge branch 'release-1.8.1-xmr-1'
liaham Jan 5, 2023
12cdea1
Updates .gitignore
liaham Apr 5, 2023
9f8af14
Merge branch 'master' of https://github.com/jbbarth/redmine_base_defa…
liaham Apr 5, 2023
bddc4d7
Change version to 1.8.1-xmr-2
liaham Apr 5, 2023
bf8f095
Merge branch 'release-1.8.1-xmr-2'
liaham Apr 5, 2023
4d003d4
Fixes a warning
liaham Aug 15, 2023
c9be1d7
Merge branch 'maintenance/fix-warning-you-no-longer-need-to-manually-…
liaham Aug 15, 2023
048702b
Bumps xmr version to 3
liaham Aug 15, 2023
fdafea0
Merge branch 'release-1.8.1-xmr-3'
liaham Sep 2, 2023
427fc1c
Fixes a warning
liaham Aug 15, 2023
1c09121
Bumps xmr version to 3
liaham Aug 15, 2023
390bdf1
Updates deface gem to 1.8.2
liaham Nov 11, 2023
26f6b1e
Updates github workflows
liaham Nov 11, 2023
913f857
Updates Gemfile
liaham Nov 11, 2023
3efa20a
Prepares release 1.8.2-xmr
liaham Nov 13, 2023
e790f36
Merge branch 'release-1.8.2-xmr' into develop
liaham Nov 13, 2023
8186a7e
Removes frozen string literal
liaham Nov 13, 2023
d5045de
Merge branch 'bug-fixing/rspec-tests' into develop
liaham Nov 13, 2023
7dadc59
Changes rspec test
liaham Nov 13, 2023
84dd355
Merge branch 'bug-fix/rspe-test-2' into develop
liaham Nov 13, 2023
8815be5
Merge branch 'develop'
liaham Nov 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/4_2_9.yml → .github/workflows/4_2_11.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Tests 4.2.9
name: Tests 4.2.11

env:
PLUGIN_NAME: redmine_base_deface
REDMINE_VERSION: 4.2.9
REDMINE_VERSION: 4.2.11
RAILS_ENV: test

on:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/5_0_4.yml → .github/workflows/5_0_6.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Tests 5.0.4
name: Tests 5.0.6

env:
PLUGIN_NAME: redmine_base_deface
REDMINE_VERSION: 5.0.4
REDMINE_VERSION: 5.0.6
RAILS_ENV: test

on:
Expand All @@ -16,7 +16,7 @@ jobs:

strategy:
matrix:
ruby: ['2.7']
ruby: ['3.1']
db: ['postgres']
fail-fast: false

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.history
.byebug_history
tmp
.ruby-lsp
46 changes: 46 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
AllCops:
NewCops: enable
DisplayCopNames: true
DisplayStyleGuide: true
TargetRubyVersion: 3.1

Exclude:
- '**/vendor/**/*'
- '**/tmp/**/*'
- '**/bin/**/*'
- '**/extra/**/*'
- '**/lib/generators/**/templates/*'
- '**/lib/tasks/**/*'
- '**/files/**/*'
- '**/test/**/*'
- '**/db/migrate/*'
- 'db/schema.rb'
- '**/*_patch.rb'

require:
- rubocop-performance
- rubocop-rails
- rubocop-minitest
- rubocop-rake

Style/FrozenStringLiteralComment:
Enabled: true
EnforcedStyle: always
Exclude:
- 'db/**/*.rb'
- 'Gemfile'
- 'Rakefile'

Metrics/AbcSize:
Exclude:
- 'test/**/*'

Metrics/MethodLength:
Exclude:
- 'test/**/*'

Layout/LineLength:
Max: 120

Style/Documentation:
Enabled: false
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Supports Rails 6
gem 'deface', '1.8.2'

# Supports Rails 5.2
# gem 'deface', '1.6.2'
Empty file modified LICENSE
100644 → 100755
Empty file.
3 changes: 0 additions & 3 deletions PluginGemfile

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Test status

|Plugin branch| Redmine Version | Test Status |
|-------------|-----------------|-------------------|
|master | 5.0.4 | [![5.0.4][1]][5] |
|master | 4.2.9 | [![4.2.9][2]][5] |
|master | 5.0.6 | [![5.0.6][1]][5] |
|master | 4.2.11 | [![4.2.11][2]][5] |
|master | master | [![master][4]][5] |

[1]: https://github.com/jbbarth/redmine_base_deface/actions/workflows/5_0_4.yml/badge.svg
[2]: https://github.com/jbbarth/redmine_base_deface/actions/workflows/4_2_9.yml/badge.svg
[1]: https://github.com/jbbarth/redmine_base_deface/actions/workflows/5_0_6.yml/badge.svg
[2]: https://github.com/jbbarth/redmine_base_deface/actions/workflows/4_2_11.yml/badge.svg
[4]: https://github.com/jbbarth/redmine_base_deface/actions/workflows/master.yml/badge.svg
[5]: https://github.com/jbbarth/redmine_base_deface/actions

Expand Down
Empty file modified app/overrides/README.txt
100644 → 100755
Empty file.
27 changes: 16 additions & 11 deletions init.rb
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# frozen_string_literal: true

Redmine::Plugin.register :redmine_base_deface do
name 'Redmine Base Deface plugin'
author 'Jean-Baptiste BARTH'
description 'This is a plugin for Redmine'
version '1.6.2'
version '1.8.2-xmr'
url 'https://github.com/jbbarth/redmine_base_deface'
author_url '[email protected]'
#doesn't work since redmine evaluates dependencies as it loads, and loads in lexical order
#TODO: see if it works in Redmine 2.6.x or 3.x when they're released
# doesn't work since redmine evaluates dependencies as it loads, and loads in lexical order
# TODO: see if it works in Redmine 2.6.x or 3.x when they're released
# requires_redmine_plugin :redmine_base_rspec, :version_or_higher => '0.0.3' if Rails.env.test?
end

Expand All @@ -15,21 +17,24 @@
# - deface doesn't support direct loading anymore ; it unloads everything at boot so that reload in dev works
# - hack consists in adding "app/overrides" path of all plugins in Redmine's main #paths
if Rails.version > '6.0'
Dir.glob("#{Rails.root}/plugins/*/app/overrides/**/*.rb").each do |path|
Rails.autoloaders.main.ignore(path)
load File.expand_path(path, __FILE__)
# Do not require overrides when deface has precompiled views
unless Rails.application.try(:config).try(:deface).try(:enabled) == false
Dir.glob(Rails.root.join('plugins/*/app/overrides/**/*.rb').to_s).each do |path|
Rails.autoloaders.main.ignore(path)
load File.expand_path(path, __FILE__)
end
end

Rails.application.config.after_initialize do
require_relative "lib/applicator_patch"
require_relative 'lib/applicator_patch'
end
else
Rails.application.paths["app/overrides"] ||= []
Dir.glob("#{Rails.root}/plugins/*/app/overrides").each do |dir|
Rails.application.paths["app/overrides"] << dir unless Rails.application.paths["app/overrides"].include?(dir)
Rails.application.paths['app/overrides'] ||= []
Dir.glob(Rails.root.join('plugins/*/app/overrides').to_s).each do |dir|
Rails.application.paths['app/overrides'] << dir unless Rails.application.paths['app/overrides'].include?(dir)
end

ActiveSupport::Reloader.to_prepare do
require_dependency "applicator_patch"
require_dependency 'applicator_patch'
end
end
15 changes: 8 additions & 7 deletions spec/models/applicator_patch_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,19 @@ def self.all

module Deface
describe Applicator do

# include_context "mock Rails.application"

before { Dummy.all.clear }

describe "source containing a javascript tag" do
before { Deface::Override.new(:virtual_path => "posts/index",
:name => "Posts#index",
:remove => "p") }
describe 'source containing a javascript tag' do
before do
Deface::Override.new(virtual_path: 'posts/index',
name: 'Posts#index',
remove: 'p')
end
let(:source) { "<%= javascript_tag do %>if (y > 0) {y = 0;}<% end %>" }
it "should return unmodified source" do
expect(Dummy.apply(source, { :virtual_path => "posts/index" })).to eq("<%= javascript_tag do %>if (y > 0) {y = 0;}<% end %>")
it 'should return unmodified source' do
expect(Dummy.apply(source, { virtual_path: 'posts/index' })).to eq("<%= javascript_tag do %>if (y > 0) {y = 0;}<% end %>")
end
end
end
Expand Down
15 changes: 9 additions & 6 deletions spec/models/deface_paths_spec.rb
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
require "spec_helper"
# frozen_string_literal: true

describe "DefacePaths" do
require 'spec_helper'

describe 'DefacePaths' do
if Rails.version < '6.0'
it "overrides app paths" do
overrides_paths = Rails.application.paths["app/overrides"]
this_plugin_paths = Rails.root.join("plugins/redmine_base_deface/app/overrides")
it 'overrides app paths' do
overrides_paths = Rails.application.paths['app/overrides']
this_plugin_paths = Rails.root.join('plugins/redmine_base_deface/app/overrides')
expect(overrides_paths).to include(this_plugin_paths.to_s),
"The init.rb of this very plugin should add every plugins' app/overrides to rails paths for app/overrides"
"The init.rb of this very plugin should add every plugins' app/overrides \
to rails paths for app/overrides"
end
end
end