Skip to content

Commit

Permalink
fix #1615 -- make deploy work after removing cache
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Feb 7, 2015
1 parent 883cd39 commit e0cbc67
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -10,6 +10,7 @@ Features
Bugfixes
--------

* Fix ``nikola deploy`` when there is no cache (Issue #1615)
* Report issues in scale_images properly (Issue #1598)
* Correctly read sub-timezones in ``nikola init`` (via Issue #1599)
* Fix zoneinfo reading in ``nikola init`` (Issue #1599)
Expand Down
1 change: 1 addition & 0 deletions nikola/plugins/command/deploy.py
Expand Up @@ -111,6 +111,7 @@ def _execute(self, command, args):
new_deploy = datetime.utcnow()
self._emit_deploy_event(last_deploy, new_deploy, clean, undeployed_posts)

os.makedirs(self.site.config['CACHE_FOLDER'])
# Store timestamp of successful deployment
with io.open(timestamp_path, 'w+', encoding='utf8') as outf:
outf.write(unicode_str(new_deploy.isoformat()))
Expand Down

4 comments on commit e0cbc67

@kayhayen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to use os.path.dirname(timestamp_path), as you are violating "DRY" there.

@Kwpolska
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why bother? We know timestamp_path is in the cache folder, we don’t plan to move it, better to just use this and call it a day.

@kayhayen
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I wasn't suggesting to change it. It's just that "knowing" comes into play when you repeat yourself, and that can be avoided. That is why "DRY" comes into play for me. Just a comment, no demand.

Seeing code:

os.makedirs(some_dirname)
open(some_filename, "w")

requires that the reader knows the relationship between some_file and some_dir. Using

os.makedirs(dirname(some_filename))
open(some_filename, "w")

on the other hand, is pretty much immediately recognizable.

Again, just a comment, because I looked at the commit. If code review is not welcome, make that clear some prominent place.

@Kwpolska
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review is certainly welcome.

Please sign in to comment.