在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:masukomi/JekyllMail开源软件地址:https://github.com/masukomi/JekyllMail开源编程语言:Ruby 95.8%开源软件介绍:JekyllMailJekyllMail enables you to post to your Jekyll or Octopress powered blog by email. How it WorksOnce configured (see below) JekyllMail will log into a POP3 account, check for messages with a pre-defined secret in the subject line, convert them into appropriately named files, and save them in your Please note. JekyllMail assumes that the address it is checking is exclusively for its use and will only be used to post emails to a single blog. JekyllMail does support multiple blogs but you will need a seperate e-mail account for each one. UsageThe magic is all in the subject line. In order to differentiate your email from the spam that's almost guaranteed to find your account eventually suck in the appropriate metadata A subject line for JekyllMail has two parts the title (of your post) and the metadata which will go into the YAML frontmatter Jekyll needs. The metadata is a series of key value pairs separated by slashes. One of those key value pairs must be "secret" and the secret listed in your configuration. Note that the keys must contain no spaces and be immediately followed by a colon.
An example:
Your secret should be short, easy to remember, easy to type, and very unlikely to show up in an e-mail from another human or spammer. Your e-mail can be formatted in Markdown, Textile, or HTML. Subject MetadataMetadata is separated from your subject by a double pipe. There are a handful of keys that JekyllMail is specifically looking for in the subject. All of these are optional except "secret":
If you don't provide a slug JekyllMail will just convert your title to a slug ImagesImage attachments will be extracted by JekyllMail and placed in dated directory that corresponds with the date of the posting. For example If you attached flag.jpg to a post sent on July 4th 2012 it would be
stored in JekyllMail will look for the image tags in your document that reference the image
filename and update them to point to the correct published file path. For example
it will convert In practice this simply means that if you insert a InstallationClone this git repo on your server, cd into the resulting directory, and
run Required Gems:
After editing the ConfigurationJekyllMail is configured via a _config.yml file in its root directory. Within this are a couple global settings and a series of "blog" stanzas one for each blog you'll have it checking mail for. A config file for a single blog will look something like this: ---
debug: false
blogs:
- name: my blog name
active: true
markup: markdown
jekyll_blog_dir: /Users/masukomi/workspace/jekyllmail_test_site
images_dir_under_jekyll: assets/img
posts_dir_under_jekyll: _posts
images_dir_under_site_url: /assets/img
origin_repo_branch: master
local_repo: /Users/masukomi/workspace/jekyllmail_test_site
origin_repo: /Users/masukomi/workspace/jekyllmail_test_site
pop_server: mail.example.com
pop_user: [email protected]
pop_password: a_really_good_password_goes_here
secret: jekyllmail
markup: markdown
site_url: http://blog.example.com
commit_after_save: true
delete_after_run: true
Configuration Notes
The
Please note that paths must not end with a slash. Your Wiring Things upYou need to schedule a cronjob to run regularly to kick of JekyllMail and check for new e-mails. To kick of JekyllMail you'll want a script that looks something like this.
You can use the #!/bin/sh
cd /full/path/to/jekyllmail
bundle exec ruby jekyllmail.rb Save the file anywhere that isn't served up to the public, make it executable, and add a new line to your crontab to run it every five minutes or so. This is an example crontab line to do this
When JekyllMail finds something it will save the files in the appropriate locations and commit them to the appropriate git repo. When it does we can leverage git's The #!/bin/sh
cd /full/path/to/blog
jekyll build
cp -r _site /full/path/to/the/directory/your/site/is/hosted/from Depending on your server's ruby / gem configuration you may have to add some additional info to the top of those scripts ( just below the #!/bin/sh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
GEM_PATH=$GEM_PATH:/home/my_username/.gems
PATH=$PATH:/home/my_username/.gems/bin WarningAt the end of every run JekyllMail deletes every e-mail in the account. This is for two reasons:
Ok, four reasons. If you want to disable this set the DevelopersIf you set the Have fun, and remember to send in pull-requests. :) Known IssuesCheck out the Issues page on Github for the current list of known issues (if any). Credit where credit is dueJekyllMail was based on a post & gist by Ted Kulp, but has come a long way since then. LicenseJekyllMail is distributed under the MIT License. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论