Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blog_boi

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blog_boi

  • 0.1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

By Charlie Reese at Clientelify

BlogBoi

BlogBoi is a rails gem / engine that provides out-of-the-box blogging functionality to your rails application.

It requires active_storage for photo upload / storage.

Installation

  1. Add this line to your application's Gemfile:
gem 'blog_boi', '~> 0'
  1. Add these lines to your config/application.rb file:
require "active_storage/engine" # If doesn't exist already

ActiveStorage::Engine.config
.active_storage
.content_types_to_serve_as_binary
.delete('image/svg+xml')
  1. And then execute:
$ bundle
$ rake active_storage:install `# If hasn't been run yet`
$ rake active_storage:update # if upgrading to rails 6
$ rails blog_boi:install:migrations `# not needed for dummy test application`
$ rails db:migrate

Your storage.yml file should now have this code:

test:
	service: Disk
	root: <%= Rails.root.join("tmp/storage") %>

local:
	service: Disk
	root: <%= Rails.root.join("storage") %>

Note: $ rails railties:install:migrations to copy all new migrations Note: to run migrations only for certain engine, rails db:migrate SCOPE=blog_boi. To revert all migrations from blog_boi engine you can run rails db:migrate SCOPE=blog_boi VERSION=0

  1. And then mount the engine in your app's config/routes.rb file:
mount BlogBoi::Engine, at: "/blog"
  1. Customize scss colour scheme by creating stylesheets/bootstrap_customizer.scss. See example in test/dummy/app/assets/stylesheets.

  2. And then add the engines configuration options in an initializer file (named blog_boi.rb):

BlogBoi.author_class = "User" # name of active record model containing authors with property called name (for author's name)

See lib/blog_boi.rb for all customization options (like setting your Blog's meta description / image).

  1. Finally, your parent application must define the method admin_signed_in?. If you are using Devise, this method may already exist. It should return true if the blog admin is signed in, and false if not. When it returns true, you may create, update, and destroy blog articles. It should be available in controllers and views; it should be defined in ApplicationController, and should be marked a helper method. E.g.
class ApplicationController < ActionController::Base

	helper_method :admin_signed_in?

	def admin_signed_in?
		...
	end

end

View partial hooks

List of view partial hooks that are rendered if they exist in parent application:

  • layouts/blog_boi/head_extension: (for adding html to head of blog_boi application layout in layouts/blog_boi/application)

Custom style / SCSS

To override SCSS bootstrap mixins / styles, add a file in parent application called blog_boi/bootstrap_overrides.scss.

Override the header or footer by placing your own files at views/layouts/_header or views/layouts/_footer

Further, you can add your own css classes / ids to your markup:

Running tests

  • Run all tests other than system: rake app:test
  • Run system tests: rake app:test:system
  • Run all tests: rake or rake test

Test coverage

Exists in coverage folder in root directory.

To view in a browser, execute from root directory: open coverage/index.html

License

The gem is currently available as open source software under the terms of the MIT License.

Contributing

If you'd like to make a fix / change, please create a pull request; when I have a moment, I'll have a look!

Updating gem version (for maintainers)

1. Update version

In lib/blog_boi/version.rb update version.

2. Build gem

gem build blog_boi.gemspec

3. Push gem

gem push blog_boi-X.X.X.gem (replace X's with version)

4. Tag GitHub

git add -A git commit -m "Msg" git push git tag -a vX.X.X -m "Msg" git push --tags

FAQs

Package last updated on 22 Dec 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc