foreman_expire_hosts 7.0.1 → 7.0.2

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
2
  SHA256:
3
- metadata.gz: 44247c83269ff2759c38b6c8ea6821f2b65bdf2558c4703eb4a89f6ccaa7ab83
4
- data.tar.gz: 110282faa293e518d45dca6661137039ea0e8eaa9a5cd038ee7b19536b8715fe
3
+ metadata.gz: f2f0094dacc9c70e393e1bf88b942e63e03d61ad43f9279dac3bc55dc8796d0f
4
+ data.tar.gz: f9768b9ad368199ed8b8d8965664788797cf59db5c0888cf4f846c324105d889
5
5
  SHA512:
6
- metadata.gz: e55938b35afdd0ad71696a0a6ed21b8f489934223edd98aac29820d6fce255a372a1372907b3ff489e70205b367e6569eaa7fbf40c6c3251294bd55d746eddc6
7
- data.tar.gz: 61dcac4a506ba4bf9379ce3270286636f0913c46c96c2bb8691b2b98db05494d1fdb1890daade056fa497198d22266482499c49ebdfc2c1f4bf375feace4f8ca
6
+ metadata.gz: e2093d7a71c66e85f18b2712e0bd9c39397d1f731e8cdd229a1b7e55805d97d7b751694760b2f4912b169e3110a6a9847bdff8a7d43595b6d7904f35100bd1b9
7
+ data.tar.gz: 6d24cb1a6fe7c1704680a95e06b90ebffeb8636e752e007a5bd8be48d5101fa5b25c169396ed61f7ff2320f77f46083115b78798626d371ed540fcaee632c143
@@ -0,0 +1,78 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+ env:
4
+ RAILS_ENV: test
5
+ DATABASE_URL: postgresql://postgres:@localhost/test
6
+ DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true
7
+ jobs:
8
+ rubocop:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - name: Setup Ruby
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.3
16
+ - name: Setup
17
+ run: |
18
+ gem install bundler
19
+ bundle install --jobs=3 --retry=3
20
+ - name: Run rubocop
21
+ run: bundle exec rubocop
22
+ test:
23
+ runs-on: ubuntu-latest
24
+ needs: rubocop
25
+ services:
26
+ postgres:
27
+ image: postgres:12.1
28
+ ports: ['5432:5432']
29
+ options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
30
+ strategy:
31
+ fail-fast: false
32
+ matrix:
33
+ foreman-core-branch: [1.24-stable, 2.0-stable, 2.1-stable, develop]
34
+ ruby-version: [2.3, 2.5, 2.6]
35
+ node-version: [10]
36
+ exclude:
37
+ - foreman-core-branch: 2.0-stable
38
+ ruby-version: 2.3
39
+ - foreman-core-branch: 2.1-stable
40
+ ruby-version: 2.3
41
+ - foreman-core-branch: develop
42
+ ruby-version: 2.3
43
+ steps:
44
+ - name: Install dependencies
45
+ run: |
46
+ sudo apt-get update
47
+ sudo apt-get install build-essential libcurl4-openssl-dev libvirt-dev ruby-libvirt zlib1g-dev libpq-dev
48
+ - uses: actions/checkout@v2
49
+ with:
50
+ repository: theforeman/foreman
51
+ ref: ${{ matrix.foreman-core-branch }}
52
+ - uses: actions/checkout@v2
53
+ with:
54
+ path: foreman_expire_hosts
55
+ - name: Setup Ruby
56
+ uses: ruby/setup-ruby@v1
57
+ with:
58
+ ruby-version: ${{ matrix.ruby-version }}
59
+ - name: Setup Node
60
+ uses: actions/setup-node@v1
61
+ with:
62
+ node-version: ${{ matrix.node-version }}
63
+ - name: Setup Plugin
64
+ run: |
65
+ echo "gem 'foreman_expire_hosts', path: './foreman_expire_hosts'" > bundler.d/foreman_expire_hosts.local.rb
66
+ gem install bundler
67
+ bundle config set without journald development console mysql2 sqlite
68
+ bundle install --jobs=3 --retry=3
69
+ bundle exec rake db:create
70
+ bundle exec rake db:migrate
71
+ npm install
72
+ bundle exec rake webpack:compile
73
+ - name: Run plugin tests
74
+ run: bundle exec rake test:foreman_expire_hosts
75
+ - name: Precompile plugin assets
76
+ run: bundle exec rake 'plugin:assets:precompile[foreman_expire_hosts]'
77
+ env:
78
+ RAILS_ENV: production
@@ -2,6 +2,7 @@ inherit_from:
2
2
  - .rubocop_todo.yml
3
3
 
4
4
  require:
5
+ - rubocop-minitest
5
6
  - rubocop-performance
6
7
  - rubocop-rails
7
8
 
@@ -6,6 +6,12 @@
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
+ Minitest/RefuteFalse:
10
+ Enabled: false
11
+
12
+ Minitest/AssertTruthy:
13
+ Enabled: false
14
+
9
15
  Style/HashEachMethods:
10
16
  Enabled: false
11
17
 
@@ -55,8 +55,13 @@ module ForemanExpireHosts
55
55
 
56
56
  def expiration_date
57
57
  @expiration_date ||= begin
58
- expiration_date_arr = params[:host].select { |k| k.start_with?('expired_on') }.values.map(&:to_i)
59
- Date.new(*expiration_date_arr.reverse) unless expiration_date_arr.all?(&:zero?)
58
+ year = params['host']['expired_on(1i)']
59
+ month = params['host']['expired_on(2i)']
60
+ day = params['host']['expired_on(3i)']
61
+
62
+ return if year.empty? && month.empty? && day.empty?
63
+
64
+ Date.parse("#{year}-#{month}-#{day}")
60
65
  end
61
66
  end
62
67
 
@@ -10,10 +10,10 @@ Gem::Specification.new do |s|
10
10
  s.authors = ['Nagarjuna Rachaneni', 'Timo Goebel']
11
11
  s.email = ['nn.nagarjuna@gmail.com', 'mail@timogoebel.name']
12
12
  s.summary = 'Foreman plugin for limiting host lifetime'
13
- s.description = <<-DESC
14
- A Foreman plugin that allows hosts to expire at a configurable date.
15
- Hosts will be shut down and automatically deleted after a grace period.
16
- DESC
13
+ s.description = <<~DESC
14
+ A Foreman plugin that allows hosts to expire at a configurable date.
15
+ Hosts will be shut down and automatically deleted after a grace period.
16
+ DESC
17
17
  s.homepage = 'https://github.com/theforeman/foreman_expire_hosts'
18
18
  s.licenses = ['GPL-3.0']
19
19
 
@@ -27,6 +27,7 @@ DESC
27
27
 
28
28
  s.add_development_dependency 'rdoc'
29
29
  s.add_development_dependency 'rubocop', '~> 0.80.0'
30
+ s.add_development_dependency 'rubocop-minitest', '~> 0.7.0'
30
31
  s.add_development_dependency 'rubocop-performance', '~> 1.5.2'
31
32
  s.add_development_dependency 'rubocop-rails', '~> 2.4.2'
32
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanExpireHosts
4
- VERSION = '7.0.1'
4
+ VERSION = '7.0.2'
5
5
  end
@@ -26,7 +26,7 @@ namespace :test do
26
26
  end
27
27
 
28
28
  namespace :foreman_expire_hosts do
29
- task :rubocop do
29
+ task :rubocop => :environment do
30
30
  begin
31
31
  require 'rubocop/rake_task'
32
32
  RuboCop::RakeTask.new(:rubocop_foreman_expire_hosts) do |task|
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_expire_hosts
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nagarjuna Rachaneni
8
8
  - Timo Goebel
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-03-16 00:00:00.000000000 Z
12
+ date: 2021-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: deface
@@ -53,6 +53,20 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 0.80.0
56
+ - !ruby/object:Gem::Dependency
57
+ name: rubocop-minitest
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: 0.7.0
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 0.7.0
56
70
  - !ruby/object:Gem::Dependency
57
71
  name: rubocop-performance
58
72
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +107,7 @@ extra_rdoc_files:
93
107
  - README.md
94
108
  - LICENSE
95
109
  files:
110
+ - ".github/workflows/ci.yml"
96
111
  - ".gitignore"
97
112
  - ".rubocop.yml"
98
113
  - ".rubocop_todo.yml"
@@ -161,7 +176,7 @@ homepage: https://github.com/theforeman/foreman_expire_hosts
161
176
  licenses:
162
177
  - GPL-3.0
163
178
  metadata: {}
164
- post_install_message:
179
+ post_install_message:
165
180
  rdoc_options: []
166
181
  require_paths:
167
182
  - lib
@@ -176,9 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
191
  - !ruby/object:Gem::Version
177
192
  version: '0'
178
193
  requirements: []
179
- rubyforge_project:
180
- rubygems_version: 2.7.6.2
181
- signing_key:
194
+ rubygems_version: 3.1.2
195
+ signing_key:
182
196
  specification_version: 4
183
197
  summary: Foreman plugin for limiting host lifetime
184
198
  test_files: