forked from getredash/redash
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Marina Samuel
committed
Aug 24, 2018
1 parent
37f6b9d
commit 9424dad
Showing
7 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.PHONY: build bundle compose_build create_database tests test_db clean | ||
|
||
compose_build: | ||
docker-compose build | ||
|
||
test_db: | ||
docker-compose run --rm postgres psql -h postgres -U postgres -c "create database tests" | ||
|
||
create_database: | ||
docker-compose run server create_db | ||
|
||
clean: | ||
docker ps -a -q | xargs docker kill;docker ps -a -q | xargs docker rm | ||
|
||
bundle: | ||
docker-compose run server bin/bundle-extensions | ||
|
||
tests: | ||
docker-compose run server tests | ||
|
||
build: bundle | ||
npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
import redash_stmo | ||
from subprocess import call | ||
from distutils.dir_util import copy_tree | ||
|
||
from pkg_resources import iter_entry_points, resource_filename | ||
|
||
|
||
# Make a directory for extensions and set it as an environment variable | ||
# to be picked up by webpack. | ||
EXTENSIONS_RELATIVE_PATH = os.path.join('client', 'app', 'extensions') | ||
EXTENSIONS_DIRECTORY = os.path.join( | ||
os.path.dirname(os.path.dirname(__file__)), | ||
EXTENSIONS_RELATIVE_PATH) | ||
|
||
if not os.path.exists(EXTENSIONS_DIRECTORY): | ||
os.makedirs(EXTENSIONS_DIRECTORY) | ||
os.environ["EXTENSIONS_DIRECTORY"] = EXTENSIONS_RELATIVE_PATH | ||
|
||
for entry_point in iter_entry_points('webpack.bundles'): | ||
extension_data = entry_point.load() | ||
|
||
# This is where the frontend code for an extension lives | ||
# inside of its package. | ||
content_folder_relative = os.path.join( | ||
extension_data['extension_directory'], | ||
extension_data['frontend_content']) | ||
content_folder = resource_filename(redash_stmo.__name__, content_folder_relative) | ||
|
||
# This is where we place our extensions folder. | ||
destination = os.path.join( | ||
EXTENSIONS_DIRECTORY, | ||
extension_data['extension_directory']) | ||
|
||
copy_tree(content_folder, destination) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters