Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
fe2901a2
Commit
fe2901a2
authored
1 year ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
26009655
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/communication/website/with_deuxfleurs.rb
+24
-11
24 additions, 11 deletions
app/models/communication/website/with_deuxfleurs.rb
with
24 additions
and
11 deletions
app/models/communication/website/with_deuxfleurs.rb
+
24
−
11
View file @
fe2901a2
module
Communication::Website::WithDeuxfleurs
extend
ActiveSupport
::
Concern
attr_reader
:deuxfleurs_first_load
included
do
before_save
:deuxfleurs_setup
,
if: :deuxfleurs_hosting
after_save_commit
:deuxfleurs_preload
,
if: :deuxfleurs_hosting
after_save
:deuxfleurs_setup
,
if: :deuxfleurs_hosting
end
protected
...
...
@@ -16,20 +13,36 @@ module Communication::Website::WithDeuxfleurs
def
deuxfleurs_setup
return
if
deuxfleurs_setup_done?
self
.
deuxfleurs_identifier
=
deuxfleurs
.
create_bucket
(
deuxfleurs_host
)
self
.
url
=
deuxfleurs_default_url
@deuxfleurs_first_load
=
true
deuxfleurs_create_website
deuxfleurs_create_github_repository
end
handle_asynchronously
:deuxfleurs_setup
def
deuxfleurs_preload
return
unless
deuxfleurs_first_load
def
deuxfleurs_create_website
deuxfleurs_identifier
=
deuxfleurs
.
create_bucket
(
deuxfleurs_default_identifier
)
update_columns
deuxfleurs_identifier:
deuxfleurs_identifier
,
url:
deuxfleurs_default_url
deuxfleurs_first_load_to_generate_certificate
endcd
def
deuxfleurs_create_github_repository
# TODO create repo at template
update_columns
repository:
deuxfleurs_default_github_repository
,
deployment_status_badge:
deuxfleurs_default_badge_url
end
def
deuxfleurs_
host
def
deuxfleurs_
default_identifier
"
#{
university
.
identifier
}
-
#{
to_s
.
parameterize
}
"
end
def
deuxfleurs_default_github_repository
"noesya/
#{
deuxfleurs_default_identifier
}
"
end
def
deuxfleurs_default_badge_url
"https://github.com/
#{
deuxfleurs_default_github_repository
}
/actions/workflows/deuxfleurs.yml/badge.svg"
end
def
deuxfleurs_first_load_to_generate_certificate
Faraday
.
get
url
rescue
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment