Skip to content

Commit

Permalink
Fixes #80 - missing libraries directory
Browse files Browse the repository at this point in the history
  • Loading branch information
pipermerriam committed Apr 13, 2016
1 parent e05e711 commit da84ce8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions populus/cli/init_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from populus import utils
from populus.compilation import (
get_contracts_dir,
get_project_libraries_dir,
)

from .main import main
Expand All @@ -19,10 +20,15 @@ def init():
Generate project layout with an example contract.
"""
project_dir = os.getcwd()

contracts_dir = get_contracts_dir(project_dir)
if utils.ensure_path_exists(contracts_dir):
click.echo("Created Directory: ./{0}".format(os.path.relpath(contracts_dir)))

libraries_dir = get_project_libraries_dir(project_dir)
if utils.ensure_path_exists(libraries_dir):
click.echo("Created Directory: ./{0}".format(os.path.relpath(libraries_dir)))

example_contract_path = os.path.join(contracts_dir, 'Example.sol')
if not os.path.exists(example_contract_path):
with open(example_contract_path, 'w') as example_contract_file:
Expand Down
3 changes: 2 additions & 1 deletion populus/observers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def get_contracts_observer(project_dir, contract_filters=None, compiler_kwargs=N
)
observer = PollingObserver()
observer.schedule(event_handler, contracts_dir, recursive=True)
observer.schedule(event_handler, libraries_dir, recursive=True)
if os.path.exists(libraries_dir):
observer.schedule(event_handler, libraries_dir, recursive=True)
return observer


Expand Down

0 comments on commit da84ce8

Please sign in to comment.