Skip to content

Commit

Permalink
Merge pull request #81 from pipermerriam/piper/handle-missing-librari…
Browse files Browse the repository at this point in the history
…es-dir

Fixes #80 - missing libraries directory
  • Loading branch information
pipermerriam committed Apr 13, 2016
2 parents e05e711 + 5bc17b4 commit e579031
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* Populus Version: x.x.x
* OS: osx/linux/win


### What was wrong?

Please include information like:

* full output of the error you received
* what command you ran
* the code that caused the failure

#### Cute Animal Picture

> put a cute animal picture here.
File renamed without changes.
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 e579031

Please sign in to comment.