Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clowdflows
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Alain Shakour
clowdflows
Commits
d615cf58
Commit
d615cf58
authored
Apr 01, 2015
by
Janez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'external-packages' of /home/git/repositories/kt/mothra
parents
76cb82f4
72533e6e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
10 deletions
+21
-10
workflows/management/commands/export_package.py
workflows/management/commands/export_package.py
+21
-9
workflows/management/commands/import_all.py
workflows/management/commands/import_all.py
+0
-1
No files found.
workflows/management/commands/export_package.py
View file @
d615cf58
...
...
@@ -71,13 +71,18 @@ def serialize_category(c):
data
[
'fields'
].
pop
(
'user'
)
return
data
def
export_package
(
package_name
,
writer
):
def
export_package
(
package_name
,
writer
,
dest_folder
=
None
):
style
=
color_style
()
if
package_name
in
settings
.
INSTALLED_APPS_EXTERNAL_PACKAGES
:
raise
CommandError
(
"You cannot export external packages."
)
external
=
package_name
in
settings
.
INSTALLED_APPS_EXTERNAL_PACKAGES
if
'workflows.'
+
package_name
not
in
settings
.
INSTALLED_APPS
:
if
external
and
not
dest_folder
:
raise
CommandError
(
"You must provide a destination folder when exporting external packages."
)
if
not
external
and
dest_folder
:
raise
CommandError
(
"You can't use a custom destination folder when exporting local packages."
)
if
'workflows.'
+
package_name
not
in
settings
.
INSTALLED_APPS
and
not
external
:
raise
CommandError
(
"Package not found in INSTALLED_APPS."
)
#here we check the integrity of the package
...
...
@@ -92,6 +97,9 @@ def export_package(package_name,writer):
#first we check if package_data directory exists and make it if it doesn't
if
external
:
package_directory
=
dest_folder
else
:
package_directory
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
'../../'
+
package_name
+
"/package_data/"
)
ensure_dir
(
package_directory
)
widgets_directory
=
os
.
path
.
join
(
package_directory
,
"widgets"
)
...
...
@@ -182,15 +190,19 @@ def export_package(package_name,writer):
class
Command
(
BaseCommand
):
args
=
'package_name'
args
=
'package_name
[external_destination_folder]
'
help
=
'Exports the package "package_name".'
def
handle
(
self
,
*
args
,
**
options
):
if
(
len
(
args
)
<
1
)
:
if
len
(
args
)
<
1
:
raise
CommandError
(
'Argument "package_name" is required.'
)
dest_folder
=
None
if
len
(
args
)
==
2
:
dest_folder
=
args
[
1
]
package_name
=
args
[
0
]
writer
=
self
.
stdout
export_package
(
package_name
,
writer
)
export_package
(
package_name
,
writer
,
dest_folder
=
dest_folder
)
writer
.
write
(
'Thanks for using the new export command. You rock.
\n
'
)
workflows/management/commands/import_all.py
View file @
d615cf58
...
...
@@ -22,7 +22,6 @@ class Command(BaseCommand):
package_name
=
app
.
split
(
'workflows.'
)[
1
]
packages
.
append
(
package_name
)
elif
app
in
settings
.
INSTALLED_APPS_EXTERNAL_PACKAGES
:
print
app
extern_packages
.
append
(
app
)
for
package
in
packages
:
...
...
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