Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Jul 5, 2022
1 parent 80fd761 commit a34abec
Show file tree
Hide file tree
Showing 93 changed files with 1,083 additions and 1,722 deletions.
33 changes: 22 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ source 'https://rubygems.org'

# as framework
gem 'rails', '~> 7.0'

# as asset pipeline
gem 'sprockets-rails'

# as application server
gem 'puma'

# as templating engine
gem 'haml-rails', '~> 2.0'

# as database
gem 'pg'

# for appdata redirections (https -> http)
gem 'open_uri_redirections'
# al logger
gem 'lograge'

# as scheduler
gem 'clockwork'

# for stylesheets
gem 'sassc-rails'
Expand All @@ -27,16 +34,13 @@ gem 'fast_gettext', '>= 2.2.0'
gem 'gettext_i18n_rails', '>= 1.8.1'
gem 'rails-i18n'

# for markdown in views
gem 'redcarpet', '~> 3.5.1'

# for logging
gem 'lograge'

# as error catcher
gem 'sentry-rails'
gem 'sentry-ruby'

# for versioning
gem 'paper_trail'

gem 'dalli'
gem 'hashie'
gem 'mini_magick'
Expand All @@ -51,10 +55,16 @@ gem 'puma_worker_killer'
# see https://github.com/SeleniumHQ/selenium/commit/526fd9d0de60a53746ffa982feab985fed09a278
gem 'rexml'

# HTTP client library for OBS Client
# HTTP client library
gem 'faraday'
gem 'faraday_middleware'
gem 'multi_xml'
gem 'faraday-retry'
gem 'faraday-decode_xml'
gem 'faraday-follow_redirects'
gem 'faraday-gzip'
gem 'faraday-mashify'

# for parsing repomd repository files
gem 'repomd_parser'

# needed to collect translatable strings
# not needed at production
Expand All @@ -63,6 +73,7 @@ group :development do
# we only need the rake tasks
gem 'gettext', '>= 3.4.2', require: false
gem 'ruby_parser', require: false
gem 'pry'
end

group :test do
Expand Down
69 changes: 38 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ GEM
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (4.1.0)
clockwork (3.0.0)
activesupport
tzinfo
coderay (1.1.3)
concurrent-ruby (1.1.10)
crack (0.4.5)
rexml
Expand All @@ -94,31 +98,23 @@ GEM
execjs (2.8.1)
faker (2.20.0)
i18n (>= 1.8.11, < 2)
faraday (1.10.0)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
faraday (2.3.0)
faraday-net_http (~> 2.0)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.3)
multipart-post (>= 1.2, < 3)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
faraday-decode_xml (0.1.1)
faraday (< 3.0)
multi_xml (< 1.0)
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-gzip (0.1.0)
faraday (>= 1.0)
zlib (~> 2.1)
faraday-mashify (0.1.0)
faraday (~> 2.0)
hashie
faraday-net_http (2.0.3)
faraday-retry (2.0.0)
faraday (~> 2.0)
fast_gettext (2.2.0)
ffi (1.15.5)
forwardable (1.3.2)
Expand Down Expand Up @@ -179,7 +175,6 @@ GEM
mini_portile2 (2.8.0)
minitest (5.16.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
net-imap (0.2.3)
digest
net-protocol
Expand All @@ -198,7 +193,9 @@ GEM
nokogiri (1.13.6)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
open_uri_redirections (0.2.1)
paper_trail (12.3.0)
activerecord (>= 5.2)
request_store (~> 1.1)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
Expand All @@ -207,6 +204,9 @@ GEM
prime (0.1.2)
forwardable
singleton
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.7)
puma (5.6.4)
nio4r (~> 2.0)
Expand Down Expand Up @@ -248,8 +248,9 @@ GEM
zeitwerk (~> 2.5)
rainbow (3.1.1)
rake (13.0.6)
redcarpet (3.5.1)
regexp_parser (2.5.0)
repomd_parser (0.1.5)
nokogiri (~> 1.8)
request_store (1.5.1)
rack (>= 1.4)
rexml (3.2.5)
Expand Down Expand Up @@ -334,17 +335,23 @@ GEM
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.5.4)
zlib (2.1.1)

PLATFORMS
ruby

DEPENDENCIES
byebug
capybara
clockwork
dalli
faker
faraday
faraday_middleware
faraday-decode_xml
faraday-follow_redirects
faraday-gzip
faraday-mashify
faraday-retry
fast_gettext (>= 2.2.0)
geckodriver-bin (~> 0.28.0)
gettext (>= 3.4.2)
Expand All @@ -356,15 +363,15 @@ DEPENDENCIES
matrix
mini_magick
minitest
multi_xml
nokogiri
open_uri_redirections
paper_trail
pg
pry
puma
puma_worker_killer
rails (~> 7.0)
rails-i18n
redcarpet (~> 3.5.1)
repomd_parser
rexml
rubocop
rubocop-minitest
Expand Down
21 changes: 0 additions & 21 deletions TODO

This file was deleted.

59 changes: 59 additions & 0 deletions app/controllers/admin/distributions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
class Admin::DistributionsController < ApplicationController
before_action :set_distribution, only: %i[show edit update destroy]

# GET /distributions
def index
@distributions = Distribution.all
end

# GET /distributions/1
def show
end

# GET /distributions/new
def new
@distribution = Distribution.new
end

# GET /distributions/1/edit
def edit
end

# POST /distributions
def create
@distribution = Distribution.new(distribution_params)

if @distribution.save
redirect_to admin_distribution_path(@distribution), notice: "Distribution was successfully created."
else
render :new, status: :unprocessable_entity
end
end

# PATCH/PUT /distributions/1
def update
if @distribution.update(distribution_params)
redirect_to admin_distribution_path(@distribution), notice: "Distribution was successfully updated."
else
render :edit, status: :unprocessable_entity
end
end

# DELETE /distributions/1
def destroy
@distribution.destroy
redirect_to admin_distributions_url, notice: "Distribution was successfully destroyed."
end

private

# Use callbacks to share common setup or constraints between actions.
def set_distribution
@distribution = Distribution.find(params[:id])
end

# Only allow a list of trusted parameters through.
def distribution_params
params.require(:distribution).permit(:name, :vendor, :url, :obs_repo_names)
end
end
63 changes: 63 additions & 0 deletions app/controllers/admin/repositories_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
class Admin::RepositoriesController < ApplicationController
before_action :set_distribution
before_action :set_repository, only: %i[show edit update destroy]

# GET /repositories
def index
@repositories = @distribution.repositories
end

# GET /distributions/1/repositories/1
def show
end

# GET /distributions/1/repositories/new
def new
@repository = Repository.new
end

# GET /distributions/1/repositories/1/edit
def edit
end

# POST /distributions/1/repositories
def create
@repository = @distribution.repositories.new(repository_params)

if @repository.save
redirect_to admin_distribution_repositories_path(@distribution), notice: "Repository was successfully created."
else
render :new, status: :unprocessable_entity
end
end

# PATCH/PUT /distributions/1/repositories/1
def update
if @repository.update(repository_params)
redirect_to admin_distribution_repository_path(@distribution, @repository), notice: "Repository was successfully updated."
else
render :edit, status: :unprocessable_entity
end
end

# DELETE /distributions/1/repositories/1
def destroy
@repository.destroy
redirect_to admin_distribution_repositories_path(@distribution), notice: "Repository was successfully destroyed."
end

private
# Use callbacks to share common setup or constraints between actions.
def set_distribution
@distribution = Distribution.find(params[:distribution_id])
end

def set_repository
@repository = @distribution.repositories.find(params[:id])
end

# Only allow a list of trusted parameters through.
def repository_params
params.require(:repository).permit(:url, :updateinfo, :revision)
end
end
Loading

0 comments on commit a34abec

Please sign in to comment.