Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPLOY_DRAFTS and DEPLOY_FUTURE ignored by github_deploy #2406

Closed
ChillarAnand opened this issue Jul 26, 2016 · 8 comments
Closed

DEPLOY_DRAFTS and DEPLOY_FUTURE ignored by github_deploy #2406

ChillarAnand opened this issue Jul 26, 2016 · 8 comments
Assignees
Milestone

Comments

@ChillarAnand
Copy link
Contributor

FUTURE_IS_NOW = False
DEPLOY_FUTURE = False
DEPLOY_DRAFTS = False

With these settings, drafts with past dates are getting deployed.

@Kwpolska
Copy link
Member

Cannot reproduce. Please apply this patch over deploy.py in your Nikola install and show output of nikola deploy:

diff --git a/nikola/plugins/command/deploy.py b/nikola/plugins/command/deploy.py
index 365c0a3..95fbfec 100644
--- a/nikola/plugins/command/deploy.py
+++ b/nikola/plugins/command/deploy.py
@@ -97,9 +97,14 @@ class CommandDeploy(Command):
             for post in self.site.timeline:
                 if (not deploy_drafts and post.is_draft) or \
                    (not deploy_future and post.publish_later):
+                    print("Delete", post, post.is_draft, post.publish_later)
                     remove_file(os.path.join(out_dir, post.destination_path()))
                     remove_file(os.path.join(out_dir, post.source_path))
                     undeployed_posts.append(post)
+                else:
+                    print("Deploy", post, post.is_draft, post.publish_later)
+        else:
+            print("DEPLOY_DRAFTS and DEPLOY_FUTURE are both True")

         if args:
             presets = args

@Kwpolska Kwpolska self-assigned this Jul 26, 2016
@Kwpolska Kwpolska added this to the v7.7.12 milestone Jul 26, 2016
@punchagan
Copy link
Member

I suspect os.path.join(out_dir, post.destination_path()) is pointing to a wrong path. Can you also print that?

@punchagan
Copy link
Member

The source file path is incorrect, and the following patch should help.

diff --git a/nikola/plugins/command/deploy.py b/nikola/plugins/command/deploy.py
index 365c0a3..1e772c9 100644
--- a/nikola/plugins/command/deploy.py
+++ b/nikola/plugins/command/deploy.py
@@ -98,7 +98,8 @@ class CommandDeploy(Command):
                 if (not deploy_drafts and post.is_draft) or \
                    (not deploy_future and post.publish_later):
                     remove_file(os.path.join(out_dir, post.destination_path()))
-                    remove_file(os.path.join(out_dir, post.source_path))
+                    source_path = post.destination_path(extension=post.source_ext(True))
+                    remove_file(os.path.join(out_dir, source_path))
                     undeployed_posts.append(post)

         if args:

@ChillarAnand
Copy link
Contributor Author

@Kwpolska
Copy link
Member

@ChillarAnand could you test @punchagan’s patch and see if it helps in your case?

@ChillarAnand
Copy link
Contributor Author

My bad. Looks like I overlooked the issue. I was deploying to github pages and ghp-import was commiting even drafts to github. Is there a way to disable this?

@Kwpolska
Copy link
Member

Were you using nikola github_deploy? (It does not handle any of these options.)

@ChillarAnand
Copy link
Contributor Author

Yes, I was using that.

@Kwpolska Kwpolska changed the title Dont deploy drafts? DEPLOY_DRAFTS and DEPLOY_FUTURE ignored by github_deploy Jul 27, 2016
punchagan added a commit that referenced this issue Jul 27, 2016
Fix #2406 -- respect DEPLOY_* in github_deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants