foreman_custom_tab 1.0.0 → 2.0.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: 04a6a8a818805a5a392e5cf8a232482e092c9cd1
4
- data.tar.gz: 7ba39a0f5c1b868e72f3c690948b2b4c3eab5e9b
2
+ SHA256:
3
+ metadata.gz: fab57529be3fc7afdc27762df54dce297ee7a05de2dbe7442d6928f2c0f46430
4
+ data.tar.gz: 89cbbe7c14ac0131f2c94b03f5bfcc46b37f4655e7416804276b3ab4be8a7b0b
5
5
  SHA512:
6
- metadata.gz: f52a21a02c9798328c24b8d0d61c4b5ea055cc726abf9c5eb679c91e54a32d08a2daaca80b0260f963054edcff53a858c7fee1e221238fe20c97d3304e97c595
7
- data.tar.gz: 619e017d8a128e696ba5b9b85f4c35607258180a346074701ad42489ba9d4d2f107c3361e0ead407f582ac5592f8d3bf51d1cc1e6349ffe3ecc0f4f32aa12c3f
6
+ metadata.gz: ee289ad795f603726360ceec9f617b724dfcac053189206e33b61aa38288083b4402a211d5e64262e114903acbe6dc9cbd4f9d6088bd7ab5ddc80866fb5840b6
7
+ data.tar.gz: 9c15dc80e341818d98740c7b0b9c3a4b5d4a18a3206b187808359c7e7088d93388fbc6f2fac346361b765bbf5e1384d533a0f7891951d26b523efa51b6e8a8b5
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
@@ -38,7 +38,7 @@ task default: :test
38
38
  begin
39
39
  require 'rubocop/rake_task'
40
40
  RuboCop::RakeTask.new
41
- rescue StandardError => _
41
+ rescue StandardError => _e
42
42
  puts 'Rubocop not loaded.'
43
43
  end
44
44
 
@@ -8,8 +8,8 @@ module ForemanCustomTab
8
8
  # it'll override the default find_resource filter.
9
9
  find_resource
10
10
  render :partial => 'foreman_custom_tab/hosts/custom_tab', :locals => { :host => @host }
11
- rescue ActionView::Template::Error => exception
12
- process_ajax_error exception, 'fetch custom tab information'
11
+ rescue ActionView::Template::Error => e
12
+ process_ajax_error e, 'fetch custom tab information'
13
13
  end
14
14
 
15
15
  private
@@ -1,7 +1,7 @@
1
1
  if SETTINGS[:custom_tab]
2
2
  Deface::Override.new(:virtual_path => 'hosts/show',
3
3
  :name => 'custom_tab_add_tab',
4
- :insert_bottom => 'ul#myTab',
4
+ :insert_bottom => 'ul#host-show-tabs',
5
5
  :text =>
6
6
  "<li><a href='#custom_tab' data-toggle='tab'><%= _(custom_tab_title) %></a></li>")
7
7
  end
@@ -1,7 +1,7 @@
1
1
  if SETTINGS[:custom_tab]
2
2
  Deface::Override.new(:virtual_path => 'hosts/show',
3
3
  :name => 'custom_tab_add_tab_link',
4
- :insert_bottom => 'div#myTabContent',
4
+ :insert_bottom => 'div#host-show-tabs-content',
5
5
  :text =>
6
6
  "\n <div id='custom_tab' class='tab-pane'
7
7
  data-ajax-url='<%= custom_tab_host_path(@host)%>' data-on-complete='onContentLoad'>
File without changes
@@ -1,5 +1,5 @@
1
1
  Rails.application.routes.draw do
2
- constraints(:id => %r{[^\/]+}) do
2
+ constraints(:id => %r{[^/]+}) do
3
3
  resources :hosts do
4
4
  member do
5
5
  get 'custom_tab'
File without changes
@@ -17,7 +17,7 @@ module ForemanCustomTab
17
17
  # http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Adding-permission
18
18
  initializer('foreman_custom_tab.register_plugin', :before => :finisher_hook) do
19
19
  Foreman::Plugin.register :foreman_custom_tab do
20
- requires_foreman '>= 1.7'
20
+ requires_foreman '>= 2.3'
21
21
 
22
22
  security_block :foreman_custom_tab do
23
23
  permission :view_custom_tab,
@@ -31,13 +31,10 @@ module ForemanCustomTab
31
31
  # Include concerns in this config.to_prepare block
32
32
  # http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Extending-a-Controller
33
33
  config.to_prepare do
34
- begin
35
- HostsHelper.send(:include, ForemanCustomTab::HostsHelperExtensions)
36
- ::HostsController.send(:include,
37
- ForemanCustomTab::HostsControllerExtensions)
38
- rescue StandardError => e
39
- Rails.logger.warn "ForemanCustomTab: skipping engine hook (#{e})"
40
- end
34
+ HostsHelper.include ForemanCustomTab::HostsHelperExtensions
35
+ ::HostsController.include ForemanCustomTab::HostsControllerExtensions
36
+ rescue StandardError => e
37
+ Rails.logger.warn "ForemanCustomTab: skipping engine hook (#{e})"
41
38
  end
42
39
 
43
40
  initializer 'foreman_custom_tab.register_gettext', after: :load_config_initializers do |_app|
@@ -1,3 +1,3 @@
1
1
  module ForemanCustomTab
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -11,7 +11,7 @@ namespace :test do
11
11
  end
12
12
 
13
13
  namespace :foreman_custom_tab do
14
- task :rubocop do
14
+ task rubocop: :environment do
15
15
  begin
16
16
  require 'rubocop/rake_task'
17
17
  RuboCop::RakeTask.new(:rubocop_foreman_custom_tab) do |task|
File without changes
File without changes
File without changes
File without changes
@@ -4,24 +4,24 @@ class HostsControllerTest < ActionController::TestCase
4
4
  let(:os) { FactoryBot.create(:operatingsystem, name: 'CentOS', major: '7', type: 'Redhat') }
5
5
  let(:arch) { FactoryBot.create(:architecture) }
6
6
  let(:host_id) { 'foreman.example.com' }
7
- # rubocop:disable Metrics/LineLength
7
+ # rubocop:disable Layout/LineLength
8
8
  let(:host) { FactoryBot.create(:host, id: host_id, mac: '00:00:00:00:00:00', ip: '127.0.0.1', operatingsystem: os, arch: arch) }
9
- # rubocop:enable Metrics/LineLength
9
+ # rubocop:enable Layout/LineLength
10
10
  let(:custom_tab_title) { SETTINGS[:custom_tab][:title] }
11
11
 
12
- # rubocop:disable Metrics/LineLength, Style/StringLiterals, HttpPositionalArguments
12
+ # rubocop:disable Layout/LineLength, Style/StringLiterals, Rails/HttpPositionalArguments
13
13
  test 'GET hosts/:id displays tabs' do
14
14
  get :show, { :id => host.id }, set_session_user
15
15
  assert_includes response.headers['Content-Type'], 'text/html'
16
16
  assert_equal response.status, 200
17
- assert_includes response.body, "ul id=\"myTab\""
17
+ assert_includes response.body, "ul id=\"host-show-tabs\""
18
18
  end
19
19
 
20
20
  test "host overview displays tabs 'Properties', 'Metrics', 'NICs'" do
21
21
  get :show, { :id => host.id }, set_session_user
22
22
  assert_includes response.headers['Content-Type'], 'text/html'
23
23
  assert_equal response.status, 200
24
- assert_includes response.body, "<ul id=\"myTab\""
24
+ assert_includes response.body, "<ul id=\"host-show-tabs\""
25
25
  assert_includes response.body, "<li class=\"active\"><a href=\"#properties\" data-toggle=\"tab\">Properties</a></li>"
26
26
  assert_includes response.body, "<li><a href=\"#metrics\" data-toggle=\"tab\">Metrics</a></li>"
27
27
  assert_includes response.body, "<li><a href=\"#nics\" data-toggle=\"tab\">NICs</a></li>"
@@ -30,7 +30,7 @@ class HostsControllerTest < ActionController::TestCase
30
30
  test "host overview displays the Custom Tab" do
31
31
  get :show, { :id => host.id }, set_session_user
32
32
  assert_includes response.headers['Content-Type'], 'text/html'
33
- assert_includes response.body, "<ul id=\"myTab\""
33
+ assert_includes response.body, "<ul id=\"host-show-tabs\""
34
34
  assert_equal response.status, 200
35
35
  assert_includes response.body, "<li><a href=\"#custom_tab\" data-toggle=\"tab\">#{custom_tab_title}</a></li>"
36
36
  end
@@ -40,7 +40,7 @@ class HostsControllerTest < ActionController::TestCase
40
40
 
41
41
  assert_equal response.status, 200
42
42
  assert_includes response.headers['Content-Type'], 'text/html'
43
- assert_includes response.body, "<ul id=\"myTab\""
43
+ assert_includes response.body, "<ul id=\"host-show-tabs\""
44
44
  assert_includes response.body, "<li><a href=\"#custom_tab\" data-toggle=\"tab\">#{custom_tab_title}</a></li>"
45
45
  assert_includes response.body, "<div id=\"custom_tab\" class=\"tab-pane\" data-ajax-url=\"/hosts/#{host.name}/custom_tab\" data-on-complete=\"onContentLoad\">"
46
46
  end
@@ -70,5 +70,5 @@ class HostsControllerTest < ActionController::TestCase
70
70
  end
71
71
  end
72
72
  end
73
- # rubocop:enable Metrics/LineLength, Style/StringLiterals, HttpPositionalArguments
73
+ # rubocop:enable Layout/LineLength, Style/StringLiterals, Rails/HttpPositionalArguments
74
74
  end
@@ -5,9 +5,9 @@ class HostsHelperExtensionsTest < ActiveSupport::TestCase
5
5
 
6
6
  let(:os) { FactoryBot.create(:operatingsystem, name: 'CentOS', major: '7', type: 'Redhat') }
7
7
  let(:arch) { FactoryBot.create(:architecture) }
8
- # rubocop:disable Metrics/LineLength
8
+ # rubocop:disable Layout/LineLength
9
9
  let(:host) { FactoryBot.create(:host, id: 'foreman.example.com', mac: '00:00:00:00:00:00', ip: '127.0.0.1', operatingsystem: os, arch: arch) }
10
- # rubocop:enable Metrics/LineLength
10
+ # rubocop:enable Layout/LineLength
11
11
  let(:expected_fields) do
12
12
  fields = []
13
13
  SETTINGS[:custom_tab][:fields].each do |title, host_attr|
File without changes
File without changes
@@ -3,20 +3,20 @@ require 'test_plugin_helper'
3
3
  class CustomTabTest < ActionView::TestCase
4
4
  let(:os) { FactoryBot.create(:operatingsystem, name: 'CentOS', major: '7', type: 'Redhat') }
5
5
  let(:arch) { FactoryBot.create(:architecture) }
6
- # rubocop:disable Metrics/LineLength
6
+ # rubocop:disable Layout/LineLength
7
7
  let(:host) { FactoryBot.create(:host, id: 'foreman.example.com', mac: '00:00:00:00:00:00', ip: '127.0.0.1', operatingsystem: os, arch: arch) }
8
- # rubocop:enable Metrics/LineLength
8
+ # rubocop:enable Layout/LineLength
9
9
  let(:custom_tab_title) { SETTINGS[:custom_tab][:title] }
10
10
 
11
- class FakeHostsController < ActionController::Base
11
+ class FakeHostsController < ApplicationController
12
12
  include ForemanCustomTab::HostsHelperExtensions
13
13
  include LayoutHelper
14
14
 
15
15
  def index
16
16
  os = FactoryBot.create(:operatingsystem, name: 'CentOS', major: '7', type: 'Redhat')
17
- # rubocop:disable Metrics/LineLength
17
+ # rubocop:disable Layout/LineLength
18
18
  @host = FactoryBot.create(:host, id: 'foreman.example.com', mac: '00:00:00:00:00:00', ip: '127.0.0.1', operatingsystem: os, arch: FactoryBot.create(:architecture))
19
- # rubocop:enable Metrics/LineLength
19
+ # rubocop:enable Layout/LineLength
20
20
  render :partial => 'foreman_custom_tab/hosts/custom_tab', :locals => { :host => @host }
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_custom_tab
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Stannard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-19 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: deface
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Foreman Plugin that makes a new tab with different fields depending on
42
56
  the settings file
43
57
  email:
@@ -81,7 +95,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
95
  requirements:
82
96
  - - ">="
83
97
  - !ruby/object:Gem::Version
84
- version: '0'
98
+ version: 2.5.0
85
99
  required_rubygems_version: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - ">="
@@ -89,13 +103,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
103
  version: '0'
90
104
  requirements: []
91
105
  rubyforge_project:
92
- rubygems_version: 2.6.11
106
+ rubygems_version: 2.7.6
93
107
  signing_key:
94
108
  specification_version: 4
95
109
  summary: Creates custom tab for hosts in Foreman
96
110
  test_files:
97
- - test/test_plugin_helper.rb
98
111
  - test/functional/concerns/hosts_controller_extensions_test.rb
112
+ - test/helpers/concerns/foreman_custom_tab/hosts_helper_extensions_test.rb
113
+ - test/test_plugin_helper.rb
99
114
  - test/unit/foreman_custom_tab_test.rb
100
115
  - test/views/foreman_custom_tab/hosts/_custom_tab_test.rb
101
- - test/helpers/concerns/foreman_custom_tab/hosts_helper_extensions_test.rb