One way to do this is to use bundler to scaffold our gem:
bundler gem my_gem
I prefer to put tasks meant to manage the gem itself in lib/tasks
, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks
.
One way to do this is to use bundler to scaffold our gem:
bundler gem my_gem
I prefer to put tasks meant to manage the gem itself in lib/tasks
, and tasks the gem is meant to provide to gem users in lib/my_gem/tasks
.
# The following comments fill some of the gaps in Solargraph's understanding of | |
# Rails apps. Since they're all in YARD, they get mapped in Solargraph but | |
# ignored at runtime. | |
# | |
# You can put this file anywhere in the project, as long as it gets included in | |
# the workspace maps. It's recommended that you keep it in a standalone file | |
# instead of pasting it into an existing one. | |
# | |
# @!parse | |
# class ActionController::Base |
module Arel::Predications | |
def has_key(right) | |
Arel::Nodes::HasKey.new(self, quoted_node(right)) | |
end | |
end | |
class Arel::Nodes::HasKey < Arel::Nodes::Binary | |
def operator; :"?" end | |
end |
Note: Don't do this on a production evniroment!
Get the heroku database name:
heroku pg:info
Name can be found in the reponse from the command above. For example: Add-on: soaring-newly-1337
.
namespace :db do | |
desc "Backs up heroku database and restores it locally." | |
task import_from_heroku: [ :environment, :create ] do | |
HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote. | |
c = Rails.configuration.database_configuration[Rails.env] | |
heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil | |
Bundler.with_clean_env do | |
puts "[1/4] Capturing backup on Heroku" | |
`heroku pg:backups capture DATABASE_URL#{heroku_app_flag}` |
describe PostPolicy do | |
let(:scope) { Post.where(:published => true } | |
subject(:policy_scope) { PostPolicy::Scope.new(user, scope).resolve } | |
permissions ".scope" do | |
context "for an ordinary user" | |
let(:user) { User.new(:admin => false) } | |
it "hides unpublished post" do | |
post = Post.create(:published => false) |
{ | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
"draw_minimap_border": true, | |
"find_selected_text": true, | |
"font_face": "Bitstream Vera Sans Mono", | |
"font_options": | |
[ | |
"subpixel_antialias", | |
"bold" | |
], |