-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
102 additions
and
5 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,28 @@ | ||
.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 | ||
|
||
watch: bundle | ||
npm run watch | ||
|
||
start: bundle | ||
npm run start |
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,39 @@ | ||
#!/usr/bin/env python | ||
|
||
import os | ||
from subprocess import call | ||
from distutils.dir_util import copy_tree | ||
|
||
from pkg_resources import iter_entry_points, resource_filename, resource_isdir | ||
|
||
|
||
|
||
# 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('redash.extensions'): | ||
# This is where the frontend code for an extension lives | ||
# inside of its package. | ||
content_folder_relative = os.path.join( | ||
entry_point.name, 'bundle') | ||
(root_module, _) = os.path.splitext(entry_point.module_name) | ||
|
||
if not resource_isdir(root_module, content_folder_relative): | ||
continue | ||
|
||
content_folder = resource_filename(root_module, content_folder_relative) | ||
|
||
# This is where we place our extensions folder. | ||
destination = os.path.join( | ||
EXTENSIONS_DIRECTORY, | ||
entry_point.name) | ||
|
||
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
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