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

Add support for Rakefile #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

barbu110
Copy link

Created Rakefile and added support for post creation through Rake command "task".

closes #7

Created Rakefile and added support for post creation through Rake command "task".

closes kronik3r#7
@kronik3r
Copy link
Owner

Hi man, sorry for the late reply, looks nice, thanks man for your time. I have a question: Does this will require the users to run some kinds of PACKAGE_MANAGER install (pardon my ignorance, ruby world is like mars to me :D ) and if yes, does this with will prevent the users who don't want this feature to use the theme?

PS: if the answer is no would you please update the README file too, thanks again for your time.

@barbu110
Copy link
Author

This feature is just for making the process of posting something to the blog easier. So instead of:

  1. Create a post file into the _posts directory
  2. Write its template and specific headers
  3. Edit content

The use would just have to go to the root of their project and issue the following command in the terminal

$ rake post title="Hello World"

which automates this workflow. They need to install Rake to use this feature however, which is as simple as

$ sudo gem install rake

@kronik3r
Copy link
Owner

Yeah, yeah I know :), sorry my bad, I wasn't clear when I asked the question.

I feared that when the user wants to serve the website, it will be required to install the packages that you used, in order to build the website even if they don't need the feature :D. But whatever.... I have the answer now, I just polled your version and it's working perfectly 👍 tried the command and I gotta say it saves a lot of time :D thanks man.

One last thing, is it possible that you update the README file to reflect your changes also document what are the supported params.

Again thanks a lot for your time 👍

valid_options = [ 'y', 'n' ]
answer = get_stdin("#{message} ").downcase[0]

if answer == 'y'
Copy link

@jamietanna jamietanna Sep 29, 2017

Choose a reason for hiding this comment

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

This could be replaced with

-	if answer == 'y'
-		true
-	else
-		false
-	end
+	answer == 'y'


filename = File.join(CONFIG['posts'], "#{date}-#{slug}.#{CONFIG['post_ext']}")
if File.exists?(filename)
abort('Rake task aborted.') if agree?("#{filename} already exists. Do you want to override it?") == false

Choose a reason for hiding this comment

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

It may be worth using unless to tidy up the statement:

-		abort('Rake task aborted.') if agree?("#{filename} already exists. Do you want to override it?") == false 
+		abort('Rake task aborted.') unless agree?("#{filename} already exists. Do you want to override it?")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rake tasks
3 participants