diff --git a/.ruby-version b/.ruby-version index 7bde84d0..c877459a 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.1.2 +ruby-3.1.3 diff --git a/.tool-versions b/.tool-versions index 7e402d08..520a1687 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -ruby 2.5.3 +ruby 3.1.3 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 35ca81b3..00000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: ruby -dist: focal -rvm: 2.5.8 - -cache: - bundler: true - -before_install: - - yes | gem update --system --force - - gem install bundler - -install: - - bundle install - - cp config/hdm.yml.template config/hdm.yml diff --git a/Dockerfile b/Dockerfile index e082d192..6acc9d06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,32 +1,33 @@ -FROM ruby:3.1.2-alpine +FROM ruby:3.1.3-slim-bullseye -RUN apk add --update --no-cache \ - binutils-gold \ - build-base \ +RUN apt update && apt install -y \ g++ \ gcc \ - libstdc++ \ + make \ + libstdc++-10-dev \ libffi-dev \ libc-dev \ libxml2-dev \ libxslt-dev \ libgcrypt-dev \ - make \ - sqlite \ - sqlite-dev \ + libsqlite3-dev \ + sqlite3 \ # not needed for gems, but for runtime git \ - tzdata - -# RUN gem install bundler -v 2.3.11 + tzdata \ + && rm -rf /var/lib/apt/lists/* ENV APP_HOME /hdm +ENV RAILS_ENV production +ENV RAILS_SERVE_STATIC_FILES true +ENV RAILS_LOG_TO_STDOUT true + WORKDIR $APP_HOME COPY . $APP_HOME COPY config/hdm.yml.template $APP_HOME/config/hdm.yml -RUN bundle check || (bundle config set --local without 'test' && bundle install) +RUN bundle check || (bundle config set --local without 'development test' && bundle install) EXPOSE 3000 diff --git a/Gemfile b/Gemfile index 5f13cedc..b9566ec7 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,14 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.1.2' +ruby '3.1.3' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 7.0.0' # Use sqlite3 as the database for Active Record -gem 'sqlite3', '~> 1.4' +gem 'sqlite3', '~> 1.5' # Use Puma as the app server -gem 'puma', '~> 5.6' +gem 'puma', '~> 6.0' # Asset handling gem 'sprockets-rails' @@ -20,23 +20,17 @@ gem 'bootstrap', '~> 4.6.0' gem 'bootstrap-icons-helper' gem 'jquery-rails' -# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -# gem 'jbuilder', '~> 2.7' # Use Redis adapter to run Action Cable in production -gem 'redis', '~> 4.0' +gem 'redis', '~> 5.0' # Use Active Model has_secure_password gem 'bcrypt', '~> 3.1.7' gem 'faker' -gem 'friendly_id', '~> 5.4.0' +gem 'friendly_id', '~> 5.5.0' gem 'puppet' gem 'puppetdb-ruby', require: 'puppetdb' gem 'hiera-eyaml' gem 'net-ldap', require: "net/ldap" - -# Use Active Storage variant -# gem 'image_processing', '~> 1.2' - gem 'breadcrumbs_on_rails' gem 'cancancan' @@ -50,9 +44,10 @@ end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 3.3.0' - gem 'listen', '~> 3.2' end +gem 'listen', '~> 3.2' # need for rake to precompile assets + group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 2.15' @@ -67,13 +62,15 @@ group :linter do gem 'rubocop-rake' end +group :release do + gem 'github_changelog_generator', '>= 1.16.1', :require => false +end + # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] -# Professional version only gems gem 'git' gem 'gitable', require: "gitable/uri" # dependencies & sec fixes -# gem "nokogiri", ">= 1.13.2" # needs ruby >= 2.6.0 gem 'mini_racer' # minimal Google V8 JS engine for execjs diff --git a/Gemfile.lock b/Gemfile.lock index 773012aa..a3fd12ab 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,81 +2,100 @@ GEM remote: https://rubygems.org/ specs: CFPropertyList (2.3.6) - actioncable (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) + actioncable (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.3.1) - actionpack (= 7.0.3.1) - activejob (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionmailbox (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.3.1) - actionpack (= 7.0.3.1) - actionview (= 7.0.3.1) - activejob (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionmailer (7.0.4) + actionpack (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activesupport (= 7.0.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.3.1) - actionview (= 7.0.3.1) - activesupport (= 7.0.3.1) + actionpack (7.0.4) + actionview (= 7.0.4) + activesupport (= 7.0.4) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.3.1) - actionpack (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + actiontext (7.0.4) + actionpack (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.3.1) - activesupport (= 7.0.3.1) + actionview (7.0.4) + activesupport (= 7.0.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.3.1) - activesupport (= 7.0.3.1) + activejob (7.0.4) + activesupport (= 7.0.4) globalid (>= 0.3.6) - activemodel (7.0.3.1) - activesupport (= 7.0.3.1) - activerecord (7.0.3.1) - activemodel (= 7.0.3.1) - activesupport (= 7.0.3.1) - activestorage (7.0.3.1) - actionpack (= 7.0.3.1) - activejob (= 7.0.3.1) - activerecord (= 7.0.3.1) - activesupport (= 7.0.3.1) + activemodel (7.0.4) + activesupport (= 7.0.4) + activerecord (7.0.4) + activemodel (= 7.0.4) + activesupport (= 7.0.4) + activestorage (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activesupport (= 7.0.4) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.3.1) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - autoprefixer-rails (10.4.2.0) + async (2.3.1) + console (~> 1.10) + io-event (~> 1.1) + timers (~> 4.1) + async-http (0.59.5) + async (>= 1.25) + async-io (>= 1.28) + async-pool (>= 0.2) + protocol-http (~> 0.23) + protocol-http1 (~> 0.14.0) + protocol-http2 (~> 0.14.0) + traces (>= 0.8.0) + async-http-faraday (0.11.0) + async-http (~> 0.42) + faraday + async-io (1.34.3) + async + async-pool (0.3.12) + async (>= 1.25) + autoprefixer-rails (10.4.7.0) execjs (~> 2) - bcrypt (3.1.17) + bcrypt (3.1.18) bindex (0.8.1) - bootstrap (4.6.1) + bootstrap (4.6.2) autoprefixer-rails (>= 9.1.0) - popper_js (>= 1.14.3, < 2) + popper_js (>= 1.16.1, < 2) sassc-rails (>= 2.0.0) bootstrap-icons (1.0.12) nokogiri (~> 1) @@ -87,8 +106,8 @@ GEM railties (>= 5.0) builder (3.2.4) byebug (11.1.3) - cancancan (3.3.0) - capybara (3.36.0) + cancancan (3.4.0) + capybara (3.38.0) addressable matrix mini_mime (>= 0.1.3) @@ -99,15 +118,17 @@ GEM xpath (~> 3.2) childprocess (4.1.0) concurrent-ruby (1.1.10) + connection_pool (2.3.0) + console (1.16.2) + fiber-local crass (1.0.6) - dartsass-rails (0.3.0) + dartsass-rails (0.4.0) railties (>= 6.0.0) deep_merge (1.2.2) - digest (3.1.0) docile (1.4.0) erubi (1.11.0) execjs (2.8.1) - facter (4.2.9) + facter (4.2.13) hocon (~> 1.3) thor (>= 1.0.1, < 2.0) factory_bot (6.2.1) @@ -115,21 +136,37 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faker (2.20.0) + faker (3.0.0) i18n (>= 1.8.11, < 2) + faraday (2.7.4) + faraday-net_http (>= 2.0, < 3.1) + ruby2_keywords (>= 0.0.4) + faraday-http-cache (2.4.1) + faraday (>= 0.8) + faraday-net_http (3.0.2) fast_gettext (2.2.0) ffi (1.15.5) - friendly_id (5.4.2) + fiber-local (1.0.0) + friendly_id (5.5.0) activerecord (>= 4.0.0) git (1.13.0) addressable (~> 2.8) rchardet (~> 1.8) gitable (0.4.0) addressable (~> 2.2, >= 2.2.7) + github_changelog_generator (1.16.4) + activesupport + async (>= 1.25.0) + async-http-faraday + faraday-http-cache + multi_json + octokit (~> 4.6) + rainbow (>= 2.2.1) + rake (>= 10.0) globalid (1.0.1) activesupport (>= 5.0) - hiera (3.9.0) - hiera-eyaml (3.2.2) + hiera (3.10.0) + hiera-eyaml (3.3.0) highline optimist highline (2.0.3) @@ -139,13 +176,15 @@ GEM multi_xml (>= 0.5.2) i18n (1.12.0) concurrent-ruby (~> 1.0) - importmap-rails (1.0.3) + importmap-rails (1.1.5) actionpack (>= 6.0.0) railties (>= 6.0.0) - jquery-rails (4.4.0) + io-event (1.1.6) + jquery-rails (4.5.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) + json (2.6.2) libv8-node (16.10.0.0) libv8-node (16.10.0.0-x86_64-darwin) libv8-node (16.10.0.0-x86_64-linux) @@ -163,26 +202,20 @@ GEM method_source (1.0.0) mini_mime (1.1.2) mini_portile2 (2.8.0) - mini_racer (0.6.2) + mini_racer (0.6.3) libv8-node (~> 16.10.0.0) minitest (5.17.0) multi_json (1.15.0) multi_xml (0.6.0) - net-imap (0.2.3) - digest + net-imap (0.3.1) net-protocol - strscan - net-ldap (0.17.0) - net-pop (0.1.1) - digest + net-ldap (0.17.1) + net-pop (0.1.2) net-protocol - timeout net-protocol (0.1.3) timeout - net-smtp (0.3.1) - digest + net-smtp (0.3.3) net-protocol - timeout nio4r (2.5.8) nokogiri (1.13.10) mini_portile2 (~> 2.8.0) @@ -191,15 +224,25 @@ GEM racc (~> 1.4) nokogiri (1.13.10-x86_64-linux) racc (~> 1.4) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) optimist (3.0.1) parallel (1.22.1) - parser (3.1.2.0) + parser (3.1.2.1) ast (~> 2.4.1) - popper_js (1.16.0) - public_suffix (4.0.7) - puma (5.6.4) + popper_js (1.16.1) + protocol-hpack (1.4.2) + protocol-http (0.24.0) + protocol-http1 (0.14.6) + protocol-http (~> 0.22) + protocol-http2 (0.14.2) + protocol-hpack (~> 1.4) + protocol-http (~> 0.18) + public_suffix (5.0.0) + puma (6.0.0) nio4r (~> 2.0) - puppet (7.16.0) + puppet (7.20.0) concurrent-ruby (~> 1.0) deep_merge (~> 1.0) facter (> 2.0.1, < 5) @@ -210,7 +253,7 @@ GEM puppet-resource_api (~> 1.5) scanf (~> 1.0) semantic_puppet (~> 1.0) - puppet (7.16.0-universal-darwin) + puppet (7.20.0-universal-darwin) CFPropertyList (~> 2.2) concurrent-ruby (~> 1.0) deep_merge (~> 1.0) @@ -230,59 +273,64 @@ GEM rack (2.2.6.2) rack-test (2.0.2) rack (>= 1.3) - rails (7.0.3.1) - actioncable (= 7.0.3.1) - actionmailbox (= 7.0.3.1) - actionmailer (= 7.0.3.1) - actionpack (= 7.0.3.1) - actiontext (= 7.0.3.1) - actionview (= 7.0.3.1) - activejob (= 7.0.3.1) - activemodel (= 7.0.3.1) - activerecord (= 7.0.3.1) - activestorage (= 7.0.3.1) - activesupport (= 7.0.3.1) + rails (7.0.4) + actioncable (= 7.0.4) + actionmailbox (= 7.0.4) + actionmailer (= 7.0.4) + actionpack (= 7.0.4) + actiontext (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activemodel (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) bundler (>= 1.15.0) - railties (= 7.0.3.1) + railties (= 7.0.4) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.4.4) loofah (~> 2.19, >= 2.19.1) - railties (7.0.3.1) - actionpack (= 7.0.3.1) - activesupport (= 7.0.3.1) + railties (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) - rb-fsevent (0.11.1) + rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) rchardet (1.8.0) - redis (4.6.0) - regexp_parser (2.3.1) + redis (5.0.5) + redis-client (>= 0.9.0) + redis-client (0.11.2) + connection_pool + regexp_parser (2.6.1) rexml (3.2.5) - rubocop (1.28.2) + rubocop (1.39.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.1.0.0) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.17.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.23.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.17.0) + rubocop-ast (1.23.0) parser (>= 3.1.1.0) - rubocop-rails (2.14.2) + rubocop-rails (2.17.3) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) + rubocop (>= 1.33.0, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) ruby-progressbar (1.11.0) + ruby2_keywords (0.0.5) rubyzip (2.3.2) sassc (2.4.0) ffi (~> 1.9) @@ -292,11 +340,15 @@ GEM sprockets (> 3.0) sprockets-rails tilt + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) scanf (1.0.0) - selenium-webdriver (4.1.0) + selenium-webdriver (4.6.1) childprocess (>= 0.5, < 5.0) rexml (~> 3.2, >= 3.2.5) - rubyzip (>= 1.2.2) + rubyzip (>= 1.2.2, < 3.0) + websocket (~> 1.0) semantic_puppet (1.0.4) simplecov (0.21.2) docile (~> 1.1) @@ -304,41 +356,47 @@ GEM simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) simplecov_json_formatter (0.1.4) - sprockets (4.0.3) + sprockets (4.1.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - sqlite3 (1.4.2) - stimulus-rails (1.0.4) + sqlite3 (1.5.4) + mini_portile2 (~> 2.8.0) + sqlite3 (1.5.4-x86_64-darwin) + sqlite3 (1.5.4-x86_64-linux) + stimulus-rails (1.1.1) railties (>= 6.0.0) - strscan (3.0.4) thor (1.2.1) - tilt (2.0.10) + tilt (2.0.11) timeout (0.3.0) - turbo-rails (1.0.1) + timers (4.3.5) + traces (0.8.0) + turbo-rails (1.3.2) actionpack (>= 6.0.0) + activejob (>= 6.0.0) railties (>= 6.0.0) tzinfo (2.0.5) concurrent-ruby (~> 1.0) - unicode-display_width (2.1.0) + unicode-display_width (2.3.0) web-console (4.2.0) actionview (>= 6.0.0) activemodel (>= 6.0.0) bindex (>= 0.4.0) railties (>= 6.0.0) - webdrivers (5.0.0) + webdrivers (5.2.0) nokogiri (~> 1.6) rubyzip (>= 1.3.0) selenium-webdriver (~> 4.0) + websocket (1.2.9) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.0) + zeitwerk (2.6.6) PLATFORMS ruby @@ -356,27 +414,28 @@ DEPENDENCIES dartsass-rails factory_bot_rails faker - friendly_id (~> 5.4.0) + friendly_id (~> 5.5.0) git gitable + github_changelog_generator (>= 1.16.1) hiera-eyaml importmap-rails jquery-rails listen (~> 3.2) mini_racer net-ldap - puma (~> 5.6) + puma (~> 6.0) puppet puppetdb-ruby rails (~> 7.0.0) - redis (~> 4.0) + redis (~> 5.0) rubocop rubocop-rails rubocop-rake selenium-webdriver simplecov sprockets-rails - sqlite3 (~> 1.4) + sqlite3 (~> 1.5) stimulus-rails turbo-rails tzinfo-data @@ -384,7 +443,7 @@ DEPENDENCIES webdrivers RUBY VERSION - ruby 3.1.2p20 + ruby 3.1.3p185 BUNDLED WITH - 2.3.11 + 2.3.7 diff --git a/Rakefile b/Rakefile index 10249c3c..6a87560a 100644 --- a/Rakefile +++ b/Rakefile @@ -16,3 +16,27 @@ if File.file?('config/hdm.yml') else puts "Not loading Rails specific tasks because config/hdm.yml is missing!" end + +begin + require 'github_changelog_generator/task' + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'betadots' + config.project = 'hdm' + end + + # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /linux/ + task :changelog do + puts 'Fixing line endings...' + changelog_file = File.join(__dir__, 'CHANGELOG.md') + changelog_txt = File.read(changelog_file) + new_contents = changelog_txt.gsub(%r{\r\n}, "\n") + File.open(changelog_file, "w") {|file| file.puts new_contents } + end + end + +rescue LoadError +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e3942624..2d01b2db 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -46,6 +46,6 @@ def display_error_page(error) end def access_denied - render file: Rails.root.join("public/403.html"), status: :forbidden, layout: false + render file: Rails.public_path.join('403.html'), status: :forbidden, layout: false end end diff --git a/app/controllers/groups_controller.rb b/app/controllers/groups_controller.rb index 1ea837a9..4aa44057 100644 --- a/app/controllers/groups_controller.rb +++ b/app/controllers/groups_controller.rb @@ -18,6 +18,12 @@ def new @group = Group.new end + def edit + add_breadcrumb "Groups", :groups_path + add_breadcrumb @group.name, group_path(@group) + add_breadcrumb "Edit", edit_group_path(@group) + end + def create @group = Group.new(group_params) @@ -28,12 +34,6 @@ def create end end - def edit - add_breadcrumb "Groups", :groups_path - add_breadcrumb @group.name, group_path(@group) - add_breadcrumb "Edit", edit_group_path(@group) - end - def update if @group.update(group_params) redirect_to @group, notice: "Group was updated successfully." diff --git a/app/models/hiera_data/git_repo.rb b/app/models/hiera_data/git_repo.rb index 29114a96..056c2c38 100644 --- a/app/models/hiera_data/git_repo.rb +++ b/app/models/hiera_data/git_repo.rb @@ -24,7 +24,7 @@ def local_path private def setup_repo - Dir.mkdir(BASE_PATH) unless File.exist?(BASE_PATH) + FileUtils.mkdir_p(BASE_PATH) if File.exist?(local_path) Git.open(local_path) else diff --git a/app/services/puppet_db_client.rb b/app/services/puppet_db_client.rb index fb73ee9a..711499ac 100644 --- a/app/services/puppet_db_client.rb +++ b/app/services/puppet_db_client.rb @@ -32,7 +32,7 @@ def environments nil, {} ) - response.data.map { |x| x["name"] } + response.data.pluck('name') rescue => e raise Hdm::Error, e end diff --git a/bin/entry.sh b/bin/entry.sh index 17267961..8cfbb2b8 100755 --- a/bin/entry.sh +++ b/bin/entry.sh @@ -1,9 +1,9 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash -bundle exec rails db:create -bundle exec rails db:migrate +bundle exec rake db:setup +bundle exec rake hdm:assets -if [ "${DEVELOP}" -eq 1 ]; then +if [[ "${DEVELOP}" -eq 1 ]]; then bundle exec rails db:seed ./bin/fake_puppet_db & fi diff --git a/config/application.rb b/config/application.rb index 15db2d4a..c3a00027 100644 --- a/config/application.rb +++ b/config/application.rb @@ -22,6 +22,10 @@ class Application < Rails::Application config.generators.assets = nil config.generators.helper = nil + # Alow the use of sqlite in production mode without warning. + # We only use sqlite for usermanagment. + config.active_record.sqlite3_production_warning = false + # Allow serialization of Regexp as Group access rules # are defined using regular expressions. config.active_record.yaml_column_permitted_classes = [Regexp] diff --git a/config/hdm.yml.template b/config/hdm.yml.template index 9681e7d6..b4e1e370 100644 --- a/config/hdm.yml.template +++ b/config/hdm.yml.template @@ -18,18 +18,11 @@ test: port: 389 production: - read_only: false - allow_encryption: true + read_only: true + allow_encryption: false puppet_db: - # When using https make sure the server name matches - # the one in the certificate - server: "https://localhost:8081" - pem: - key: "/path/to/keyfile" - cert: "/path/to/certfile" - ca_file: "/path/to/cafile" - config_dir: "/etc/puppetlabs/code" - #hiera_config_file: "hiera_hdm.yaml" + server: "http://localhost:8083" + config_dir: <%= Rails.root.join('test','fixtures','files','puppet') %> # Example for PE token authentication # production: @@ -53,11 +46,11 @@ production: # allow_encryption: true # puppet_db: # server: "http://localhost:8081" -# config_dir: "/etc/puppetlabs/code" +# config_dir: "/etc/puppetlabs/code" # git_data: # - datadir: /etc/puppetlabs/code/myenv/data # git_url: git@githost.example.com:puppet/hiera_data.git -# path_in_repo: environments/myenv/data +# path_in_repo: environments/myenv/data # Example for ldap authentication # production: diff --git a/config/importmap.rb b/config/importmap.rb index 35a1d015..4f73ca6d 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -4,7 +4,7 @@ pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true -pin "jquery", to: "jquery" -pin "bootstrap", to: "bootstrap" +pin "jquery", to: "jquery.js" +pin "bootstrap", to: "bootstrap.js" pin_all_from "app/javascript/controllers", under: "controllers" pin "slim-select" # @1.27.1 diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 2eeef966..21019fb6 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -10,3 +10,4 @@ # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. # Rails.application.config.assets.precompile += %w( admin.js admin.css ) +Rails.application.config.assets.precompile += %w[jquery.js bootstrap.js] diff --git a/docker-compose.yaml b/docker-compose.yaml index d40277b3..dc915d11 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -2,7 +2,7 @@ version: "3.5" services: hdm: - image: ghcr.io/betadots/hdm:main + image: ghcr.io/betadots/hdm:latest container_name: hdm environment: - TZ=Europe/Berlin diff --git a/lib/tasks/hdm.rake b/lib/tasks/hdm.rake index a6d49173..0d0b06ef 100644 --- a/lib/tasks/hdm.rake +++ b/lib/tasks/hdm.rake @@ -21,4 +21,11 @@ namespace :hdm do puts "The new password is:" puts new_password end + + desc "A task to clean and compile all assets" + task :assets do + Rake::Task['assets:clean'].invoke + Rake::Task['assets:clobber'].invoke + Rake::Task['assets:precompile'].invoke + end end diff --git a/test/test_helper.rb b/test/test_helper.rb index 76ff700d..eb7547ec 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -27,10 +27,10 @@ class ActiveSupport::TestCase # Add more helper methods to be used by all tests here... def with_temp_file(path, &block) begin - File.unlink(path) if File.exist?(path) + FileUtils.rm_f(path) yield ensure - File.unlink(path) if File.exist?(path) + FileUtils.rm_f(path) end end