Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
6609d289
Commit
6609d289
authored
Oct 16, 2023
by
shadMod
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added compile_download
quick code cleanup and reformat
parent
1ab629e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
uitwww/main.py
uitwww/main.py
+15
-7
No files found.
uitwww/main.py
View file @
6609d289
...
@@ -24,18 +24,20 @@ from htmlmin import minify
...
@@ -24,18 +24,20 @@ from htmlmin import minify
from
.constants
import
UITWWW_DIR
,
BASE_DIR
from
.constants
import
UITWWW_DIR
,
BASE_DIR
from
.utils
import
ReverseProxied
,
GunicornInstance
from
.utils
import
ReverseProxied
,
GunicornInstance
from
.src.download.compile_download
import
CompileVersion
@
click
.
group
()
@
click
.
group
()
def
cli
():
def
cli
():
"""
Ubuntu-it website's command line utility
"""
"""
Ubuntu-it website's command line utility
"""
pass
pass
@
cli
.
command
(
"run"
)
@
cli
.
command
(
"run"
)
@
click
.
argument
(
"data"
)
@
click
.
argument
(
"data"
)
@
click
.
option
(
"-g"
,
"--gunicorn-config"
,
default
=
None
,
help
=
"Path to a"
@
click
.
option
(
"gunicorn config file"
)
"-g"
,
"--gunicorn-config"
,
default
=
None
,
help
=
"Path to a"
"gunicorn config file"
)
@
click
.
option
(
"-p"
,
"--port"
,
default
=
8000
,
help
=
"Bind that port"
)
@
click
.
option
(
"-p"
,
"--port"
,
default
=
8000
,
help
=
"Bind that port"
)
@
click
.
option
(
"--public"
,
help
=
"Make available to the public"
,
is_flag
=
True
)
@
click
.
option
(
"--public"
,
help
=
"Make available to the public"
,
is_flag
=
True
)
@
click
.
option
(
"-w"
,
"--workers"
,
help
=
"Number of workers to start"
,
default
=
3
)
@
click
.
option
(
"-w"
,
"--workers"
,
help
=
"Number of workers to start"
,
default
=
3
)
...
@@ -81,9 +83,17 @@ def run(data, gunicorn_config, port, public, workers, debug):
...
@@ -81,9 +83,17 @@ def run(data, gunicorn_config, port, public, workers, debug):
@
click
.
option
(
"-d"
,
"--debug"
,
help
=
"Enable debug mode"
,
is_flag
=
True
)
@
click
.
option
(
"-d"
,
"--debug"
,
help
=
"Enable debug mode"
,
is_flag
=
True
)
def
init
(
data
,
debug
):
def
init
(
data
,
debug
):
"""Initialize the data directory"""
"""Initialize the data directory"""
print
(
"Initializing data directory:"
,
data
)
data_path
=
os
.
path
.
expanduser
(
os
.
path
.
abspath
(
data
))
data_path
=
os
.
path
.
expanduser
(
os
.
path
.
abspath
(
data
))
print
(
"Initializing data directory:"
,
data
)
compiler
=
CompileVersion
(
path_out
=
UITWWW_DIR
+
"/data/downloads.toml"
,
constants
=
UITWWW_DIR
+
"/src/download/assets/constants.json"
,
ignore_interim
=
"mantic"
,
)
compiler
.
compile_download
()
print
(
"Compile download file"
)
uitwww
.
init_data_directory
(
data_path
,
debug
)
uitwww
.
init_data_directory
(
data_path
,
debug
)
print
(
"Created data directory:"
,
data
)
@
cli
.
command
(
"build_scss"
)
@
cli
.
command
(
"build_scss"
)
...
@@ -99,6 +109,4 @@ def build_scss():
...
@@ -99,6 +109,4 @@ def build_scss():
os
.
makedirs
(
os
.
path
.
dirname
(
path
),
exist_ok
=
True
)
os
.
makedirs
(
os
.
path
.
dirname
(
path
),
exist_ok
=
True
)
# open file, compile and write css
# open file, compile and write css
with
open
(
path
,
"w"
)
as
fn
:
with
open
(
path
,
"w"
)
as
fn
:
fn
.
write
(
minify
(
compile_file
(
fn
.
write
(
minify
(
compile_file
(
f"
{
BASE_DIR
}
/assets/scss/
{
val
}
.scss"
)))
f"
{
BASE_DIR
}
/assets/scss/
{
val
}
.scss"
)))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment