Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Almanac is the most elegant mountable blog engine that can be easily hooked up in the existing Rails application. You can read more about it in this blog post.
Gemfile
gem "almanac"
And run bundle install
.
To hook up Almanac routes to your current Rails app simply put this code in your config/routes.rd
file
mount Almanac::Engine, :at => '/blog'
You can obviously setup any route you want. E.g. /posts
or /almanac
.
First off, install Almanac migrations:
rake almanac:install:migrations
Then migrate your database:
rake db:migrate
Almanac relies on Devise and CanCan properly configured in your app. In short, the current_user
variable and CanCan ability.rb
file has to exist. You can setup permissions for the following Almanac models:
can :manage, Almanac::Post
can :manage, Almanac::Blog
can :manage, Almanac::Image
These particular rules will allow the specified user to do anything with any Almanac record in the database.
Almanac relies on the Dragonfly gem for file uploads. Configure Dragonfly in your app by adding the following line to config/initializers/dragonfly.rb
:
require 'dragonfly/rails/images'
In order for some of the Dragonfly functionality to work, ImageMagick is required.
Lastly, you'll have to specify the name of your user model. Create a config/initializers/almanac.rb
file and add the following line there:
Almanac.user_class = "User" # other possibilities: "Author", "Writer", etc.
Kramdown is the superset of Markdown. All input fields can use it. Check out all syntax rules for kramdown. One of the best examples of kramdown usage is code highlighting that is part of Almanac. In your post you can simply write:
~~~ruby
def foo
puts "bar"
end
And it will generate a nice looking block of Ruby code once your post is published.
Almanac supports commenting via Disqus—the best commenting solution on the web. If you want your blog to support commenting, register with Disqus, add a website and copy-paste "Site Shortname" to the appropriate field in Blog Settings.
Prior to version 0.9 Almanac had it's own commenting solution. It's not supported anymore. However, you can back up your comments from the database, since there is no migration that removes the comments table in the system.
Almanac is a mountable Rails engine, which means that all of its controllers, views and models can be rewritten in your main application. E.g. if you want to change the main layout view, create a app/views/layouts/almanac/application.html.haml
file in your project directory that will be used automatically by Rails instead of the default Almanac layout.
This applies to all other views, models and controllers. Basically, add an almanac
folder to any abstraction that you are willing to change and replace almanac files with your own.
Almanac's models and controllers are tested with RSpec and FactoryGirl. Rails engines, such as Almanac, are normally tested with a dummy app that is located inside the 'spec' folder. Migrate your test database from the spec/dummy
directory:
rake db:migrate RAILS_ENV=test
Go back to the almanac
directory and run rspec spec
.
FAQs
Unknown package
We found that almanac demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.